當前位置: 首頁>>代碼示例>>Java>>正文


Java PolicyElementDTO.setVersion方法代碼示例

本文整理匯總了Java中org.wso2.balana.utils.policy.dto.PolicyElementDTO.setVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java PolicyElementDTO.setVersion方法的具體用法?Java PolicyElementDTO.setVersion怎麽用?Java PolicyElementDTO.setVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.wso2.balana.utils.policy.dto.PolicyElementDTO的用法示例。


在下文中一共展示了PolicyElementDTO.setVersion方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processPolicyEditorData

import org.wso2.balana.utils.policy.dto.PolicyElementDTO; //導入方法依賴的package包/類
public static void processPolicyEditorData(PolicyElementDTO policyElementDTO, String[] policyEditorData) {

        List<String> targetList = new ArrayList<String>();

        if (policyEditorData != null) {
            for (String data : policyEditorData) {
                if (data.contains("|")) {
                    String identifier = data.substring(0, data.indexOf("|"));
                    if (("policy").equals(identifier)) {
                        targetList.add(data.substring(data.indexOf("|") + 1));
                    }
                }
            }

            policyElementDTO.setPolicyName(targetList.get(0));
            policyElementDTO.setRuleCombiningAlgorithms(targetList.get(1));
            if (targetList.get(2) != null) {
                policyElementDTO.setPolicyDescription(targetList.get(2));
            }
            policyElementDTO.setVersion(targetList.get(3));
        }
    }
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:23,代碼來源:PolicyEditorUtil.java

示例2: createPolicy

import org.wso2.balana.utils.policy.dto.PolicyElementDTO; //導入方法依賴的package包/類
/**
 * Create XACML policy using the data received from basic policy wizard
 *
 * @param policyDTO PolicyDTO
 * @return String object of the XACML policy
 * @throws PolicyEditorException throws
 */
public String createPolicy(PolicyDTO policyDTO) throws PolicyEditorException {

    if (policyDTO == null) {
        throw new PolicyEditorException("Policy object can not be null");
    }

    PolicyElementDTO policyElementDTO = new PolicyElementDTO();
    policyElementDTO.setPolicyName(policyDTO.getPolicyId());
    policyElementDTO.setRuleCombiningAlgorithms(policyDTO.getRuleAlgorithm());
    policyElementDTO.setPolicyDescription(policyDTO.getDescription());
    policyElementDTO.setVersion(policyDTO.getVersion());

    if (policyDTO.getTargetDTO() != null) {
        TargetElementDTO targetElementDTO = PolicyEditorUtil.
                createTargetElementDTO(policyDTO.getTargetDTO());
        policyElementDTO.setTargetElementDTO(targetElementDTO);
    }

    if (policyDTO.getRuleDTOs() != null) {
        for (RuleDTO ruleDTO : policyDTO.getRuleDTOs()) {
            RuleElementDTO ruleElementDTO = PolicyEditorUtil.createRuleElementDTO(ruleDTO);
            policyElementDTO.addRuleElementDTO(ruleElementDTO);
        }
    }

    if (policyDTO.getObligationDTOs() != null) {
        List<ObligationElementDTO> obligationElementDTOs = PolicyEditorUtil.
                createObligation(policyDTO.getObligationDTOs());
        policyElementDTO.setObligationElementDTOs(obligationElementDTOs);
    }

    try {
        return PolicyBuilder.getInstance().build(policyElementDTO);
    } catch (PolicyBuilderException e) {
        throw new PolicyEditorException("Error while building XACML Policy");
    }
}
 
開發者ID:wso2,項目名稱:carbon-identity-framework,代碼行數:45,代碼來源:EntitlementPolicyCreator.java


注:本文中的org.wso2.balana.utils.policy.dto.PolicyElementDTO.setVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。