Search in sources :

Example 6 with WindowId

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

the class WindowQuickInputRestController method getLayout.

@GetMapping("/layout")
public JSONQuickInputLayoutDescriptor getLayout(// 
@PathVariable("windowId") final String windowIdStr, // 
@PathVariable("documentId") final String documentIdStr_NOTUSED, // 
@PathVariable("tabId") final String tabIdStr) {
    userSession.assertLoggedIn();
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentEntityDescriptor includedDocumentDescriptor = documentsCollection.getDocumentEntityDescriptor(windowId).getIncludedEntityByDetailId(DetailId.fromJson(tabIdStr));
    final QuickInputDescriptor quickInputDescriptor = quickInputDescriptors.getQuickInputEntityDescriptor(includedDocumentDescriptor);
    if (quickInputDescriptor == null) {
        return null;
    }
    final QuickInputLayoutDescriptor layout = quickInputDescriptor.getLayout();
    return JSONQuickInputLayoutDescriptor.fromNullable(layout, newJSONOptions());
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) JSONQuickInputLayoutDescriptor(de.metas.ui.web.window.datatypes.json.JSONQuickInputLayoutDescriptor) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 7 with WindowId

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

the class JSONCreateProcessInstanceRequest method createSelectedIncludedDocumentPaths.

private static final List<DocumentPath> createSelectedIncludedDocumentPaths(final WindowId windowId, final String documentIdStr, final JSONSelectedIncludedTab selectedTab) {
    if (windowId == null || Check.isEmpty(documentIdStr, true) || selectedTab == null) {
        return ImmutableList.of();
    }
    final DocumentId documentId = DocumentId.of(documentIdStr);
    final DetailId selectedTabId = DetailId.fromJson(selectedTab.getTabId());
    return selectedTab.getRowIds().stream().map(DocumentId::of).map(rowId -> DocumentPath.includedDocumentPath(windowId, documentId, selectedTabId, rowId)).collect(ImmutableList.toImmutableList());
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) ViewRowIdsSelection(de.metas.ui.web.view.ViewRowIdsSelection) ImmutableSet(com.google.common.collect.ImmutableSet) DocumentPath(de.metas.ui.web.window.datatypes.DocumentPath) NonNull(lombok.NonNull) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) Set(java.util.Set) Visibility(com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility) MoreObjects(com.google.common.base.MoreObjects) WindowId(de.metas.ui.web.window.datatypes.WindowId) JsonAutoDetect(com.fasterxml.jackson.annotation.JsonAutoDetect) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) ProcessId(de.metas.ui.web.process.ProcessId) Check(de.metas.printing.esb.base.util.Check) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) DetailId(de.metas.ui.web.window.descriptor.DetailId) Data(lombok.Data) JsonInclude(com.fasterxml.jackson.annotation.JsonInclude) ViewId(de.metas.ui.web.view.ViewId) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) DetailId(de.metas.ui.web.window.descriptor.DetailId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 8 with WindowId

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

the class SqlViewFactory method makeViewInvalidationAdvisorsMap.

private ImmutableMap<WindowId, IViewInvalidationAdvisor> makeViewInvalidationAdvisorsMap(final List<IViewInvalidationAdvisor> viewInvalidationAdvisors) {
    try {
        return Maps.uniqueIndex(viewInvalidationAdvisors, advisor -> {
            final WindowId windowId = advisor.getWindowId();
            Check.assumeNotNull(windowId, "windowId shall not be null for {}", advisor);
            return windowId;
        });
    } catch (IllegalArgumentException e) {
        final String message = "The given collection of " + IViewInvalidationAdvisor.class + " implementors contains more than one element with the same window-id";
        throw new AdempiereException(message, e).setParameter("viewInvalidationAdvisors", viewInvalidationAdvisors).appendParametersToMessage();
    }
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) AdempiereException(org.adempiere.exceptions.AdempiereException)

Example 9 with WindowId

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

the class SqlViewFactory method createViewBinding.

private SqlViewBinding createViewBinding(@NonNull final SqlViewBindingKey key) {
    final WindowId windowId = key.getWindowId();
    final DocumentEntityDescriptor entityDescriptor = documentDescriptorFactory.getDocumentEntityDescriptor(windowId);
    final Set<String> displayFieldNames = entityDescriptor.getFieldNamesWithCharacteristic(key.getRequiredFieldCharacteristic());
    final SqlDocumentEntityDataBindingDescriptor entityBinding = SqlDocumentEntityDataBindingDescriptor.cast(entityDescriptor.getDataBinding());
    final DocumentFilterDescriptorsProvider filterDescriptors = entityDescriptor.getFilterDescriptors();
    final SqlViewBinding.Builder builder = createBuilderForEntityBindingAndFieldNames(entityBinding, displayFieldNames).filterDescriptors(filterDescriptors).viewInvalidationAdvisor(getViewInvalidationAdvisor(windowId));
    if (windowId2SqlDocumentFilterConverterDecorator.containsKey(windowId)) {
        builder.filterConverterDecorator(windowId2SqlDocumentFilterConverterDecorator.get(windowId));
    }
    final SqlViewCustomizer sqlViewCustomizer = getSqlViewCustomizer(windowId, key.getProfileId());
    if (sqlViewCustomizer != null) {
        final ViewRowCustomizer rowCustomizer = sqlViewCustomizer;
        builder.rowCustomizer(rowCustomizer);
        sqlViewCustomizer.customizeSqlViewBinding(builder);
    }
    return builder.build();
}
Also used : WindowId(de.metas.ui.web.window.datatypes.WindowId) SqlDocumentEntityDataBindingDescriptor(de.metas.ui.web.window.descriptor.sql.SqlDocumentEntityDataBindingDescriptor) SqlViewBinding(de.metas.ui.web.view.descriptor.SqlViewBinding) DocumentEntityDescriptor(de.metas.ui.web.window.descriptor.DocumentEntityDescriptor) DocumentFilterDescriptorsProvider(de.metas.ui.web.document.filter.DocumentFilterDescriptorsProvider)

Example 10 with WindowId

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

the class WindowRestController method deleteIncludedDocument.

@DeleteMapping("/{windowId}/{documentId}/{tabId}/{rowId}")
public List<JSONDocument> deleteIncludedDocument(// 
@PathVariable("windowId") final String windowIdStr, // 
@PathVariable("documentId") final String documentId, // 
@PathVariable("tabId") final String tabId, // 
@PathVariable("rowId") final String rowId) {
    final WindowId windowId = WindowId.fromJson(windowIdStr);
    final DocumentPath documentPath = DocumentPath.includedDocumentPath(windowId, documentId, tabId, rowId);
    return deleteDocuments(ImmutableList.of(documentPath));
}
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) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping)

Aggregations

WindowId (de.metas.ui.web.window.datatypes.WindowId)48 DocumentPath (de.metas.ui.web.window.datatypes.DocumentPath)22 JSONDocumentPath (de.metas.ui.web.window.datatypes.json.JSONDocumentPath)13 GetMapping (org.springframework.web.bind.annotation.GetMapping)13 DocumentId (de.metas.ui.web.window.datatypes.DocumentId)9 DocumentEntityDescriptor (de.metas.ui.web.window.descriptor.DocumentEntityDescriptor)9 List (java.util.List)9 Set (java.util.Set)9 ImmutableList (com.google.common.collect.ImmutableList)8 ImmutableSet (com.google.common.collect.ImmutableSet)8 AdempiereException (org.adempiere.exceptions.AdempiereException)8 TableRecordReference (org.adempiere.util.lang.impl.TableRecordReference)8 NonNull (lombok.NonNull)7 Services (org.adempiere.util.Services)7 LogManager (de.metas.logging.LogManager)6 EntityNotFoundException (de.metas.ui.web.exceptions.EntityNotFoundException)6 DetailId (de.metas.ui.web.window.descriptor.DetailId)6 Logger (org.slf4j.Logger)6 Autowired (org.springframework.beans.factory.annotation.Autowired)6 JSONViewDataType (de.metas.ui.web.view.json.JSONViewDataType)5