本文整理匯總了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));
}
}
示例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");
}
}