use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIDescriptorFactory method createASIDescriptor.
private ASIDescriptor createASIDescriptor(final ASIEditingInfo info) {
final DocumentId asiDescriptorId = DocumentId.ofString(info.getWindowType() + "_" + info.getM_AttributeSet_ID());
final DocumentEntityDescriptor entityDescriptor = createDocumentEntityDescriptor(//
asiDescriptorId, // name
info.getM_AttributeSet_Name(), // description
info.getM_AttributeSet_Description(), // attributes
info.getAvailableAttributes());
final ASILayout layout = createLayout(asiDescriptorId, entityDescriptor);
return ASIDescriptor.builder().setM_AttributeSet_ID(info.getM_AttributeSet_ID()).setEntityDescriptor(entityDescriptor).setLayout(layout).build();
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRestController method getASIDocument.
@GetMapping("/{asiDocId}")
public JSONDocument getASIDocument(@PathVariable("asiDocId") final String asiDocIdStr) {
userSession.assertLoggedIn();
final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
return asiRepo.forASIDocumentReadonly(asiDocId, asiDoc -> asiDoc.toJSONDocument(newJsonOpts()));
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRestController method complete.
@PostMapping(value = "/{asiDocId}/complete")
public JSONLookupValue complete(@PathVariable("asiDocId") final String asiDocIdStr) {
userSession.assertLoggedIn();
final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
return Execution.callInNewExecution("complete", () -> asiRepo.complete(asiDocId)).transform(JSONLookupValue::ofLookupValue);
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRestController method getLayout.
@GetMapping("/{asiDocId}/layout")
public JSONASILayout getLayout(@PathVariable("asiDocId") final String asiDocIdStr) {
userSession.assertLoggedIn();
final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
final ASILayout asiLayout = asiRepo.getLayout(asiDocId);
return JSONASILayout.of(asiLayout, newJsonOpts());
}
use of de.metas.ui.web.window.datatypes.DocumentId in project metasfresh-webui-api by metasfresh.
the class ASIRestController method processChanges.
@PatchMapping("/{asiDocId}")
public List<JSONDocument> processChanges(//
@PathVariable("asiDocId") final String asiDocIdStr, //
@RequestBody final List<JSONDocumentChangedEvent> events) {
userSession.assertLoggedIn();
final DocumentId asiDocId = DocumentId.of(asiDocIdStr);
return Execution.callInNewExecution("processChanges", () -> {
final IDocumentChangesCollector changesCollector = Execution.getCurrentDocumentChangesCollectorOrNull();
asiRepo.processASIDocumentChanges(asiDocId, events, changesCollector);
return JSONDocument.ofEvents(changesCollector, newJsonOpts());
});
}
Aggregations