@Test @Rollback(false) public void removeServiceCSS() throws CSSNotFoundException{ serReg.deleteServiceCSS(servicesList.get(9).getServiceInstance().getFullJid()); }
@Override public boolean deleteServiceCSS(String CSSId) throws CSSNotFoundException { Session session = null; boolean returnedValue = false; try { session = sessionFactory.openSession(); List<RegistryEntry> tmpRegistryEntryList = session .createCriteria(RegistryEntry.class) .createCriteria("serviceInstance") .add(Restrictions.eq("fullJid", CSSId)).list(); if (tmpRegistryEntryList.size() == 0) { throw new CSSNotFoundException("The CSS with Id: " + CSSId + " is not present in the Registry"); } List<Service> tmpServiceList = new ArrayList<Service>(); for (RegistryEntry registryEntry : tmpRegistryEntryList) { tmpServiceList.add(registryEntry .createServiceFromRegistryEntry()); } this.unregisterServiceList(tmpServiceList); returnedValue = true; } catch (CSSNotFoundException ex) { log.error(ex.getMessage()); throw ex; } catch (Exception e) { log.error(e.getMessage()); } finally { if(session != null ) session.close(); } return returnedValue; }
ServiceRegistry implements IServiceRegistry { @Override public boolean deleteServiceCSS(String CSSId) throws CSSNotFoundException { Session session = null; boolean returnedValue = false; try { session = sessionFactory.openSession(); List<RegistryEntry> tmpRegistryEntryList = session .createCriteria(RegistryEntry.class) .createCriteria("serviceInstance") .add(Restrictions.eq("fullJid", CSSId)).list(); if (tmpRegistryEntryList.size() == 0) { throw new CSSNotFoundException("The CSS with Id: " + CSSId + " is not present in the Registry"); } List<Service> tmpServiceList = new ArrayList<Service>(); for (RegistryEntry registryEntry : tmpRegistryEntryList) { tmpServiceList.add(registryEntry .createServiceFromRegistryEntry()); } this.unregisterServiceList(tmpServiceList); returnedValue = true; } catch (CSSNotFoundException ex) { log.error(ex.getMessage()); throw ex; } catch (Exception e) { log.error(e.getMessage()); } finally { if(session != null ) session.close(); } return returnedValue; } }
ServiceRegistry implements IServiceRegistry { @Override public boolean deleteServiceCSS(String CSSId) throws CSSNotFoundException { Session session = null; boolean returnedValue = false; try { session = sessionFactory.openSession(); List<RegistryEntry> tmpRegistryEntryList = session .createCriteria(RegistryEntry.class) .createCriteria("serviceInstance") .add(Restrictions.eq("fullJid", CSSId)).list(); if (tmpRegistryEntryList.size() == 0) { throw new CSSNotFoundException("The CSS with Id: " + CSSId + " is not present in the Registry"); } List<Service> tmpServiceList = new ArrayList<Service>(); for (RegistryEntry registryEntry : tmpRegistryEntryList) { tmpServiceList.add(registryEntry .createServiceFromRegistryEntry()); } this.unregisterServiceList(tmpServiceList); returnedValue = true; } catch (CSSNotFoundException ex) { log.error(ex.getMessage()); throw ex; } catch (Exception e) { log.error(e.getMessage()); } finally { if(session != null ) session.close(); } return returnedValue; } ServiceRegistry(); }
ServiceRegistry implements IServiceRegistry { @Override public boolean deleteServiceCSS(String CSSId) throws CSSNotFoundException { Session session = null; boolean returnedValue = false; try { session = sessionFactory.openSession(); List<RegistryEntry> tmpRegistryEntryList = session .createCriteria(RegistryEntry.class) .createCriteria("serviceInstance") .add(Restrictions.eq("fullJid", CSSId)).list(); if (tmpRegistryEntryList.size() == 0) { throw new CSSNotFoundException("The CSS with Id: " + CSSId + " is not present in the Registry"); } List<Service> tmpServiceList = new ArrayList<Service>(); for (RegistryEntry registryEntry : tmpRegistryEntryList) { tmpServiceList.add(registryEntry .createServiceFromRegistryEntry()); } this.unregisterServiceList(tmpServiceList); returnedValue = true; } catch (CSSNotFoundException ex) { log.error(ex.getMessage()); throw ex; } catch (Exception e) { log.error(e.getMessage()); } finally { if(session != null ) session.close(); } return returnedValue; } ServiceRegistry(); @Override void registerServiceList(List<Service> servicesList); @Override void unregisterServiceList(List<Service> servicesList); @Override List<Service> retrieveServicesInCSSNode(String CSSID); @Override List<Service> retrieveServicesInCSS(String CSSID); @Override List<Service> retrieveServicesSharedByCIS(String CISID); @Override List<Service> findServices(Service filter); @Override List<Service> findServices(Service filter, String cisId); @Override void notifyServiceIsSharedInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override void removeServiceSharingInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override Service retrieveService(ServiceResourceIdentifier serviceIdentifier); @Override boolean changeStatusOfService(
			ServiceResourceIdentifier serviceIdentifier,
			ServiceStatus serviceStatus); SessionFactory getSessionFactory(); void setSessionFactory(SessionFactory sessionFactory); @Override boolean deleteServiceCSS(String CSSId); @Override boolean clearServiceSharedCIS(String CISId); @Override boolean updateRegisteredService(Service service); @Override List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier); }
ServiceRegistry implements IServiceRegistry { @Override public boolean deleteServiceCSS(String CSSId) throws CSSNotFoundException { Session session = null; boolean returnedValue = false; try { session = sessionFactory.openSession(); List<RegistryEntry> tmpRegistryEntryList = session .createCriteria(RegistryEntry.class) .createCriteria("serviceInstance") .add(Restrictions.eq("fullJid", CSSId)).list(); if (tmpRegistryEntryList.size() == 0) { throw new CSSNotFoundException("The CSS with Id: " + CSSId + " is not present in the Registry"); } List<Service> tmpServiceList = new ArrayList<Service>(); for (RegistryEntry registryEntry : tmpRegistryEntryList) { tmpServiceList.add(registryEntry .createServiceFromRegistryEntry()); } this.unregisterServiceList(tmpServiceList); returnedValue = true; } catch (CSSNotFoundException ex) { log.error(ex.getMessage()); throw ex; } catch (Exception e) { log.error(e.getMessage()); } finally { if(session != null ) session.close(); } return returnedValue; } ServiceRegistry(); @Override void registerServiceList(List<Service> servicesList); @Override void unregisterServiceList(List<Service> servicesList); @Override List<Service> retrieveServicesInCSSNode(String CSSID); @Override List<Service> retrieveServicesInCSS(String CSSID); @Override List<Service> retrieveServicesSharedByCIS(String CISID); @Override List<Service> findServices(Service filter); @Override List<Service> findServices(Service filter, String cisId); @Override void notifyServiceIsSharedInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override void removeServiceSharingInCIS(
			ServiceResourceIdentifier serviceIdentifier, String CISID); @Override Service retrieveService(ServiceResourceIdentifier serviceIdentifier); @Override boolean changeStatusOfService(
			ServiceResourceIdentifier serviceIdentifier,
			ServiceStatus serviceStatus); SessionFactory getSessionFactory(); void setSessionFactory(SessionFactory sessionFactory); @Override boolean deleteServiceCSS(String CSSId); @Override boolean clearServiceSharedCIS(String CISId); @Override boolean updateRegisteredService(Service service); @Override List<String> retrieveCISSharedService(ServiceResourceIdentifier serviceIdentifier);  }