diff options
author | 2017-08-23 18:27:19 -0400 | |
---|---|---|
committer | 2017-08-23 21:12:56 -0400 | |
commit | 978dbcf0a196acbafad72fe1e2478ec0e384f02f (patch) | |
tree | 17e1ceaa4a12a599320cbb317947e990bf1a5383 /ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java | |
parent | bc7350dce5b7b1dcd1c472a3922b42c4ea99809d (diff) |
Deliver centralized role management feature
Repair multiple defects also.
Revise deployment to use docker-compose.
Remove all zip archives.
Issue: PORTAL-21, PORTAL-25, PORTAL-28, PORTAL-52, PORTAL-69,
PORTAL-74, PORTAL-76, PORTAL-80, PORTAL-82
Change-Id: Ie72fec7d35ba78beb162bba6ed27b2caee340c61
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java')
-rw-r--r-- | ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java b/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java deleted file mode 100644 index 395d4283..00000000 --- a/ecomp-portal-widget-ms/src/main/java/org/openecomp/portalapp/widget/service/impl/MicroserviceServiceImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.openecomp.portalapp.widget.service.impl; - -import java.util.List; - -import javax.transaction.Transactional; - -import org.hibernate.Criteria; -import org.hibernate.Session; -import org.hibernate.SessionFactory; -import org.hibernate.Transaction; -import org.hibernate.criterion.Restrictions; -import org.openecomp.portalapp.widget.domain.MicroserviceData; -import org.openecomp.portalapp.widget.domain.MicroserviceParameter; -import org.openecomp.portalapp.widget.domain.WidgetCatalog; -import org.openecomp.portalapp.widget.service.MicroserviceService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.EnableAspectJAutoProxy; -import org.springframework.stereotype.Service; - -/** - * TODO: moved all microservice-related code (domain, controller, service) - * from ecomp portal Backend to widget microservice - */ -@Service("microserviceService") -@Transactional -@org.springframework.context.annotation.Configuration -@EnableAspectJAutoProxy -public class MicroserviceServiceImpl implements MicroserviceService{ - - private static final Logger logger = LoggerFactory.getLogger(MicroserviceServiceImpl.class); - - @Autowired - private SessionFactory sessionFactory; - - @Override - public Long saveMicroserivce(MicroserviceData newService) { - try{ - logger.debug("MicroserviceServiceImpl.saveMicroserivce: microservice={}", newService); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.save(newService); - tx.commit(); - session.flush(); - session.close(); - } - catch(Exception e){ - logger.error("Exception occurred while performing MicroserviceServiceImpl.saveMicroserivce in widget microservices. Details:" + e.getMessage()); - } - return newService.getId(); - } - - @Override - public void saveMicroserviceParameter(MicroserviceParameter newParameter) { - try{ - logger.debug("MicroserviceServiceImpl.saveMicroserviceData: microservice={}", newParameter); - Session session = sessionFactory.openSession(); - Transaction tx = session.beginTransaction(); - session.save(newParameter); - tx.commit(); - session.flush(); - session.close(); - } - catch(Exception e){ - logger.error("Exception occurred while performing MicroserviceServiceImpl.saveMicroserviceData in widget microservices. Details:" + e.getMessage()); - } - } - - @SuppressWarnings("unchecked") - @Override - public Long getMicroserviceIdByName(String newServiceName) { - - Session session = sessionFactory.openSession(); - Criteria criteria = session.createCriteria(MicroserviceData.class) - .add(Restrictions.eq("name", newServiceName)) - .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); - - List<MicroserviceData> services = criteria.list(); - logger.debug("MicroserviceServiceImpl.getMicroserviceByName: result={}", services); - session.flush(); - session.close(); - - return (services.size() > 0) ? services.get(0).getId() : null; - } - -} |