Examples of AuthIdsNoIdType


Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

    return new Action() {

      @Override
      protected Object doAction(Object... params) {
        String policyId = (String) params[0];
        AuthIdsNoIdType authIds = (AuthIdsNoIdType) params[1];

        if(authIds.getId() == null || authIds.getId().equals("")) {
          // create the id
          authIds.setId(UUID.randomUUID().toString());
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Create bucket:", authIds.getId());
        }

        com.alu.e3.data.model.sub.QuotaRLBucket authIdsDataModel = BeanConverterUtil.toDataModel(authIds);
        dataManager.createBucket(policyId, authIdsDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setId(authIds.getId());

        return response;
      }
    };
  }
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

      @Override
      protected Object doAction(Object... params) {
        String policyId = (String) params[0];
        String bucketId = (String) params[1];
        AuthIdsNoIdType authIds = (AuthIdsNoIdType) params[2];

        if(LOG.isDebugEnabled()) {
          LOG.debug("Add auths to policy:" + policyId + " on bucket:", bucketId);
        }
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

      @Override
      protected Object doAction(Object... params) {
        String policyId = (String) params[0];
        String bucketId = (String) params[1];
        AuthIdsNoIdType authIds = (AuthIdsNoIdType) params[2];

        if(LOG.isDebugEnabled()) {
          LOG.debug("Remove auths fromo policy:" + policyId + " on bucket:", bucketId);
        }

        for (String authId : authIds.getAuthIds())
        {
          dataManager.removeAuthFromBucket(policyId, bucketId, authId);
        }

        return new PolicyResponse(PolicyResponse.SUCCESS);
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

    Action addBucket = new Action() {

      protected Object doAction(Object... params) {
        PolicyIdsType policies = request.getPolicies();
        AuthIdsNoIdType authIds = request.getQuotaRLBucket();

        if (authIds.getId() == null || authIds.getId().equals("")) {
          // create the id
          authIds.setId(UUID.randomUUID().toString());
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Add auths to policies:" + policies + " on bucket:" + authIds);
        }

        com.alu.e3.data.model.sub.QuotaRLBucket authIdsDataModel = BeanConverterUtil.toDataModel(authIds);
        dataManager.addAuthsToBucket(policies.getId(), authIds.getId(), authIdsDataModel);

        return new PolicyResponse(PolicyResponse.SUCCESS, authIds.getId());
      }
    };

    return execute(addBucket, request);
  }
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

  @Description(value = "This REST API is used to append auths to a bucket for several policies.")
  public Response appendBucket(final BulkPolicyQuotaRLBucketType request, final @PathParam("BUCKET_ID") String bucketID) throws ProvisionException {

    checkCreate(request);
   
    AuthIdsNoIdType authIds = request.getQuotaRLBucket();
   
    if (authIds.getId() != null) {
      if(!authIds.getId().equals(bucketID)){
        throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.INVALID_XML, "Bucket ID not the same in payload as in URL:" + authIds.getId() +" >> " + bucketID));
      }
     
    }
   
    Action appendBucket = new Action() {

      protected Object doAction(Object... params) {
        PolicyIdsType policies = request.getPolicies();
       
        AuthIdsNoIdType authIds = request.getQuotaRLBucket();

        if(LOG.isDebugEnabled()) {
          LOG.debug("Add auths to policies:" + policies + " on bucket:" + authIds);
        }

        com.alu.e3.data.model.sub.QuotaRLBucket authIdsDataModel = BeanConverterUtil.toDataModel(authIds);
        dataManager.appendAuthsToBucket(policies.getId(), authIds.getId(), authIdsDataModel);

        return new PolicyResponse(PolicyResponse.SUCCESS, authIds.getId());
      }
    };

    return execute(appendBucket, request);
  }
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

  @Description(value = "This REST API is used to remove auths from a bucket for several policies.")
  public Response deleteAuth(final BulkPolicyQuotaRLBucketType request, final @PathParam("BUCKET_ID") String bucketID) throws ProvisionException {

    checkCreate(request);
   
    AuthIdsNoIdType authIds = request.getQuotaRLBucket();
   
    if (authIds.getId() != null) {
      if(!authIds.getId().equals(bucketID)){
        throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.INVALID_XML, "Bucket ID not the same in payload as in URL:" + authIds.getId() +" >> " + bucketID));
      }
    }
   
    Action removeAuths = new Action() {
      protected Object doAction(Object... params) {
        PolicyIdsType policies = request.getPolicies();
        AuthIdsNoIdType authIds = request.getQuotaRLBucket()
        dataManager.removeAuthsFromBucket(policies.getId(), bucketID, authIds.getAuthIds());
        if(LOG.isDebugEnabled()) {
          LOG.debug("Remove auths from policies:" + policies + " on bucket:" + authIds);
        }
        return new PolicyResponse(PolicyResponse.SUCCESS);
      }
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.AuthIdsNoIdType

    policies.getId().add("p_1");
    policies.getId().add("p_2");
    policies.getId().add("p_3");

    AuthIdsNoIdType authBucket = new AuthIdsNoIdType();
    bulk.setQuotaRLBucket(authBucket);

    authBucket.getAuthIds().add("a_1");
    authBucket.getAuthIds().add("a_2");
    //authBucket.getAuthIds().add("a_3");
    //authBucket.getAuthIds().add("a_4");

    authBucket.setId(bucketId);

    System.out.println(ObjectMapping.serialize(bulk, "xml", ObjectMapper.JAXB));

    return bulk;
  }
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.