@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getId(); return result; }
public int getServiceId() { if (service != null) { return service.getId(); } else { return -1; } }
@Override public String toString() { StringBuilder str = new StringBuilder(); return str.append(getClass().getSimpleName()).append(":[id='").append(getId()).append("', name='").append(name) .append("', description='").append(getDescription()).append("', delay='").append(getDelay()) .append("', recurrence='").append(getRecurrence()).append("', enabled='").append(isEnabled()) .append("', script='").append(getScript()).append("']").toString(); }
public static void blockServiceOnDestination(RpcCaller rpcCaller, Service service, int destinationId) throws InternalErrorException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); params.put("destination", destinationId); try { rpcCaller.call("generalServiceManager", "blockServiceOnDestination", params); } catch(InternalErrorException e) { throw e; } catch(PerunException e) { throw new ConsistencyErrorException(e); } }
public static void blockServiceOnFacility(RpcCaller rpcCaller, Service service, Facility facility) throws InternalErrorException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); params.put("facility", facility.getId()); try { rpcCaller.call("generalServiceManager", "blockServiceOnFacility", params); } catch(InternalErrorException e) { throw e; } catch(PerunException e) { throw new ConsistencyErrorException(e); } }
public static void deleteService(RpcCaller rpcCaller, Service service) throws InternalErrorException, ServiceNotExistsException, PrivilegeException, RelationExistsException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); try { rpcCaller.call("servicesManager", "deleteService", params); } catch (RelationExistsException e) { throw e; } catch (ServiceNotExistsException e) { throw e; } catch (PrivilegeException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
@Override public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", name=<").append(getName() == null ? "\\0" : BeansUtils.createEscaping(getName())).append(">").append( ", description=<").append(getDescription() == null ? "\\0" : BeansUtils.createEscaping(getDescription())).append(">").append( ", delay=<").append(this.getDelay()).append(">").append( ", recurrence=<").append(this.getRecurrence()).append(">").append( ", enabled=<").append(this.isEnabled()).append(">").append( ", script=<").append(getScript() == null ? "\\0" : BeansUtils.createEscaping(getScript())).append(">").append( ']').toString(); }
public static List<AttributeDefinition> getRequiredAttributesDefinition(RpcCaller rpcCaller, Service service) throws InternalErrorException, PrivilegeException, ServiceNotExistsException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); try { return rpcCaller.call("attributesManager", "getRequiredAttributesDefinition", params).readList(AttributeDefinition.class); } catch (ServiceNotExistsException e) { throw e; } catch (PrivilegeException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
public static void removeAllDestinations(RpcCaller rpcCaller, Service service, Facility facility) throws PrivilegeException, InternalErrorException, ServiceNotExistsException, FacilityNotExistsException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); params.put("facility", facility.getId()); try { rpcCaller.call("servicesManager", "removeAllDestinations", params); } catch (FacilityNotExistsException e) { throw e; } catch (ServiceNotExistsException e) { throw e; } catch (PrivilegeException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
public static List<Destination> getDestinations(RpcCaller rpcCaller, Service service, Facility facility) throws PrivilegeException, InternalErrorException, ServiceNotExistsException, FacilityNotExistsException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); params.put("facility", facility.getId()); try { return rpcCaller.call("servicesManager", "getDestinations", params).readList(Destination.class); } catch (FacilityNotExistsException e) { throw e; } catch (ServiceNotExistsException e) { throw e; } catch (PrivilegeException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
public static Destination addDestination(RpcCaller rpcCaller, Service service, Facility facility, Destination destination) throws PrivilegeException, InternalErrorException, ServiceNotExistsException, FacilityNotExistsException, DestinationAlreadyAssignedException { Map<String, Object> params = new HashMap<String, Object>(); params.put("service", service.getId()); params.put("facility", facility.getId()); params.put("destination", destination.getDestination()); params.put("type", destination.getType()); try { return rpcCaller.call("servicesManager", "addDestination", params).read(Destination.class); } catch (DestinationAlreadyAssignedException e) { throw e; } catch (FacilityNotExistsException e) { throw e; } catch (ServiceNotExistsException e) { throw e; } catch (PrivilegeException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
@Override public int compareTo(PerunBean perunBean) { if(perunBean == null) throw new NullPointerException("PerunBean to compare with is null."); if(perunBean instanceof Service) { Service service = (Service) perunBean; if (this.getName() == null && service.getName() != null) return -1; if (service.getName() == null && this.getName() != null) return 1; if (this.getName() == null && service.getName() == null) return 0; return this.getName().compareToIgnoreCase(service.getName()); } else { return (this.getId() - perunBean.getId()); } } }
if (serviceDenialDao.isServiceBlockedOnFacility(service.getId(), facility.getId())) { log.debug("Service blocked on Facility: {} , {}.", service, facility); continue; while (iter.hasNext()) { Destination dest = iter.next(); if (serviceDenialDao.isServiceBlockedOnDestination(service.getId(), dest.getId())) { iter.remove();
service = perun.getServicesManager().getServiceById(perunSession, service.getId()); facility = perun.getFacilitiesManager().getFacilityById(perunSession, facility.getId()); task.setService(service); log.debug("[{}] Service {} is enabled globally.", task.getId(), service.getId()); } else { log.debug("[{}] Service {} is disabled globally.", task.getId(), service.getId()); return DENIED; if (!serviceDenialDao.isServiceBlockedOnFacility(service.getId(), facility.getId())) { log.debug("[{}] Service {} is allowed on Facility {}.", task.getId(), service.getId(), facility.getId()); } else { log.debug("[{}] Service {} is blocked on Facility {}.", task.getId(), service.getId(), facility.getId()); return DENIED; while (iter.hasNext()) { Destination dest = iter.next(); if (serviceDenialDao.isServiceBlockedOnDestination(service.getId(), dest.getId())) { iter.remove(); log.debug("[{}] Removed blocked destination: {}", task.getId(), dest.toString());
public ServiceForGUI(Service service){ setId(service.getId()); setName(service.getName()); setDescription(service.getDescription()); setDelay(service.getDelay()); setRecurrence(service.getRecurrence()); setScript(service.getScript()); setEnabled(service.isEnabled()); }