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.issue;
018:
019: import org.ofbiz.entity.GenericDelegator;
020: import org.ofbiz.entity.GenericEntityException;
021: import org.ofbiz.entity.GenericValue;
022:
023: import com.sourcetap.sfa.event.DataMatrix;
024: import com.sourcetap.sfa.event.GenericWebEventProcessor;
025: import com.sourcetap.sfa.ui.UICache;
026: import com.sourcetap.sfa.ui.UIScreenSection;
027: import com.sourcetap.sfa.ui.UIWebScreenSection;
028: import com.sourcetap.sfa.util.UserInfo;
029:
030: /**
031: * DOCUMENT ME!
032: *
033: */
034: public class IssueWebEventProcessor extends GenericWebEventProcessor {
035: public static final String module = IssueEventProcessor.class
036: .getName();
037:
038: /**
039: * DOCUMENT ME!
040: *
041: * @param userInfo
042: * @param screenName
043: * @param sectionName
044: * @param delegator
045: * @param uiCache
046: *
047: * @return
048: *
049: * @throws GenericEntityException
050: */
051: protected UIWebScreenSection getUiWebScreenSection(
052: UserInfo userInfo, String screenName, String sectionName,
053: GenericDelegator delegator, UICache uiCache)
054: throws GenericEntityException {
055: // This method is here so a child class can specify a different screen section class.
056:
057: UIScreenSection uiScreenSection = uiCache.getUiScreenSection(
058: screenName, sectionName, userInfo.getPartyId());
059: UIWebScreenSectionIssue uiWebScreenSectionIssue = null;
060:
061: if (uiScreenSection == null) {
062:
063: uiWebScreenSectionIssue = new UIWebScreenSectionIssue(
064: userInfo, screenName, sectionName, delegator,
065: uiCache);
066: uiCache.putUiScreenSection(screenName, sectionName,
067: userInfo.getPartyId(),
068: (UIScreenSection) uiWebScreenSectionIssue);
069: } else {
070:
071: uiWebScreenSectionIssue = (UIWebScreenSectionIssue) uiScreenSection;
072: }
073:
074: return (UIWebScreenSection) uiWebScreenSectionIssue;
075: }
076:
077: /**
078: * This function gets the application path to be used to reconstruct the URI when a
079: * UI History record is logged. Example: "/accounts"
080: * @author John Nutting
081: * @param url The URL used to open the screen section
082: * @return String containing the application path
083: */
084: protected String getUiHistoryAppPath(String url) {
085: return "/issues";
086: }
087:
088: /**
089: * This function gets the description to store in the UI history table. This description
090: * will show up in the UI History drop list.
091: * @author John Nutting
092: * @param dataMatrix DataMatrix object containing the data from the screen
093: * @param delegator Generic delegator through which the data base is accessed
094: * @param action The action being performed on the screen
095: * @param uiWebScreenSection The UIWebScreenSection being used to construct the screen section
096: * @return String containing the UI History description
097: */
098: protected String getUiHistoryDescription(DataMatrix dataMatrix,
099: GenericDelegator delegator, String action,
100: UIWebScreenSection uiWebScreenSection) {
101: GenericValue primaryGV = dataMatrix.getCurrentBuffer()
102: .getGenericValue(0, 0);
103:
104: return "Issue: " + primaryGV.getString("issueId");
105: }
106: }
|