⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accountwebeventprocessor.java

📁 国外的一套开源CRM
💻 JAVA
字号:
/*
 * 
 * Copyright (c) 2004 SourceTap - www.sourcetap.com
 *
 *  The contents of this file are subject to the SourceTap Public License 
 * ("License"); You may not use this file except in compliance with the 
 * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 */

package com.sourcetap.sfa.account;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.ofbiz.base.util.Debug;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.condition.EntityOperator;

import com.sourcetap.sfa.event.DataMatrix;
import com.sourcetap.sfa.event.GenericEventProcessor;
import com.sourcetap.sfa.event.GenericWebEventProcessor;
import com.sourcetap.sfa.ui.UICache;
import com.sourcetap.sfa.ui.UIWebScreenSection;
import com.sourcetap.sfa.util.QueryInfo;
import com.sourcetap.sfa.util.UserInfo;


/**
 * DOCUMENT ME!
 *
 */
public class AccountWebEventProcessor extends GenericWebEventProcessor {
    private static final boolean DEBUG = false;
	public static final String module = AccountWebEventProcessor.class.getName();

    // overide the default.  do not display accounts with type = BASE.
    protected void addUseQueryParameterClauses(
        UIWebScreenSection uiWebScreenSection, QueryInfo queryInfo,
        List relatedSearchClauses, String primaryEntityName,
        HttpServletRequest request) {
        if (DEBUG) {
            Debug.logVerbose(
                "-->[AccountWebEventProcessor.addUseQueryParameterClauses]", module);
        }

		queryInfo.addCondition("Account", "accountTypeId", EntityOperator.NOT_EQUAL, "base");
    }

    /**
     * DOCUMENT ME!
     *
     * @param userInfo 
     * @param uiWebScreenSection 
     * @param request 
     * @param response 
     * @param delegator 
     * @param eventProcessor 
     * @param dataMatrix 
     * @param uiCache 
     *
     * @return 
     */
    protected int postInsert(UserInfo userInfo,
        UIWebScreenSection uiWebScreenSection, HttpServletRequest request,
        HttpServletResponse response, GenericDelegator delegator,
        GenericEventProcessor eventProcessor, DataMatrix dataMatrix,
        UICache uiCache) {
        if (DEBUG) {
			Debug.logVerbose("-->[AccountWebEventProcessor.postInsert]", module);
        }

        // Need to get the account ID and store it
        // in the request object so the other event processors can read it and store
        //  it on the other entities being created.
        GenericValue accountGV = dataMatrix.getCurrentBuffer().getGenericValue(0,
                0);
        String accountId = accountGV.getString("accountId");

        if (DEBUG) {
			Debug.logVerbose(
                "-->[AccountWebEventProcessor.postInsert] Storing " +
                accountId + " as the account ID in the request object.", module);
        }

        request.setAttribute("com.sourcetap.sfa.account.accountId",
            accountId);

        return STATUS_CONTINUE;
    }

    /**
     * This function gets the application path to be used to reconstruct the URI when a
     * UI History record is logged.  Example: "/accounts"
     * @author  John Nutting
     * @param url The URL used to open the screen section
     * @return String containing the application path
     */
    protected String getUiHistoryAppPath(String url) {
        return "/accounts";
    }

    /**
     * This function gets the description to store in the UI history table.  This description
     * will show up in the UI History drop list.
     * @author  John Nutting
     * @param dataMatrix DataMatrix object containing the data from the screen
     * @param delegator Generic delegator through which the data base is accessed
     * @param action The action being performed on the screen
     * @param uiWebScreenSection The UIWebScreenSection being used to construct the screen section
     * @return String containing the UI History description
     */
    protected String getUiHistoryDescription(DataMatrix dataMatrix,
        GenericDelegator delegator, String action,
        UIWebScreenSection uiWebScreenSection) {
        GenericValue primaryGV = dataMatrix.getCurrentBuffer().getGenericValue(0,
                0);

        return "Account: " +
        ((primaryGV.getString("accountName") == null) ? ""
                                                      : primaryGV.getString(
            "accountName"));
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -