@Override public ResourcePolicy createOrModifyPolicy( ResourcePolicy policy, Context context, String name, Group group, EPerson ePerson, Date embargoDate, int action, String reason, DSpaceObject dso) throws AuthorizeException, SQLException { int policyID = -1; if (policy != null) policyID = policy.getID(); // if an identical policy (same Action and same Group) is already in place modify it... ResourcePolicy policyTemp = findByTypeIdGroupAction(context, dso, group, action, policyID); if (policyTemp != null) { policy = policyTemp; policy.setRpType(ResourcePolicy.TYPE_CUSTOM); } if (policy == null) { policy = createResourcePolicy(context, dso, group, ePerson, action, ResourcePolicy.TYPE_CUSTOM); } policy.setGroup(group); policy.setEPerson(ePerson); if (embargoDate != null) { policy.setStartDate(embargoDate); } else { policy.setStartDate(null); policy.setEndDate(null); } policy.setRpName(name); policy.setRpDescription(reason); return policy; }
@Override public boolean isAnIdenticalPolicyAlreadyInPlace(Context c, DSpaceObject o, ResourcePolicy rp) throws SQLException { return isAnIdenticalPolicyAlreadyInPlace(c, o, rp.getGroup(), rp.getAction(), rp.getID()); }