@Override public String serializeToString() { StringBuilder str = new StringBuilder(); 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(getName() == null ? "\\0" : BeansUtils.createEscaping(getName())).append(">").append( ", description=<").append(getDescription() == null ? "\\0" : BeansUtils.createEscaping(getDescription())).append(">").append( ']').toString(); }
@Override public String toString() { StringBuilder str = new StringBuilder(); return str.append(getClass().getSimpleName()).append(":[" ).append("id='").append(getId() ).append("', voId='").append(super.getVoId() ).append("', facilityId='").append(super.getFacilityId() ).append("', name='").append(super.getName() ).append("', description='").append(super.getDescription() ).append("', facility='").append(getFacility() ).append("', vo='").append(getVo() ).append("', resourceTags='").append(getResourceTags() ).append("']").toString(); }
public void deleteResource(Resource resource) throws InternalErrorException { try { ldapTemplate.unbind(getResourceDN(String.valueOf(resource.getVoId()), String.valueOf(resource.getId()))); log.debug("Entry deleted from LDAP: Resource {} from Vo with ID=" + resource.getVoId() + " and Facility with ID=" + resource.getFacilityId() + ".", resource); } catch (NameNotFoundException e) { throw new InternalErrorException(e); } }
public void updateResource(Resource resource, ModificationItem[] modificationItems) { ldapTemplate.modifyAttributes(getResourceDN(String.valueOf(resource.getVoId()), String.valueOf(resource.getId())), modificationItems); log.debug("Entry modified in LDAP: Resource {}.", resource); }
public boolean resourceAttributeExist(Resource resource, String ldapAttributeName) throws InternalErrorException { if(ldapAttributeName == null) throw new InternalErrorException("ldapAttributeName can't be null."); Object o = null; try { setLdapAttributeName(ldapAttributeName); o = ldapTemplate.lookup(getResourceDN(String.valueOf(resource.getVoId()), String.valueOf(resource.getId())), new AttributeContextMapper()); } catch (NameNotFoundException ex) { return false; } if(o == null) return false; return true; }
public void createResource(Resource resource, String entityID) throws InternalErrorException { // Create a set of attributes Attributes attributes = new BasicAttributes(); // Create the objectclass to add Attribute objClasses = new BasicAttribute(EventProcessorImpl.ldapAttrObjectClass); objClasses.add(EventProcessorImpl.objectClassTop); objClasses.add(EventProcessorImpl.objectClassPerunResource); // Add attributes attributes.put(objClasses); attributes.put(EventProcessorImpl.ldapAttrCommonName, resource.getName()); attributes.put(EventProcessorImpl.ldapAttrPerunResourceId, String.valueOf(resource.getId())); attributes.put(EventProcessorImpl.ldapAttrPerunFacilityId, String.valueOf(resource.getFacilityId())); attributes.put(EventProcessorImpl.ldapAttrPerunVoId, String.valueOf(resource.getVoId())); if(resource.getDescription() != null && !resource.getDescription().isEmpty()) attributes.put(EventProcessorImpl.ldapAttrDescription, resource.getDescription()); // get info about entityID attribute if exists if(entityID != null) attributes.put(EventProcessorImpl.ldapAttrEntityID, entityID); // Create the entry try { ldapTemplate.bind(getResourceDN(String.valueOf(resource.getVoId()), String.valueOf(resource.getId())), null, attributes); log.debug("New entry created in LDAP: Resource {} in Vo with Id=" + resource.getVoId() + " and Facility with ID=" + resource.getFacilityId() + ".", resource); } catch (NameNotFoundException e) { throw new InternalErrorException(e); } }
/** * Constructs a new instance. */ public RichResource(Resource resource) { super(resource.getId(), resource.getName(), resource.getDescription(), resource.getFacilityId(), resource.getVoId(), resource.getCreatedAt(), resource.getCreatedBy(), resource.getModifiedAt(), resource.getModifiedBy(), resource.getCreatedByUid(), resource.getModifiedByUid()); }