Search in sources :

Example 26 with DocumentId

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

the class PickingSlotViewFactory method extractCurrentShipmentScheduleId.

private static final int extractCurrentShipmentScheduleId(final CreateViewRequest request) {
    final DocumentId pickingRowId = request.getParentRowId();
    // TODO make it more obvious/explicit
    final int shipmentScheduleId = pickingRowId.toInt();
    return shipmentScheduleId;
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 27 with DocumentId

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

the class PickingSlotViewsIndexStorage method removeById.

@Override
public void removeById(@NonNull final ViewId pickingSlotViewId) {
    final DocumentId rowId = extractRowId(pickingSlotViewId);
    final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
    packageableView.removePickingSlotView(rowId, ViewCloseReason.USER_REQUEST);
}
Also used : PackageableView(de.metas.ui.web.picking.packageable.PackageableView) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 28 with DocumentId

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

the class PickingSlotViewsIndexStorage method put.

@Override
public void put(final IView pickingSlotView) {
    final ViewId pickingSlotViewId = pickingSlotView.getViewId();
    final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
    final DocumentId rowId = extractRowId(pickingSlotViewId);
    packageableView.setPickingSlotView(rowId, PickingSlotView.cast(pickingSlotView));
}
Also used : PackageableView(de.metas.ui.web.picking.packageable.PackageableView) ViewId(de.metas.ui.web.view.ViewId) DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

Example 29 with DocumentId

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

the class PurchaseRowsLoader method handleThrowableForAsyncAvailabilityCheck.

private void handleThrowableForAsyncAvailabilityCheck(@Nullable final Throwable throwable) {
    if (throwable == null) {
        return;
    }
    if (throwable instanceof AvailabilityException) {
        final AvailabilityException availabilityException = (AvailabilityException) throwable;
        final List<DocumentId> changedRowIds = new ArrayList<>();
        final Set<Entry<PurchaseCandidate, Throwable>> entrySet = availabilityException.getPurchaseCandidate2Throwable().entrySet();
        for (final Entry<PurchaseCandidate, Throwable> purchaseCandidate2throwable : entrySet) {
            final PurchaseRow purchaseRowToAugment = purchaseCandidate2purchaseRow.get(purchaseCandidate2throwable.getKey());
            final PurchaseRow availabilityResultRow = purchaseRowFactory.rowFromThrowableBuilder().parentRow(purchaseRowToAugment).throwable(purchaseCandidate2throwable.getValue()).build();
            purchaseRowToAugment.setAvailabilityInfoRows(ImmutableList.of(availabilityResultRow));
            changedRowIds.add(purchaseRowToAugment.getId());
        }
        notifyViewOfChanges(changedRowIds);
    } else {
    // TODO: display an error-message in the webui
    }
}
Also used : AvailabilityException(de.metas.purchasecandidate.availability.AvailabilityException) Entry(java.util.Map.Entry) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) ArrayList(java.util.ArrayList) PurchaseCandidate(de.metas.purchasecandidate.PurchaseCandidate)

Example 30 with DocumentId

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

the class PurchaseView method patchViewRow.

@Override
public void patchViewRow(@NonNull final RowEditingContext ctx, @NonNull final List<JSONDocumentChangedEvent> fieldChangeRequests) {
    final PurchaseRowId rowId = PurchaseRowId.fromDocumentId(ctx.getRowId());
    rows.patchRow(rowId, fieldChangeRequests);
    // notify the frontend
    final DocumentId groupRowDocumentId = PurchaseRowId.fromDocumentId(ctx.getRowId()).toGroupRowId().toDocumentId();
    ViewChangesCollector.getCurrentOrAutoflush().collectRowChanged(this, groupRowDocumentId);
}
Also used : DocumentId(de.metas.ui.web.window.datatypes.DocumentId)

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