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.code;
018:
019: import java.util.List;
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:
027: import com.sourcetap.sfa.event.DataMatrix;
028: import com.sourcetap.sfa.event.GenericEventProcessor;
029: import com.sourcetap.sfa.event.GenericWebEventProcessor;
030: import com.sourcetap.sfa.ui.UIWebScreenSection;
031: import com.sourcetap.sfa.util.UserInfo;
032:
033: /**
034: * DOCUMENT ME!
035: *
036: */
037: public class CodeWebEventProcessor extends GenericWebEventProcessor {
038:
039: /**
040: * DOCUMENT ME!
041: *
042: * @param userInfo
043: * @param uiWebScreenSection
044: * @param request
045: * @param response
046: * @param delegator
047: * @param eventProcessor
048: * @param dataMatrix
049: * @param entityNameList
050: *
051: * @return
052: */
053: protected int postCreate(UserInfo userInfo,
054: UIWebScreenSection uiWebScreenSection,
055: HttpServletRequest request, HttpServletResponse response,
056: GenericDelegator delegator,
057: GenericEventProcessor eventProcessor,
058: DataMatrix dataMatrix, List entityNameList) {
059:
060: // Clear the code ID and parent code ID if they was set from passed-in parameters.
061: GenericValue codeGV = dataMatrix.getCurrentBuffer()
062: .getGenericValue(0, 0);
063:
064: // codeGV.set("codeId", "");
065: // codeGV.set("parentCodeId", "");
066: // Set the visible and active flags to true.
067: codeGV.set("isVisible", new Boolean(true));
068: codeGV.set("isActive", new Boolean(true));
069:
070: return STATUS_CONTINUE;
071: }
072:
073: /**
074: * This function gets the application path to be used to reconstruct the URI when a
075: * UI History record is logged. Example: "/accounts"
076: * @author John Nutting
077: * @param url The URL used to open the screen section
078: * @return String containing the application path
079: */
080: protected String getUiHistoryAppPath(String url) {
081: return "/codes";
082: }
083:
084: /**
085: * This function gets the description to store in the UI history table. This description
086: * will show up in the UI History drop list.
087: * @author John Nutting
088: * @param dataMatrix DataMatrix object containing the data from the screen
089: * @param delegator Generic delegator through which the data base is accessed
090: * @param action The action being performed on the screen
091: * @param uiWebScreenSection The UIWebScreenSection being used to construct the screen section
092: * @return String containing the UI History description
093: */
094: protected String getUiHistoryDescription(DataMatrix dataMatrix,
095: GenericDelegator delegator, String action,
096: UIWebScreenSection uiWebScreenSection) {
097: GenericValue primaryGV = dataMatrix.getCurrentBuffer()
098: .getGenericValue(0, 0);
099:
100: return "Code: " + primaryGV.getString("codeTypeId") + "/"
101: + primaryGV.getString("codeValue");
102: }
103: }
|