Search in sources :

Example 1 with I_AD_Process

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

the class AProcess method startProcess.

private void startProcess(I_AD_Process process) {
    final I_AD_Process processTrl = POWrapper.translate(process, I_AD_Process.class);
    final VButton button = new VButton(// columnName,
    "StartProcess", // mandatory,
    false, // isReadOnly,
    false, // isUpdateable,
    true, processTrl.getName(), processTrl.getDescription(), processTrl.getHelp(), process.getAD_Process_ID());
    parent.actionButton(button);
}
Also used : I_AD_Process(org.compiere.model.I_AD_Process) VButton(org.compiere.grid.ed.VButton)

Example 2 with I_AD_Process

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

the class AProcessModel method fetchProcesses.

public List<I_AD_Process> fetchProcesses(Properties ctx, GridTab gridTab) {
    final List<I_AD_Process> emptyList = Collections.unmodifiableList(new ArrayList<I_AD_Process>());
    if (gridTab == null) {
        return emptyList;
    }
    final MRole role = MRole.getDefault(ctx, false);
    Check.assumeNotNull(role, "No role found for {0}", ctx);
    final int AD_Table_ID = gridTab.getAD_Table_ID();
    final List<I_AD_Process> list = fetchProcessesForTable(ctx, AD_Table_ID);
    for (Iterator<I_AD_Process> it = list.iterator(); it.hasNext(); ) {
        final I_AD_Process process = it.next();
        // Filter out processes on which we don't have access
        final Boolean accessRW = role.checkProcessAccess(process.getAD_Process_ID());
        if (accessRW == null) {
            logger.log(Level.FINE, "Removing process {0} because user has no access at all to it", process);
            it.remove();
            continue;
        } else if (!accessRW) {
            logger.log(Level.FINE, "Removing process {0} because user has only readonly access to it", process);
            it.remove();
            continue;
        }
        // Filter out processes which have preconditions which don't apply
        if (!isPreconditionApplicable(process, gridTab)) {
            logger.log(Level.FINE, "Removing process {0} because preconditions were not met", process);
            it.remove();
            continue;
        }
    }
    return list;
}
Also used : I_AD_Process(org.compiere.model.I_AD_Process) MRole(org.compiere.model.MRole)

Example 3 with I_AD_Process

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

the class AProcessModel method getDescription.

/**
	 * Gets description/tooltip to be used in Gear
	 * 
	 * @param process
	 * @return description/tooltip
	 */
public String getDescription(final I_AD_Process process) {
    final I_AD_Process processTrl = POWrapper.translate(process, I_AD_Process.class);
    String description = processTrl.getDescription();
    final IDeveloperModeBL developerModeBL = Services.get(IDeveloperModeBL.class);
    if (developerModeBL != null && developerModeBL.isEnabled()) {
        if (description == null) {
            description = "";
        } else {
            description += "\n - ";
        }
        description += "Classname:" + process.getClassname() + ", ID=" + process.getAD_Process_ID();
    }
    return description;
}
Also used : IDeveloperModeBL(org.adempiere.ad.service.IDeveloperModeBL) I_AD_Process(org.compiere.model.I_AD_Process)

Example 4 with I_AD_Process

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

the class AProcessModel method getDisplayName.

/**
	 * Gets display name to be used in Gear
	 * 
	 * @param process
	 * @return process display name
	 */
public String getDisplayName(final I_AD_Process process) {
    final I_AD_Process processTrl = POWrapper.translate(process, I_AD_Process.class);
    String name = processTrl.getName();
    final IDeveloperModeBL developerModeBL = Services.get(IDeveloperModeBL.class);
    if (developerModeBL != null && developerModeBL.isEnabled()) {
        name += "/" + process.getValue();
    }
    return name;
}
Also used : IDeveloperModeBL(org.adempiere.ad.service.IDeveloperModeBL) I_AD_Process(org.compiere.model.I_AD_Process)

Example 5 with I_AD_Process

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

the class AProcess method getPopupMenu.

private JPopupMenu getPopupMenu() {
    JPopupMenu popup = new JPopupMenu("ProcessMenu");
    List<I_AD_Process> processes = model.fetchProcesses(Env.getCtx(), parent.getCurrentTab());
    if (processes.size() == 0)
        return null;
    for (I_AD_Process process : processes) {
        CMenuItem mi = createProcessMenuItem(process);
        popup.add(mi);
    }
    return popup;
}
Also used : CMenuItem(org.compiere.swing.CMenuItem) I_AD_Process(org.compiere.model.I_AD_Process) JPopupMenu(javax.swing.JPopupMenu)

Aggregations

I_AD_Process (org.compiere.model.I_AD_Process)5 IDeveloperModeBL (org.adempiere.ad.service.IDeveloperModeBL)2 JPopupMenu (javax.swing.JPopupMenu)1 VButton (org.compiere.grid.ed.VButton)1 MRole (org.compiere.model.MRole)1 CMenuItem (org.compiere.swing.CMenuItem)1