Search in sources :

Example 21 with ServerGeoObjectType

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;
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType)

Example 22 with ServerGeoObjectType

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;
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) HierarchyType(org.commongeoregistry.adapter.metadata.HierarchyType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) MetadataCache(org.commongeoregistry.adapter.metadata.MetadataCache) RegistryAdapter(org.commongeoregistry.adapter.RegistryAdapter)

Example 23 with ServerGeoObjectType

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;
}
Also used : RolePermissionService(net.geoprism.registry.permission.RolePermissionService) Organization(net.geoprism.registry.Organization) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JobHistoryRecord(com.runwaysdk.system.scheduler.JobHistoryRecord) ListType(net.geoprism.registry.ListType) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 24 with ServerGeoObjectType

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 + "].");
    }
}
Also used : ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject) GeoObjectOverTime(org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime) ServerParentTreeNodeOverTime(net.geoprism.registry.view.ServerParentTreeNodeOverTime) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 25 with ServerGeoObjectType

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);
    }
}
Also used : MasterList(net.geoprism.registry.MasterList) JobHistory(com.runwaysdk.system.scheduler.JobHistory) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject) JSONException(org.json.JSONException) MasterListVersion(net.geoprism.registry.MasterListVersion) GeoprismUser(net.geoprism.GeoprismUser) SimpleDateFormat(java.text.SimpleDateFormat) ProgrammingErrorException(com.runwaysdk.dataaccess.ProgrammingErrorException)

Aggregations

ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)201 Request (com.runwaysdk.session.Request)69 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)57 JsonObject (com.google.gson.JsonObject)48 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)32 JsonArray (com.google.gson.JsonArray)30 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)30 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)27 LinkedList (java.util.LinkedList)27 Test (org.junit.Test)27 VertexObject (com.runwaysdk.business.graph.VertexObject)26 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)26 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)23 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)23 Date (java.util.Date)21 GraphQuery (com.runwaysdk.business.graph.GraphQuery)19 List (java.util.List)18 EdgeObject (com.runwaysdk.business.graph.EdgeObject)17 SimpleDateFormat (java.text.SimpleDateFormat)17 Locale (java.util.Locale)17