use of org.commongeoregistry.adapter.constants.GeometryType in project geoprism-registry by terraframe.
the class ListType method listForType.
public static JsonObject listForType(String typeCode) {
ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
Organization org = type.getOrganization();
final boolean isMember = Organization.isMember(org);
ListTypeQuery query = new ListTypeQuery(new QueryFactory());
query.WHERE(query.getUniversal().EQ(type.getUniversal()));
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
final JsonArray lists = new JsonArray();
try (OIterator<? extends ListType> it = query.getIterator()) {
it.getAll().stream().sorted((a, b) -> {
return a.getDisplayLabel().getValue().compareTo(b.getDisplayLabel().getValue());
}).filter(f -> {
return true;
}).forEach(list -> {
// JsonObject object = new JsonObject();
// object.addProperty("label", list.getDisplayLabel().getValue());
// object.addProperty("oid", list.getOid());
// object.addProperty("createDate",
// format.format(list.getCreateDate()));
// object.addProperty("lasteUpdateDate",
// format.format(list.getLastUpdateDate()));
// object.addProperty("write", list.doesActorHaveWritePermission());
// object.addProperty("read", list.doesActorHaveReadPermission());
//
lists.add(list.toJSON());
});
}
JsonObject object = new JsonObject();
object.addProperty("orgCode", org.getCode());
object.addProperty("orgLabel", org.getDisplayLabel().getValue());
object.addProperty("typeCode", type.getCode());
object.addProperty("typeLabel", type.getLabel().getValue());
object.addProperty("geometryType", type.getGeometryType().name());
object.addProperty("write", doesActorHaveWritePermissions(type));
object.add("lists", lists);
return object;
}
use of org.commongeoregistry.adapter.constants.GeometryType in project geoprism-registry by terraframe.
the class XMLImporter method createServerGeoObjectType.
private ServerGeoObjectType createServerGeoObjectType(Organization organization, Element elem) {
String code = elem.getAttribute("code");
LocalizedValue label = this.getLabel(elem);
LocalizedValue description = this.getDescription(elem);
String visibility = elem.getAttribute("visibility");
GeometryType geometryType = this.getGeometryType(elem);
boolean isGeometryEditable = this.getIsGeometryEditable(elem);
boolean isAbstract = this.getIsGroup(elem) || (elem.getElementsByTagName("group-item").getLength() > 0);
GeoObjectType type = new GeoObjectType(code, geometryType, label, description, isGeometryEditable, organization.getCode(), adapter);
type.setIsPrivate(this.getIsPrivate(visibility));
type.setIsAbstract(isAbstract);
ServiceFactory.getGeoObjectTypePermissionService().enforceCanCreate(organization.getCode(), type.getIsPrivate());
return new ServerGeoObjectTypeConverter().create(type);
}
Aggregations