Package org.apache.ambari.server.controller.predicate

Examples of org.apache.ambari.server.controller.predicate.AndPredicate


    if (internalPredicate == null) {
        return predicate;
    }
    return (predicate == null ? internalPredicate :
          new AndPredicate(predicate, internalPredicate));
  }
View Full Code Here


    }
    Predicate predicate;

    switch (operator) {
      case And:
        predicate = new AndPredicate(predicates.toArray(new Predicate[predicates.size()]));
        break;
      case Or:
        predicate = new OrPredicate(predicates.toArray(new Predicate[predicates.size()]));
        break;
      default:
View Full Code Here

  }

  @Override
  public Predicate toPredicate(Predicate left, Predicate right) {
    //todo: refactor to not need down casts
    return new AndPredicate(left, right);
  }
View Full Code Here

    }

    if (setPredicates.size() == 1) {
      return setPredicates.iterator().next();
    } else if (setPredicates.size() > 1) {
      return new AndPredicate(setPredicates.toArray(new Predicate[setPredicates.size()]));
    } else {
      return null;
    }
  }
View Full Code Here

    if (internalPredicate == null) {
        return predicate;
    }
    return (predicate == null ? internalPredicate :
          new AndPredicate(predicate, internalPredicate));
  }
View Full Code Here

  @Test
  public void testToPredicate() {
    EqualsPredicate p1 = new EqualsPredicate<String>("p1", "one");
    EqualsPredicate p2 = new EqualsPredicate<String>("p2", "two");
    AndPredicate andPredicate = new AndPredicate(p1, p2);

    assertEquals(andPredicate, new AndOperator(1).toPredicate(p1, p2));
  }
View Full Code Here

    visitor = new SubResourcePredicateVisitor("components");
    PredicateHelper.visit(predicate, visitor);

    subResourcePredicate = visitor.getSubResourcePredicate();

    Assert.assertEquals(new AndPredicate(), subResourcePredicate);
  }
View Full Code Here

    Map<String, String> requestInfo = new HashMap<String, String>();
    requestInfo.put("context", "Install and start all services");
    Request installRequest = new RequestImpl(null, Collections.singleton(installProperties), requestInfo, null);
    Predicate statePredicate = new EqualsPredicate<String>(SERVICE_SERVICE_STATE_PROPERTY_ID, "INIT");
    Predicate clusterPredicate = new EqualsPredicate<String>(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
    Predicate installPredicate = new AndPredicate(statePredicate, clusterPredicate);

    final Request startRequest;
    Predicate startPredicate;
    try {
      LOG.info("Installing all services");
      requestStages = doUpdateResources(null, installRequest, installPredicate);
      notifyUpdate(Resource.Type.Service, installRequest, installPredicate);

      Map<String, Object> startProperties = new HashMap<String, Object>();
      startProperties.put(SERVICE_SERVICE_STATE_PROPERTY_ID, "STARTED");
      startRequest = new RequestImpl(null, Collections.singleton(startProperties), requestInfo, null);
      Predicate installedStatePredicate = new EqualsPredicate<String>(SERVICE_SERVICE_STATE_PROPERTY_ID, "INSTALLED");
      Predicate serviceClusterPredicate = new EqualsPredicate<String>(SERVICE_CLUSTER_NAME_PROPERTY_ID, clusterName);
      startPredicate = new AndPredicate(installedStatePredicate, serviceClusterPredicate);

      LOG.info("Starting all services");
      doUpdateResources(requestStages, startRequest, startPredicate);
      notifyUpdate(Resource.Type.Service, startRequest, startPredicate);
      requestStages.persist();
View Full Code Here

TOP

Related Classes of org.apache.ambari.server.controller.predicate.AndPredicate

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.