public int getFacilityId() { if (facility != null) { return facility.getId(); } else { return -1; } }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getId(); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); return result; }
@Override public String toString() { StringBuilder str = new StringBuilder(); return str.append(getClass().getSimpleName()).append( ":[id='").append(getId()).append("', name='").append(name).append( "', description='").append(description).append("']").toString(); }
public static void freeAllDenialsOnFacility(RpcCaller rpcCaller, Facility facility) throws InternalErrorException { Map<String, Object> params = new HashMap<String, Object>(); params.put("facility", facility.getId()); try { rpcCaller.call("generalServiceManager", "unblockAllServicesOnFacility", params); } 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( ']').toString(); }
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); } }
@Override public String toString() { StringBuilder str = new StringBuilder(); return str.append("ContactGroup:[facilityID='").append(getFacility().getId()).append("', name='").append(getName()).append("', groupsIDs='").append(BeansUtils.getIDsOfPerunBeans(getGroups())).append( "', ownersIDs='").append(BeansUtils.getIDsOfPerunBeans(getOwners())).append("', usersIDs='").append(BeansUtils.getIDsOfPerunBeans(users)).append("']").toString(); }
public static void deleteFacility(RpcCaller rpcCaller, Facility facility) throws InternalErrorException, RelationExistsException, FacilityNotExistsException, PrivilegeException { Map<String, Object> params = new HashMap<String,Object>(); params.put("facility", facility.getId()); try { rpcCaller.call("facilitiesManager", "deleteFacility", params); } catch (PrivilegeException e) { throw e; } catch (FacilityNotExistsException e) { throw e; } catch (RelationExistsException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
public static List<Resource> getAssignedResources(RpcCaller rpcCaller, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Map<String, Object> params = new HashMap<String,Object>(); params.put("facility", facility.getId()); try { return rpcCaller.call("facilitiesManager", "getAssignedResources", params).readList(Resource.class); } catch (PrivilegeException e) { throw e; } catch (FacilityNotExistsException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (PerunException e) { throw new ConsistencyErrorException(e); } }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Facility other = (Facility) obj; if (getId() != other.getId()) { return false; } if (this.name == null ? other.getName() != null : !this.name.equals(other.getName())) { return false; } if (description == null ? other.getDescription() != null : !this.description.equals(other.getDescription())) { return false; } return true; }
public static Attribute getAttribute(RpcCaller rpcCaller, Facility facility, String attributeName) throws PrivilegeException, InternalErrorException, AttributeNotExistsException, FacilityNotExistsException, WrongAttributeAssignmentException { Map<String, Object> params = new HashMap<String, Object>(); params.put("facility", facility.getId()); params.put("attributeName", attributeName); try { return rpcCaller.call("attributesManager", "getAttribute", params).read(Attribute.class); } catch (AttributeNotExistsException e) { throw e; } catch (PrivilegeException e) { throw e; } catch (InternalErrorException e) { throw e; } catch (FacilityNotExistsException e) { throw e; } catch (WrongAttributeAssignmentException 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<Service> getAssignedServices(RpcCaller rpcCaller, Facility facility) throws InternalErrorException, FacilityNotExistsException, PrivilegeException { Map<String, Object> params = new HashMap<String, Object>(); params.put("facility", facility.getId()); try { return rpcCaller.call("servicesManager", "getAssignedServices", params).readList(Service.class); } catch (PrivilegeException e) { throw e; } catch (FacilityNotExistsException 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 Facility) { Facility facility = (Facility) perunBean; if (this.getName() == null && facility.getName() != null) return -1; if (facility.getName() == null && this.getName() != null) return 1; if (this.getName() == null && facility.getName() == null) return 0; return this.getName().compareToIgnoreCase(facility.getName()); } else { return (this.getId() - perunBean.getId()); } } }
.getAssignedResources(perunSession, facility)); } catch (FacilityNotExistsException ex) { log.warn("Non-existing facility found while resolving event. id={}", facility.getId());
public RichFacility(Facility facility, List<Owner> facilityOwners) { super(facility.getId(), facility.getName(), facility.getDescription(), facility.getCreatedAt(), facility.getCreatedBy(), facility.getModifiedAt(), facility.getModifiedBy(), facility.getCreatedByUid(), facility.getModifiedByUid()); this.facilityOwners = facilityOwners; }
if (serviceDenialDao.isServiceBlockedOnFacility(service.getId(), facility.getId())) { log.debug("Service blocked on Facility: {} , {}.", service, facility); continue;
initPerunSession(); service = perun.getServicesManager().getServiceById(perunSession, service.getId()); facility = perun.getFacilitiesManager().getFacilityById(perunSession, facility.getId()); task.setService(service); task.setFacility(facility); 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;