Search in sources :

Example 11 with LocalizedValue

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;
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) DateFormat(java.text.DateFormat)

Example 12 with LocalizedValue

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;
}
Also used : Locale(java.util.Locale) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue)

Example 13 with 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);
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue)

Example 14 with LocalizedValue

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);
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue)

Example 15 with LocalizedValue

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);
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue)

Aggregations

LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)133 Request (com.runwaysdk.session.Request)54 Test (org.junit.Test)52 JsonObject (com.google.gson.JsonObject)27 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)22 TransitionEvent (net.geoprism.registry.graph.transition.TransitionEvent)17 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)16 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)16 Term (org.commongeoregistry.adapter.Term)15 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)15 Date (java.util.Date)13 Locale (java.util.Locale)13 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)13 AttributeTermType (org.commongeoregistry.adapter.metadata.AttributeTermType)13 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)11 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)11 HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)10 JsonArray (com.google.gson.JsonArray)9 Classification (net.geoprism.registry.model.Classification)9 VertexObject (com.runwaysdk.business.graph.VertexObject)7