Package org.hibernate.criterion

Examples of org.hibernate.criterion.Conjunction


    String message = new String("");

    StrTokenizer tokenizer = new StrTokenizer(inFilter, ' ', '\"');

    // conjunctions collecting conditions
    Conjunction conjWorkPiece = null;
    Conjunction conjProjects = null;
    Conjunction conjSteps = null;
    Conjunction conjProcesses = null;
    Conjunction conjTemplates = null;
    Conjunction conjUsers = null;
    Conjunction conjStepProperties = null;
    Conjunction conjProcessProperties = null;

    // this is needed if we filter processes
    if (flagProcesses) {
      conjProjects = Restrictions.conjunction();
      limitToUserAccessRights(conjProjects);
View Full Code Here


     * {@inheritDoc }
     */
    @Override
    public List<SimpleAction> getLogs(LogSearchCriteria searchCriteria) {
        final Session session = (Session) entityManager.getDelegate();
        final Conjunction criteria = conjunction();

        if (searchCriteria.isUserNameSet()) {
            criteria.add(eq("userNickname", searchCriteria.getUserName()));
        }
        if (searchCriteria.isDateSet()) {
            switch (searchCriteria.getDateType()) {
                case SINGLE: {
                    criteria.add(eq("actionDate", searchCriteria.getDateSingle()));
                    break;
                }
                case PERIOD: {
                    criteria.add(between("actionDate", searchCriteria.getDateFrom(), searchCriteria.getDateTo()));
                    break;
                }
            }
        }
        if (searchCriteria.isOperationsSet()) {
            Disjunction operations = disjunction();
            for (PosibleOperations operation : searchCriteria.getOperations()) {
                operations.add(eq("actionName", operation));
            }
            criteria.add(operations);
        }

        return session.createCriteria(SimpleAction.class).add(criteria).
                addOrder(Order.desc("actionDate")).addOrder(Order.desc("actionTime")).list();
    }
View Full Code Here

  }

  protected ConjunctionEvaluator<Criterion, Object> compileConjunction(Collection<CommandEvaluator> childs) {
    return new AbstractConjunction<Criterion, Object>(childs) {
      public Criterion evaluate(Object arg) {
        Conjunction conj = Restrictions.conjunction();
        for (CommandEvaluator eval : childs) {
          conj.add((Criterion) eval.evaluate(null));
        }
        return conj;
      }
    };
  }
View Full Code Here

    if (eq.getIdentifier() instanceof Property) {
      propertyInQuery = true;
      final Property property = (Property) eq.getIdentifier();
      return new EqualityEvaluator<String, Criterion, Object>() {
        public Criterion evaluate(Object paramValue) {
          Conjunction conj = Restrictions.conjunction();
          if (!StringUtils.isEmpty(property.getNamespace())) {
            conj.add(Restrictions.eq(PROPERTY_NS_DB_FIELD, property.getNamespace()));
          }
          conj.add(Restrictions.eq(PROPERTY_NAME_DB_FIELD, property.getName()));
          conj.add(Restrictions.eq(PROPERTY_VALUE_DB_FIELD, eq.getValue().getValue()));

          return conj;
        };

        public String getIdentifier() {
View Full Code Here

    if (ge.getIdentifier() instanceof Property) {
      propertyInQuery = true;
      final Property property = (Property) ge.getIdentifier();
      return new GEEvaluator<String, Criterion, Object>() {
        public Criterion evaluate(Object paramValue) {
          Conjunction conj = Restrictions.conjunction();
          if (!StringUtils.isEmpty(property.getNamespace())) {
            conj.add(Restrictions.ge(PROPERTY_NS_DB_FIELD, property.getNamespace()));
          }
          conj.add(Restrictions.ge(PROPERTY_NAME_DB_FIELD, property.getName()));
          conj.add(Restrictions.ge(PROPERTY_VALUE_DB_FIELD, ge.getValue().getValue()));

          return conj;
        };

        public String getIdentifier() {
View Full Code Here

    if (gt.getIdentifier() instanceof Property) {
      propertyInQuery = true;
      final Property property = (Property) gt.getIdentifier();
      return new GreaterEvaluator<String, Criterion, Object>() {
        public Criterion evaluate(Object paramValue) {
          Conjunction conj = Restrictions.conjunction();
          if (!StringUtils.isEmpty(property.getNamespace())) {
            conj.add(Restrictions.gt(PROPERTY_NS_DB_FIELD, property.getNamespace()));
          }
          conj.add(Restrictions.gt(PROPERTY_NAME_DB_FIELD, property.getName()));
          conj.add(Restrictions.gt(PROPERTY_VALUE_DB_FIELD, gt.getValue().getValue()));

          return conj;
        };

        public String getIdentifier() {
View Full Code Here

          String propertyNS = property.getNamespace();
          String propertyName = property.getName();

          for (Value value : in.getValues()) {
            Conjunction conj = Restrictions.conjunction();
            if (!StringUtils.isEmpty(property.getNamespace())) {
              conj.add(Restrictions.gt(PROPERTY_NS_DB_FIELD, propertyNS));
            }
            conj.add(Restrictions.gt(PROPERTY_NAME_DB_FIELD, propertyName));
            conj.add(Restrictions.gt(PROPERTY_VALUE_DB_FIELD, value.getValue()));

            disj.add(conj);
          }
          return disj;
        };
View Full Code Here

  protected LEEvaluator<String, Criterion, Object> compileLE(final LE le) {
    if (le.getIdentifier() instanceof Property) {
      final Property property = (Property) le.getIdentifier();
      return new LEEvaluator<String, Criterion, Object>() {
        public Criterion evaluate(Object paramValue) {
          Conjunction conj = Restrictions.conjunction();
          if (!StringUtils.isEmpty(property.getNamespace())) {
            conj.add(Restrictions.le(PROPERTY_NS_DB_FIELD, property.getNamespace()));
          }
          conj.add(Restrictions.le(PROPERTY_NAME_DB_FIELD, property.getName()));
          conj.add(Restrictions.le(PROPERTY_VALUE_DB_FIELD, le.getValue().getValue()));

          return conj;
        };

        public String getIdentifier() {
View Full Code Here

    if (less.getIdentifier() instanceof Property) {
      propertyInQuery = true;
      final Property property = (Property) less.getIdentifier();
      return new LessEvaluator<String, Criterion, Object>() {
        public Criterion evaluate(Object paramValue) {
          Conjunction conj = Restrictions.conjunction();
          if (!StringUtils.isEmpty(property.getNamespace())) {
            conj.add(Restrictions.lt(PROPERTY_NS_DB_FIELD, property.getNamespace()));
          }
          conj.add(Restrictions.lt(PROPERTY_NAME_DB_FIELD, property.getName()));
          conj.add(Restrictions.lt(PROPERTY_VALUE_DB_FIELD, less.getValue().getValue()));

          return conj;
        };

        public String getIdentifier() {
View Full Code Here

    if (like.getIdentifier() instanceof Property) {
      propertyInQuery = true;
      final Property property = (Property) like.getIdentifier();
      return new LikeEvaluator<String, Criterion, Object>() {
        public Criterion evaluate(Object paramValue) {
          Conjunction conj = Restrictions.conjunction();
          if (!StringUtils.isEmpty(property.getNamespace())) {
            conj.add(Restrictions.like(PROPERTY_NS_DB_FIELD, property.getNamespace()));
          }
          conj.add(Restrictions.like(PROPERTY_NAME_DB_FIELD, property.getName()));
          conj.add(Restrictions.like(PROPERTY_VALUE_DB_FIELD, like.getValue().getValue()));

          return conj;
        };

        public String getIdentifier() {
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Conjunction

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.