use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class ArcGisRestCatalog method toMap.
@Override
public MapEx toMap() {
final MapEx map = newTypeMap(J_TYPE);
final String name = getName();
addToMap(map, "name", name);
map.put("serviceUrl", getServiceUrl());
addToMap(map, "username", this.username, "");
addToMap(map, "password", PasswordUtil.encrypt(this.password), "");
return map;
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class ArcGisRestCatalog method initialize.
@Override
protected void initialize(final MapEx properties) {
final List<CatalogElement> children = new ArrayList<>();
final Map<String, CatalogElement> childByName = new HashMap<>();
final List<String> folderNames = properties.getValue("folders", Collections.emptyList());
for (final String folderPath : folderNames) {
final String folderName = PathName.newPathName(folderPath).getName();
final ArcGisRestCatalog folder = new ArcGisRestCatalog(this, folderName);
children.add(folder);
final String childKey = folderName.toLowerCase();
childByName.put(childKey, folder);
}
final List<MapEx> serviceDescriptions = properties.getValue("services", Collections.emptyList());
for (final MapEx serviceDescription : serviceDescriptions) {
final String serviceContainerPath = serviceDescription.getString("name");
final String serviceType = serviceDescription.getString("type");
final String serviceContainerName = PathName.newPathName(serviceContainerPath).getName();
try {
final String childKey = serviceContainerName.toLowerCase();
ArcGisRestServiceContainer container = (ArcGisRestServiceContainer) childByName.get(childKey);
if (container == null) {
container = new ArcGisRestServiceContainer(this, serviceContainerName);
childByName.put(childKey, container);
children.add(container);
}
ArcGisRestService service;
final Function<ArcGisRestServiceContainer, ArcGisRestService> serviceFactory = SERVICE_FACTORY_BY_TYPE.get(serviceType);
if (serviceFactory == null) {
service = new ArcGisRestService(container, serviceType);
} else {
service = serviceFactory.apply(container);
}
container.addService(service);
} catch (final Throwable e) {
Logs.error(this, "Unable to get service: " + getServiceUrl() + "/" + serviceContainerPath, e);
}
}
this.childByName = Collections.unmodifiableMap(childByName);
this.children = Collections.unmodifiableList(children);
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class AnnotationLayer method initialize.
@Override
protected void initialize(final MapEx properties) {
super.initialize(properties);
final ArcGisRestAbstractLayerService service = getService();
final Map<String, LayerDescription> layersByName = new TreeMap<>();
final List<MapEx> layerDefinitions = properties.getValue("subLayers", Collections.emptyList());
for (final MapEx layerProperties : layerDefinitions) {
service.addLayer(this, layersByName, layerProperties);
}
this.layers = Lists.toArray(layersByName.values());
this.layersByName = layersByName;
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class ArcGisRestAbstractLayerService method initChildren.
protected void initChildren(final MapEx properties, final List<CatalogElement> children, final Map<String, LayerDescription> rootLayersByName) {
final Map<String, GroupLayer> groups = new TreeMap<>();
final Map<String, LayerDescription> layers = new TreeMap<>();
final List<MapEx> layerDefinitions = properties.getValue("layers", Collections.emptyList());
for (final MapEx layerProperties : layerDefinitions) {
final Integer parentLayerId = layerProperties.getInteger("parentLayerId");
if (parentLayerId == null || parentLayerId == -1) {
final LayerDescription layer = addLayer(this, rootLayersByName, layerProperties);
if (layer != null) {
final String layerName = layer.getName();
if (layer instanceof GroupLayer) {
final GroupLayer group = (GroupLayer) layer;
groups.put(layerName, group);
} else {
layers.put(layerName, layer);
}
}
}
}
final List<MapEx> tableDefinitions = properties.getValue("tables", Collections.emptyList());
for (final MapEx layerProperties : tableDefinitions) {
final LayerDescription layer = addLayer(this, rootLayersByName, layerProperties);
if (layer != null) {
final String layerName = layer.getName();
layers.put(layerName, layer);
}
}
children.addAll(groups.values());
children.addAll(layers.values());
}
use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.
the class FeatureLayer method setCodeTable.
@SuppressWarnings("unchecked")
private void setCodeTable(final FieldDefinition fieldDefinition, final MapEx field) {
final MapEx domain = (MapEx) field.get("domain");
if (domain != null) {
final String domainType = domain.getString("type");
final String domainName = domain.getString("name");
final List<MapEx> codedValues = (List<MapEx>) domain.get("codedValues");
if ("codedValue".equals(domainType) && Property.hasValuesAll(domainName, codedValues)) {
final SimpleCodeTable codeTable = new SimpleCodeTable(domainName);
for (final MapEx codedValue : codedValues) {
final String code = codedValue.getString("code");
final String description = codedValue.getString("name");
codeTable.addValue(code, description);
}
fieldDefinition.setCodeTable(codeTable);
}
}
}
Aggregations