use of org.olat.user.propertyhandlers.DatePropertyHandler in project OpenOLAT by OpenOLAT.
the class UserVOFactory method post.
public static void post(User dbUser, UserVO user, Locale locale) {
UserManager um = UserManager.getInstance();
List<UserPropertyHandler> propertyHandlers = um.getUserPropertyHandlersFor(UserWebService.PROPERTY_HANDLER_IDENTIFIER, false);
dbUser.setProperty(UserConstants.FIRSTNAME, user.getFirstName());
dbUser.setProperty(UserConstants.LASTNAME, user.getLastName());
dbUser.setProperty(UserConstants.EMAIL, user.getEmail());
for (UserPropertyVO entry : user.getProperties()) {
for (UserPropertyHandler propertyHandler : propertyHandlers) {
if (entry.getName().equals(propertyHandler.getName())) {
String value = parseUserProperty(entry.getValue(), propertyHandler, locale);
String parsedValue;
if (propertyHandler instanceof DatePropertyHandler) {
parsedValue = formatDbDate(value, locale);
} else if (propertyHandler instanceof GenderPropertyHandler) {
parsedValue = parseGender(value, (GenderPropertyHandler) propertyHandler, locale);
} else {
parsedValue = propertyHandler.getStringValue(value, locale);
}
dbUser.setProperty(entry.getName(), parsedValue);
break;
}
}
}
}
use of org.olat.user.propertyhandlers.DatePropertyHandler in project OpenOLAT by OpenOLAT.
the class CertificatesManagerImpl method getPreviewIdentity.
private Identity getPreviewIdentity() {
TransientIdentity identity = new TransientIdentity();
identity.setName("username");
List<UserPropertyHandler> userPropertyHandlers = userManager.getAllUserPropertyHandlers();
for (UserPropertyHandler handler : userPropertyHandlers) {
if (handler instanceof DatePropertyHandler) {
identity.getUser().setProperty(handler.getName(), Formatter.formatDatetime(new Date()));
} else {
identity.getUser().setProperty(handler.getName(), handler.getName());
}
}
return identity;
}
use of org.olat.user.propertyhandlers.DatePropertyHandler in project openolat by klemens.
the class UserVOFactory method post.
public static void post(User dbUser, UserVO user, Locale locale) {
UserManager um = UserManager.getInstance();
List<UserPropertyHandler> propertyHandlers = um.getUserPropertyHandlersFor(UserWebService.PROPERTY_HANDLER_IDENTIFIER, false);
dbUser.setProperty(UserConstants.FIRSTNAME, user.getFirstName());
dbUser.setProperty(UserConstants.LASTNAME, user.getLastName());
dbUser.setProperty(UserConstants.EMAIL, user.getEmail());
for (UserPropertyVO entry : user.getProperties()) {
for (UserPropertyHandler propertyHandler : propertyHandlers) {
if (entry.getName().equals(propertyHandler.getName())) {
String value = parseUserProperty(entry.getValue(), propertyHandler, locale);
String parsedValue;
if (propertyHandler instanceof DatePropertyHandler) {
parsedValue = formatDbDate(value, locale);
} else if (propertyHandler instanceof GenderPropertyHandler) {
parsedValue = parseGender(value, (GenderPropertyHandler) propertyHandler, locale);
} else {
parsedValue = propertyHandler.getStringValue(value, locale);
}
dbUser.setProperty(entry.getName(), parsedValue);
break;
}
}
}
}
use of org.olat.user.propertyhandlers.DatePropertyHandler in project openolat by klemens.
the class CertificatesManagerImpl method getPreviewIdentity.
private Identity getPreviewIdentity() {
TransientIdentity identity = new TransientIdentity();
identity.setName("username");
List<UserPropertyHandler> userPropertyHandlers = userManager.getAllUserPropertyHandlers();
for (UserPropertyHandler handler : userPropertyHandlers) {
if (handler instanceof DatePropertyHandler) {
identity.getUser().setProperty(handler.getName(), Formatter.formatDatetime(new Date()));
} else {
identity.getUser().setProperty(handler.getName(), handler.getName());
}
}
return identity;
}
Aggregations