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