Package org.apache.juddi.query.util

Examples of org.apache.juddi.query.util.DynamicQuery


*/
public class FindSubscriptionByPublisherQuery extends SubscriptionQuery {
 
 
  public static List<?> select(EntityManager em, String authorizedName) {
    DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
    dynamicQry.WHERE().pad();
    dynamicQry.appendGroupedAnd(new DynamicQuery.Parameter(ENTITY_ALIAS + "." + FindEntityByPublisherQuery.AUTHORIZED_NAME_FIELD, authorizedName, DynamicQuery.PREDICATE_EQUALS));   
    return getQueryResult(em, dynamicQry, null, null);
  }
View Full Code Here


   
    List<DiscoveryURL> discURLlist = discURLs.getDiscoveryURL();
    if (discURLlist == null || discURLlist.size() == 0)
      return keysIn;
   
    DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
    appendConditions(dynamicQry, fq, discURLlist);
    if (restrictions != null && restrictions.length > 0)
      dynamicQry.AND().pad().appendGroupedAnd(restrictions);

    return getQueryResult(em, dynamicQry, keysIn, ENTITY_ALIAS + "." + KEY_NAME);
  }
View Full Code Here

      params.add(param);

    }

    // Make sure keys aren't implicated in another transfer request
    DynamicQuery checkKeysQry = new DynamicQuery();
    checkKeysQry.append("select ttk.entityKey from TransferTokenKey ttk ");
    checkKeysQry.WHERE().pad().appendGroupedOr(params.toArray(new DynamicQuery.Parameter[0]));

    Query qry = checkKeysQry.buildJPAQuery(em);
    List<?> obj = qry.getResultList();
    if (obj != null && obj.size() > 0)
      throw new TokenAlreadyExistsException(new ErrorMessage("errors.gettransfertoken.KeyExists", (String)obj.get(0)));

  }
View Full Code Here

         
          params.add(param);
        }
 
        // Find the associated transfer tokens and remove them.
        DynamicQuery getTokensQry = new DynamicQuery();
        getTokensQry.append("select distinct ttk.transferToken from TransferTokenKey ttk").pad();
        getTokensQry.WHERE().pad().appendGroupedOr(params.toArray(new DynamicQuery.Parameter[0]));
 
        Query qry = getTokensQry.buildJPAQuery(em);
        List<org.apache.juddi.model.TransferToken> tokensToDelete = qry.getResultList();
        if (tokensToDelete != null && tokensToDelete.size() > 0) {
          for (org.apache.juddi.model.TransferToken tt : tokensToDelete)
            em.remove(tt);
        }
View Full Code Here

   
    // If keysIn is null or empty, then nothing to fetch.
    if ((keysIn == null) || (keysIn.size() == 0))
      return Collections.emptyList();

    DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
    appendSortTables(dynamicQry);
    dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
    if (restrictions != null && restrictions.length > 0)
      dynamicQry.AND().pad().appendGroupedAnd(restrictions);

    appendSortCriteria(dynamicQry, fq);
   
    appendGroupByEntityKey(dynamicQry);
View Full Code Here

   
    // If keysIn is null or empty, then nothing to fetch.
    if ((keysIn == null) || (keysIn.size() == 0))
      return Collections.emptyList();

    DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
    appendSortTables(dynamicQry);
    dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
    if (restrictions != null && restrictions.length > 0)
      dynamicQry.AND().pad().appendGroupedAnd(restrictions);
   
    appendSortCriteria(dynamicQry, fq);
   
    appendGroupByEntityKey(dynamicQry);
View Full Code Here

   
    // If keysIn is null or empty, then nothing to fetch.
    if ((keysIn == null) || (keysIn.size() == 0))
      return Collections.emptyList();

    DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
    appendSortTables(dynamicQry);
    dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
    if (restrictions != null && restrictions.length > 0)
      dynamicQry.AND().pad().appendGroupedAnd(restrictions);
   
    appendSortCriteria(dynamicQry, fq);
   
    appendGroupByEntityKey(dynamicQry);
View Full Code Here

   
    // If keysIn is null or empty, then nothing to fetch.
    if ((keysIn == null) || (keysIn.size() == 0))
      return Collections.emptyList();

    DynamicQuery dynamicQry = new DynamicQuery(selectSQL);
    appendSortTables(dynamicQry);
    dynamicQry.appendInListWithAnd(ENTITY_ALIAS + "." + KEY_NAME, keysIn);
    if (restrictions != null && restrictions.length > 0)
      dynamicQry.AND().pad().appendGroupedAnd(restrictions);
   
    appendSortCriteria(dynamicQry, fq);
   
    appendGroupByEntityKey(dynamicQry);
View Full Code Here

    this.keyGeneratorKeys = keyGeneratorKeys;
  }

  @SuppressWarnings("unchecked")
  public void populateKeyGeneratorKeys(EntityManager em) {
    DynamicQuery getKeysQuery = new DynamicQuery();
    getKeysQuery.append("select t.entityKey from Tmodel t").pad().WHERE().pad();

    DynamicQuery.Parameter pubParam = new DynamicQuery.Parameter("t.authorizedName",
         getAuthorizedName(),
         DynamicQuery.PREDICATE_EQUALS);

    DynamicQuery.Parameter keyParam = new DynamicQuery.Parameter("UPPER(t.entityKey)",
         (DynamicQuery.WILDCARD + KeyGenerator.KEYGENERATOR_SUFFIX).toUpperCase(),
         DynamicQuery.PREDICATE_LIKE);
   
   
    getKeysQuery.appendGroupedAnd(pubParam, keyParam);
    Query qry = getKeysQuery.buildJPAQuery(em);
   
    keyGeneratorKeys = qry.getResultList();
  }
View Full Code Here

            DynamicQuery.PREDICATE_EQUALS);
        params.add(param);
        requiredCount++;
      }
     
      DynamicQuery checkParentKeyQry = new DynamicQuery();
      checkParentKeyQry.append("select COUNT(t.entityKey) from Tmodel t").pad();

      checkParentKeyQry.WHERE().pad().appendGroupedAnd(pubParam);
      checkParentKeyQry.AND().pad().appendGroupedOr(params.toArray(new DynamicQuery.Parameter[0]));
     
      Query qry = checkParentKeyQry.buildJPAQuery(em);     
      Number resultCount = (Number)qry.getSingleResult();
      if (resultCount.longValue() != requiredCount)
        return false;
    }
    else {
      // If only two tokens, then a domain key generator is being checked.  A domain key generator can only be registered if no other publishers
      // own it.  For example, if trying to register the uddi:domain:abc:123 key then uddi:domain cannot be owned by another publisher.
      DynamicQuery.Parameter notPubParam = new DynamicQuery.Parameter("t.authorizedName",
           getAuthorizedName(),
           DynamicQuery.PREDICATE_NOTEQUALS);

      DynamicQuery.Parameter keyParam = new DynamicQuery.Parameter("UPPER(t.entityKey)",
          (domainPartition + KeyGenerator.PARTITION_SEPARATOR + KeyGenerator.KEYGENERATOR_SUFFIX).toUpperCase(),
          DynamicQuery.PREDICATE_EQUALS);
     
      DynamicQuery checkDomainKeyQry = new DynamicQuery();
      checkDomainKeyQry.append("select t.entityKey from Tmodel t").pad();
     
      checkDomainKeyQry.WHERE().pad().appendGroupedAnd(notPubParam, keyParam);

      Query qry = checkDomainKeyQry.buildJPAQuery(em);
      List<?> obj = qry.getResultList();
      // If there are results then another publisher has the domain key and therefore the key generator is unavailable
      if (obj != null && obj.size() > 0)
        return false;
    }
View Full Code Here

TOP

Related Classes of org.apache.juddi.query.util.DynamicQuery

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.