use of com.runwaysdk.system.VaultFile in project geoprism-registry by terraframe.
the class ChangeRequest method delete.
@Override
public void delete() {
List<? extends AbstractAction> actions = this.getOrderedActions();
for (AbstractAction action : actions) {
action.delete();
}
OIterator<? extends ChangeRequestHasDocument> it = this.getAllDocumentRel();
for (ChangeRequestHasDocument rel : it) {
VaultFile vf = rel.getChild();
rel.delete();
vf.delete();
}
super.delete();
}
use of com.runwaysdk.system.VaultFile in project geoprism-registry by terraframe.
the class ETLService method reImportInTrans.
@Transaction
public void reImportInTrans(MultipartFileParameter file, String json) {
ImportConfiguration config = ImportConfiguration.build(json);
ImportHistory hist = ImportHistory.get(config.getHistoryId());
hist.getConfig().enforceExecutePermissions();
VaultFile vf = VaultFile.get(config.getVaultFileId());
vf.delete();
VaultFile vf2 = null;
try (InputStream is = file.getInputStream()) {
vf2 = VaultFile.createAndApply(file.getFilename(), is);
} catch (IOException e) {
throw new RuntimeException(e);
}
config.setVaultFileId(vf2.getOid());
config.setFileName(file.getFilename());
hist = ImportHistory.lock(config.getHistoryId());
hist.setImportFile(vf2);
hist.setConfigJson(config.toJSON().toString());
hist.apply();
}
use of com.runwaysdk.system.VaultFile 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 com.runwaysdk.system.VaultFile 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 com.runwaysdk.system.VaultFile in project geoprism-registry by terraframe.
the class ChangeRequestService method downloadDocumentCR.
ApplicationResource downloadDocumentCR(String crOid, String vfOid) {
ChangeRequest request = ChangeRequest.get(crOid);
if (!this.permService.getPermissions(request).contains(ChangeRequestPermissionAction.READ_DOCUMENTS)) {
throw new CGRPermissionException();
}
VaultFile vf = VaultFile.get(vfOid);
return vf;
}
Aggregations