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());
}
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);
}
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;
}
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;
}
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.");
}
Aggregations