Search in sources :

Example 1 with I_AD_Process_Para

use of org.compiere.model.I_AD_Process_Para in project adempiere by adempiere.

the class CalloutParameter method element.

/**
	 * Set the default values from Element
	 * 
	 * @param ctx
	 * @param WindowNo
	 * @param mTab
	 * @param mField
	 * @param value
	 * @return
	 */
public String element(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) {
    Integer AD_Element_ID = (Integer) value;
    if (AD_Element_ID == null || AD_Element_ID <= 0)
        return "";
    I_AD_Process_Para para = GridTabWrapper.create(mTab, I_AD_Process_Para.class);
    MTable table = MTable.get(ctx, para.Table_ID);
    MProcess process = MProcess.get(ctx, para.getAD_Process_ID());
    para.setEntityType(process.getEntityType());
    M_Element element = new M_Element(ctx, AD_Element_ID, null);
    if (element.getAD_Reference_ID() == DisplayType.ID) {
        String columnName = table.get_TableName() + "_ID";
        if (!columnName.equals(element.getColumnName())) {
            para.setAD_Reference_ID(DisplayType.TableDir);
        }
    }
    if (para.getColumnName() == null || para.getColumnName().length() <= 0)
        para.setColumnName(element.getColumnName());
    if (para.getFieldLength() <= 0)
        para.setFieldLength(element.getFieldLength());
    if (para.getAD_Reference_ID() <= 0)
        para.setAD_Reference_ID(element.getAD_Reference_ID());
    if (para.getAD_Reference_Value_ID() <= 0)
        para.setAD_Reference_Value_ID(element.getAD_Reference_Value_ID());
    if (para.getName() == null || para.getName().length() <= 0)
        para.setName(element.getName());
    if (para.getDescription() == null || para.getDescription().length() <= 0)
        para.setDescription(element.getDescription());
    if (para.getHelp() == null || para.getHelp().length() <= 0)
        para.setHelp(element.getHelp());
    return "";
}
Also used : MProcess(org.compiere.model.MProcess) MTable(org.compiere.model.MTable) I_AD_Process_Para(org.compiere.model.I_AD_Process_Para) M_Element(org.compiere.model.M_Element)

Example 2 with I_AD_Process_Para

use of org.compiere.model.I_AD_Process_Para 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());
}
Also used : IHandlingUnitsBL(de.metas.handlingunits.IHandlingUnitsBL) LookupDataSourceFactory(de.metas.ui.web.window.model.lookup.LookupDataSourceFactory) IntegerLookupValue(de.metas.ui.web.window.datatypes.LookupValue.IntegerLookupValue) Env(org.compiere.util.Env) HUEditorRowFilter(de.metas.ui.web.handlingunits.HUEditorRowFilter) I_M_HU_PI_Version(de.metas.handlingunits.model.I_M_HU_PI_Version) SqlLookupDescriptor(de.metas.ui.web.window.descriptor.sql.SqlLookupDescriptor) I_AD_Process_Para(org.compiere.model.I_AD_Process_Para) HashSet(java.util.HashSet) ADRefListItem(org.adempiere.ad.service.IADReferenceDAO.ADRefListItem) Select(de.metas.ui.web.handlingunits.HUEditorRowFilter.Select) LookupDescriptor(de.metas.ui.web.window.descriptor.LookupDescriptor) DisplayType(org.compiere.util.DisplayType) LookupValuesList(de.metas.ui.web.window.datatypes.LookupValuesList) I_M_HU_PI_Item(de.metas.handlingunits.model.I_M_HU_PI_Item) IADReferenceDAO(org.adempiere.ad.service.IADReferenceDAO) I_M_HU(de.metas.handlingunits.model.I_M_HU) Nullable(javax.annotation.Nullable) I_C_BPartner(org.compiere.model.I_C_BPartner) IADProcessDAO(de.metas.process.IADProcessDAO) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) LookupDataSource(de.metas.ui.web.window.model.lookup.LookupDataSource) LookupDataSourceContext(de.metas.ui.web.window.model.lookup.LookupDataSourceContext) NonNull(lombok.NonNull) Collection(java.util.Collection) Set(java.util.Set) IHandlingUnitsDAO(de.metas.handlingunits.IHandlingUnitsDAO) HUTransformService(de.metas.handlingunits.allocation.transfer.HUTransformService) Services(org.adempiere.util.Services) List(java.util.List) WEBUI_ProcessHelper(de.metas.ui.web.handlingunits.util.WEBUI_ProcessHelper) StringLookupValue(de.metas.ui.web.window.datatypes.LookupValue.StringLookupValue) X_M_HU(de.metas.handlingunits.model.X_M_HU) Builder(lombok.Builder) Check(de.metas.printing.esb.base.util.Check) IProcessDefaultParametersProvider(de.metas.process.IProcessDefaultParametersProvider) I_M_Product(de.metas.adempiere.model.I_M_Product) ActionType(de.metas.ui.web.handlingunits.process.WebuiHUTransformCommand.ActionType) HUEditorView(de.metas.ui.web.handlingunits.HUEditorView) Comparator(java.util.Comparator) I_AD_Process_Para(org.compiere.model.I_AD_Process_Para) IADProcessDAO(de.metas.process.IADProcessDAO) HUEditorRow(de.metas.ui.web.handlingunits.HUEditorRow) HashSet(java.util.HashSet) ADRefListItem(org.adempiere.ad.service.IADReferenceDAO.ADRefListItem)

Aggregations

I_AD_Process_Para (org.compiere.model.I_AD_Process_Para)2 I_M_Product (de.metas.adempiere.model.I_M_Product)1 IHandlingUnitsBL (de.metas.handlingunits.IHandlingUnitsBL)1 IHandlingUnitsDAO (de.metas.handlingunits.IHandlingUnitsDAO)1 HUTransformService (de.metas.handlingunits.allocation.transfer.HUTransformService)1 I_M_HU (de.metas.handlingunits.model.I_M_HU)1 I_M_HU_PI_Item (de.metas.handlingunits.model.I_M_HU_PI_Item)1 I_M_HU_PI_Version (de.metas.handlingunits.model.I_M_HU_PI_Version)1 X_M_HU (de.metas.handlingunits.model.X_M_HU)1 Check (de.metas.printing.esb.base.util.Check)1 IADProcessDAO (de.metas.process.IADProcessDAO)1 IProcessDefaultParametersProvider (de.metas.process.IProcessDefaultParametersProvider)1 HUEditorRow (de.metas.ui.web.handlingunits.HUEditorRow)1 HUEditorRowFilter (de.metas.ui.web.handlingunits.HUEditorRowFilter)1 Select (de.metas.ui.web.handlingunits.HUEditorRowFilter.Select)1 HUEditorView (de.metas.ui.web.handlingunits.HUEditorView)1 ActionType (de.metas.ui.web.handlingunits.process.WebuiHUTransformCommand.ActionType)1 WEBUI_ProcessHelper (de.metas.ui.web.handlingunits.util.WEBUI_ProcessHelper)1 IntegerLookupValue (de.metas.ui.web.window.datatypes.LookupValue.IntegerLookupValue)1 StringLookupValue (de.metas.ui.web.window.datatypes.LookupValue.StringLookupValue)1