use of net.geoprism.registry.MasterList 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);
}
}
use of net.geoprism.registry.MasterList in project geoprism-registry by terraframe.
the class PublishMasterListJob method toJson.
public JsonObject toJson() {
SimpleDateFormat format = new SimpleDateFormat(GeoObjectImportConfiguration.DATE_FORMAT);
format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
final MasterList masterlist = this.getMasterList();
final ServerGeoObjectType type = masterlist.getGeoObjectType();
List<? extends JobHistory> allHist = this.getAllJobHistory().getAll();
final GeoprismUser user = GeoprismUser.get(this.getRunAsUser().getOid());
try {
final JsonObject object = new JsonObject();
object.addProperty(PublishMasterListJob.OID, this.getOid());
object.addProperty(PublishMasterListJob.MASTERLIST, this.getMasterListOid());
object.addProperty(PublishMasterListJob.TYPE, type.getLabel().getValue());
if (allHist.size() > 0) {
final JobHistory history = allHist.get(0);
object.addProperty(JobHistory.STATUS, history.getStatus().get(0).getDisplayLabel());
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.getStatus().get(0).equals(AllJobStatus.FAILURE) && history.getErrorJson().length() > 0) {
String errorJson = history.getErrorJson();
JsonObject error = JsonParser.parseString(errorJson).getAsJsonObject();
JsonObject exception = new JsonObject();
exception.addProperty("type", error.get("type").getAsString());
exception.addProperty("message", history.getLocalizedError(Session.getCurrentLocale()));
object.add("exception", exception);
}
}
return object;
} catch (JSONException e) {
throw new ProgrammingErrorException(e);
}
}
use of net.geoprism.registry.MasterList in project geoprism-registry by terraframe.
the class PublishShapefileJob 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(PublishShapefileJob.OID, this.getOid());
object.add(PublishShapefileJob.VERSION, this.getVersion().toJSON(false));
object.addProperty(PublishShapefileJob.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());
return object;
} catch (JSONException e) {
throw new ProgrammingErrorException(e);
}
}
use of net.geoprism.registry.MasterList in project geoprism-registry by terraframe.
the class LocalizeListMetadataFieldsPatch method migrateExistingLists.
private void migrateExistingLists() {
MasterListQuery mlq = new MasterListQuery(new QueryFactory());
logger.info("Migrating metadata for " + mlq.getCount() + " existing lists.");
try (OIterator<? extends MasterList> it = mlq.getIterator()) {
while (it.hasNext()) {
MasterList list = it.next();
BusinessDAO listDAO = (BusinessDAO) BusinessFacade.getEntityDAO(list);
list.getDescriptionLocal().setDefaultValue(listDAO.getValue(LISTABSTRACT));
list.getProcessLocal().setDefaultValue(listDAO.getValue(PROCESS));
list.getProgressLocal().setDefaultValue(listDAO.getValue(PROGRESS));
list.getAccessConstraintsLocal().setDefaultValue(listDAO.getValue(ACCESSCONSTRAINTS));
list.getUseConstraintsLocal().setDefaultValue(listDAO.getValue(USECONSTRAINTS));
list.getAcknowledgementsLocal().setDefaultValue(listDAO.getValue(ACKNOWLEDGEMENTS));
list.getDisclaimerLocal().setDefaultValue(listDAO.getValue(DISCLAIMER));
list.apply();
}
}
}
Aggregations