Search in sources :

Example 1 with LocalStruct

use of com.runwaysdk.business.LocalStruct in project geoprism-registry by terraframe.

the class ListTypeVersion method parseMetadata.

private void parseMetadata(String prefix, JsonObject object) {
    if (object.has("visibility")) {
        this.setValue(prefix + "Visibility", object.get("visibility").getAsString());
    }
    if (object.has("master")) {
        this.setValue(prefix + "Master", object.get("master").getAsBoolean());
    }
    ((LocalStruct) this.getStruct(prefix + "Label")).setLocaleMap(LocalizedValue.fromJSON(object.get("label").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Description")).setLocaleMap(LocalizedValue.fromJSON(object.get("description").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Process")).setLocaleMap(LocalizedValue.fromJSON(object.get("process").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Progress")).setLocaleMap(LocalizedValue.fromJSON(object.get("progress").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "AccessConstraints")).setLocaleMap(LocalizedValue.fromJSON(object.get("accessConstraints").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "UseConstraints")).setLocaleMap(LocalizedValue.fromJSON(object.get("useConstraints").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Acknowledgements")).setLocaleMap(LocalizedValue.fromJSON(object.get("acknowledgements").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Disclaimer")).setLocaleMap(LocalizedValue.fromJSON(object.get("disclaimer").getAsJsonObject()).getLocaleMap());
    this.setValue(prefix + "ContactName", object.get("contactName").getAsString());
    this.setValue(prefix + "Organization", object.get("organization").getAsString());
    this.setValue(prefix + "TelephoneNumber", object.get("telephoneNumber").getAsString());
    this.setValue(prefix + "Email", object.get("email").getAsString());
    if (!object.get("originator").isJsonNull()) {
        this.setValue(prefix + "Originator", object.get("originator").getAsString());
    }
    if (!object.get("collectionDate").isJsonNull()) {
        SimpleDateFormat formatter = new SimpleDateFormat(Constants.DATETIME_FORMAT);
        Date collectionDate = GeoRegistryUtil.parseDate(object.get("collectionDate").getAsString());
        if (collectionDate != null) {
            this.setValue(prefix + "CollectionDate", formatter.format(collectionDate));
        }
    }
    if (prefix.equals("geospatial")) {
        this.setGeospatialTopicCategories(!object.get("topicCategories").isJsonNull() ? object.get("topicCategories").getAsString() : null);
        this.setGeospatialPlaceKeywords(!object.get("placeKeywords").isJsonNull() ? object.get("placeKeywords").getAsString() : null);
        this.setGeospatialUpdateFrequency(!object.get("updateFrequency").isJsonNull() ? object.get("updateFrequency").getAsString() : null);
        this.setGeospatialLineage(!object.get("lineage").isJsonNull() ? object.get("lineage").getAsString() : null);
        this.setGeospatialLanguages(!object.get("languages").isJsonNull() ? object.get("languages").getAsString() : null);
        this.setGeospatialScaleResolution(!object.get("scaleResolution").isJsonNull() ? object.get("scaleResolution").getAsString() : null);
        this.setGeospatialSpatialRepresentation(!object.get("spatialRepresentation").isJsonNull() ? object.get("spatialRepresentation").getAsString() : null);
        this.setGeospatialReferenceSystem(!object.get("referenceSystem").isJsonNull() ? object.get("referenceSystem").getAsString() : null);
        this.setGeospatialReportSpecification(!object.get("reportSpecification").isJsonNull() ? object.get("reportSpecification").getAsString() : null);
        this.setGeospatialDistributionFormat(!object.get("distributionFormat").isJsonNull() ? object.get("distributionFormat").getAsString() : null);
    }
}
Also used : LocalStruct(com.runwaysdk.business.LocalStruct) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 2 with LocalStruct

use of com.runwaysdk.business.LocalStruct in project geoprism-registry by terraframe.

the class ListType method parseMetadata.

private void parseMetadata(String prefix, JsonObject object) {
    ((LocalStruct) this.getStruct(prefix + "Label")).setLocaleMap(LocalizedValue.fromJSON(object.get("label").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Description")).setLocaleMap(LocalizedValue.fromJSON(object.get("description").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Process")).setLocaleMap(LocalizedValue.fromJSON(object.get("process").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Progress")).setLocaleMap(LocalizedValue.fromJSON(object.get("progress").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "AccessConstraints")).setLocaleMap(LocalizedValue.fromJSON(object.get("accessConstraints").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "UseConstraints")).setLocaleMap(LocalizedValue.fromJSON(object.get("useConstraints").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Acknowledgements")).setLocaleMap(LocalizedValue.fromJSON(object.get("acknowledgements").getAsJsonObject()).getLocaleMap());
    ((LocalStruct) this.getStruct(prefix + "Disclaimer")).setLocaleMap(LocalizedValue.fromJSON(object.get("disclaimer").getAsJsonObject()).getLocaleMap());
    this.setValue(prefix + "ContactName", object.get("contactName").getAsString());
    this.setValue(prefix + "Organization", object.get("organization").getAsString());
    this.setValue(prefix + "TelephoneNumber", object.get("telephoneNumber").getAsString());
    this.setValue(prefix + "Email", object.get("email").getAsString());
    if (!object.get("originator").isJsonNull()) {
        this.setValue(prefix + "Originator", object.get("originator").getAsString());
    }
    if (!object.get("collectionDate").isJsonNull()) {
        SimpleDateFormat formatter = new SimpleDateFormat(Constants.DATETIME_FORMAT);
        Date collectionDate = GeoRegistryUtil.parseDate(object.get("collectionDate").getAsString());
        if (collectionDate != null) {
            this.setValue(prefix + "CollectionDate", formatter.format(collectionDate));
        }
    }
    if (prefix.equals("geospatial")) {
        this.setGeospatialTopicCategories(!object.get("topicCategories").isJsonNull() ? object.get("topicCategories").getAsString() : null);
        this.setGeospatialPlaceKeywords(!object.get("placeKeywords").isJsonNull() ? object.get("placeKeywords").getAsString() : null);
        this.setGeospatialUpdateFrequency(!object.get("updateFrequency").isJsonNull() ? object.get("updateFrequency").getAsString() : null);
        this.setGeospatialLineage(!object.get("lineage").isJsonNull() ? object.get("lineage").getAsString() : null);
        this.setGeospatialLanguages(!object.get("languages").isJsonNull() ? object.get("languages").getAsString() : null);
        this.setGeospatialScaleResolution(!object.get("scaleResolution").isJsonNull() ? object.get("scaleResolution").getAsString() : null);
        this.setGeospatialSpatialRepresentation(!object.get("spatialRepresentation").isJsonNull() ? object.get("spatialRepresentation").getAsString() : null);
        this.setGeospatialReferenceSystem(!object.get("referenceSystem").isJsonNull() ? object.get("referenceSystem").getAsString() : null);
        this.setGeospatialReportSpecification(!object.get("reportSpecification").isJsonNull() ? object.get("reportSpecification").getAsString() : null);
        this.setGeospatialDistributionFormat(!object.get("distributionFormat").isJsonNull() ? object.get("distributionFormat").getAsString() : null);
    }
}
Also used : LocalStruct(com.runwaysdk.business.LocalStruct) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 3 with LocalStruct

use of com.runwaysdk.business.LocalStruct in project geoprism-registry by terraframe.

the class LocalizedValueConverter method populate.

public static void populate(MetadataDAO mdClass, String attributeName, LocalizedValue label) {
    AttributeLocal attributeLocal = (AttributeLocal) mdClass.getAttribute(attributeName);
    LocalStruct struct = (LocalStruct) BusinessFacade.get(attributeLocal.getStructDAO());
    populate(struct, label);
}
Also used : LocalStruct(com.runwaysdk.business.LocalStruct) AttributeLocal(com.runwaysdk.dataaccess.attributes.entity.AttributeLocal)

Aggregations

LocalStruct (com.runwaysdk.business.LocalStruct)3 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 AttributeLocal (com.runwaysdk.dataaccess.attributes.entity.AttributeLocal)1