use of de.metas.ui.web.window.datatypes.LookupValuesList in project metasfresh-webui-api by metasfresh.
the class LookupDataSourceAdapter method findEntities.
@Override
public final LookupValuesList findEntities(final Evaluatee ctx, final String filter, final int firstRow, final int pageLength) {
final String filterEffective;
if (Check.isEmpty(filter, true)) {
filterEffective = LookupDataSourceContext.FILTER_Any;
} else {
filterEffective = filter.trim();
}
final LookupDataSourceContext evalCtx = fetcher.newContextForFetchingList().setParentEvaluatee(ctx).putFilter(filterEffective, firstRow, pageLength).requiresFilterAndLimit().build();
final LookupValuesList lookupValuesList = fetcher.retrieveEntities(evalCtx);
return lookupValuesList;
}
use of de.metas.ui.web.window.datatypes.LookupValuesList in project metasfresh-webui-api by metasfresh.
the class MailRestController method attachFile.
private WebuiEmail attachFile(final String emailId, final Supplier<LookupValue> attachmentProducer) {
// Ask the producer to create the attachment
@NonNull final LookupValue attachment = attachmentProducer.get();
try {
final WebuiEmailChangeResult result = changeEmail(emailId, emailOld -> {
final LookupValuesList attachmentsOld = emailOld.getAttachments();
final LookupValuesList attachmentsNew = attachmentsOld.addIfAbsent(attachment);
return emailOld.toBuilder().attachments(attachmentsNew).build();
});
return result.getEmail();
} catch (final Throwable ex) {
mailAttachmentsRepo.deleteAttachment(emailId, attachment);
throw AdempiereException.wrapIfNeeded(ex);
}
}
use of de.metas.ui.web.window.datatypes.LookupValuesList in project metasfresh-webui-api by metasfresh.
the class WebuiHUTransformParametersFiller method getActions.
/**
* @return the actions that are available according to which row is currently selected and to also according to whether there are already existing TUs or LUs in the context.
*/
public final LookupValuesList getActions(final int processId) {
final Set<String> allowedActions = new HashSet<>();
final HUEditorRow huRow = getSelectedRow();
if (huRow.isCU()) {
allowedActions.addAll(getActionTypesForCUs());
} else if (huRow.isTU()) {
allowedActions.addAll(getActionTypesForTUs());
} else if (huRow.isLU()) {
allowedActions.add(ActionType.LU_Set_Ownership.toString());
}
final IADProcessDAO adProcessDAO = Services.get(IADProcessDAO.class);
final I_AD_Process_Para processParameter = adProcessDAO.retriveProcessParameter(Env.getCtx(), processId, WEBUI_M_HU_Transform.PARAM_Action);
final int actionsReferenceId = processParameter.getAD_Reference_Value_ID();
final Collection<ADRefListItem> allActiveActionItems = adReferenceDAO.retrieveListItems(actionsReferenceId);
final String adLanguage = Env.getAD_Language();
return allActiveActionItems.stream().filter(item -> allowedActions.contains(item.getValueName())).map(item -> StringLookupValue.of(item.getValueName(), item.getName())).sorted(Comparator.comparing(lookupValue -> lookupValue.getDisplayName(adLanguage))).collect(LookupValuesList.collect());
}
use of de.metas.ui.web.window.datatypes.LookupValuesList in project metasfresh-webui-api by metasfresh.
the class WebuiHUTransformParametersFiller method getM_HU_PI_Item_IDs.
public LookupValuesList getM_HU_PI_Item_IDs() {
final ActionType actionType = getActionType();
if (actionType != ActionType.TU_To_NewLUs) {
return LookupValuesList.EMPTY;
}
final HUEditorRow tuRow = getSelectedRow();
final I_M_HU tuHU = tuRow.getM_HU();
final I_M_HU_PI_Version effectivePIVersion = handlingUnitsBL.getEffectivePIVersion(tuHU);
Check.errorIf(effectivePIVersion == null, "tuHU is inconsistent; hu={}", tuHU);
final List<I_M_HU_PI_Item> luPIItems = handlingUnitsDAO.retrieveParentPIItemsForParentPI(effectivePIVersion.getM_HU_PI(), null, tuHU.getC_BPartner());
return luPIItems.stream().filter(luPIItem -> luPIItem.getM_HU_PI_Version().isCurrent() && luPIItem.getM_HU_PI_Version().isActive() && luPIItem.getM_HU_PI_Version().getM_HU_PI().isActive()).map(luPIItem -> IntegerLookupValue.of(luPIItem.getM_HU_PI_Item_ID(), WEBUI_ProcessHelper.buildHUPIItemString(luPIItem))).sorted(Comparator.comparing(IntegerLookupValue::getDisplayName)).collect(LookupValuesList.collect());
}
use of de.metas.ui.web.window.datatypes.LookupValuesList in project metasfresh-webui-api by metasfresh.
the class WEBUI_M_HU_Pick_ParametersFiller method getPickingSlotValues.
public LookupValuesList getPickingSlotValues(@NonNull final LookupDataSourceContext context) {
if (shipmentScheduleId <= 0) {
return LookupValuesList.EMPTY;
}
final IShipmentScheduleEffectiveBL shipmentScheduleEffectiveBL = Services.get(IShipmentScheduleEffectiveBL.class);
final I_M_ShipmentSchedule shipmentSchedule = load(shipmentScheduleId, I_M_ShipmentSchedule.class);
final PickingSlotQuery pickingSlotQuery = PickingSlotQuery.builder().availableForBPartnerId(shipmentScheduleEffectiveBL.getC_BP_Location_ID(shipmentSchedule)).availableForBPartnerLocationId(shipmentScheduleEffectiveBL.getC_BP_Location_ID(shipmentSchedule)).build();
final List<I_M_PickingSlot> availablePickingSlots = Services.get(IPickingSlotDAO.class).retrievePickingSlots(pickingSlotQuery);
return availablePickingSlots.stream().map(pickingSlot -> IntegerLookupValue.of(pickingSlot.getM_PickingSlot_ID(), createPickingSlotLabel(pickingSlot))).collect(LookupValuesList.collect());
}
Aggregations