use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.
the class SetParentAction method getMessage.
@Override
protected String getMessage() {
ServerGeoObjectType childType = ServerGeoObjectType.get(this.getChildTypeCode());
String message = LocalizationFacade.getFromBundles("change.request.email.set.parent");
message = message.replaceAll("\\{0\\}", childType.getLabel().getValue(Session.getCurrentLocale()));
message = message.replaceAll("\\{1\\}", this.getChildCode());
return message;
}
use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.
the class RemoveChildAction method getMessage.
@Override
protected String getMessage() {
RegistryAdapter adapter = ServiceFactory.getAdapter();
MetadataCache cache = adapter.getMetadataCache();
ServerGeoObjectType parentType = ServerGeoObjectType.get(this.getParentTypeCode());
ServerGeoObjectType childType = ServerGeoObjectType.get(this.getChildTypeCode());
HierarchyType hierarchyType = cache.getHierachyType(this.getHierarchyTypeCode()).get();
String message = LocalizationFacade.getFromBundles("change.request.email.remove.child");
message = message.replaceAll("\\{0\\}", this.getChildId());
message = message.replaceAll("\\{1\\}", childType.getLabel().getValue(Session.getCurrentLocale()));
message = message.replaceAll("\\{2\\}", this.getParentId());
message = message.replaceAll("\\{3\\}", parentType.getLabel().getValue(Session.getCurrentLocale()));
message = message.replaceAll("\\{4\\}", hierarchyType.getLabel().getValue(Session.getCurrentLocale()));
return message;
}
use of net.geoprism.registry.model.ServerGeoObjectType 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.model.ServerGeoObjectType in project geoprism-registry by terraframe.
the class ETLService method submitImportErrorResolutionInTrans.
@Transaction
private void submitImportErrorResolutionInTrans(String sessionId, String json) {
JsonObject config = JsonParser.parseString(json).getAsJsonObject();
ImportHistory hist = ImportHistory.get(config.get("historyId").getAsString());
hist.getConfig().enforceExecutePermissions();
ImportError err = ImportError.get(config.get("importErrorId").getAsString());
String resolution = config.get("resolution").getAsString();
if (resolution.equals(ErrorResolution.APPLY_GEO_OBJECT.name())) {
String parentTreeNode = config.get("parentTreeNode").toString();
String geoObject = config.get("geoObject").toString();
Boolean isNew = config.get("isNew").getAsBoolean();
GeoObjectOverTime go = GeoObjectOverTime.fromJSON(ServiceFactory.getAdapter(), geoObject);
if (isNew) {
go.setUid(RegistryIdService.getInstance().next());
geoObject = go.toJSON().toString();
new ServerGeoObjectService().createGeoObject(sessionId, parentTreeNode, geoObject, null, null);
} else {
ServerGeoObjectService service = new ServerGeoObjectService();
ServerGeoObjectIF serverGO = service.apply(go, isNew, false);
final ServerGeoObjectType type = serverGO.getType();
ServerParentTreeNodeOverTime ptnOt = ServerParentTreeNodeOverTime.fromJSON(type, parentTreeNode);
serverGO.setParents(ptnOt);
}
err.appLock();
err.setResolution(resolution);
err.apply();
hist.appLock();
hist.setErrorResolvedCount(hist.getErrorResolvedCount() + 1);
hist.setImportedRecords(hist.getImportedRecords() + 1);
hist.apply();
} else if (resolution.equals(ErrorResolution.IGNORE.name())) {
err.appLock();
err.setResolution(resolution);
err.apply();
} else {
throw new UnsupportedOperationException("Invalid import resolution [" + resolution + "].");
}
}
use of net.geoprism.registry.model.ServerGeoObjectType in project geoprism-registry by terraframe.
the class FhirExportJob method toJson.
public JsonObject toJson() {
SimpleDateFormat format = new SimpleDateFormat(GeoObjectImportConfiguration.DATE_FORMAT);
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
final MasterListVersion version = this.getVersion();
final MasterList masterlist = version.getMasterlist();
final ServerGeoObjectType type = masterlist.getGeoObjectType();
final JobHistory history = this.getAllJobHistory().getAll().get(0);
final GeoprismUser user = GeoprismUser.get(this.getRunAsUser().getOid());
try {
final JsonObject object = new JsonObject();
object.addProperty(FhirExportJob.OID, this.getOid());
object.add(FhirExportJob.VERSION, this.getVersion().toJSON(false));
object.addProperty(FhirExportJob.IMPLEMENTATION, this.getImplementation());
object.addProperty(FhirExportJob.TYPE, type.getLabel().getValue());
object.addProperty(JobHistory.STATUS, history.getStatus().get(0).getDisplayLabel());
object.addProperty("date", format.format(version.getPublishDate()));
object.addProperty("author", user.getUsername());
object.addProperty("createDate", format.format(history.getCreateDate()));
object.addProperty("lastUpdateDate", format.format(history.getLastUpdateDate()));
object.addProperty("workProgress", history.getWorkProgress());
object.addProperty("workTotal", history.getWorkTotal());
object.addProperty("historyoryId", history.getOid());
if (history.getErrorJson() != null && history.getErrorJson().length() > 0) {
object.addProperty("message", history.getLocalizedError(Session.getCurrentLocale()));
}
return object;
} catch (JSONException e) {
throw new ProgrammingErrorException(e);
}
}
Aggregations