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; }
private static Facility createFacility(Map<String, String> beanAttr) { if(beanAttr==null) return null; Facility facility = new Facility(); facility.setId(Integer.valueOf(beanAttr.get("id"))); facility.setName(BeansUtils.eraseEscaping(beanAttr.get("name"))); facility.setDescription(BeansUtils.eraseEscaping(beanAttr.get("description"))); return facility; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; FacilityState other = (FacilityState) obj; if (facility == null) { if (other.facility != null) return false; } else if (!facility.equals(other.facility)) return false; return true; }
@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()); } } }
public int getFacilityId() { if (facility != null) { return facility.getId(); } else { return -1; } }
@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; }
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; + task.isPropagationForced() + "]|[" + fixStringSeparators(task.getService().serializeToString()) + "]|[" + fixStringSeparators(task.getFacility().serializeToString()) + "]|[" + fixStringSeparators(destinations_s.toString()) + "]");
@Override public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", destination=<").append(super.getDestination() == null ? "\\0" : BeansUtils.createEscaping(super.getDestination())).append(">").append( ", type=<").append(super.getType() == null ? "\\0" : BeansUtils.createEscaping(super.getType())).append(">").append( ", facility=<").append(getFacility() == null ? "\\0" : getFacility().serializeToString()).append(">").append( ", service=<").append(getService() == null ? "\\0" : getService().serializeToString()).append(">").append( ']').toString(); }
@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 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(); }
@Override public String serializeToString() { StringBuilder str = new StringBuilder(); String tags = "\\0"; if (getResourceTags() != null && !getResourceTags().isEmpty()) { ArrayList<String> list = new ArrayList<String>(); for (ResourceTag t : getResourceTags()) { list.add(t.serializeToString()); } tags = list.toString(); } return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", voId=<").append(getVoId()).append(">").append( ", facilityId=<").append(getFacilityId()).append(">").append( ", name=<").append(super.getName() == null ? "\\0" : BeansUtils.createEscaping(super.getName())).append(">").append( ", description=<").append(super.getDescription() == null ? "\\0" : BeansUtils.createEscaping(super.getDescription())).append(">").append( ", facility=<").append(getFacility() == null ? "\\0" : getFacility().serializeToString()).append(">").append( ", vo=<").append(getVo() == null ? "\\0" : getVo().serializeToString()).append(">").append( ", resourceTags=<").append(tags).append(">").append( ']').toString(); }
task.getFacility().getName(), sendTask.getDestination().getDestination(), sendTask.getDestination().getType()
@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(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RichFacility other = (RichFacility) obj; if(!super.equals(obj)) return false; if (facilityOwners == null) { if (other.facilityOwners != null) { return false; } } else if (!facilityOwners.equals(other.facilityOwners)) { return false; } return true; }
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 boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Task other = (Task) obj; if (!service.equals(other.service)) return false; if (!facility.equals(other.facility)) return false; if (id != other.id) return false; return true; }
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 boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } RichDestination other = (RichDestination) obj; if (facility == null) { if (other.facility != null) { return false; } } else if (!facility.equals(other.facility)) { return false; } if (service == null) { if (other.service != null) { return false; } } else if (!service.equals(other.service)) { return false; } return true; }