use of net.geoprism.registry.action.ChangeRequest in project geoprism-registry by terraframe.
the class ChangeRequestService method markAllAsInvalid.
@Transaction
public void markAllAsInvalid(ServerGeoObjectType type) {
String reason = LocalizationFacade.localize("changeRequest.invalidate.deleteReferencedGeoObjectType");
ChangeRequestQuery crq = new ChangeRequestQuery(new QueryFactory());
crq.WHERE(crq.getApprovalStatus().containsExactly(AllGovernanceStatus.PENDING));
try (OIterator<? extends ChangeRequest> it = crq.getIterator()) {
for (ChangeRequest cr : it) {
if (cr.getGeoObjectTypeCode().equals(type.getCode())) {
cr.invalidate(reason);
}
}
}
}
use of net.geoprism.registry.action.ChangeRequest in project geoprism-registry by terraframe.
the class ChangeRequestService method uploadFileInTransactionCR.
@Transaction
String uploadFileInTransactionCR(String requestId, String fileName, InputStream fileStream) {
ChangeRequest request = ChangeRequest.get(requestId);
if (!this.permService.getPermissions(request).contains(ChangeRequestPermissionAction.WRITE_DOCUMENTS)) {
throw new CGRPermissionException();
}
VaultFile vf = VaultFile.createAndApply(fileName, fileStream);
request.addDocument(vf).apply();
JsonObject jo = new JsonObject();
jo.addProperty("fileName", vf.getName());
jo.addProperty("oid", vf.getOid());
jo.addProperty("requestId", requestId);
return jo.toString();
}
use of net.geoprism.registry.action.ChangeRequest in project geoprism-registry by terraframe.
the class ChangeRequestService method deleteChangeRequest.
@Request(RequestType.SESSION)
public String deleteChangeRequest(String sessionId, String requestId) {
ChangeRequest request = ChangeRequest.get(requestId);
if (!this.permService.getPermissions(request).containsAll(Arrays.asList(ChangeRequestPermissionAction.DELETE))) {
throw new CGRPermissionException();
}
request.delete();
return requestId;
}
use of net.geoprism.registry.action.ChangeRequest in project geoprism-registry by terraframe.
the class ChangeRequestService method listDocumentsCR.
String listDocumentsCR(String requestId) {
JsonArray ja = new JsonArray();
ChangeRequest request = ChangeRequest.get(requestId);
if (!this.permService.getPermissions(request).contains(ChangeRequestPermissionAction.READ_DOCUMENTS)) {
throw new CGRPermissionException();
}
OIterator<? extends VaultFile> it = request.getAllDocument();
try {
for (VaultFile vf : it) {
JsonObject jo = new JsonObject();
jo.addProperty("fileName", vf.getName());
jo.addProperty("oid", vf.getOid());
jo.addProperty("requestId", requestId);
ja.add(jo);
}
} finally {
it.close();
}
return ja.toString();
}
use of net.geoprism.registry.action.ChangeRequest in project geoprism-registry by terraframe.
the class ChangeRequestService method update.
@Request(RequestType.SESSION)
public JsonObject update(String sessionId, String cr) {
JsonObject obj = JsonParser.parseString(cr).getAsJsonObject();
String oid = obj.get("oid").getAsString();
JsonArray actions = obj.get("actions").getAsJsonArray();
String notes = obj.get("contributorNotes").getAsString();
ChangeRequest current = ChangeRequest.get(oid);
ServerGeoObjectService service = new ServerGeoObjectService();
service.updateChangeRequest(current, notes, actions);
return current.getDetails();
}
Aggregations