public ActionForward createBlackListed( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws OperationException, ApplicationException { ActionForward fwd = init(mapping, form, request, response); if (fwd != null) return fwd; Properties ctx = TmkJSPEnv.getCtx(request); DefaultForm df = (DefaultForm) form; BlackListedBean bean = (BlackListedBean) df.getBean(); Trx trx = Trx.get(TrxPrefix.getPrefix(), true); try { trx.start(); BlackListedManager.createBlackListed(ctx, bean, trx.getTrxName()); trx.commit(); } catch (OperationException ex) { trx.rollback(); throw ex; } finally { trx.close(); } request.setAttribute(Constants.BLACKLISTED_DETAILS, bean); return mapping.findForward(CREATE_BLACKLISTED); }
public ActionForward editCheque( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException { ActionForward fwd = init(mapping, form, request, response); if (fwd != null) return fwd; Properties ctx = TmkJSPEnv.getCtx(request); BlackListForm f = (BlackListForm) form; BlackListedBean bean = (BlackListedBean) f.getBean(); Integer blacklistedID = bean.getBlackListedId(); if (blacklistedID == null) { throw new OperationException( "Cannot load Cheque details. Cause BlacklistedId cannot be null!"); } Trx trx = Trx.get(TrxPrefix.getPrefix(), true); trx.start(); try { BlackListedManager.editBlackListed(ctx, bean, trx.getTrxName()); trx.commit(); } catch (OperationException ex) { trx.rollback(); throw ex; } finally { trx.close(); } request.getSession().setAttribute(Constants.BLACKLISTED_DETAILS, bean); return mapping.findForward(EDIT_CHEQUE); }
public ActionForward deactivateCheque( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException, OperationException { ActionForward fwd = init(mapping, form, request, response); if (fwd != null) return fwd; Properties ctx = TmkJSPEnv.getCtx(request); BlackListForm f = (BlackListForm) form; f.validate(mapping, request); BlackListedBean bean = (BlackListedBean) f.getBean(); Integer blackListedId = bean.getBlackListedId(); if (blackListedId == null) { throw new OperationException( "Cannot deactivate Blacklisted Cheques. Cause BlackListed id cannot be null!"); } Trx trx = Trx.get(TrxPrefix.getPrefix(), true); try { trx.start(); BlackListedManager.deactivateBListedCheque(ctx, blackListedId.intValue(), trx.getTrxName()); trx.commit(); } catch (OperationException e) { trx.rollback(); postGlobalError("error.deactivate.customer", request); mapping.getInputForward(); } finally { trx.close(); } return mapping.findForward(DEACTIVATE_CHEQUE); }
/** @param e */ public void valueChange(ValueChangeEvent e) { if (gridTab.isProcessed()) // only active records { Object source = e.getSource(); if (source instanceof WEditor) { // Elaine 2009/05/06 WEditor editor = (WEditor) source; GridField gridField = editor.getGridField(); if (gridField != null) { if (!gridField.isEditable(true)) { logger.config("(" + gridTab.toString() + ") " + e.getPropertyName()); return; } } else if (!editor.isReadWrite()) { logger.config("(" + gridTab.toString() + ") " + e.getPropertyName()); return; } } else { logger.config("(" + gridTab.toString() + ") " + e.getPropertyName()); return; } } // processed logger.config( "(" + gridTab.toString() + ") " + e.getPropertyName() + "=" + e.getNewValue() + " (" + e.getOldValue() + ") " + (e.getOldValue() == null ? "" : e.getOldValue().getClass().getName())); // Get Row/Col Info GridTable mTable = gridTab.getTableModel(); int row = gridTab.getCurrentRow(); int col = mTable.findColumn(e.getPropertyName()); // if (e.getNewValue() == null && e.getOldValue() != null && e.getOldValue().toString().length() > 0) // some editors return "" instead of null // this is the original code from GridController, don't know what it does there but // it breaks ignore button for web ui // mTable.setChanged (true); mTable.setValueAt(e.getNewValue(), row, col); else { Object newValue = e.getNewValue(); Integer newValues[] = null; if (newValue instanceof Integer[]) { newValues = ((Integer[]) newValue); newValue = newValues[0]; if (newValues.length > 1) { Integer valuesCopy[] = new Integer[newValues.length - 1]; System.arraycopy(newValues, 1, valuesCopy, 0, valuesCopy.length); newValues = valuesCopy; } else { newValues = null; } } else if (newValue instanceof Object[]) { logger.severe("Multiple values can only be processed for IDs (Integer)"); throw new IllegalArgumentException( "Multiple Selection values not available for this field. " + e.getPropertyName()); } mTable.setValueAt(newValue, row, col); // Force Callout if (e.getPropertyName().equals("S_ResourceAssignment_ID")) { GridField mField = gridTab.getField(col); if (mField != null && mField.getCallout().length() > 0) { gridTab.processFieldChange(mField); // Dependencies & Callout } } if (newValues != null && newValues.length > 0) { // Save data, since record need to be used for generating clones. if (!gridTab.dataSave(false)) { throw new AdempiereException("SaveError"); } // Retrieve the current record ID int recordId = gridTab.getKeyID(gridTab.getCurrentRow()); Trx trx = Trx.get(Trx.createTrxName(), true); trx.start(); try { saveMultipleRecords( Env.getCtx(), gridTab.getTableName(), e.getPropertyName(), recordId, newValues, trx.getTrxName()); trx.commit(); gridTab.dataRefreshAll(); } catch (Exception ex) { trx.rollback(); logger.severe(ex.getMessage()); throw new AdempiereException("SaveError"); } finally { trx.close(); } } } } // ValueChange