org.wso2.balana.utils.policy.dto.BasicPolicyDTO Java Examples

The following examples show how to use org.wso2.balana.utils.policy.dto.BasicPolicyDTO. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntitlementPolicyCreator.java    From carbon-identity-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Create XACML policy using the data received from basic policy wizard
 *
 * @param basicPolicyDTO BasicPolicyDTO
 * @return String object of the XACML policy
 * @throws PolicyEditorException throws
 */
public String createBasicPolicy(BasicPolicyDTO basicPolicyDTO) throws PolicyEditorException {

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

    try {
        return PolicyBuilder.getInstance().build(basicPolicyDTO);
    } catch (PolicyBuilderException e) {
        log.error(e);
        throw new PolicyEditorException("Error while building policy");
    }
}
 
Example #2
Source File: EntitlementPolicyCreator.java    From carbon-identity with Apache License 2.0 5 votes vote down vote up
/**
 * Create XACML policy using the data received from basic policy wizard
 *
 * @param basicPolicyDTO BasicPolicyDTO
 * @return String object of the XACML policy
 * @throws PolicyEditorException throws
 */
public String createBasicPolicy(BasicPolicyDTO basicPolicyDTO) throws PolicyEditorException {

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

    try {
        return PolicyBuilder.getInstance().build(basicPolicyDTO);
    } catch (PolicyBuilderException e) {
        log.error(e);
        throw new PolicyEditorException("Error while building policy");
    }
}
 
Example #3
Source File: PolicyEditorUtil.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
public static BasicPolicyDTO createBasicPolicyDTO(String[] policyEditorData) {

        BasicPolicyDTO basicPolicyDTO = new BasicPolicyDTO();
        int i = 0;

        if (policyEditorData[i] != null) {
            basicPolicyDTO.setPolicyId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setRuleAlgorithm(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setVersion(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setDescription(policyEditorData[i]);
        }
        i++;

        BasicTargetDTO basicTargetDTO = new BasicTargetDTO();

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnResources(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnSubjects(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnActions(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnEnvironment(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentDataType(policyEditorData[i]);
        }
        i++;

        basicPolicyDTO.setTargetDTO(basicTargetDTO);
        List<BasicRuleDTO> basicRuleDTOs = createBasicRuleDTOs(policyEditorData, i);
        if (basicRuleDTOs != null && basicRuleDTOs.size() > 0) {
            basicPolicyDTO.setBasicRuleDTOs(basicRuleDTOs);
        }

        return basicPolicyDTO;
    }
 
Example #4
Source File: PolicyEditorUtil.java    From carbon-identity-framework with Apache License 2.0 4 votes vote down vote up
public static BasicPolicyDTO createBasicPolicyDTO(String[] policyEditorData) {

        BasicPolicyDTO basicPolicyDTO = new BasicPolicyDTO();
        int i = 0;

        if (policyEditorData[i] != null) {
            basicPolicyDTO.setPolicyId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setRuleAlgorithm(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setVersion(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setDescription(policyEditorData[i]);
        }
        i++;

        BasicTargetDTO basicTargetDTO = new BasicTargetDTO();

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnResources(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnSubjects(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnActions(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnEnvironment(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentDataType(policyEditorData[i]);
        }
        i++;

        basicPolicyDTO.setTargetDTO(basicTargetDTO);
        List<BasicRuleDTO> basicRuleDTOs = createBasicRuleDTOs(policyEditorData, i);
        if (basicRuleDTOs != null && basicRuleDTOs.size() > 0) {
            basicPolicyDTO.setBasicRuleDTOs(basicRuleDTOs);
        }

        return basicPolicyDTO;
    }
 
Example #5
Source File: PolicyEditorUtil.java    From carbon-identity with Apache License 2.0 4 votes vote down vote up
public static BasicPolicyDTO createBasicPolicyDTO(String[] policyEditorData) {

        BasicPolicyDTO basicPolicyDTO = new BasicPolicyDTO();
        int i = 0;

        if (policyEditorData[i] != null) {
            basicPolicyDTO.setPolicyId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setRuleAlgorithm(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setVersion(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicPolicyDTO.setDescription(policyEditorData[i]);
        }
        i++;

        BasicTargetDTO basicTargetDTO = new BasicTargetDTO();

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnResources(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setResourceDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnSubjects(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setSubjectDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnActions(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setActionDataType(policyEditorData[i]);
        }
        i++;

        if (policyEditorData[i] != null) {
            basicTargetDTO.setFunctionOnEnvironment(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentList(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentId(policyEditorData[i]);
        }
        i++;
        if (policyEditorData[i] != null) {
            basicTargetDTO.setEnvironmentDataType(policyEditorData[i]);
        }
        i++;

        basicPolicyDTO.setTargetDTO(basicTargetDTO);
        List<BasicRuleDTO> basicRuleDTOs = createBasicRuleDTOs(policyEditorData, i);
        if (basicRuleDTOs != null && basicRuleDTOs.size() > 0) {
            basicPolicyDTO.setBasicRuleDTOs(basicRuleDTOs);
        }

        return basicPolicyDTO;
    }