Search in sources :

Example 1 with I18NProcedureMetadata

use of org.n52.iceland.i18n.metadata.I18NProcedureMetadata in project arctic-sea by 52North.

the class I18NJsonEncoder method decodeI18NMetadata.

public AbstractI18NMetadata decodeI18NMetadata(JsonNode s) throws JSONException {
    String type = s.path(TYPE).asText();
    String id = s.path(ID).asText();
    final AbstractI18NMetadata i18n;
    if (type.equals(TYPE_FEATURE)) {
        i18n = new I18NFeatureMetadata(id);
    } else if (type.equals(TYPE_OBSERVABLE_PROPERTY)) {
        i18n = new I18NObservablePropertyMetadata(id);
    } else if (type.equals(TYPE_OFFERING)) {
        i18n = new I18NOfferingMetadata(id);
    } else if (type.equals(TYPE_PROCEDURE)) {
        I18NProcedureMetadata pi18n = new I18NProcedureMetadata(id);
        decodeMultilingualString(s.path(LONG_NAME), pi18n.getLongName());
        decodeMultilingualString(s.path(SHORT_NAME), pi18n.getShortName());
        i18n = pi18n;
    } else {
        throw new JSONException("Unknown type: " + type);
    }
    decodeMultilingualString(s.path(NAME), i18n.getName());
    decodeMultilingualString(s.path(DESCRIPTION), i18n.getDescription());
    return i18n;
}
Also used : AbstractI18NMetadata(org.n52.iceland.i18n.metadata.AbstractI18NMetadata) I18NFeatureMetadata(org.n52.iceland.i18n.metadata.I18NFeatureMetadata) I18NOfferingMetadata(org.n52.iceland.i18n.metadata.I18NOfferingMetadata) JSONException(org.n52.iceland.exception.JSONException) MultilingualString(org.n52.janmayen.i18n.MultilingualString) LocalizedString(org.n52.janmayen.i18n.LocalizedString) I18NObservablePropertyMetadata(org.n52.iceland.i18n.metadata.I18NObservablePropertyMetadata) I18NProcedureMetadata(org.n52.iceland.i18n.metadata.I18NProcedureMetadata)

Aggregations

JSONException (org.n52.iceland.exception.JSONException)1 AbstractI18NMetadata (org.n52.iceland.i18n.metadata.AbstractI18NMetadata)1 I18NFeatureMetadata (org.n52.iceland.i18n.metadata.I18NFeatureMetadata)1 I18NObservablePropertyMetadata (org.n52.iceland.i18n.metadata.I18NObservablePropertyMetadata)1 I18NOfferingMetadata (org.n52.iceland.i18n.metadata.I18NOfferingMetadata)1 I18NProcedureMetadata (org.n52.iceland.i18n.metadata.I18NProcedureMetadata)1 LocalizedString (org.n52.janmayen.i18n.LocalizedString)1 MultilingualString (org.n52.janmayen.i18n.MultilingualString)1