Search in sources :

Example 36 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class PageInternals method savePerformed.

private void savePerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(PageInternals.class.getName() + ".changeTime");
    XMLGregorianCalendar offset = model.getObject();
    if (offset != null) {
        clock.override(offset);
    }
    result.recordSuccess();
    showResult(result);
    target.add(getFeedbackPanel(), getMainForm());
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 37 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class ActionsExecutedInformation method recordObjectActionExecuted.

public synchronized void recordObjectActionExecuted(String objectName, String objectDisplayName, QName objectType, String objectOid, ChangeType changeType, String channel, Throwable exception) {
    XMLGregorianCalendar now = XmlTypeConverter.createXMLGregorianCalendar(new Date());
    ObjectActionExecuted action = new ObjectActionExecuted(objectName, objectDisplayName, objectType, objectOid, changeType, channel, exception, now);
    addEntry(allObjectActions, action);
    if (action.objectOid == null) {
        // hack for unsuccessful ADDs
        action.objectOid = "dummy-" + ((int) Math.random() * 10000000);
    }
    addAction(action);
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) Date(java.util.Date)

Example 38 with XMLGregorianCalendar

use of javax.xml.datatype.XMLGregorianCalendar in project midpoint by Evolveum.

the class ObjectValuePolicyEvaluator method getSortedHistoryList.

private List<PasswordHistoryEntryType> getSortedHistoryList(PrismContainer<PasswordHistoryEntryType> historyEntries, boolean ascending) {
    if (historyEntries == null || historyEntries.isEmpty()) {
        return new ArrayList<>();
    }
    List<PasswordHistoryEntryType> historyEntryValues = (List<PasswordHistoryEntryType>) historyEntries.getRealValues();
    Collections.sort(historyEntryValues, (o1, o2) -> {
        XMLGregorianCalendar changeTimestampFirst = o1.getChangeTimestamp();
        XMLGregorianCalendar changeTimestampSecond = o2.getChangeTimestamp();
        if (ascending) {
            return changeTimestampFirst.compare(changeTimestampSecond);
        } else {
            return changeTimestampSecond.compare(changeTimestampFirst);
        }
    });
    return historyEntryValues;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) PasswordHistoryEntryType(com.evolveum.midpoint.xml.ns._public.common.common_3.PasswordHistoryEntryType) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 39 with XMLGregorianCalendar

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

the class NotificationManagerImpl method createResetParams.

private String createResetParams(String userEmail) {
    XMLGregorianCalendar date = DateUtils.convertToXMLGregorianCalendarNoTimeZoneNoMillis(new Date());
    String resetParams = MessageFormat.format("email={0}&issueDate={1}", new Object[] { userEmail, date.toXMLFormat() });
    return resetParams;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) Date(java.util.Date)

Example 40 with XMLGregorianCalendar

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

the class DefaultPermissionChecker method performUserChecks.

private void performUserChecks(OAuth2Authentication oAuth2Authentication, ScopePathType requiredScope, OrcidMessage orcidMessage, String orcid) {
    ProfileEntity principal = (ProfileEntity) oAuth2Authentication.getPrincipal();
    String userOrcid = principal.getId();
    if (orcidMessage != null && orcidMessage.getOrcidProfile() != null && orcidMessage.getOrcidProfile().getOrcidIdentifier() != null && StringUtils.isNotBlank(orcid)) {
        String messageOrcid = orcidMessage.getOrcidProfile().getOrcidIdentifier().getPath();
        // the request is invalid
        if (!messageOrcid.equals(orcid)) {
            throw new IllegalArgumentException("The ORCID in the body and the URI do not match. Body ORCID: " + messageOrcid + " URI ORCID: " + orcid + " do NOT match.");
        }
    }
    // through
    if (userOrcid.equals(orcid)) {
        return;
    } else {
        if (profileDao.isProfileDeprecated(orcid)) {
            ProfileEntity entity = profileEntityCacheManager.retrieve(orcid);
            Map<String, String> params = new HashMap<String, String>();
            StringBuffer primary = new StringBuffer(baseUrl).append("/").append(entity.getPrimaryRecord().getId());
            params.put(OrcidDeprecatedException.ORCID, primary.toString());
            if (entity.getDeprecatedDate() != null) {
                XMLGregorianCalendar calendar = DateUtils.convertToXMLGregorianCalendar(entity.getDeprecatedDate());
                params.put(OrcidDeprecatedException.DEPRECATED_DATE, calendar.toString());
            }
            throw new OrcidDeprecatedException(params);
        }
    }
    throw new AccessControlException("You do not have the required permissions.");
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) HashMap(java.util.HashMap) OrcidDeprecatedException(org.orcid.core.exception.OrcidDeprecatedException) AccessControlException(java.security.AccessControlException) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

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