Package org.glite.authz.pap.common.xacml.wizard

Examples of org.glite.authz.pap.common.xacml.wizard.RuleWizard


       
        if ((actionId == null) && (actionValue == null)) {
            throw new XACMLPolicyManagementServiceException("Action id and action value are both unspecified.");
        }
       
        RuleWizard ruleWizard = new RuleWizard(attributeWizardList, effect);
       
        PapContainer papContainer = new PapContainer(pap);
       
        if (actionId == null) {
            actionId = getActionId(papContainer, actionValue, resourceValue, after);
        }
       
        PolicyType actionPolicy = papContainer.getPolicy(actionId);
       
       
        if (obligationValue!= null){
          if (ObligationScopeType.action.equals(obligationScope)){
           
            if (!PolicyHelper.hasObligationWithId(actionPolicy, obligationValue)){
              ObligationWizard owiz = new ObligationWizard(obligationValue);
              ObligationsType obligations = ObligationsHelper.build();
              obligations.getObligations().add(owiz.getXACML());
              actionPolicy.setObligations(obligations);
            }
           
          }else{
           
            PolicySetType resourcePolicySet = findResourcePolicySet(papContainer);
            if (!PolicySetHelper.hasObligationWithId(resourcePolicySet, obligationValue)){
              ObligationWizard owiz = new ObligationWizard(obligationValue);
              ObligationsType obligations = ObligationsHelper.build();
              obligations.getObligations().add(owiz.getXACML());
              resourcePolicySet.setObligations(obligations);
            }
           
          }
        }
       
        int index = 0;

        if (ruleId != null) {

            index = PolicyHelper.indexOfRule(actionPolicy, ruleId);

            if (index == -1) {
                throw new XACMLPolicyManagementServiceException("ruleId not found: " + ruleId);
            }

            if (after) {
                index++;
            }
        }

        if ((ruleId == null) && (after)) {
            index = -1;
        }

       
        PolicyHelper.addRule(actionPolicy, index, ruleWizard.getXACML());

        String version = actionPolicy.getVersion();

        PolicyWizard.increaseVersion(actionPolicy);
       

        TypeStringUtils.releaseUnneededMemory(actionPolicy);

        papContainer.updatePolicy(version, actionPolicy);

        return ruleWizard.getRuleId();
    }
View Full Code Here

TOP

Related Classes of org.glite.authz.pap.common.xacml.wizard.RuleWizard

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.