@Test public void testInferCisPrivacyPolicy() { String testTitle = "InferCisPrivacyPolicy: create a pre-privacy policy"; LOG.info(testTitle); RequestPolicy privacyPolicyPrivate = null; RequestPolicy privacyPolicyMembersOnly = null; RequestPolicy privacyPolicyPublic = null; try { privacyPolicyPrivate = PrivacyPolicyUtils.inferCisPrivacyPolicy(PrivacyPolicyBehaviourConstants.PRIVATE, null); privacyPolicyMembersOnly = PrivacyPolicyUtils.inferCisPrivacyPolicy(PrivacyPolicyBehaviourConstants.MEMBERS_ONLY, null); privacyPolicyPublic = PrivacyPolicyUtils.inferCisPrivacyPolicy(PrivacyPolicyBehaviourConstants.PUBLIC, null); } catch (PrivacyException e) { LOG.error("[Test Exception] "+testTitle, e); fail("Error "+e.getMessage()+": "+testTitle); } assertNotNull("Private privacy policy should not be null", privacyPolicyPrivate); assertNotNull("Members only privacy policy should not be null", privacyPolicyMembersOnly); assertNotNull("Public privacy policy should not be null", privacyPolicyPublic); }
public static RequestPolicy inferCisPrivacyPolicy( PrivacyPolicyBehaviourConstants globalBehaviour, MembershipCrit membershipCriteria, Map<String, String> configuration) throws PrivacyException { List<Action> actions = ActionUtils.createList(ActionConstants.READ, ActionConstants.CREATE); List<Condition> conditions = new ArrayList<Condition>(); conditions.add(ConditionUtils.create(ConditionConstants.STORE_IN_SECURE_STORAGE, "1")); if (PrivacyPolicyBehaviourConstants.PUBLIC.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createPublic()); } else if (PrivacyPolicyBehaviourConstants.MEMBERS_ONLY.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createMembersOnly()); } else { conditions.add(ConditionUtils.createPrivate()); } List<RequestItem> requestItems = new ArrayList<RequestItem>(); boolean optional = false; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CIS, CisAttributeTypes.MEMBER_LIST); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAssociationTypes.HAS_MEMBERS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_SYMBOLIC); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } optional = true; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.INTERESTS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.EMAIL); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.OCCUPATION); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LANGUAGES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, "caci_model"); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("globalBehaviour", globalBehaviour); parameters.put("membershipCriteria", membershipCriteria); parameters.put("requestItems", requestItems); if (null != configuration) { parameters.putAll(configuration); } return inferPrivacyPolicy(PrivacyPolicyTypeConstants.CIS, parameters); }
PrivacyPolicyUtils { public static RequestPolicy inferCisPrivacyPolicy( PrivacyPolicyBehaviourConstants globalBehaviour, MembershipCrit membershipCriteria, Map<String, String> configuration) throws PrivacyException { List<Action> actions = ActionUtils.createList(ActionConstants.READ, ActionConstants.CREATE); List<Condition> conditions = new ArrayList<Condition>(); conditions.add(ConditionUtils.create(ConditionConstants.STORE_IN_SECURE_STORAGE, "1")); if (PrivacyPolicyBehaviourConstants.PUBLIC.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createPublic()); } else if (PrivacyPolicyBehaviourConstants.MEMBERS_ONLY.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createMembersOnly()); } else { conditions.add(ConditionUtils.createPrivate()); } List<RequestItem> requestItems = new ArrayList<RequestItem>(); boolean optional = false; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CIS, CisAttributeTypes.MEMBER_LIST); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAssociationTypes.HAS_MEMBERS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_SYMBOLIC); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } optional = true; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.INTERESTS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.EMAIL); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.OCCUPATION); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LANGUAGES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, "caci_model"); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("globalBehaviour", globalBehaviour); parameters.put("membershipCriteria", membershipCriteria); parameters.put("requestItems", requestItems); if (null != configuration) { parameters.putAll(configuration); } return inferPrivacyPolicy(PrivacyPolicyTypeConstants.CIS, parameters); } }
PrivacyPolicyUtils { public static RequestPolicy inferCisPrivacyPolicy( PrivacyPolicyBehaviourConstants globalBehaviour, MembershipCrit membershipCriteria, Map<String, String> configuration) throws PrivacyException { List<Action> actions = ActionUtils.createList(ActionConstants.READ, ActionConstants.CREATE); List<Condition> conditions = new ArrayList<Condition>(); conditions.add(ConditionUtils.create(ConditionConstants.STORE_IN_SECURE_STORAGE, "1")); if (PrivacyPolicyBehaviourConstants.PUBLIC.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createPublic()); } else if (PrivacyPolicyBehaviourConstants.MEMBERS_ONLY.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createMembersOnly()); } else { conditions.add(ConditionUtils.createPrivate()); } List<RequestItem> requestItems = new ArrayList<RequestItem>(); boolean optional = false; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CIS, CisAttributeTypes.MEMBER_LIST); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAssociationTypes.HAS_MEMBERS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_SYMBOLIC); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } optional = true; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.INTERESTS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.EMAIL); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.OCCUPATION); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LANGUAGES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, "caci_model"); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("globalBehaviour", globalBehaviour); parameters.put("membershipCriteria", membershipCriteria); parameters.put("requestItems", requestItems); if (null != configuration) { parameters.putAll(configuration); } return inferPrivacyPolicy(PrivacyPolicyTypeConstants.CIS, parameters); }  }
PrivacyPolicyUtils { public static RequestPolicy inferCisPrivacyPolicy( PrivacyPolicyBehaviourConstants globalBehaviour, MembershipCrit membershipCriteria, Map<String, String> configuration) throws PrivacyException { List<Action> actions = ActionUtils.createList(ActionConstants.READ, ActionConstants.CREATE); List<Condition> conditions = new ArrayList<Condition>(); conditions.add(ConditionUtils.create(ConditionConstants.STORE_IN_SECURE_STORAGE, "1")); if (PrivacyPolicyBehaviourConstants.PUBLIC.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createPublic()); } else if (PrivacyPolicyBehaviourConstants.MEMBERS_ONLY.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createMembersOnly()); } else { conditions.add(ConditionUtils.createPrivate()); } List<RequestItem> requestItems = new ArrayList<RequestItem>(); boolean optional = false; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CIS, CisAttributeTypes.MEMBER_LIST); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAssociationTypes.HAS_MEMBERS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_SYMBOLIC); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } optional = true; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.INTERESTS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.EMAIL); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.OCCUPATION); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LANGUAGES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, "caci_model"); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("globalBehaviour", globalBehaviour); parameters.put("membershipCriteria", membershipCriteria); parameters.put("requestItems", requestItems); if (null != configuration) { parameters.putAll(configuration); } return inferPrivacyPolicy(PrivacyPolicyTypeConstants.CIS, parameters); }  static RequestPolicy inferPrivacyPolicy(PrivacyPolicyTypeConstants privacyPolicyType, Map configuration); static RequestPolicy inferCisPrivacyPolicy(
			PrivacyPolicyBehaviourConstants globalBehaviour,
			MembershipCrit membershipCriteria,
			Map<String, String> configuration); static RequestPolicy inferCisPrivacyPolicy(
			PrivacyPolicyBehaviourConstants globalBehaviour,
			MembershipCrit membershipCriteria); static RequestPolicy infer3pServicePrivacyPolicy(
			Map<String, String> configuration); static List<String> getDataTypes(RequestPolicy privacyPolicy); static List<String> getDataTypes(DataIdentifierScheme schemeFilter, RequestPolicy privacyPolicy); static String toXacmlString(RequestPolicy privacyPolicy); @Deprecated static String toXmlString(RequestPolicy privacyPolicy); static RequestPolicy fromXacmlString(String xmlPrivacyPolicy); }
PrivacyPolicyUtils { public static RequestPolicy inferCisPrivacyPolicy( PrivacyPolicyBehaviourConstants globalBehaviour, MembershipCrit membershipCriteria, Map<String, String> configuration) throws PrivacyException { List<Action> actions = ActionUtils.createList(ActionConstants.READ, ActionConstants.CREATE); List<Condition> conditions = new ArrayList<Condition>(); conditions.add(ConditionUtils.create(ConditionConstants.STORE_IN_SECURE_STORAGE, "1")); if (PrivacyPolicyBehaviourConstants.PUBLIC.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createPublic()); } else if (PrivacyPolicyBehaviourConstants.MEMBERS_ONLY.name().equals(globalBehaviour.name())) { conditions.add(ConditionUtils.createMembersOnly()); } else { conditions.add(ConditionUtils.createPrivate()); } List<RequestItem> requestItems = new ArrayList<RequestItem>(); boolean optional = false; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CIS, CisAttributeTypes.MEMBER_LIST); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAssociationTypes.HAS_MEMBERS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_SYMBOLIC); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } optional = true; { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.INTERESTS); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.EMAIL); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.OCCUPATION); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LANGUAGES); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } { Resource resource = ResourceUtils.create(DataIdentifierScheme.CONTEXT, "caci_model"); RequestItem requestItem = RequestItemUtils.create(resource, actions, conditions, optional); requestItems.add(requestItem); } Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("globalBehaviour", globalBehaviour); parameters.put("membershipCriteria", membershipCriteria); parameters.put("requestItems", requestItems); if (null != configuration) { parameters.putAll(configuration); } return inferPrivacyPolicy(PrivacyPolicyTypeConstants.CIS, parameters); }  static RequestPolicy inferPrivacyPolicy(PrivacyPolicyTypeConstants privacyPolicyType, Map configuration); static RequestPolicy inferCisPrivacyPolicy(
			PrivacyPolicyBehaviourConstants globalBehaviour,
			MembershipCrit membershipCriteria,
			Map<String, String> configuration); static RequestPolicy inferCisPrivacyPolicy(
			PrivacyPolicyBehaviourConstants globalBehaviour,
			MembershipCrit membershipCriteria); static RequestPolicy infer3pServicePrivacyPolicy(
			Map<String, String> configuration); static List<String> getDataTypes(RequestPolicy privacyPolicy); static List<String> getDataTypes(DataIdentifierScheme schemeFilter, RequestPolicy privacyPolicy); static String toXacmlString(RequestPolicy privacyPolicy); @Deprecated static String toXmlString(RequestPolicy privacyPolicy); static RequestPolicy fromXacmlString(String xmlPrivacyPolicy);  }