use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class LocalizedValueConverter method convert.
public static LocalizedValue convert(Date date) {
LocalizedValue dateValue = LocalizedValue.createEmptyLocalizedValue();
// Add the default locale
{
DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT, Locale.US);
formatter.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
dateValue.setValue(LocalizedValue.DEFAULT_LOCALE, formatter.format(date));
}
// Add the individual locales
LocalizationFacade.getInstalledLocales().forEach(locale -> {
DateFormat formatter = DateFormat.getDateInstance(DateFormat.SHORT, locale);
formatter.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
String format = formatter.format(date);
dateValue.setValue(locale, format);
});
return dateValue;
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class LocalizedValueConverter method convert.
public static LocalizedValue convert(Map<String, ?> map) {
LocalizedValue localizedValue = new LocalizedValue(coalesce(map));
localizedValue.setValue(MdAttributeLocalInfo.DEFAULT_LOCALE, map.get(MdAttributeLocalInfo.DEFAULT_LOCALE).toString());
Set<Locale> locales = LocalizationFacade.getInstalledLocales();
for (Locale locale : locales) {
String key = locale.toString().toLowerCase();
if (map.containsKey(key) && map.get(key) != null) {
localizedValue.setValue(locale, map.get(key).toString());
}
}
return localizedValue;
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class RegistryRoleConverter method buildAC_Role.
/**
* Returns the {@link RegistryRole} object for the given RC {@link Roles}.
*
* Precondition: assumes the roleName is a valid RC role
*
* @param role RunwaySDK role
*
* @return {@link RegistryRole}
*/
private RegistryRole buildAC_Role(Roles raRole) {
LocalizedValue localizedValue = LocalizedValueConverter.convert(raRole.getDisplayLabel());
String[] strArray = raRole.getRoleName().split("\\.");
String organizationCode = strArray[2];
String geoObjectTypeCode = strArray[3];
return RegistryRole.createAC(localizedValue, organizationCode, geoObjectTypeCode);
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class RegistryRoleConverter method buildRM_Role.
/**
* Returns the {@link RegistryRole} object for the given RM {@link Roles}.
*
* Precondition: assumes the roleName is a valid RM role
*
* @param role RunwaySDK role
*
* @return {@link RegistryRole}
*/
private RegistryRole buildRM_Role(Roles raRole) {
LocalizedValue localizedValue = LocalizedValueConverter.convert(raRole.getDisplayLabel());
String[] strArray = raRole.getRoleName().split("\\.");
String organizationCode = strArray[2];
String geoObjectTypeCode = strArray[3];
return RegistryRole.createRM(localizedValue, organizationCode, geoObjectTypeCode);
}
use of org.commongeoregistry.adapter.dataaccess.LocalizedValue in project geoprism-registry by terraframe.
the class RegistryRoleConverter method buildRC_Role.
/**
* Returns the {@link RegistryRole} object for the given RC {@link Roles}.
*
* Precondition: assumes the roleName is a valid RC role
*
* @param role RunwaySDK role
*
* @return {@link RegistryRole}
*/
private RegistryRole buildRC_Role(Roles raRole) {
LocalizedValue localizedValue = LocalizedValueConverter.convert(raRole.getDisplayLabel());
String[] strArray = raRole.getRoleName().split("\\.");
String organizationCode = strArray[2];
String geoObjectTypeCode = strArray[3];
return RegistryRole.createRC(localizedValue, organizationCode, geoObjectTypeCode);
}
Aggregations