Examples of Groups


Examples of org.apache.bval.jsr303.groups.Groups

    }

    public ElementDescriptor.ConstraintFinder unorderedAndMatchingGroups(Class<?>... groups) {
        Set<ConstraintValidation> matchingDescriptors =
              new HashSet<ConstraintValidation>(constraintDescriptors.size());
        Groups groupChain = new GroupsComputer().computeGroups(groups);
        for (Group group : groupChain.getGroups()) {
            if ( group.isDefault() ) {
                // If group is default, check if it gets redefined
                List<Group> expandedDefaultGroup = metaBean.getFeature(Jsr303Features.Bean.GROUP_SEQUENCE);
                for ( Group defaultGroupMember : expandedDefaultGroup ) {
                    for (ConstraintValidation descriptor : constraintDescriptors) {
View Full Code Here

Examples of org.apache.bval.jsr303.groups.Groups

   */
  private <T> void validateParameterInContext(
      GroupValidationContext<ConstraintValidationListener<T>> context,
      ParameterDescriptorImpl paramDesc) {

    final Groups groups = context.getGroups();

    for (ConstraintDescriptor consDesc : paramDesc.getConstraintDescriptors()) {
      ConstraintValidation validation = (ConstraintValidation) consDesc;
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validation.validate(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validation.validate(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
           * the groups following in the sequence must not be processed
           */
          if (!context.getListener().isEmpty()) break;
        }
      }
    }
    if (paramDesc.isCascaded() && context.getValidatedValue() != null) {
      context.setMetaBean(factoryContext.getMetaBeanFinder().
          findForClass(context.getValidatedValue().getClass()));
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validateContext(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validateContext(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

Examples of org.apache.bval.jsr303.groups.Groups

   */
  private <T> void validateReturnedValueInContext(
      GroupValidationContext<ConstraintValidationListener<T>> context,
      MethodDescriptorImpl methodDescriptor) {

    final Groups groups = context.getGroups();

    for (ConstraintDescriptor consDesc : methodDescriptor.getConstraintDescriptors()) {
      ConstraintValidation validation = (ConstraintValidation) consDesc;
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validation.validate(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validation.validate(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
           * the groups following in the sequence must not be processed
           */
          if (!context.getListener().isEmpty()) break;
        }
      }
    }
    if (methodDescriptor.isCascaded() && context.getValidatedValue() != null) {
      context.setMetaBean(factoryContext.getMetaBeanFinder().
          findForClass(context.getValidatedValue().getClass()));
      // 1. process groups
      for (Group current : groups.getGroups()) {
        context.setCurrentGroup(current);
        validateContext(context);
      }
      // 2. process sequences
      for (List<Group> eachSeq : groups.getSequences()) {
        for (Group current : eachSeq) {
          context.setCurrentGroup(current);
          validateContext(context);
          /**
           * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

Examples of org.apache.bval.jsr303.groups.Groups

                  createContext(metaBean, null, beanType, groups);
            ConstraintValidationListener result = context.getListener();
            context.setMetaProperty(
                  getNestedProperty(metaBean, null, propertyName).getMetaProperty());
            context.setFixedValue(value);
            Groups sequence = context.getGroups();
            // 1. process groups
            for (Group current : sequence.getGroups()) {
                context.setCurrentGroup(current);
                validatePropertyInGroup(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : sequence.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validatePropertyInGroup(context);
                    /**
                     * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

Examples of org.apache.bval.jsr303.groups.Groups

        try {
            final GroupValidationContext<ConstraintValidationListener<T>> context =
                  createContext(factoryContext.getMetaBeanFinder()
                        .findForClass(object.getClass()), object, (Class<T>)object.getClass(), groupArray);
            final ConstraintValidationListener result = context.getListener();
            final Groups groups = context.getGroups();
            // 1. process groups
            for (Group current : groups.getGroups()) {
                context.setCurrentGroup(current);
                validateBeanNet(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : groups.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validateBeanNet(context);
                    /**
                     * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

Examples of org.apache.bval.jsr303.groups.Groups

            } else {
                context.setMetaProperty(nestedProp.getMetaProperty());
            }
            if (context.getMetaProperty() == null) throw new IllegalArgumentException(
                  "Unknown property " + object.getClass().getName() + "." + propertyName);
            Groups sequence = context.getGroups();
            // 1. process groups
            for (Group current : sequence.getGroups()) {
                context.setCurrentGroup(current);
                validatePropertyInGroup(context);
            }
            // 2. process sequences
            for (List<Group> eachSeq : sequence.getSequences()) {
                for (Group current : eachSeq) {
                    context.setCurrentGroup(current);
                    validatePropertyInGroup(context);
                    /**
                     * if one of the group process in the sequence leads to one or more validation failure,
View Full Code Here

Examples of org.apache.hadoop.lib.service.Groups

        response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();
        break;
      }
      case INSTRUMENTATION: {
        enforceRootPath(op.value(), path);
        Groups groups = HttpFSServerWebApp.get().get(Groups.class);
        List<String> userGroups = groups.getGroups(user.getName());
        if (!userGroups.contains(HttpFSServerWebApp.get().getAdminGroup())) {
          throw new AccessControlException(
            "User not in HttpFSServer admin group");
        }
        Instrumentation instrumentation =
View Full Code Here

Examples of org.apache.hadoop.lib.service.Groups

        response = Response.ok(json).type(MediaType.APPLICATION_JSON).build();
        break;
      }
      case INSTRUMENTATION: {
        enforceRootPath(op.value(), path);
        Groups groups = HttpFSServerWebApp.get().get(Groups.class);
        List<String> userGroups = groups.getGroups(user.getName());
        if (!userGroups.contains(HttpFSServerWebApp.get().getAdminGroup())) {
          throw new AccessControlException(
            "User not in HttpFSServer admin group");
        }
        Instrumentation instrumentation =
View Full Code Here

Examples of org.apache.hadoop.lib.service.Groups

    String dir = TestDirHelper.getTestDir().getAbsolutePath();
    Configuration conf = new Configuration(false);
    conf.set("server.services", StringUtils.join(",", Arrays.asList(GroupsService.class.getName())));
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Groups groups = server.get(Groups.class);
    Assert.assertNotNull(groups);
    List<String> g = groups.getGroups(System.getProperty("user.name"));
    Assert.assertNotSame(g.size(), 0);
    server.destroy();
  }
View Full Code Here

Examples of org.apache.hadoop.lib.service.Groups

    String dir = TestDirHelper.getTestDir().getAbsolutePath();
    Configuration conf = new Configuration(false);
    conf.set("server.services", StringUtils.join(",", Arrays.asList(GroupsService.class.getName())));
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Groups groups = server.get(Groups.class);
    List<String> g = groups.getGroups(System.getProperty("user.name"));
    server.destroy();
    return g.get(0);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.