use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentReferences.
@GetMapping(value = "/{windowId}/{documentId}/{tabId}/{rowId}/references")
public JSONDocumentReferencesGroup getDocumentReferences(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @PathVariable("tabId") final String tabIdStr, @PathVariable("rowId") final String rowIdStr) {
userSession.assertLoggedIn();
// Get document references
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentIdStr, tabIdStr, rowIdStr);
final List<DocumentReference> documentReferences = documentReferencesService.getDocumentReferences(documentPath);
final JSONOptions jsonOpts = newJSONOptions().build();
return JSONDocumentReferencesGroup.builder().caption("References").references(JSONDocumentReference.ofList(documentReferences, jsonOpts)).build();
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowRestController method getDocumentChangeLog.
@GetMapping("/{windowId}/{documentId}/changeLog")
public JSONDocumentChangeLog getDocumentChangeLog(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr) {
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
return getDocumentChangeLog(documentPath);
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class DocumentAttachmentsRestController method getDocumentAttachments.
private DocumentAttachments getDocumentAttachments(final String windowIdStr, final String documentId) {
final DocumentPath documentPath = DocumentPath.rootDocumentPath(WindowId.fromJson(windowIdStr), documentId);
final TableRecordReference recordRef = documentDescriptorFactory.getTableRecordReference(documentPath);
return DocumentAttachments.builder().documentPath(documentPath).recordRef(recordRef).entityDescriptor(documentDescriptorFactory.getDocumentEntityDescriptor(documentPath)).websocketPublisher(websocketPublisher).build();
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class WindowQuickInputRestController method create.
@PostMapping
public JSONDocument create(//
@PathVariable("windowId") final String windowIdStr, //
@PathVariable("documentId") final String documentIdStr, //
@PathVariable("tabId") final String tabIdStr) {
userSession.assertLoggedIn();
final WindowId windowId = WindowId.fromJson(windowIdStr);
final DocumentPath rootDocumentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
final DetailId detailId = DetailId.fromJson(tabIdStr);
return Execution.callInNewExecution("quickInput.create", () -> {
final QuickInput quickInput = documentsCollection.forRootDocumentReadonly(rootDocumentPath, rootDocument -> {
// Make sure we can edit our root document. Fail fast.
DocumentPermissionsHelper.assertCanEdit(rootDocument, userSession.getUserRolePermissions());
final DocumentEntityDescriptor includedDocumentDescriptor = rootDocument.getEntityDescriptor().getIncludedEntityByDetailId(detailId);
final QuickInputDescriptor quickInputDescriptor = quickInputDescriptors.getQuickInputEntityDescriptor(includedDocumentDescriptor);
try {
return QuickInput.builder().setQuickInputDescriptor(quickInputDescriptor).setRootDocumentPath(rootDocument.getDocumentPath()).build().bindRootDocument(rootDocument).assertTargetWritable();
} catch (Exception ex) {
// see https://github.com/metasfresh/metasfresh-webui-frontend/issues/487
throw EntityNotFoundException.wrapIfNeeded(ex);
}
});
commit(quickInput);
return JSONDocument.ofDocument(quickInput.getQuickInputDocument(), newJSONOptions());
});
}
use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.
the class HUEditorRowAttributes method toJson.
@Override
public JSONViewRowAttributes toJson(final JSONOptions jsonOpts) {
final JSONViewRowAttributes jsonDocument = new JSONViewRowAttributes(documentPath);
final List<JSONDocumentField> jsonFields = attributesStorage.getAttributeValues().stream().map(attributeValue -> toJSONDocumentField(attributeValue, jsonOpts)).collect(Collectors.toList());
jsonDocument.setFields(jsonFields);
return jsonDocument;
}
Aggregations