Package org.jboss.identity.idm.impl.api

Examples of org.jboss.identity.idm.impl.api.PageSearchControl


      if (defaultStoreIdentityObject != null)
      {
         Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, controls);

         PageSearchControl pageSearchControl = null;
         SortByNameSearchControl sortSearchControl = null;

         if (controls != null)
         {
            for (IdentityObjectSearchControl control : controls)
View Full Code Here


      checkControls(controls);

      //TODO: page control with LDAP request control

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterSearchControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
View Full Code Here



      checkControls(controls);

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterSearchControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
View Full Code Here

   {
      checkIOType(identityType);

      checkControls(controls);

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
      {
         for (IdentityObjectSearchControl control : controls)
         {
            if (control instanceof PageSearchControl)
            {
               pageSearchControl = (PageSearchControl)control;
            }
            else if (control instanceof SortByNameSearchControl)
            {
               sortSearchControl = (SortByNameSearchControl)control;
            }
            else if (control instanceof AttributeFilterSearchControl)
            {
               attributeFilterControl = (AttributeFilterSearchControl)control;
            }
            else if (control instanceof NameFilterSearchControl)
            {
               nameFilterSearchControl = (NameFilterSearchControl)control;
            }
         }
      }

      HibernateIdentityObjectType hibernateType = getHibernateIdentityObjectType(ctx, identityType);

      List<IdentityObject> results;

      HibernateEntityManager em = getHibernateEntityManager(ctx);

      try
      {

         Query q = null;

         if (sortSearchControl != null)
         {
            if (sortSearchControl.isAscending())
            {
               q = em.createNamedQuery("findIdentityObjectsByTypeOrderedByNameAsc");
            }
            else
            {
               q = em.createNamedQuery("findIdentityObjectsByTypeOrderedByNameDesc");
            }
         }
         else
         {
            q = em.createNamedQuery("findIdentityObjectsByType");
         }

         if (pageSearchControl != null)
         {
            if (pageSearchControl.getLimit() > 0)
            {
               q.setMaxResults(pageSearchControl.getLimit());
            }
            q.setFirstResult(pageSearchControl.getOffset());

         }

         q.setParameter("realm", getRealm(em, ctx))
          .setParameter("typeName", hibernateType.getName());
View Full Code Here

      List<IdentityObject> results;

      checkControls(controls);

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
      {
         for (IdentityObjectSearchControl control : controls)
         {
            if (control instanceof PageSearchControl)
            {
               pageSearchControl = (PageSearchControl)control;
            }
            else if (control instanceof SortByNameSearchControl)
            {
               sortSearchControl = (SortByNameSearchControl)control;
            }
            else if (control instanceof AttributeFilterSearchControl)
            {
               attributeFilterControl = (AttributeFilterSearchControl)control;
            }
            else if (control instanceof NameFilterSearchControl)
            {
               nameFilterSearchControl = (NameFilterSearchControl)control;
            }
         }
      }

      boolean orderByName = false;
      boolean ascending = true;

      if (sortSearchControl != null)
      {
         orderByName = true;
         ascending = sortSearchControl.isAscending();
      }

      try
      {
         org.hibernate.Query q = null;

         StringBuilder hqlString = new StringBuilder("");

         if (orderByName)
         {
            hqlString.append(" orderBy ior.toIdentityObject.name");
            if (ascending)
            {
               hqlString.append(" asc");
            }
         }

         if (parent)
         {
            hqlString.append("select ior.toIdentityObject from HibernateIdentityObjectRelationship ior where " +
               "ior.toIdentityObject.name like :nameFilter and ior.type.name like :relType and ior.fromIdentityObject like :identity");

            if (orderByName)
            {
               hqlString.append(" orderBy ior.toIdentityObject.name");
               if (ascending)
               {
                  hqlString.append(" asc");
               }
            }
         }
         else
         {
            hqlString.append("select ior.fromIdentityObject from HibernateIdentityObjectRelationship ior where " +
               "ior.fromIdentityObject.name like :nameFilter and ior.type.name like :relType and ior.toIdentityObject like :identity");


            if (orderByName)
            {
               hqlString.append(" orderBy ior.toIdentityObject.name");
               if (ascending)
               {
                  hqlString.append(" asc");
               }
            }
         }



         q = getHibernateEntityManager(ctx).getSession().createQuery(hqlString.toString())
            .setParameter("relType", relationshipType.getName())
            .setParameter("identity",hibernateObject);

         if (nameFilterSearchControl != null)
         {
            q.setParameter("nameFilter", nameFilterSearchControl.getFilter().replaceAll("\\*", "%"));
         }
         else
         {
            q.setParameter("nameFilter", "%");
         }

        
         if (pageSearchControl != null)
         {
            q.setFirstResult(pageSearchControl.getOffset());
            if (pageSearchControl.getLimit() > 0)
            {
               q.setMaxResults(pageSearchControl.getLimit());
            }
         }



View Full Code Here

      HibernateEntityManager em = getHibernateEntityManager(ctx);

      checkControls(controls);

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
      {
         for (IdentityObjectSearchControl control : controls)
         {
            if (control instanceof PageSearchControl)
            {
               pageSearchControl = (PageSearchControl)control;
            }
            else if (control instanceof SortByNameSearchControl)
            {
               sortSearchControl = (SortByNameSearchControl)control;
            }
            else if (control instanceof AttributeFilterSearchControl)
            {
               attributeFilterControl = (AttributeFilterSearchControl)control;
            }
            else if (control instanceof NameFilterSearchControl)
            {
               nameFilterSearchControl = (NameFilterSearchControl)control;
            }
         }
      }


      try
      {
         Query q = null;

         if (sortSearchControl != null)
         {
            if (sortSearchControl.isAscending())
            {
               q = em.createNamedQuery("findIdentityObjectRelationshipNamesOrderedByNameAsc");
            }
            else
            {
               q = em.createNamedQuery("findIdentityObjectRelationshipNamesOrderedByNameDesc");
            }
         }
         else
         {
            q = em.createNamedQuery("findIdentityObjectRelationshipNames");
         }

         q.setParameter("realm", getRealm(em, ctx));

         if (nameFilterSearchControl != null)
         {
            q.setParameter("nameFilter", nameFilterSearchControl.getFilter().replaceAll("\\*", "%"));
         }
         else
         {
            q.setParameter("nameFilter", "%");
         }


         if (pageSearchControl != null)
         {
            q.setFirstResult(pageSearchControl.getOffset());
            if (pageSearchControl.getLimit() > 0)
            {
               q.setMaxResults(pageSearchControl.getLimit());
            }
         }

         List<String> results = (List<String>)q.getResultList();

View Full Code Here

      HibernateEntityManager em = getHibernateEntityManager(ctx);

      checkControls(controls);

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;

      if (controls != null)
      {
         for (IdentityObjectSearchControl control : controls)
         {
            if (control instanceof PageSearchControl)
            {
               pageSearchControl = (PageSearchControl)control;
            }
            else if (control instanceof SortByNameSearchControl)
            {
               sortSearchControl = (SortByNameSearchControl)control;
            }
         }
      }

      try
      {
         Query q = null;

         if (sortSearchControl != null)
         {
            if (sortSearchControl.isAscending())
            {
               q = em.createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameAsc");
            }
            else
            {
               q = em.createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObjectOrderedByNameDesc");
            }
         }
         else
         {
            q = em.createNamedQuery("findIdentityObjectRelationshipNamesForIdentityObject");
         }

         q.setParameter("identityObject", hibernateObject);

         if (pageSearchControl != null)
         {
            q.setFirstResult(pageSearchControl.getOffset());
            if (pageSearchControl.getLimit() > 0)
            {
               q.setMaxResults(pageSearchControl.getLimit());
            }
         }

         List<String> results = (List<String>)q.getResultList();
View Full Code Here

      if (defaultStoreIdentityObject != null)
      {
         Collection<IdentityObject> objects = defaultIdentityStore.findIdentityObject(defaultCtx, identity, relationshipType, parent, controls);

         PageSearchControl pageSearchControl = null;
         SortByNameSearchControl sortSearchControl = null;

         if (controls != null)
         {
            for (IdentityObjectSearchControl control : controls)
View Full Code Here

      checkControls(controls);

      //TODO: page control with LDAP request control

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterSearchControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
View Full Code Here



      checkControls(controls);

      PageSearchControl pageSearchControl = null;
      SortByNameSearchControl sortSearchControl = null;
      AttributeFilterSearchControl attributeFilterSearchControl = null;
      NameFilterSearchControl nameFilterSearchControl = null;

      if (controls != null)
View Full Code Here

TOP

Related Classes of org.jboss.identity.idm.impl.api.PageSearchControl

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.