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; }
/** * Create a XACML string representing the Privacy Policy from a Java RequestPolicy * * @param privacyPolicy Privacy policy as a Java object * @return A string containing the XACML version the privacy policy */ public static String toXmlString( org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicy) { StringBuilder sb = new StringBuilder(); if (null != requestPolicy) { sb.append("<RequestPolicy>"); sb.append(RequestorUtils.toXmlString(requestPolicy.getRequestor())); sb.append(RequestItemUtils.toXmlString(requestPolicy.getRequestItems())); sb.append("</RequestPolicy>"); } return sb.toString(); }
public static RequestPolicy toRequestPolicy( org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicyBean, IIdentityManager identityManager) throws InvalidFormatException { if (null == requestPolicyBean) { return null; } return new RequestPolicy( RequestorUtils.toRequestor(requestPolicyBean.getRequestor(), identityManager), RequestItemUtils.toRequestItems(requestPolicyBean.getRequestItems())); }
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; }
public static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy toRequestPolicyBean(RequestPolicy requestPolicy) { if (null == requestPolicy) { return null; } org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicyBean = new org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy(); requestPolicyBean.setRequestor(RequestorUtils.toRequestorBean(requestPolicy.getRequestor())); requestPolicyBean.setRequestItems( RequestItemUtils.toRequestItemBeans(requestPolicy.getRequests())); return requestPolicyBean; }
/** * 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; }
public static boolean equal( org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy o1, Object o2) { // -- Verify reference equality if (o1 == o2) { return true; } if (o2 == null) { return false; } if (o1 == null) { return false; } if (o1.getClass() != o2.getClass()) { return false; } // -- Verify obj type org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy) o2; return ( /*PrivacyPolicyTypeConstantsUtils.equal(o1.getPrivacyPolicyType(), ro2.getPrivacyPolicyType()) && */ RequestItemUtils.equal(o1.getRequestItems(), ro2.getRequestItems()) && RequestorUtils.equal(o1.getRequestor(), ro2.getRequestor())); }