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.HashMap;
020:
021: import javax.servlet.http.HttpServletRequest;
022: import javax.servlet.http.HttpServletResponse;
023:
024: import org.ofbiz.entity.GenericDelegator;
025: import org.ofbiz.entity.GenericValue;
026: import org.ofbiz.entity.model.ModelEntity;
027:
028: import com.sourcetap.sfa.event.DataMatrix;
029: import com.sourcetap.sfa.event.GenericEventProcessor;
030: import com.sourcetap.sfa.event.GenericWebEventProcessor;
031: import com.sourcetap.sfa.ui.UICache;
032: import com.sourcetap.sfa.ui.UIWebScreenSection;
033: import com.sourcetap.sfa.util.UserInfo;
034:
035: /**
036: * DOCUMENT ME!
037: *
038: */
039: public class LeadRuleCriteriaWebEventProcessor extends
040: GenericWebEventProcessor {
041: public static final String module = LeadRuleCriteriaWebEventProcessor.class
042: .getName();
043:
044: /**
045: * DOCUMENT ME!
046: *
047: * @param delegator
048: */
049: protected void clearRuleCache(GenericDelegator delegator) {
050: LeadHelper leadHelper = LeadHelper.getInstance(delegator);
051: leadHelper.clearCache();
052: }
053:
054: /**
055: * DOCUMENT ME!
056: *
057: * @param userInfo
058: * @param uiWebScreenSection
059: * @param request
060: * @param response
061: * @param delegator
062: * @param eventProcessor
063: * @param dataMatrix
064: * @param uiCache
065: *
066: * @return
067: */
068: protected int postUpdate(UserInfo userInfo,
069: UIWebScreenSection uiWebScreenSection,
070: HttpServletRequest request, HttpServletResponse response,
071: GenericDelegator delegator,
072: GenericEventProcessor eventProcessor,
073: DataMatrix dataMatrix, UICache uiCache) {
074:
075: clearRuleCache(delegator);
076:
077: return STATUS_CONTINUE;
078: }
079:
080: /**
081: * DOCUMENT ME!
082: *
083: * @param userInfo
084: * @param uiWebScreenSection
085: * @param request
086: * @param response
087: * @param delegator
088: * @param eventProcessor
089: * @param dataMatrix
090: * @param uiCache
091: *
092: * @return
093: */
094: protected int postInsert(UserInfo userInfo,
095: UIWebScreenSection uiWebScreenSection,
096: HttpServletRequest request, HttpServletResponse response,
097: GenericDelegator delegator,
098: GenericEventProcessor eventProcessor,
099: DataMatrix dataMatrix, UICache uiCache) {
100:
101: // Clear the entire UI cache so all users' copies of screen sections will be refreshed.
102: clearRuleCache(delegator);
103:
104: return STATUS_CONTINUE;
105: }
106:
107: /**
108: * DOCUMENT ME!
109: *
110: * @param userInfo
111: * @param uiWebScreenSection
112: * @param request
113: * @param response
114: * @param delegator
115: * @param eventProcessor
116: * @param primaryME
117: * @param fields
118: * @param uiCache
119: *
120: * @return
121: */
122: protected int postDelete(UserInfo userInfo,
123: UIWebScreenSection uiWebScreenSection,
124: HttpServletRequest request, HttpServletResponse response,
125: GenericDelegator delegator,
126: GenericEventProcessor eventProcessor,
127: ModelEntity primaryME, HashMap fields, UICache uiCache) {
128:
129: // Clear the entire UI cache so all users' copies of screen sections will be refreshed.
130: clearRuleCache(delegator);
131:
132: return STATUS_CONTINUE;
133: }
134:
135: /**
136: * This function gets the application path to be used to reconstruct the URI when a
137: * UI History record is logged. Example: "/accounts"
138: * @author John Nutting
139: * @param url The URL used to open the screen section
140: * @return String containing the application path
141: */
142: protected String getUiHistoryAppPath(String url) {
143: return "/LeadRuleCriteriaHeader";
144: }
145:
146: /**
147: * This function gets the description to store in the UI history table. This description
148: * will show up in the UI History drop list.
149: * @author John Nutting
150: * @param dataMatrix DataMatrix object containing the data from the screen
151: * @param delegator Generic delegator through which the data base is accessed
152: * @param action The action being performed on the screen
153: * @param uiWebScreenSection The UIWebScreenSection being used to construct the screen section
154: * @return String containing the UI History description
155: */
156: protected String getUiHistoryDescription(DataMatrix dataMatrix,
157: GenericDelegator delegator, String action,
158: UIWebScreenSection uiWebScreenSection) {
159: GenericValue primaryGV = dataMatrix.getCurrentBuffer()
160: .getGenericValue(0, 0);
161:
162: return "Lead Assignment Criteria: "
163: + primaryGV.getString("leadAssignmentCriteriaId");
164: }
165: }
|