Package com.alu.e3.prov.restapi.model

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


  protected final Action newUpdateAction() {
    return new Action() {

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

        /**
         * Some validation
         */
        for(Key key : policy.getProperties()){
          if(key.getName() == null || key.getName().isEmpty())
            throw new IllegalArgumentException("All properties must have a name");
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Updating Policy:", policyId);
        }

        if(policy.getId() == null || policy.getId().equals(""))
          policy.setId(policyId);
        else if(policy.getId().equals(policyId) == false)
          throw new InvalidParameterException("Policy ID mismatch");

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);       
        dataManager.updatePolicy(policyDataModel);

View Full Code Here


        com.alu.e3.data.model.Policy policyDataModel = dataManager.getPolicyById(policyId);
        if(policyDataModel == null)
          throw new InvalidIDException("A Policy with that ID does not exist");

        Policy policy = BeanConverterUtil.fromDataModel(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setPolicy(policy);

        return response;
View Full Code Here

    checkCreate(request);

    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());
      }
    };
View Full Code Here

    }
   
    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());
      }
    };
View Full Code Here

    checkDelete(request);

    Action deleteBucket = new Action() {

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

        if(LOG.isDebugEnabled()) {
          LOG.debug("Remove bucket ID:[" + bucketID + "] on policy:"+ policies.getId());
        }

        dataManager.removeBucket(policies.getId(), bucketID);

        return new PolicyResponse(PolicyResponse.SUCCESS);
      }
    };
    return execute(deleteBucket, bucketID);
View Full Code Here

      }
    }
   
    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

  }

  private BulkPolicyQuotaRLBucketType newBulkProvision(String bucketId) {

    BulkPolicyQuotaRLBucketType bulk = new BulkPolicyQuotaRLBucketType();
    PolicyIdsType policies = new PolicyIdsType();

    bulk.setPolicies(policies);

    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");
View Full Code Here

        }

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);
        dataManager.addPolicy(policyDataModel);

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

        return response;
      }
    };
  }
View Full Code Here

          throw new InvalidParameterException("Policy ID mismatch");

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);       
        dataManager.updatePolicy(policyDataModel);

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

          LOG.debug("Deleting Policy:", policyId);
        }

        dataManager.removePolicy(policyId);

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

TOP

Related Classes of com.alu.e3.prov.restapi.model.PolicyIdsType

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.