Search in sources :

Example 46 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(ActivitiesContainer actContainerRc2) {
    Date latestAct = null;
    Collection<? extends Activity> activities = actContainerRc2.retrieveActivities();
    if (activities != null && !activities.isEmpty()) {
        Iterator<? extends Activity> activitiesIterator = activities.iterator();
        XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
        while (activitiesIterator.hasNext()) {
            Activity activity = activitiesIterator.next();
            if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
                latest = activity.getLastModifiedDate().getValue();
            }
        }
        actContainerRc2.setLastModifiedDate(new LastModifiedDate(latest));
        latestAct = latest.toGregorianCalendar().getTime();
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) GroupableActivity(org.orcid.jaxb.model.record_rc2.GroupableActivity) Activity(org.orcid.jaxb.model.record_rc2.Activity) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 47 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(Emails emails) {
    Date latestAct = null;
    if (emails != null && emails.getEmails() != null && !emails.getEmails().isEmpty()) {
        XMLGregorianCalendar latest = emails.getEmails().get(0).getLastModifiedDate().getValue();
        for (Email email : emails.getEmails()) {
            if (latest.compare(email.getLastModifiedDate().getValue()) == -1) {
                latest = email.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        emails.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Email(org.orcid.jaxb.model.record_rc2.Email) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 48 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(Addresses addresses) {
    Date latestAct = null;
    if (addresses != null && addresses.getAddress() != null && !addresses.getAddress().isEmpty()) {
        XMLGregorianCalendar latest = addresses.getAddress().get(0).getLastModifiedDate().getValue();
        for (Address address : addresses.getAddress()) {
            if (latest.compare(address.getLastModifiedDate().getValue()) == -1) {
                latest = address.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        addresses.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Address(org.orcid.jaxb.model.record_rc2.Address) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 49 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.

the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(ActivitiesContainer actContainerRc3) {
    Collection<? extends Activity> activities = actContainerRc3.retrieveActivities();
    if (activities != null && !activities.isEmpty()) {
        Iterator<? extends Activity> activitiesIterator = activities.iterator();
        XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
        while (activitiesIterator.hasNext()) {
            Activity activity = activitiesIterator.next();
            if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
                latest = activity.getLastModifiedDate().getValue();
            }
        }
        actContainerRc3.setLastModifiedDate(new LastModifiedDate(latest));
    }
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) Activity(org.orcid.jaxb.model.record_rc3.Activity) GroupableActivity(org.orcid.jaxb.model.record_rc3.GroupableActivity)

Example 50 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project opennms by OpenNMS.

the class PersistenceSerializationTest method setUp.

@Before
public void setUp() throws Exception {
    MockLogAppender.setupLogging();
    fa = new FileAnticipator();
    fsr = new MockForeignSourceRepository();
    fsr.save(new ForeignSource("cheese"));
    fsr.flush();
    fs = fsr.getForeignSource("cheese");
    //        fs.setScanInterval(scanInterval)
    XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar("2009-02-25T12:45:38.800-05:00");
    fs.setDateStamp(cal);
    List<PluginConfig> detectors = new ArrayList<PluginConfig>();
    final PluginConfig detector = new PluginConfig("food", "org.opennms.netmgt.provision.persist.detectors.FoodDetector");
    detector.addParameter("type", "cheese");
    detector.addParameter("density", "soft");
    detector.addParameter("sharpness", "mild");
    detectors.add(detector);
    fs.setDetectors(detectors);
    List<PluginConfig> policies = new ArrayList<PluginConfig>();
    PluginConfig policy = new PluginConfig("lower-case-node", "org.opennms.netmgt.provision.persist.policies.NodeCategoryPolicy");
    policy.addParameter("label", "~^[a-z]$");
    policy.addParameter("category", "Lower-Case-Nodes");
    policies.add(policy);
    policy = new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy");
    policies.add(policy);
    policy = new PluginConfig("10-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.MatchingInterfacePolicy");
    policy.addParameter("ipaddress", "~^10\\..*$");
    policies.add(policy);
    policy = new PluginConfig("cisco-snmp-interfaces", "org.opennms.netmgt.provision.persist.policies.MatchingSnmpInterfacePolicy");
    policy.addParameter("ifdescr", "~^(?i:LEC).*$");
    policies.add(policy);
    fs.setPolicies(policies);
    fsw = new ForeignSourceCollection();
    fsw.getForeignSources().addAll(fsr.getForeignSources());
    c = JAXBContext.newInstance(ForeignSourceCollection.class, ForeignSource.class);
    m = c.createMarshaller();
    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setIgnoreAttributeOrder(true);
    XMLUnit.setNormalize(true);
}
Also used : PluginConfig(org.opennms.netmgt.provision.persist.foreignsource.PluginConfig) ForeignSourceCollection(org.opennms.netmgt.provision.persist.foreignsource.ForeignSourceCollection) XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) ForeignSource(org.opennms.netmgt.provision.persist.foreignsource.ForeignSource) ArrayList(java.util.ArrayList) FileAnticipator(org.opennms.test.FileAnticipator) Before(org.junit.Before)

Aggregations

XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)336 Test (org.testng.annotations.Test)159 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)130 Task (com.evolveum.midpoint.task.api.Task)104 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)72 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)52 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)44 Date (java.util.Date)36 TestValidityRecomputeTask (com.evolveum.midpoint.model.intest.sync.TestValidityRecomputeTask)32 ArrayList (java.util.ArrayList)32 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)31 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)31 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)30 AbstractSynchronizationStoryTest (com.evolveum.midpoint.model.intest.sync.AbstractSynchronizationStoryTest)23 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)21 GregorianCalendar (java.util.GregorianCalendar)18 QName (javax.xml.namespace.QName)18 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)15 Duration (javax.xml.datatype.Duration)15 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)14