private List<String> getReturningAttributes(final LDAPMappingConfiguration mappingConfiguration) { List<String> returningAttributes = new ArrayList<String>(); if (mappingConfiguration != null) { returningAttributes.addAll(mappingConfiguration.getMappedProperties().values()); returningAttributes.add(mappingConfiguration.getParentMembershipAttributeName()); for (LDAPMappingConfiguration relationshipConfig : this.config.getRelationshipConfigs()) { if (relationshipConfig.getRelatedAttributedType().equals(mappingConfiguration.getMappedClass())) { returningAttributes.addAll(relationshipConfig.getMappedProperties().values()); } } } else { returningAttributes.add("*"); } returningAttributes.add(getUniqueIdentifierAttributeName()); returningAttributes.add(CREATE_TIMESTAMP); returningAttributes.add(LDAPConstants.OBJECT_CLASS); return returningAttributes; } }
private List<String> getReturningAttributes(final LDAPMappingConfiguration mappingConfiguration) { List<String> returningAttributes = new ArrayList<String>(); if (mappingConfiguration != null) { returningAttributes.addAll(mappingConfiguration.getMappedProperties().values()); returningAttributes.add(mappingConfiguration.getParentMembershipAttributeName()); for (LDAPMappingConfiguration relationshipConfig : this.config.getRelationshipConfigs()) { if (relationshipConfig.getRelatedAttributedType().equals(mappingConfiguration.getMappedClass())) { returningAttributes.addAll(relationshipConfig.getMappedProperties().values()); } } } else { returningAttributes.add("*"); } returningAttributes.add(getUniqueIdentifierAttributeName()); returningAttributes.add(CREATE_TIMESTAMP); returningAttributes.add(LDAPConstants.OBJECT_CLASS); return returningAttributes; } }
protected void addToParentAsMember(final AttributedType attributedType) { LDAPMappingConfiguration entryConfig = getMappingConfig(attributedType.getClass()); if (entryConfig.getParentMembershipAttributeName() != null) { Property<AttributedType> parentProperty = PropertyQueries .<AttributedType>createQuery(attributedType.getClass()) .addCriteria(new TypedPropertyCriteria(attributedType.getClass())) .getFirstResult(); if (parentProperty != null) { AttributedType parentType = parentProperty.getValue(attributedType); if (parentType != null) { Attributes attributes = this.operationManager.getAttributes(parentType.getId(), getBaseDN(parentType), entryConfig); Attribute attribute = attributes.get(entryConfig.getParentMembershipAttributeName()); attribute.add(getBindingDN(attributedType, true)); this.operationManager.modifyAttribute(getBindingDN(parentType, true), attribute); } } } }
protected void addToParentAsMember(final AttributedType attributedType) { LDAPMappingConfiguration entryConfig = getMappingConfig(attributedType.getClass()); if (entryConfig.getParentMembershipAttributeName() != null) { Property<AttributedType> parentProperty = PropertyQueries .<AttributedType>createQuery(attributedType.getClass()) .addCriteria(new TypedPropertyCriteria(attributedType.getClass())) .getFirstResult(); if (parentProperty != null) { AttributedType parentType = parentProperty.getValue(attributedType); if (parentType != null) { Attributes attributes = this.operationManager.getAttributes(parentType.getId(), getBaseDN(parentType), entryConfig); Attribute attribute = attributes.get(entryConfig.getParentMembershipAttributeName()); attribute.add(getBindingDN(attributedType, true)); this.operationManager.modifyAttribute(getBindingDN(parentType, true), attribute); } } } }
@Override protected Builder<LDAPMappingConfiguration> readFrom(LDAPMappingConfiguration fromConfiguration) { this.mappedClass = fromConfiguration.getMappedClass(); this.objectClasses.addAll(fromConfiguration.getObjectClasses()); this.baseDN = fromConfiguration.getBaseDN(); if (fromConfiguration.getIdProperty() != null) { this.idPropertyName = fromConfiguration.getIdProperty().getName(); } this.mappedProperties.putAll(fromConfiguration.getMappedProperties()); this.readOnlyAttributes.addAll(fromConfiguration.getReadOnlyAttributes()); this.parentMapping.putAll(fromConfiguration.getParentMapping()); this.relatedAttributedType = fromConfiguration.getRelatedAttributedType(); this.parentMembershipAttributeName = fromConfiguration.getParentMembershipAttributeName(); this.hierarchySearchDepth = fromConfiguration.getHierarchySearchDepth(); return this; }
@Override protected Builder<LDAPMappingConfiguration> readFrom(LDAPMappingConfiguration fromConfiguration) { this.mappedClass = fromConfiguration.getMappedClass(); this.objectClasses.addAll(fromConfiguration.getObjectClasses()); this.baseDN = fromConfiguration.getBaseDN(); if (fromConfiguration.getIdProperty() != null) { this.idPropertyName = fromConfiguration.getIdProperty().getName(); } this.mappedProperties.putAll(fromConfiguration.getMappedProperties()); this.readOnlyAttributes.addAll(fromConfiguration.getReadOnlyAttributes()); this.parentMapping.putAll(fromConfiguration.getParentMapping()); this.relatedAttributedType = fromConfiguration.getRelatedAttributedType(); this.parentMembershipAttributeName = fromConfiguration.getParentMembershipAttributeName(); this.hierarchySearchDepth = fromConfiguration.getHierarchySearchDepth(); return this; }
if (mappingConfig.getParentMembershipAttributeName() != null) { StringBuilder filter = new StringBuilder("(&"); String entryBaseDN = entryDN.substring(entryDN.indexOf(COMMA) + 1); .append(")") .append("(") .append(mappingConfig.getParentMembershipAttributeName()) .append(EQUAL).append("") .append(getBindingDN(attributedType, false))
if (mappingConfig.getParentMembershipAttributeName() != null) { StringBuilder filter = new StringBuilder("(&"); String entryBaseDN = entryDN.substring(entryDN.indexOf(COMMA) + 1); .append(")") .append("(") .append(mappingConfig.getParentMembershipAttributeName()) .append(EQUAL).append("") .append(getBindingDN(attributedType, false))