use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListCurationJob method startInTrans.
@Transaction
private JobHistoryRecord startInTrans(ListTypeVersion version) {
final ListType listType = version.getListType();
final ServerGeoObjectType type = listType.getGeoObjectType();
final Organization org = listType.getOrganization();
RolePermissionService perms = ServiceFactory.getRolePermissionService();
if (perms.isRA()) {
perms.enforceRA(org.getCode());
} else if (perms.isRM()) {
perms.enforceRM(org.getCode(), type);
} else {
perms.enforceRM();
}
ListCurationHistory history = (ListCurationHistory) this.createNewHistory();
history.appLock();
history.setVersion(version);
history.apply();
JobHistoryRecord record = new JobHistoryRecord(this, history);
record.apply();
return record;
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class CurationService method curate.
@Request(RequestType.SESSION)
public JsonObject curate(String sessionId, String listTypeVersionId) {
final ListTypeVersion version = ListTypeVersion.get(listTypeVersionId);
final ListType listType = version.getListType();
final ServerGeoObjectType serverGOT = listType.getGeoObjectType();
final String orgCode = listType.getOrganization().getCode();
this.checkPermissions(orgCode, serverGOT);
ListCurationJob job = new ListCurationJob();
job.setRunAsUserId(Session.getCurrentSession().getUser().getOid());
job.apply();
ListCurationHistory history = job.start(version);
return this.serializeHistory(history, GeoprismUser.get(job.getRunAsUser().getOid()), job);
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class MCSDFhirDataPopulator method configure.
@Override
public void configure(FhirConnection context, ListTypeVersion version, boolean resolveIds) {
super.configure(context, version, resolveIds);
ListType list = version.getListType();
JsonArray hierarchies = list.getHierarchiesAsJson();
for (int i = 0; i < hierarchies.size(); i++) {
JsonObject hierarchy = hierarchies.get(i).getAsJsonObject();
String hCode = hierarchy.get("code").getAsString();
List<String> pCodes = list.getParentCodes(hierarchy);
if (pCodes.size() > 0) {
this.hierarchies.add(ServerHierarchyType.get(hCode));
}
}
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeService method record.
@Request(RequestType.SESSION)
public JsonObject record(String sessionId, String oid, String uid) {
ListTypeVersion version = ListTypeVersion.get(oid);
if (version.getWorking()) {
ListType type = version.getListType();
if (type.doesActorHaveExploratoryPermission()) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
ServerGeoObjectType geoObjectType = type.getGeoObjectType();
ServerGeoObjectIF geoObject = new ServerGeoObjectService().getGeoObject(uid, geoObjectType.getCode());
JsonObject object = new JsonObject();
object.addProperty("recordType", "GEO_OBJECT");
object.add("type", geoObject.getType().toJSON(new DefaultSerializer()));
object.addProperty("code", geoObject.getCode());
object.addProperty(ListTypeVersion.FORDATE, format.format(version.getForDate()));
// Add geometry so we can zoom to it
object.add("geoObject", geoObject.toGeoObject(version.getForDate()).toJSON());
return object;
}
}
return version.record(uid);
}
use of net.geoprism.registry.ListType in project geoprism-registry by terraframe.
the class ListTypeService method apply.
@Request(RequestType.SESSION)
public JsonObject apply(String sessionId, JsonObject list) {
ListType mList = ListType.apply(list);
((Session) Session.getCurrentSession()).reloadPermissions();
// Auto publish the working versions of the lists
List<ListTypeVersion> versions = mList.getVersions();
for (ListTypeVersion version : versions) {
if (version.getWorking()) {
this.publishVersion(sessionId, version.getOid());
}
}
return mList.toJSON();
}
Aggregations