Search in sources :

Example 16 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class SpringExpresssionLanguageFilter method toMap.

@Override
public MapEx toMap() {
    final MapEx map = new LinkedHashMapEx();
    addTypeToMap(map, "queryFilter");
    map.put("query", this.query);
    return map;
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 17 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class MapGuideWebService method getResource.

public Resource getResource(final String operation, final String format, final Map<String, ? extends Object> parameters) throws Error {
    final MapEx newParameters = new LinkedHashMapEx(parameters);
    newParameters.put("VERSION", "1.0.0");
    newParameters.put("OPERATION", operation);
    newParameters.put("format", format);
    final UrlResource serviceUrl = getServiceUrl();
    final UrlResource mapAgentUrl = serviceUrl.newChildResource("mapagent/mapagent.fcgi");
    final UrlResource resource = mapAgentUrl.newUrlResource(newParameters);
    return resource;
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) UrlResource(com.revolsys.spring.resource.UrlResource) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Example 18 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class MapGuideWebService method getResources.

public Map<PathName, MapGuideResource> getResources(final String path) {
    final MapEx parameters = new LinkedHashMapEx();
    parameters.put("RESOURCEID", "Library:/" + path);
    parameters.put("COMPUTECHILDREN", "1");
    parameters.put("DEPTH", "-1");
    final MapEx response = getJsonResponse("ENUMERATERESOURCES", parameters);
    final MapEx resourceList = response.getValue("ResourceList");
    final List<MapEx> resourceFolders = resourceList.getValue("ResourceFolder");
    final Map<PathName, Folder> folderByPath = new HashMap<>();
    final Map<PathName, MapGuideResource> resourceByPath = new HashMap<>();
    for (final MapEx resourceDefinition : resourceFolders) {
        final Folder folder = new Folder(resourceDefinition);
        folder.setWebService(this);
        final PathName resourcePath = folder.getPath();
        folderByPath.put(resourcePath, folder);
        resourceByPath.put(resourcePath, folder);
        final PathName parentPath = resourcePath.getParent();
        if (parentPath != null) {
            final Folder parent = folderByPath.get(parentPath);
            parent.addResource(folder);
        }
    }
    final List<MapEx> resourceDocuments = resourceList.getValue("ResourceDocument");
    for (final MapEx resourceDefinition : resourceDocuments) {
        final List<String> resourceIdList = resourceDefinition.getValue("ResourceId");
        final String resourceId = resourceIdList.get(0);
        final String resourceType = resourceId.substring(resourceId.lastIndexOf(".") + 1);
        final Function<MapEx, ResourceDocument> factory = RESOURCE_DOCUMENT_FACTORIES.get(resourceType);
        if (factory != null) {
            final ResourceDocument resource = factory.apply(resourceDefinition);
            resource.setWebService(this);
            final PathName resourcePath = resource.getPath();
            resourceByPath.put(resourcePath, resource);
            final PathName parentPath = resourcePath.getParent();
            if (parentPath != null) {
                final Folder parent = folderByPath.get(parentPath);
                parent.addResource(resource);
            }
        } else {
            Logs.debug(this, "Unsupported resource type: " + resourceType);
        }
    }
    final Folder root = folderByPath.get(PathName.ROOT);
    if (root != null) {
        this.root = root;
    }
    return resourceByPath;
}
Also used : LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) MapEx(com.revolsys.collection.map.MapEx) HashMap(java.util.HashMap) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) PathName(com.revolsys.io.PathName)

Example 19 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class RecordDefinitionImpl method toMap.

@Override
public MapEx toMap() {
    final MapEx map = new LinkedHashMapEx();
    addTypeToMap(map, "recordDefinition");
    final String path = getPath();
    map.put("path", path);
    final ClockDirection polygonRingDirection = getPolygonRingDirection();
    addToMap(map, "polygonRingDirection", polygonRingDirection, null);
    final GeometryFactory geometryFactory = getGeometryFactory();
    addToMap(map, "geometryFactory", geometryFactory, null);
    final List<FieldDefinition> fields = getFields();
    addToMap(map, "fields", fields);
    return map;
}
Also used : GeometryFactory(com.revolsys.geometry.model.GeometryFactory) MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) ClockDirection(com.revolsys.geometry.model.ClockDirection)

Example 20 with MapEx

use of com.revolsys.collection.map.MapEx in project com.revolsys.open by revolsys.

the class FieldDefinition method toMap.

@Override
public MapEx toMap() {
    final MapEx map = new LinkedHashMapEx();
    addTypeToMap(map, "field");
    map.put("name", getName());
    map.put("title", getTitle());
    addToMap(map, "description", getDescription(), "");
    map.put("dataType", getDataType().getName());
    map.put("length", getLength());
    map.put("scale", getScale());
    map.put("required", isRequired());
    addToMap(map, "minValue", getMinValue(), null);
    addToMap(map, "maxValue", getMaxValue(), null);
    addToMap(map, "defaultValue", getDefaultValue(), null);
    addToMap(map, "allowedValues", getAllowedValues(), Collections.emptyMap());
    return map;
}
Also used : MapEx(com.revolsys.collection.map.MapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx) LinkedHashMapEx(com.revolsys.collection.map.LinkedHashMapEx)

Aggregations

MapEx (com.revolsys.collection.map.MapEx)144 LinkedHashMapEx (com.revolsys.collection.map.LinkedHashMapEx)48 ArrayList (java.util.ArrayList)17 Resource (com.revolsys.spring.resource.Resource)9 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)7 Map (java.util.Map)7 HashMap (java.util.HashMap)6 PathName (com.revolsys.io.PathName)5 UrlResource (com.revolsys.spring.resource.UrlResource)5 DataType (com.revolsys.datatype.DataType)4 FieldDefinition (com.revolsys.record.schema.FieldDefinition)4 PathResource (com.revolsys.spring.resource.PathResource)4 Color (java.awt.Color)4 LinkedHashMap (java.util.LinkedHashMap)4 List (java.util.List)4 TreeMap (java.util.TreeMap)4 NamedLinkedHashMapEx (com.revolsys.collection.map.NamedLinkedHashMapEx)3 Geometry (com.revolsys.geometry.model.Geometry)3 LineString (com.revolsys.geometry.model.LineString)3 Record (com.revolsys.record.Record)3