Output policy data to METSRIGHTS only if a policy is effect (by date)

Test cases
1. No date present
2. Start date and end date present
3. Start date only present
4. End date only present
This commit is contained in:
Terry Brady
2013-10-01 10:12:52 -04:00
parent 1b1cdd0b7e
commit e3653224ac

View File

@@ -158,6 +158,24 @@ public class METSRightsCrosswalk
//For each DSpace policy
for(ResourcePolicy policy : policies)
{
// As of DSpace 3.0, policies may have an effective date range, check if a policy is effective
Date now = new Date();
if (policy.getStartDate() != null)
{
if (policy.getStartDate().after(now))
{
continue;
}
}
if (policy.getEndDate() != null)
{
if (policy.getEndDate().before(now))
{
continue;
}
}
// DSpace Policies can either reference a Group or an Individual, but not both!
Group group = policy.getGroup();
EPerson person = policy.getEPerson();