Search in sources :

Example 21 with DocumentPath

use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.

the class CreateViewRequest method deleteStickyFilterBuilder.

public static Builder deleteStickyFilterBuilder(@NonNull final IView view, @NonNull final String stickyFilterIdToDelete) {
    final DocumentFilterList stickyFilters = view.getStickyFilters().stream().filter(stickyFilter -> !Objects.equals(stickyFilter.getFilterId(), stickyFilterIdToDelete)).collect(DocumentFilterList.toDocumentFilterList());
    // FIXME: instead of removing all referencing document paths (to prevent creating sticky filters from them),
    // we shall remove only those is are related to "stickyFilterIdToDelete".
    // view.getReferencingDocumentPaths();
    final Set<DocumentPath> referencingDocumentPaths = ImmutableSet.of();
    return builder(view.getViewId().getWindowId(), view.getViewType()).setProfileId(view.getProfileId()).setParentViewId(view.getParentViewId()).setParentRowId(view.getParentRowId()).setReferencingDocumentPaths(referencingDocumentPaths).setStickyFilters(stickyFilters).setFilters(view.getFilters()).setUseAutoFilters(false).addActions(view.getActions()).addAdditionalRelatedProcessDescriptors(view.getAdditionalRelatedProcessDescriptors());
}
Also used : DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) Getter(lombok.Getter) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) JSONViewDataType(de.metas.ui.web.view.json.JSONViewDataType) ArrayList(java.util.ArrayList) Value(lombok.Value) LinkedHashMap(java.util.LinkedHashMap) ViewActionDescriptorsFactory(de.metas.ui.web.process.view.ViewActionDescriptorsFactory) AccessLevel(lombok.AccessLevel) ImmutableList(com.google.common.collect.ImmutableList) Characteristic(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor.Characteristic) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList) Map(java.util.Map) ToString(lombok.ToString) DocumentFilter(de.metas.ui.web.document.filter.DocumentFilter) JSONFilterViewRequest(de.metas.ui.web.view.json.JSONFilterViewRequest) JSONDocumentFilter(de.metas.ui.web.document.filter.json.JSONDocumentFilter) LinkedHashSet(java.util.LinkedHashSet) Check(de.metas.util.Check) ViewActionDescriptorsList(de.metas.ui.web.process.view.ViewActionDescriptorsList) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) NonNull(lombok.NonNull) Collection(java.util.Collection) RelatedProcessDescriptor(de.metas.process.RelatedProcessDescriptor) Set(java.util.Set) DocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.provider.DocumentFilterDescriptorsProvider) WindowId(de.metas.ui.web.window.datatypes.WindowId) Objects(java.util.Objects) List(java.util.List) AdempiereException(org.adempiere.exceptions.AdempiereException) CollectionUtils(de.metas.util.collections.CollectionUtils) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) DocumentFilterList(de.metas.ui.web.document.filter.DocumentFilterList)

Example 22 with DocumentPath

use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.

the class WindowRestController method getDocumentFieldZoomInto.

@ApiOperation("field current value's window layout to zoom into")
@GetMapping("/{windowId}/{documentId}/field/{fieldName}/zoomInto")
public JSONZoomInto getDocumentFieldZoomInto(// 
@PathVariable("windowId") final String windowIdStr, // 
@PathVariable("documentId") final String documentId, // 
@PathVariable("fieldName") final String fieldName) {
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentId);
    return getDocumentFieldZoomInto(documentPath, fieldName);
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) GetMapping(org.springframework.web.bind.annotation.GetMapping) ApiOperation(io.swagger.annotations.ApiOperation)

Example 23 with DocumentPath

use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.

the class WindowRestController method processRecord.

/**
 * @task https://github.com/metasfresh/metasfresh/issues/1090
 */
@GetMapping("/{windowId}/{documentId}/processNewRecord")
public int processRecord(// 
@PathVariable("windowId") final String windowIdStr, // 
@PathVariable("documentId") final String documentIdStr) {
    userSession.assertLoggedIn();
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentPath documentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
    final IDocumentChangesCollector changesCollector = NullDocumentChangesCollector.instance;
    return Execution.callInNewExecution("window.processTemplate", () -> documentCollection.forDocumentWritable(documentPath, changesCollector, document -> {
        document.saveIfValidAndHasChanges();
        if (document.hasChangesRecursivelly()) {
            throw new AdempiereException("Not saved");
        }
        final int newRecordId = newRecordDescriptorsProvider.getNewRecordDescriptor(document.getEntityDescriptor()).getProcessor().processNewRecordDocument(document);
        return newRecordId;
    }));
}
Also used : PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) DisplayPlace(de.metas.process.RelatedProcessDescriptor.DisplayPlace) WebRequest(org.springframework.web.context.request.WebRequest) DocumentZoomIntoInfo(de.metas.ui.web.window.model.lookup.DocumentZoomIntoInfo) Autowired(org.springframework.beans.factory.annotation.Autowired) ApiParam(io.swagger.annotations.ApiParam) JSONZoomInto(de.metas.ui.web.window.datatypes.json.JSONZoomInto) DocumentCollection(de.metas.ui.web.window.model.DocumentCollection) DocumentChangeLogService(de.metas.ui.web.window.model.DocumentChangeLogService) ReasonSupplier(de.metas.ui.web.window.model.IDocumentChangesCollector.ReasonSupplier) JSONDocumentChangeLog(de.metas.ui.web.window.datatypes.json.JSONDocumentChangeLog) ApiOperation(io.swagger.annotations.ApiOperation) DocumentWebsocketPublisher(de.metas.ui.web.window.events.DocumentWebsocketPublisher) IDocumentFieldView(de.metas.ui.web.window.model.IDocumentFieldView) JSONDocumentReferencesGroupList(de.metas.ui.web.window.datatypes.json.JSONDocumentReferencesGroupList) DocumentReference(de.metas.ui.web.window.model.DocumentReference) TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) PostMapping(org.springframework.web.bind.annotation.PostMapping) ImmutableSet(com.google.common.collect.ImmutableSet) JSONDocumentLayoutOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutOptions) DocumentQueryOrderByList(de.metas.ui.web.window.model.DocumentQueryOrderByList) Predicate(java.util.function.Predicate) HttpHeaders(org.springframework.http.HttpHeaders) NonNull(lombok.NonNull) MediaType(org.springframework.http.MediaType) DocumentDescriptor(de.metas.ui.web.window.descriptor.DocumentDescriptor) Set(java.util.Set) ProcessRestController(de.metas.ui.web.process.ProcessRestController) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) UserSession(de.metas.ui.web.session.UserSession) DocumentFieldDescriptor(de.metas.ui.web.window.descriptor.DocumentFieldDescriptor) EntityNotFoundException(de.metas.ui.web.exceptions.EntityNotFoundException) List(java.util.List) DocumentPrint(de.metas.ui.web.window.model.DocumentCollection.DocumentPrint) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) DocumentFieldWidgetType(de.metas.ui.web.window.descriptor.DocumentFieldWidgetType) IMsgBL(de.metas.i18n.IMsgBL) MenuTreeRepository(de.metas.ui.web.menu.MenuTreeRepository) JSONDocument(de.metas.ui.web.window.datatypes.json.JSONDocument) IADTableDAO(org.adempiere.ad.table.api.IADTableDAO) JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) DocumentReferencesService(de.metas.ui.web.window.model.DocumentReferencesService) WebConfig(de.metas.ui.web.config.WebConfig) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentChangedEvent(de.metas.ui.web.window.datatypes.json.JSONDocumentChangedEvent) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ButtonFieldActionDescriptor(de.metas.ui.web.window.descriptor.ButtonFieldActionDescriptor) MenuTree(de.metas.ui.web.menu.MenuTree) PatchMapping(org.springframework.web.bind.annotation.PatchMapping) NullDocumentChangesCollector(de.metas.ui.web.window.model.NullDocumentChangesCollector) RequestBody(org.springframework.web.bind.annotation.RequestBody) ImmutableList(com.google.common.collect.ImmutableList) DetailId(de.metas.ui.web.window.descriptor.DetailId) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) GetMapping(org.springframework.web.bind.annotation.GetMapping) JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) JSONDocumentReferencesGroup(de.metas.ui.web.window.datatypes.json.JSONDocumentReferencesGroup) NewRecordDescriptorsProvider(de.metas.ui.web.window.descriptor.factory.NewRecordDescriptorsProvider) Api(io.swagger.annotations.Api) Nullable(javax.annotation.Nullable) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) WindowId(de.metas.ui.web.window.datatypes.WindowId) ETagResponseEntityBuilder(de.metas.ui.web.cache.ETagResponseEntityBuilder) WebuiRelatedProcessDescriptor(de.metas.ui.web.process.descriptor.WebuiRelatedProcessDescriptor) Services(de.metas.util.Services) HttpStatus(org.springframework.http.HttpStatus) JSONDocumentActionsList(de.metas.ui.web.process.json.JSONDocumentActionsList) DocumentPreconditionsAsContext(de.metas.ui.web.process.DocumentPreconditionsAsContext) AdempiereException(org.adempiere.exceptions.AdempiereException) JSONDocumentReference(de.metas.ui.web.window.datatypes.json.JSONDocumentReference) JSONOptionsBuilder(de.metas.ui.web.window.datatypes.json.JSONOptions.JSONOptionsBuilder) ResponseEntity(org.springframework.http.ResponseEntity) JSONDocumentLayout(de.metas.ui.web.window.datatypes.json.JSONDocumentLayout) JSONDocumentLayoutOptionsBuilder(de.metas.ui.web.window.datatypes.json.JSONDocumentLayoutOptions.JSONDocumentLayoutOptionsBuilder) Document(de.metas.ui.web.window.model.Document) JSONDocumentOptionsBuilder(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions.JSONDocumentOptionsBuilder) WindowId(de.metas.ui.web.window.datatypes.WindowId) AdempiereException(org.adempiere.exceptions.AdempiereException) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) IDocumentChangesCollector(de.metas.ui.web.window.model.IDocumentChangesCollector) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 24 with DocumentPath

use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.

the class WindowRestController method getIncludedTabTopActions.

@GetMapping("/{windowId}/{documentId}/{tabId}/topActions")
public JSONDocumentActionsList getIncludedTabTopActions(@PathVariable("windowId") final String windowIdStr, @PathVariable("documentId") final String documentIdStr, @PathVariable("tabId") final String tabIdStr) {
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentPath rootDocumentPath = DocumentPath.rootDocumentPath(windowId, documentIdStr);
    final DetailId selectedTabId = DetailId.fromJson(tabIdStr);
    final Set<TableRecordReference> selectedIncludedRecords = ImmutableSet.of();
    boolean returnDisabled = false;
    return getDocumentActions(rootDocumentPath, selectedTabId, selectedIncludedRecords, returnDisabled, DisplayPlace.IncludedTabTopActionsMenu);
}
Also used : DetailId(de.metas.ui.web.window.descriptor.DetailId) WindowId(de.metas.ui.web.window.datatypes.WindowId) TableRecordReference(org.adempiere.util.lang.impl.TableRecordReference) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 25 with DocumentPath

use of de.metas.ui.web.window.datatypes.DocumentPath in project metasfresh-webui-api by metasfresh.

the class WindowRestController method getIncludedTabRow.

@GetMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> getIncludedTabRow(// 
@PathVariable("windowId") final String windowIdStr, // 
@PathVariable("documentId") final String documentIdStr, // 
@PathVariable("tabId") final String tabIdStr, // 
@PathVariable("rowId") final String rowIdStr, // 
@RequestParam(name = PARAM_FieldsList, required = false) @ApiParam("comma separated field names") final String fieldsListStr, // 
@RequestParam(name = PARAM_Advanced, required = false, defaultValue = PARAM_Advanced_DefaultValue) final boolean advanced) {
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentIdStr, tabIdStr, rowIdStr);
    final JSONDocumentOptions jsonOpts = newJSONDocumentOptions().showOnlyFieldsListStr(fieldsListStr).showAdvancedFields(advanced).build();
    return getData(documentPath, DocumentQueryOrderByList.EMPTY, jsonOpts);
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) JSONDocumentPath(de.metas.ui.web.window.datatypes.json.JSONDocumentPath) JSONDocumentOptions(de.metas.ui.web.window.datatypes.json.JSONDocumentOptions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)65 WindowId (de.metas.ui.web.window.datatypes.WindowId)29 JSONDocumentPath (de.metas.ui.web.window.datatypes.json.JSONDocumentPath)22 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)20 GetMapping (org.springframework.web.bind.annotation.GetMapping)14 List (java.util.List)13 ImmutableList (com.google.common.collect.ImmutableList)12 ImmutableSet (com.google.common.collect.ImmutableSet)12 DetailId (de.metas.ui.web.window.descriptor.DetailId)12 Set (java.util.Set)11 NonNull (lombok.NonNull)10 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)10 AdempiereException (org.adempiere.exceptions.AdempiereException)9 PostMapping (org.springframework.web.bind.annotation.PostMapping)9 DocumentIdsSelection (de.metas.ui.web.window.datatypes.DocumentIdsSelection)8 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)8 Document (de.metas.ui.web.window.model.Document)7 ViewId (de.metas.ui.web.view.ViewId)6 Services (de.metas.util.Services)6 EntityNotFoundException (de.metas.ui.web.exceptions.EntityNotFoundException)5