001: /*
002: *
003: * Copyright (c) 2004 SourceTap - www.sourcetap.com
004: *
005: * The contents of this file are subject to the SourceTap Public License
006: * ("License"); You may not use this file except in compliance with the
007: * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
008: * Software distributed under the License is distributed on an "AS IS" basis,
009: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
010: * the specific language governing rights and limitations under the License.
011: *
012: * The above copyright notice and this permission notice shall be included
013: * in all copies or substantial portions of the Software.
014: *
015: */
016:
017: package com.sourcetap.sfa.lead;
018:
019: import java.util.List;
020:
021: import javax.servlet.http.HttpServletRequest;
022: import javax.servlet.http.HttpServletResponse;
023:
024: import org.ofbiz.base.util.Debug;
025: import org.ofbiz.entity.GenericDelegator;
026: import org.ofbiz.entity.GenericValue;
027: import org.ofbiz.entity.condition.EntityOperator;
028:
029: import com.sourcetap.sfa.event.DataMatrix;
030: import com.sourcetap.sfa.event.GenericEventProcessor;
031: import com.sourcetap.sfa.event.GenericWebEventProcessor;
032: import com.sourcetap.sfa.ui.UICache;
033: import com.sourcetap.sfa.ui.UIWebScreenSection;
034: import com.sourcetap.sfa.util.QueryInfo;
035: import com.sourcetap.sfa.util.UserInfo;
036:
037: /**
038: * DOCUMENT ME!
039: *
040: */
041: public class LeadWebEventProcessor extends GenericWebEventProcessor {
042: public static final String module = LeadWebEventProcessor.class
043: .getName();
044:
045: // overide the default. do not display converted leads.
046: protected void addUseQueryParameterClauses(
047: UIWebScreenSection uiWebScreenSection, QueryInfo queryInfo,
048: List relatedSearchClauses, String primaryEntityName,
049: HttpServletRequest request) {
050:
051: queryInfo.addCondition("Lead", "convertedDate",
052: EntityOperator.EQUALS, null);
053: }
054:
055: /**
056: * DOCUMENT ME!
057: *
058: * @param userInfo
059: * @param uiWebScreenSection
060: * @param request
061: * @param response
062: * @param delegator
063: * @param eventProcessor
064: * @param dataMatrix
065: * @param uiCache
066: *
067: * @return
068: */
069: protected int postUpdate(UserInfo userInfo,
070: UIWebScreenSection uiWebScreenSection,
071: HttpServletRequest request, HttpServletResponse response,
072: GenericDelegator delegator,
073: GenericEventProcessor eventProcessor,
074: DataMatrix dataMatrix, UICache uiCache) {
075: Debug.logVerbose("Start postUpdate", module);
076:
077: return STATUS_CONTINUE;
078: }
079:
080: /**
081: * This function gets the application path to be used to reconstruct the URI when a
082: * UI History record is logged. Example: "/accounts"
083: * @author John Nutting
084: * @param url The URL used to open the screen section
085: * @return String containing the application path
086: */
087: protected String getUiHistoryAppPath(String url) {
088: return "/leadDetail";
089: }
090:
091: /**
092: * This function gets the description to store in the UI history table. This description
093: * will show up in the UI History drop list.
094: * @author John Nutting
095: * @param dataMatrix DataMatrix object containing the data from the screen
096: * @param delegator Generic delegator through which the data base is accessed
097: * @param action The action being performed on the screen
098: * @param uiWebScreenSection The UIWebScreenSection being used to construct the screen section
099: * @return String containing the UI History description
100: */
101: protected String getUiHistoryDescription(DataMatrix dataMatrix,
102: GenericDelegator delegator, String action,
103: UIWebScreenSection uiWebScreenSection) {
104: GenericValue primaryGV = dataMatrix.getCurrentBuffer()
105: .getGenericValue(0, 0);
106:
107: return "Lead: " + primaryGV.getString("firstName") + " "
108: + primaryGV.getString("lastName");
109: }
110: }
|