public static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy createList( RequestorBean requestor, org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem... requestItems) { org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicy = new org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy(); requestPolicy.setPrivacyPolicyType(PrivacyPolicyTypeConstants.OTHER); requestPolicy.setRequestor(requestor); requestPolicy.setRequestItems(Arrays.asList(requestItems)); return requestPolicy; }
public static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy create( PrivacyPolicyTypeConstants privacyPolicyType, RequestorBean requestor, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem> requestItems) { org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicy = new org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy(); requestPolicy.setPrivacyPolicyType(privacyPolicyType); requestPolicy.setRequestor(requestor); requestPolicy.setRequestItems(requestItems); return requestPolicy; }
/** * Generic function to help a developer or a user to create a privacy policy by inferring a * default one using information about the CIS or the 3P service. The privacy policy in result * will be slightly completed but still need to be filled. E.g. if a CIS membership criteria * engine requires access to geolocation data, the inference engine will add geolocation data line * to the privacy policy. * * @param privacyPolicyType Type of the privacy policy: for a CIS or a 3P service * @param configuration Configuration of the CIS or the 3P service * @return A slightly completed privacy policy */ @SuppressWarnings("rawtypes") public static RequestPolicy inferPrivacyPolicy( PrivacyPolicyTypeConstants privacyPolicyType, Map configuration) throws PrivacyException { RequestPolicy privacyPolicy = new RequestPolicy(); List<RequestItem> requestItems = new ArrayList<RequestItem>(); // ---- Add privacy policy type privacyPolicy.setPrivacyPolicyType(privacyPolicyType); // ---- Add configured request items if (configuration.containsKey("requestItems")) { requestItems.addAll((List<RequestItem>) configuration.get("requestItems")); } // ---- Add common request items // // --- Prepare common data // PrivacyPolicyBehaviourConstants globalBaheviour = PrivacyPolicyBehaviourConstants.PRIVATE; // if (configuration.containsKey("globalBehaviour")) { // globalBaheviour = (PrivacyPolicyBehaviourConstants) configuration.get("globalBehaviour"); // } // // -- Actions: read // List<Action> actions = ActionUtils.createList(ActionConstants.READ, ActionConstants.CREATE); // // -- Conditions // List<Condition> conditions = new ArrayList<Condition>(); // // - Common // conditions.add(ConditionUtils.create(ConditionConstants.STORE_IN_SECURE_STORAGE, "Yes")); // // - Visibility // // Public // if (PrivacyPolicyBehaviourConstants.PUBLIC.name().equals(globalBaheviour.name())) { // conditions.add(ConditionUtils.createPublic()); // } // // Members only // else if (PrivacyPolicyBehaviourConstants.MEMBERS_ONLY.name().equals(globalBaheviour.name())) // { // conditions.add(ConditionUtils.createMembersOnly()); // } // // Private // else { // conditions.add(ConditionUtils.createPrivate()); // } privacyPolicy.setRequestItems(requestItems); return privacyPolicy; }