public SimpleAttribute(IdentityObjectAttribute attribute) { this.name = attribute.getName(); this.values.addAll(attribute.getValues()); }
public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException { if (attribute == null) { throw new IllegalArgumentException("attribute is null"); } checkIOType(identityObjectType); String attrMappedName = resolveAttributeStoreMapping(identityObjectType, attribute.getName()); HibernateIdentityObjectType hiot = getHibernateIdentityObjectType(invocationCtx, identityObjectType); Session session = getHibernateSession(invocationCtx); Query q = session.createQuery("select a from HibernateIdentityObjectTextAttribute a where a.identityObject.identityType = :identityType " + "and a.name like :attributeName and :value = any elements(a.values)"); Set attrValues = new HashSet(); attrValues.addAll(attribute.getValues()); List<HibernateIdentityObjectAttribute> attrs = (List<HibernateIdentityObjectAttribute>) q.setParameter("identityType", hiot) .setParameter("attributeName", attrMappedName) .setParameter("value", attribute.getValue()).list(); if (attrs.size() == 0) { return null; } if (attrs.size() > 1) { throw new IdentityException("Illegal state - more than one IdentityObject with the same unique attribute value: " + attribute); } return attrs.get(0).getIdentityObject(); }
public IdentityObject findIdentityObjectByUniqueAttribute(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityObjectType, IdentityObjectAttribute attribute) throws IdentityException { List<String> filteredAttrs = new LinkedList<String>(); List<String> leftAttrs = new LinkedList<String>(); IdentityStore toStore = resolveIdentityStore(identityObjectType); IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx); // Put supported attrs to the main store if (toStore != defaultAttributeStore) { Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identityObjectType); if (supportedAttrs.contains(attribute.getName())) { return toStore.findIdentityObjectByUniqueAttribute(targetCtx, identityObjectType, attribute); } } IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx); if (isAllowNotDefinedAttributes()) { defaultAttributeStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute); } else { Set<String> supportedAttrs = defaultAttributeStore.getSupportedAttributeNames(defaultCtx, identityObjectType); if (supportedAttrs.contains(attribute.getName())) { return toStore.findIdentityObjectByUniqueAttribute(defaultCtx, identityObjectType, attribute); } } return null; }
String name = resolveAttributeStoreMapping(identity.getIdentityType(), attribute.getName()); mappedAttributes.put(name, attribute); if (mdMap == null || !mdMap.containsKey(attribute.getName())) "' option if needed. Attribute name: " + attribute.getName()); IdentityObjectAttributeMetaData amd = mdMap.get(attribute.getName()); throw new IdentityException("Cannot assigned multiply values to single valued attribute: " + attribute.getName()); throw new IdentityException("Cannot update readonly attribute: " + attribute.getName()); throw new IdentityException("Unique attribute '" + attribute.getName() + " value already set for identityObject: " + checkIdentity); + attribute.getName() + " / " + value); + attribute.getName() + " / " + value); IdentityObjectAttributeMetaData amd = mdMap.get(attribute.getName());
String name = resolveAttributeStoreMapping(identity.getIdentityType(), attribute.getName()); mappedAttributes.put(name, attribute); if ((mdMap == null || !mdMap.containsKey(attribute.getName())) && !isAllowNotDefinedAttributes) "' option if needed. Attribute name: " + attribute.getName()); amd = mdMap.get(attribute.getName()); throw new IdentityException("Cannot add multiply values to single valued attribute: " + attribute.getName()); throw new IdentityException("Cannot add readonly attribute: " + attribute.getName()); throw new IdentityException("Unique attribute '" + attribute.getName() + " value already set for identityObject: " + checkIdentity); + attribute.getName() + " / " + value); + attribute.getName() + " / " + value); IdentityObjectAttributeMetaData amd = mdMap != null ? mdMap.get(attribute.getName()) : null;