Search in sources :

Example 31 with DocumentId

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();
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)

Example 32 with DocumentId

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()));
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 33 with DocumentId

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);
}
Also used : JSONLookupValue(de.metas.ui.web.window.datatypes.json.JSONLookupValue) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 34 with DocumentId

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());
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONASILayout(de.metas.ui.web.pattribute.json.JSONASILayout) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 35 with DocumentId

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());
    });
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) PatchMapping(org.springframework.web.bind.annotation.PatchMapping)

Aggregations

DocumentId (de.metas.ui.web.window.datatypes.DocumentId)99 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)18 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)14 List (java.util.List)14 ImmutableList (com.google.common.collect.ImmutableList)12 GetMapping (org.springframework.web.bind.annotation.GetMapping)12 AdempiereException (org.adempiere.exceptions.AdempiereException)11 JSONLookupValuesList (de.metas.ui.web.window.datatypes.json.JSONLookupValuesList)9 ArrayList (java.util.ArrayList)9 Set (java.util.Set)9 NonNull (lombok.NonNull)9 Test (org.junit.Test)9 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 UserSession (de.metas.ui.web.session.UserSession)8 ViewId (de.metas.ui.web.view.ViewId)8 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)8 Document (de.metas.ui.web.window.model.Document)8 IDocumentChangesCollector (de.metas.ui.web.window.model.IDocumentChangesCollector)8 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)8 Autowired (org.springframework.beans.factory.annotation.Autowired)8