01: /*
02: *
03: * Copyright (c) 2004 SourceTap - www.sourcetap.com
04: *
05: * The contents of this file are subject to the SourceTap Public License
06: * ("License"); You may not use this file except in compliance with the
07: * License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
08: * Software distributed under the License is distributed on an "AS IS" basis,
09: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
10: * the specific language governing rights and limitations under the License.
11: *
12: * The above copyright notice and this permission notice shall be included
13: * in all copies or substantial portions of the Software.
14: *
15: */
16:
17: package com.sourcetap.sfa.contact;
18:
19: import java.util.HashMap;
20: import java.util.Iterator;
21: import java.util.List;
22: import java.util.Map;
23:
24: import javax.servlet.http.HttpServletRequest;
25:
26: import org.ofbiz.entity.condition.EntityOperator;
27:
28: import com.sourcetap.sfa.event.GenericWebEventProcessor;
29: import com.sourcetap.sfa.ui.UIWebScreenSection;
30: import com.sourcetap.sfa.util.QueryInfo;
31:
32: /**
33: * DOCUMENT ME!
34: *
35: */
36: public class ContactOpportunityListWEP extends GenericWebEventProcessor {
37: public static final String module = ContactOpportunityListWEP.class
38: .getName();
39:
40: // overide the default. Link Contact and Deal via the OpportunityContact entity
41: protected void addUseQueryParameterClauses(
42: UIWebScreenSection uiWebScreenSection, QueryInfo queryInfo,
43: List relatedSearchClauses, String primaryEntityName,
44: HttpServletRequest request) {
45: HashMap paramMap = uiWebScreenSection
46: .getUseQueryParameterValueMap();
47: Iterator params = paramMap.entrySet().iterator();
48:
49: while (params.hasNext()) {
50: Map.Entry param = (Map.Entry) params.next();
51: String searchAttribName = (String) param.getKey();
52: String searchAttribValue = (String) param.getValue();
53:
54: if (searchAttribName.equals("contactId")) {
55: queryInfo.addJoin("OpportunityContact", "Deal",
56: Boolean.FALSE, "dealId", "dealId");
57: queryInfo.addCondition("OpportunityContact",
58: "contactId", EntityOperator.EQUALS,
59: searchAttribValue);
60: } else {
61: queryInfo.addCondition(primaryEntityName,
62: searchAttribName, EntityOperator.EQUALS,
63: searchAttribValue);
64: }
65: }
66: }
67: }
|