Package org.jboss.identity.idm.spi.store

Examples of org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext


   public Map<String, IdentityObjectAttribute> getAttributes(IdentityStoreInvocationContext invocationContext, IdentityObject identity) throws IdentityException
   {
      Map<String, IdentityObjectAttribute> results;

      IdentityStore toStore = resolveIdentityStore(identity);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationContext);

      results = toStore.getAttributes(targetCtx, identity);

      if (toStore != defaultAttributeStore)
      {
         IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationContext);

         Map<String, IdentityObjectAttribute> defaultAttrs = defaultAttributeStore.getAttributes(defaultCtx, identity);

         // Add only those attributes which are missing - don't overwrite or merge existing values
         for (Map.Entry<String, IdentityObjectAttribute> entry : defaultAttrs.entrySet())
View Full Code Here


      ArrayList<IdentityObjectAttribute> leftAttrs = new ArrayList<IdentityObjectAttribute>();

      IdentityObjectAttribute[] attributesToAdd = null;

      IdentityStore toStore = resolveIdentityStore(identity);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);

      // Put supported attrs to the main store
      if (toStore != defaultAttributeStore)
      {
         Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());

         // Filter out supported and not supported attributes
         for (IdentityObjectAttribute entry : attributes)
         {
            if (supportedAttrs.contains(entry.getName()))
            {
               filteredAttrs.add(entry);
            }
            else
            {
               leftAttrs.add(entry);
            }
         }

         toStore.updateAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));

         attributesToAdd = leftAttrs.toArray(new IdentityObjectAttribute[leftAttrs.size()]);

      }
      else
      {
         attributesToAdd = attributes;
      }

      IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);

      if (isAllowNotDefinedAttributes())
      {
         defaultAttributeStore.updateAttributes(defaultCtx, identity, attributesToAdd);
      }
View Full Code Here

      ArrayList<IdentityObjectAttribute> filteredAttrs = new ArrayList<IdentityObjectAttribute>();
      ArrayList<IdentityObjectAttribute> leftAttrs = new ArrayList<IdentityObjectAttribute>();
      IdentityObjectAttribute[] attributesToAdd = null;

      IdentityStore toStore = resolveIdentityStore(identity);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);

      // Put supported attrs to the main store
      if (toStore != defaultAttributeStore)
      {
         Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());

         // Filter out supported and not supported attributes
         for (IdentityObjectAttribute entry : attributes)
         {
            if (supportedAttrs.contains(entry.getName()))
            {
               filteredAttrs.add(entry);
            }
            else
            {
               leftAttrs.add(entry);
            }
         }

         toStore.addAttributes(targetCtx, identity, filteredAttrs.toArray(new IdentityObjectAttribute[filteredAttrs.size()]));

         attributesToAdd = leftAttrs.toArray(new IdentityObjectAttribute[leftAttrs.size()]);


      }
      else
      {
         attributesToAdd = attributes;
      }

      IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);

      if (isAllowNotDefinedAttributes())
      {
         defaultAttributeStore.addAttributes(defaultCtx, identity, attributesToAdd);
      }
View Full Code Here

   {
      List<String> filteredAttrs = new LinkedList<String>();
      List<String> leftAttrs = new LinkedList<String>();

      IdentityStore toStore = resolveIdentityStore(identity);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(toStore, invocationCtx);

      // Put supported attrs to the main store
      if (toStore != defaultAttributeStore)
      {
         Set<String> supportedAttrs = toStore.getSupportedAttributeNames(targetCtx, identity.getIdentityType());

         // Filter out supported and not supported attributes
         for (String name : attributes)
         {
            if (supportedAttrs.contains(name))
            {
               filteredAttrs.add(name);
            }
            else
            {
               leftAttrs.add(name);
            }
         }

         toStore.removeAttributes(targetCtx, identity, filteredAttrs.toArray(new String[filteredAttrs.size()]));


      }
      else
      {
         leftAttrs = Arrays.asList(attributes);
      }

      IdentityStoreInvocationContext defaultCtx = resolveInvocationContext(defaultAttributeStore, invocationCtx);

      if (isAllowNotDefinedAttributes())
      {
         defaultAttributeStore.removeAttributes(defaultCtx, identity, leftAttrs.toArray(new String[leftAttrs.size()]));
      }
View Full Code Here

   }

   public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType) throws IdentityException
   {
      IdentityStore targetStore = resolveIdentityStore(identityObjectType);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
      return targetStore.createIdentityObject(targetCtx, name, identityObjectType);
   }
View Full Code Here

   }

   public IdentityObject createIdentityObject(IdentityStoreInvocationContext invocationCtx, String name, IdentityObjectType identityObjectType, Map<String, String[]> attributes) throws IdentityException
   {
      IdentityStore targetStore = resolveIdentityStore(identityObjectType);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);
      return targetStore.createIdentityObject(targetCtx, name, identityObjectType, attributes);
   }
View Full Code Here

   }

   public void removeIdentityObject(IdentityStoreInvocationContext invocationCtx, IdentityObject identity) throws IdentityException
   {
      IdentityStore targetStore = resolveIdentityStore(identity);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);

      targetStore.removeIdentityObject(targetCtx, identity);
   }
View Full Code Here

   }

   public int getIdentityObjectsCount(IdentityStoreInvocationContext invocationCtx, IdentityObjectType identityType) throws IdentityException
   {
      IdentityStore targetStore = resolveIdentityStore(identityType);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationCtx);

      return targetStore.getIdentityObjectsCount(targetCtx, identityType);
   }
View Full Code Here

   }

   public IdentityObject findIdentityObject(IdentityStoreInvocationContext invocationContext, String name, IdentityObjectType identityObjectType) throws IdentityException
   {
      IdentityStore targetStore = resolveIdentityStore(identityObjectType);
      IdentityStoreInvocationContext targetCtx = resolveInvocationContext(targetStore, invocationContext);

      return targetStore.findIdentityObject(targetCtx, name, identityObjectType);
   }
View Full Code Here

                              IdentityObjectTypeMapper typeMapper) throws IdentityException
   {
      this.realmName = realmName;

      IdentityStoreSession storeSession = repository.createIdentityStoreSession();
      final IdentityStoreInvocationContext invocationCtx = new SimpleIdentityStoreInvocationContext(storeSession, realmName);

      IdentityStoreInvocationContextResolver resolver = new IdentityStoreInvocationContextResolver()
      {
         public IdentityStoreInvocationContext resolveInvocationContext()
         {
View Full Code Here

TOP

Related Classes of org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.