com.glookast.commons.templates.ArvatoEditMateMetadataSystem Maven / Gradle / Ivy
package com.glookast.commons.templates;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import javax.xml.bind.annotation.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
/**
* Java class for ArvatoEditMateMetadataSystem complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder(toBuilder = true)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ArvatoEditMateMetadataSystem", propOrder = {
"hostname",
"port",
"ssl",
"username",
"password",
"locatorTypeName",
"locatorNoteName",
"locatorColorName",
"restrictionTypeName",
"restrictionNoteName",
"restrictionColorName",
"metadataFieldsMap",
"isSinglePointMarkerName"
})
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, defaultImpl = ArvatoEditMateMetadataSystem.class)
public class ArvatoEditMateMetadataSystem
extends MetadataSystem {
@XmlElement(required = true)
protected String hostname;
@XmlSchemaType(name = "unsignedShort")
protected int port;
protected boolean ssl;
@XmlElement(required = true)
protected String username;
@XmlElement(required = true)
protected String password;
@XmlElement(required = true)
protected String locatorTypeName;
@XmlElement(required = true)
protected String locatorNoteName;
@XmlElement(required = true)
protected String locatorColorName;
@XmlElement(required = true)
protected String restrictionTypeName;
@XmlElement(required = true)
protected String restrictionNoteName;
@XmlElement(required = true)
protected String restrictionColorName;
protected Map metadataFieldsMap;
protected String isSinglePointMarkerName;
// DEFAULTS
public static final String LOCATOR_TYPE_NAME_DEFAULT = "V3_MarkerGroup";
public static final String LOCATOR_NOTE_NAME_DEFAULT = "V3_Note";
public static final String LOCATOR_COLOR_NAME_DEFAULT = "V3_Color";
public static final String RESTRICTION_TYPE_NAME_DEFAULT = "V3_RestrictionGroup";
public static final String RESTRICTION_NOTE_NAME_DEFAULT = "V3_Note";
public static final String RESTRICTION_COLOR_NAME_DEFAULT = "V3_Color";
public static final String IS_SINGLE_POINT_MARKER_NAME_DEFAULT = "V3_IsSinglePointerMarker";
public static Map parseMetadataFieldsMap(String json) {
if (json != null) {
ObjectMapper mapper = new ObjectMapper();
try {
Map parsedMap = mapper.reader().forType(HashMap.class).readValue(json);
// exclude empty keys
parsedMap.keySet().removeIf(String::isEmpty);
return parsedMap;
} catch (IOException ex) {
Logger.getLogger(ArvatoEditMateMetadataSystem.class.getName()).warning(ex.getMessage());
}
}
return new HashMap<>();
}
}