Example usage for javax.servlet ServletException printStackTrace

List of usage examples for javax.servlet ServletException printStackTrace

Introduction

In this page you can find the example usage for javax.servlet ServletException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

@Deprecated
public static String getConvertedAmt(String Amt, String CurFrom_ID, String CurTo_ID, String ConvDate,
        String RateType, String client, String org, String recordId, String docType, ConnectionProvider conn) {
    boolean useSystemConversionRate = true;
    if (log4j.isDebugEnabled())
        log4j.debug("AcctServer - getConvertedAmount - starting method - Amt : " + Amt + " - CurFrom_ID : "
                + CurFrom_ID + " - CurTo_ID : " + CurTo_ID + "- ConvDate: " + ConvDate + " - RateType:"
                + RateType + " - client:" + client + "- org:" + org);

    if (Amt.equals(""))
        throw new IllegalArgumentException("AcctServer - getConvertedAmt - required parameter missing - Amt");
    if ((CurFrom_ID.equals(CurTo_ID) && !docType.equals(EXCHANGE_DOCTYPE_Transaction)) || Amt.equals("0"))
        return Amt;
    AcctServerData[] data = null;// w w  w. ja  va 2s . c  o m
    OBContext.setAdminMode();
    try {
        if (ConvDate != null && ConvDate.equals(""))
            ConvDate = DateTimeData.today(conn);
        // ConvDate IN DATE
        if (RateType == null || RateType.equals(""))
            RateType = "S";
        data = AcctServerData.currencyConvert(conn, Amt, CurFrom_ID, CurTo_ID, ConvDate, RateType, client, org);
        // Search if exists any conversion rate at document level

        OBCriteria<ConversionRateDoc> docRateCriteria = OBDal.getInstance()
                .createCriteria(ConversionRateDoc.class);
        if (docType.equals(EXCHANGE_DOCTYPE_Invoice) && recordId != null) {
            docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_TOCURRENCY,
                    OBDal.getInstance().get(Currency.class, CurTo_ID)));
            docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_CURRENCY,
                    OBDal.getInstance().get(Currency.class, CurFrom_ID)));
            // get reversed invoice id if exist.
            OBCriteria<ReversedInvoice> reversedCriteria = OBDal.getInstance()
                    .createCriteria(ReversedInvoice.class);
            reversedCriteria.add(Restrictions.eq(ReversedInvoice.PROPERTY_INVOICE,
                    OBDal.getInstance().get(Invoice.class, recordId)));
            if (!reversedCriteria.list().isEmpty()) {
                String strDateFormat;
                strDateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties()
                        .getProperty("dateFormat.java");
                final SimpleDateFormat dateFormat = new SimpleDateFormat(strDateFormat);
                ConvDate = dateFormat
                        .format(reversedCriteria.list().get(0).getReversedInvoice().getAccountingDate());
                data = AcctServerData.currencyConvert(conn, Amt, CurFrom_ID, CurTo_ID, ConvDate, RateType,
                        client, org);
                docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_INVOICE, OBDal.getInstance()
                        .get(Invoice.class, reversedCriteria.list().get(0).getReversedInvoice().getId())));
            } else {
                docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_INVOICE,
                        OBDal.getInstance().get(Invoice.class, recordId)));
            }
            useSystemConversionRate = false;
        } else if (docType.equals(EXCHANGE_DOCTYPE_Payment)) {
            docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_TOCURRENCY,
                    OBDal.getInstance().get(Currency.class, CurTo_ID)));
            docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_CURRENCY,
                    OBDal.getInstance().get(Currency.class, CurFrom_ID)));
            docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_PAYMENT,
                    OBDal.getInstance().get(FIN_Payment.class, recordId)));
            useSystemConversionRate = false;
        } else if (docType.equals(EXCHANGE_DOCTYPE_Transaction)) {
            APRM_FinaccTransactionV a = OBDal.getInstance().get(APRM_FinaccTransactionV.class, recordId);
            if (a.getForeignCurrency() != null) { // && !a.getForeignCurrency().getId().equals(CurTo_ID)
                String strDateFormat;
                strDateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties()
                        .getProperty("dateFormat.java");
                final SimpleDateFormat dateFormat = new SimpleDateFormat(strDateFormat);
                Amt = a.getForeignAmount().toString();
                data = AcctServerData.currencyConvert(conn, Amt, a.getForeignCurrency().getId(), CurTo_ID,
                        ConvDate, RateType, client, org);
                docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_TOCURRENCY,
                        OBDal.getInstance().get(Currency.class, CurTo_ID)));
                docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_CURRENCY,
                        OBDal.getInstance().get(Currency.class, a.getForeignCurrency().getId())));
            } else {
                docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_TOCURRENCY,
                        OBDal.getInstance().get(Currency.class, CurTo_ID)));
                docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_CURRENCY,
                        OBDal.getInstance().get(Currency.class, CurFrom_ID)));
            }
            docRateCriteria.add(Restrictions.eq(ConversionRateDoc.PROPERTY_FINANCIALACCOUNTTRANSACTION,
                    OBDal.getInstance().get(APRM_FinaccTransactionV.class, recordId)));
            useSystemConversionRate = false;
        }
        if (docType.equals(EXCHANGE_DOCTYPE_Invoice) || docType.equals(EXCHANGE_DOCTYPE_Payment)
                || docType.equals(EXCHANGE_DOCTYPE_Transaction)) {
            List<ConversionRateDoc> conversionRates = docRateCriteria.list();
            if (!conversionRates.isEmpty() && !useSystemConversionRate) {
                BigDecimal Amount = new BigDecimal(Amt);
                BigDecimal AmountConverted = Amount.multiply(conversionRates.get(0).getRate()).setScale(2,
                        BigDecimal.ROUND_HALF_UP);
                return AmountConverted.toString();
            }
        }
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    } finally {
        OBContext.restorePreviousMode();
    }
    if (data == null || data.length == 0) {
        /*
         * log4j.error("No conversion ratio"); throw new
         * ServletException("No conversion ratio defined!");
         */
        return "";
    } else {
        if (log4j.isDebugEnabled())
            log4j.debug("getConvertedAmount - converted:" + data[0].converted);
        return data[0].converted;
    }
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

/**
 * Save to Disk - set posted flag//from www. j a va2  s  .c  o  m
 * 
 * @param conn
 *          connection
 * @param strUser
 *          AD_User_ID
 * @return true if saved
 */
private final boolean save(ConnectionProvider conn, String strUser) {
    int no = 0;
    try {
        no = AcctServerData.updateSave(conn, tableName, Status, strUser, Record_ID);
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
    return no == 1;
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

/**
 * Create MatchInv record/* w  ww .j a  v  a 2 s.c  om*/
 * 
 * @param AD_Client_ID
 *          Client
 * @param AD_Org_ID
 *          Org
 * @param M_InOutLine_ID
 *          Receipt
 * @param C_InvoiceLine_ID
 *          Invoice
 * @param M_Product_ID
 *          Product
 * @param DateTrx
 *          Date
 * @param Qty
 *          Qty
 * @return true if record created
 */
private int createMatchInv(String AD_Client_ID, String AD_Org_ID, String M_InOutLine_ID,
        String C_InvoiceLine_ID, String M_Product_ID, String DateTrx, String Qty, VariablesSecureApp vars,
        ConnectionProvider conn, Connection con) {
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - createMatchInv - InvLine=" +
    // C_InvoiceLine_ID + ",Rec=" + M_InOutLine_ID + ", Qty=" + Qty + ", " +
    // DateTrx);
    int no = 0;
    try {
        String M_MatchInv_ID = SequenceIdData.getUUID();
        //
        no = AcctServerData.insertMatchInv(con, conn, M_MatchInv_ID, AD_Client_ID, AD_Org_ID, M_InOutLine_ID,
                C_InvoiceLine_ID, M_Product_ID, DateTrx, Qty);
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
    return no;
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

/**
 * Calculate Period ID. Set to -1 if no period open, 0 if no period control
 *///w  ww  .j  a  v  a  2 s .c  o m
public void setC_Period_ID() {
    if (C_Period_ID != null)
        return;
    if (log4j.isDebugEnabled())
        log4j.debug("AcctServer - setC_Period_ID - AD_Client_ID - " + AD_Client_ID + "--DateAcct - " + DateAcct
                + "--DocumentType -" + DocumentType);
    AcctServerData[] data = null;
    try {
        if (log4j.isDebugEnabled())
            log4j.debug("setC_Period_ID - inside try - AD_Client_ID - " + AD_Client_ID + " -- DateAcct - "
                    + DateAcct + " -- DocumentType - " + DocumentType);
        data = AcctServerData.periodOpen(connectionProvider, AD_Client_ID, DocumentType, AD_Org_ID, DateAcct);
        C_Period_ID = data[0].period;
        if (log4j.isDebugEnabled())
            log4j.debug("AcctServer - setC_Period_ID - " + AD_Client_ID + "/" + DateAcct + "/" + DocumentType
                    + " => " + C_Period_ID);
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

public void loadDocumentType(boolean supressWarnings) {
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - loadDocumentType - DocumentType: " +
    // DocumentType + " - C_DocType_ID : " + C_DocType_ID);
    try {/*from  w w  w .  j  a  va2 s  .  c o  m*/
        if (/* DocumentType.equals("") && */C_DocType_ID != null && C_DocType_ID != "") {
            AcctServerData[] data = AcctServerData.selectDocType(connectionProvider, C_DocType_ID);
            DocumentType = data[0].docbasetype;
            GL_Category_ID = data[0].glCategoryId;
            IsReversal = data[0].isreversal;
            IsReturn = data[0].isreturn;
        }
        // We have a document Type, but no GL info - search for DocType
        if (GL_Category_ID != null && GL_Category_ID.equals("")) {
            AcctServerData[] data = AcctServerData.selectGLCategory(connectionProvider, AD_Client_ID,
                    DocumentType);
            if (data != null && data.length != 0) {
                GL_Category_ID = data[0].glCategoryId;
                IsReversal = data[0].isreversal;
                IsReturn = data[0].isreturn;
            }
        }
        if (!supressWarnings && DocumentType != null && DocumentType.equals(""))
            log4j.warn("AcctServer - loadDocumentType - No DocType for GL Info");
        if (GL_Category_ID != null && GL_Category_ID.equals("")) {
            AcctServerData[] data = AcctServerData.selectDefaultGLCategory(connectionProvider, AD_Client_ID);
            GL_Category_ID = data[0].glCategoryId;
        }
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
    if (GL_Category_ID != null && GL_Category_ID.equals(""))
        log4j.warn("AcctServer - loadDocumentType - No GL Info");
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - loadDocumentType -" + tableName + "_ID : "
    // + Record_ID + " - C_DocType_ID: " + C_DocType_ID +
    // " - DocumentType: " + DocumentType);
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

/**
 * This method handles the accounting of the record identified by strClave. Due to the possibility
 * of developing processes that may run after the standard accounting the commit of the
 * transactions made in this method cannot be done here. The commit must be handled in the caller
 * of this method appropriately. Realize that you must handle the commit of the transactions made
 * through a normal or a DAL connection.
 *//*w w w. j a  v  a2s.  c  om*/
public boolean post(String strClave, boolean force, VariablesSecureApp vars, ConnectionProvider conn,
        Connection con) throws ServletException {
    Record_ID = strClave;
    if (log4j.isDebugEnabled())
        log4j.debug("post " + strClave + " tablename: " + tableName);
    try {
        if (AcctServerData.update(conn, tableName, strClave) != 1) {
            log4j.warn("AcctServer - Post -Cannot lock Document - ignored: " + tableName + "_ID=" + strClave);
            setStatus(STATUS_DocumentLocked); // Status locked document
            this.setMessageResult(conn, vars, STATUS_DocumentLocked, "Error");
            return false;
        } else
            AcctServerData.delete(connectionProvider, AD_Table_ID, Record_ID);
        if (log4j.isDebugEnabled())
            log4j.debug("AcctServer - Post -TableName -" + tableName + "- ad_client_id -" + AD_Client_ID + "- "
                    + tableName + "_id -" + strClave);
        try {
            loadObjectFieldProvider(connectionProvider, AD_Client_ID, strClave);
        } catch (ServletException e) {
            log4j.warn(e);
            e.printStackTrace();
        }
        FieldProvider data[] = getObjectFieldProvider();
        // If there is any template active for current document in any accounting schema, skip this
        // step as getDocumentConfirmation can lock template
        try {
            if ((disableDocumentConfirmation() || getDocumentConfirmation(conn, Record_ID))
                    && post(data, force, vars, conn, con)) {
                success++;
            } else {
                errors++;
                if (messageResult == null)
                    setMessageResult(conn, vars, getStatus(), "");
                save(conn, vars.getUser());
            }
        } catch (Exception e) {
            errors++;
            Status = AcctServer.STATUS_Error;
            save(conn, vars.getUser());
            log4j.error("An error ocurred posting RecordId: " + strClave + " - tableId: " + AD_Table_ID, e);
        }
    } catch (ServletException e) {
        log4j.error(e);
        return false;
    }
    return true;
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

/**
 * Matching/* w w w  .j a v a2 s. co m*/
 * 
 * <pre>
 *  Derive Invoice-Receipt Match from PO-Invoice and PO-Receipt
 *  Purchase Order (20)
 *  - Invoice1 (10)
 *  - Invoice2 (10)
 *  - Receipt1 (5)
 *  - Receipt2 (15)
 *  (a) Creates Directs
 *      - Invoice1 - Receipt1 (5)
 *      - Invoice2 - Receipt2 (10)
 *  (b) Creates Indirects
 *      - Invoice1 - Receipt2 (5)
 *  (Not imlemented)
 * 
 * 
 * </pre>
 * 
 * @return number of records created
 */
public int match(VariablesSecureApp vars, ConnectionProvider conn, Connection con) {
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - Match--Starting");
    int counter = 0;
    // (a) Direct Matches
    AcctServerData[] data = null;
    try {
        data = AcctServerData.selectMatch(conn, AD_Client_ID);
        for (int i = 0; i < data.length; i++) {
            BigDecimal qty1 = new BigDecimal(data[i].qty1);
            BigDecimal qty2 = new BigDecimal(data[i].qty2);
            BigDecimal Qty = qty1.min(qty2);
            if (Qty.toString().equals("0"))
                continue;
            // if (log4j.isDebugEnabled())
            // log4j.debug("AcctServer - Match--dateTrx1 :->" + data[i].datetrx1
            // + "Match--dateTrx2: ->" + data[i].datetrx2);
            String dateTrx1 = data[i].datetrx1;
            String dateTrx2 = data[i].datetrx2;
            String compare = "";
            try {
                compare = DateTimeData.compare(conn, dateTrx1, dateTrx2);
            } catch (ServletException e) {
                log4j.warn(e);
                e.printStackTrace();
            }
            String DateTrx = dateTrx1;
            if (compare.equals("-1"))
                DateTrx = dateTrx2;
            //
            String strQty = Qty.toString();
            String strDateTrx = DateTrx;
            String AD_Client_ID = data[i].adClientId;
            String AD_Org_ID = data[i].adOrgId;
            String C_InvoiceLine_ID = data[i].cInvoicelineId;
            String M_InOutLine_ID = data[i].mInoutlineId;
            String M_Product_ID = data[i].mProductId;
            //
            if (createMatchInv(AD_Client_ID, AD_Org_ID, M_InOutLine_ID, C_InvoiceLine_ID, M_Product_ID,
                    strDateTrx, strQty, vars, conn, con) == 1)
                counter++;
        }
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - Matcher.match - Client_ID=" + AD_Client_ID
    // + ", Records created=" + counter);
    return counter;
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

public boolean loadDocument(FieldProvider[] data, boolean force, ConnectionProvider conn, Connection con) {
    if (log4j.isDebugEnabled())
        log4j.debug("loadDocument " + data.length);

    setStatus(STATUS_NotPosted);//  www .j ava  2 s. com
    Name = "";
    AD_Client_ID = data[0].getField("AD_Client_ID");
    AD_Org_ID = data[0].getField("AD_Org_ID");
    C_BPartner_ID = data[0].getField("C_BPartner_ID");
    M_Product_ID = data[0].getField("M_Product_ID");
    AD_OrgTrx_ID = data[0].getField("AD_OrgTrx_ID");
    C_SalesRegion_ID = data[0].getField("C_SalesRegion_ID");
    C_Project_ID = data[0].getField("C_Project_ID");
    C_Campaign_ID = data[0].getField("C_Campaign_ID");
    C_Activity_ID = data[0].getField("C_Activity_ID");
    C_LocFrom_ID = data[0].getField("C_LocFrom_ID");
    C_LocTo_ID = data[0].getField("C_LocTo_ID");
    User1_ID = data[0].getField("User1_ID");
    User2_ID = data[0].getField("User2_ID");
    C_Costcenter_ID = data[0].getField("C_Costcenter_ID");

    Name = data[0].getField("Name");
    DocumentNo = data[0].getField("DocumentNo");
    DateAcct = data[0].getField("DateAcct");
    DateDoc = data[0].getField("DateDoc");
    C_Period_ID = data[0].getField("C_Period_ID");
    C_Currency_ID = data[0].getField("C_Currency_ID");
    C_DocType_ID = data[0].getField("C_DocType_ID");
    C_Charge_ID = data[0].getField("C_Charge_ID");
    ChargeAmt = data[0].getField("ChargeAmt");
    C_BankAccount_ID = data[0].getField("C_BankAccount_ID");
    if (log4j.isDebugEnabled())
        log4j.debug("AcctServer - loadDocument - C_BankAccount_ID : " + C_BankAccount_ID);
    Posted = data[0].getField("Posted");
    if (!loadDocumentDetails(data, conn))
        loadDocumentType();
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - loadDocument - DocumentDetails Loaded");
    if ((DateAcct == null || DateAcct.equals("")) && (DateDoc != null && !DateDoc.equals("")))
        DateAcct = DateDoc;
    else if ((DateDoc == null || DateDoc.equals("")) && (DateAcct != null && !DateAcct.equals("")))
        DateDoc = DateAcct;
    // DocumentNo (or Name)
    if (DocumentNo == null || DocumentNo.length() == 0)
        DocumentNo = Name;
    // if (DocumentNo == null || DocumentNo.length() ==
    // 0)(DateDoc.equals("") && !DateAcct.equals(""))
    // DocumentNo = "";

    // Check Mandatory Info
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - loadDocument - C_Currency_ID : " +
    // C_Currency_ID);
    String error = "";
    if (AD_Table_ID == null || AD_Table_ID.equals(""))
        error += " AD_Table_ID";
    if (Record_ID == null || Record_ID.equals(""))
        error += " Record_ID";
    if (AD_Client_ID == null || AD_Client_ID.equals(""))
        error += " AD_Client_ID";
    if (AD_Org_ID == null || AD_Org_ID.equals(""))
        error += " AD_Org_ID";
    if (C_Currency_ID == null || C_Currency_ID.equals(""))
        error += " C_Currency_ID";
    if (DateAcct == null || DateAcct.equals(""))
        error += " DateAcct";
    if (DateDoc == null || DateDoc.equals(""))
        error += " DateDoc";
    if (error.length() > 0) {
        log4j.warn("AcctServer - loadDocument - " + DocumentNo + " - Mandatory info missing: " + error);
        return false;
    }
    try {
        dateAcct = OBDateUtils.getDate(DateAcct);
    } catch (ParseException e1) {
        // Do nothing
    }

    // Delete existing Accounting
    if (force) {
        if (Posted.equals("Y") && !isPeriodOpen()) { // already posted -
            // don't delete if
            // period closed
            log4j.warn("AcctServer - loadDocument - " + DocumentNo
                    + " - Period Closed for already posted document");
            return false;
        }
        // delete it
        try {
            AcctServerData.delete(connectionProvider, AD_Table_ID, Record_ID);
        } catch (ServletException e) {
            log4j.warn(e);
            e.printStackTrace();
        }
        // if (log4j.isDebugEnabled()) log4j.debug("post - deleted=" + no);
    } else if (Posted.equals("Y")) {
        log4j.warn("AcctServer - loadDocument - " + DocumentNo + " - Document already posted");
        return false;
    }
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - loadDocument -finished");
    return true;
}

From source file:org.openbravo.erpCommon.ad_forms.AcctServer.java

/**
 * Get the account for Accounting Schema
 * /*w ww .j  a  v a 2  s .c  om*/
 * @param AcctType
 *          see ACCTTYPE_*
 * @param as
 *          accounting schema
 * @return Account
 */
public final Account getAccount(String AcctType, AcctSchema as, ConnectionProvider conn) {
    BigDecimal AMT = null;
    AcctServerData[] data = null;
    // if (log4j.isDebugEnabled())
    // log4j.debug("*******************************getAccount 1: AcctType:-->"
    // + AcctType);
    try {
        /** Account Type - Invoice */
        if (AcctType.equals(ACCTTYPE_Charge)) { // see getChargeAccount in
            // DocLine
            // if (log4j.isDebugEnabled())
            // log4j.debug("AcctServer - *******************amount(AMT);-->"
            // + getAmount(AMTTYPE_Charge));
            AMT = new BigDecimal(getAmount(AMTTYPE_Charge));
            // if (log4j.isDebugEnabled())
            // log4j.debug("AcctServer - *******************AMT;-->" + AMT);
            int cmp = AMT.compareTo(BigDecimal.ZERO);
            // if (log4j.isDebugEnabled())
            // log4j.debug("AcctServer - ******************* CMP: " + cmp);
            if (cmp == 0)
                return null;
            else if (cmp < 0)
                data = AcctServerData.selectExpenseAcct(conn, C_Charge_ID, as.getC_AcctSchema_ID());
            else
                data = AcctServerData.selectRevenueAcct(conn, C_Charge_ID, as.getC_AcctSchema_ID());
            // if (log4j.isDebugEnabled())
            // log4j.debug("AcctServer - *******************************getAccount 2");
        } else if (AcctType.equals(ACCTTYPE_V_Liability)) {
            data = AcctServerData.selectLiabilityAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_V_Liability_Services)) {
            data = AcctServerData.selectLiabilityServicesAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_C_Receivable)) {
            data = AcctServerData.selectReceivableAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_UnallocatedCash)) {
            /** Account Type - Payment */
            data = AcctServerData.selectUnallocatedCashAcct(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_BankInTransit)) {
            data = AcctServerData.selectInTransitAcct(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_BankInTransitDefault)) {
            data = AcctServerData.selectInTransitDefaultAcct(conn, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_ConvertChargeDefaultAmt)) {
            data = AcctServerData.selectConvertChargeDefaultAmtAcct(conn, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_ConvertGainDefaultAmt)) {
            data = AcctServerData.selectConvertGainDefaultAmtAcct(conn, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_PaymentSelect)) {
            data = AcctServerData.selectPaymentSelectAcct(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_WriteOffDefault)) {
            data = AcctServerData.selectWriteOffDefault(conn, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_WriteOffDefault_Revenue)) {
            data = AcctServerData.selectWriteOffDefaultRevenue(conn, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_DiscountExp)) {
            /** Account Type - Allocation */
            data = AcctServerData.selectDiscountExpAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_DiscountRev)) {
            data = AcctServerData.selectDiscountRevAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_WriteOff)) {
            data = AcctServerData.selectWriteOffAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_WriteOff_Revenue)) {
            data = AcctServerData.selectWriteOffAcctRevenue(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_ConvertChargeLossAmt)) {
            /** Account Type - Bank Statement */
            data = AcctServerData.selectConvertChargeLossAmt(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_ConvertChargeGainAmt)) {
            data = AcctServerData.selectConvertChargeGainAmt(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_BankAsset)) {
            data = AcctServerData.selectAssetAcct(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_InterestRev)) {
            data = AcctServerData.selectInterestRevAcct(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_InterestExp)) {
            data = AcctServerData.selectInterestExpAcct(conn, C_BankAccount_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_CashAsset)) {
            /** Account Type - Cash */
            data = AcctServerData.selectCBAssetAcct(conn, C_CashBook_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_CashTransfer)) {
            data = AcctServerData.selectCashTransferAcct(conn, C_CashBook_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_CashExpense)) {
            data = AcctServerData.selectCBExpenseAcct(conn, C_CashBook_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_CashReceipt)) {
            data = AcctServerData.selectCBReceiptAcct(conn, C_CashBook_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_CashDifference)) {
            data = AcctServerData.selectCBDifferencesAcct(conn, C_CashBook_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_InvDifferences)) {
            /** Inventory Accounts */
            data = AcctServerData.selectWDifferencesAcct(conn, M_Warehouse_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_NotInvoicedReceipts)) {
            if (log4j.isDebugEnabled())
                log4j.debug("AcctServer - getAccount - ACCTYPE_NotInvoicedReceipts - C_BPartner_ID - "
                        + C_BPartner_ID);
            data = AcctServerData.selectNotInvoicedReceiptsAcct(conn, C_BPartner_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_ProjectAsset)) {
            /** Project Accounts */
            data = AcctServerData.selectPJAssetAcct(conn, C_Project_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_ProjectWIP)) {
            data = AcctServerData.selectPJWIPAcct(conn, C_Project_ID, as.getC_AcctSchema_ID());
        } else if (AcctType.equals(ACCTTYPE_PPVOffset)) {
            /** GL Accounts */
            data = AcctServerData.selectPPVOffsetAcct(conn, as.getC_AcctSchema_ID());
        } else {
            log4j.warn("AcctServer - getAccount - Not found AcctType=" + AcctType);
            return null;
        }
        // if (log4j.isDebugEnabled())
        // log4j.debug("AcctServer - *******************************getAccount 3");
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
    // Get Acct
    String Account_ID = "";
    if (data != null && data.length != 0) {
        Account_ID = data[0].accountId;
    } else
        return null;
    // No account
    if (Account_ID.equals("")) {
        log4j.warn("AcctServer - getAccount - NO account Type=" + AcctType + ", Record=" + Record_ID);
        return null;
    }
    // if (log4j.isDebugEnabled())
    // log4j.debug("AcctServer - *******************************getAccount 4");
    // Return Account
    Account acct = null;
    try {
        acct = Account.getAccount(conn, Account_ID);
    } catch (ServletException e) {
        log4j.warn(e);
        e.printStackTrace();
    }
    return acct;
}

From source file:com.bluexml.xforms.controller.alfresco.AlfrescoController.java

public String getWebscriptHelp(AlfrescoTransaction transaction) {
    String result;//w ww .  j a va2 s . co m
    Map<String, String> parameters = new HashMap<String, String>();
    try {
        result = requestString(transaction, parameters, MsgId.INT_WEBSCRIPT_OPCODE_HELP);
    } catch (ServletException e) {
        e.printStackTrace();
        return null;
    }
    return result;
}