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.attachment;
18:
19: import java.util.List;
20:
21: import javax.servlet.http.HttpServletRequest;
22:
23: import org.ofbiz.entity.condition.EntityOperator;
24:
25: import com.sourcetap.sfa.event.GenericWebEventProcessor;
26: import com.sourcetap.sfa.ui.UIWebScreenSection;
27: import com.sourcetap.sfa.util.QueryInfo;
28:
29: /**
30: * DOCUMENT ME!
31: *
32: */
33: public class AbstractAttachmentWEP extends GenericWebEventProcessor {
34: public static final String module = AbstractAttachmentWEP.class
35: .getName();
36:
37: // overide the default. Link Contact and Deal via the OpportunityContact entity
38: protected void addUseQueryParameterClauses(
39: UIWebScreenSection uiWebScreenSection, QueryInfo queryInfo,
40: List relatedSearchClauses, String primaryEntityName,
41: HttpServletRequest request) {
42: String[] linkParams = { "accountId", "contactId", "dealId",
43: "activityId", "productId", "leadId" };
44: String[] linkEntities = { "AccountFile", "ContactFile",
45: "DealFile", "ActivityFile", "ProductFile", "LeadFile" };
46:
47: for (int i = 0; i < linkParams.length; i++) {
48: String linkValue = request.getParameter(linkParams[i]);
49:
50: if ((linkValue != null) && (linkValue.length() > 0)) {
51:
52: queryInfo.addJoin("FileAttachment", linkEntities[i],
53: Boolean.FALSE, "fileId", "fileId");
54: queryInfo.addCondition(linkEntities[i], linkParams[i],
55: EntityOperator.EQUALS, linkValue);
56: }
57: }
58: }
59: }
|