2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 package org.onap.portalsdk.analytics.model.search;
40 import org.onap.portalsdk.analytics.util.AppConstants;
42 public class SearchResultField extends org.onap.portalsdk.analytics.RaptorObject {
43 private String columnId;
44 private String displayValue = "";
46 private String alignment = "Left";
48 private String drillDownLink = null;
50 private String drillDownImage = null;
52 private String confirmationText = null;
54 private boolean isAuthorized = false;
56 public boolean isAuthorized() {
60 public void setAuthorized(boolean isAuthorized) {
61 this.isAuthorized = isAuthorized;
64 public String getConfirmationText() {
65 return confirmationText;
68 public void setConfirmationText(String confirmationText) {
69 this.confirmationText = confirmationText;
72 public String getDrillDownImage() {
73 return drillDownImage;
76 public void setDrillDownImage(String drillDownImage) {
77 this.drillDownImage = drillDownImage;
80 public SearchResultField() {
83 public SearchResultField(String displayValue, String linkIdValue,
84 SearchResultColumn column, boolean isAuthorized) {
90 setColumnId(column.getColumnId());
91 setDisplayValue(displayValue);
92 setAlignment(column.getAlignment());
93 setAuthorized(isAuthorized);
94 if(column.getColumnId().equals("edit")) {
95 setDrillDownLink("report#/report_wizard/"+linkIdValue);
96 setDrillDownImage(column.getLinkImg());
97 setConfirmationText(null);
98 } else if(column.getColumnId().equals("copy")) {
99 setDrillDownLink("report#/report_wizard/copy/"+linkIdValue);
100 setDrillDownImage(column.getLinkImg());
101 setConfirmationText(column.getLinkConfirmMsg());
102 } else if(column.getColumnId().equals("delete")) {
103 setDrillDownLink("raptor.htm?action=report.delete&c_master="+linkIdValue);
104 setDrillDownImage(column.getLinkImg());
105 setConfirmationText(column.getLinkConfirmMsg());
106 } else if(column.getColumnId().equals("schedule")) {
107 setDrillDownLink("report_wizard.htm?action=report.schedule.report.submit_wmenu&c_master="+linkIdValue+"&refresh=Y");
108 setDrillDownImage(column.getLinkImg());
109 setConfirmationText(null);
110 } else if(column.getColumnId().equals("run")) {
111 setDrillDownLink("raptor.htm?action=report.run.container&c_master="+linkIdValue+"&refresh=Y");
112 setDrillDownImage(column.getLinkImg());
113 setConfirmationText(null);
115 if (column.getLinkURL() != null) {
116 StringBuffer sb = new StringBuffer();
118 if (column.getLinkForm() == null) {
119 sb.append("<a href=\"");
120 sb.append(column.getLinkURL());
121 sb.append(nvl(linkIdValue));
122 if (column.getLinkConfirmMsg() != null) {
123 sb.append(" onClick=\"return confirm('");
124 sb.append(column.getLinkConfirmMsg());
128 if (column.getLinkImg() != null) {
129 sb.append("<img src=\"");
130 sb.append(column.getLinkImg());
132 sb.append(column.getLinkImgSizeHtml());
133 sb.append(" border=\"0\"");
134 sb.append(column.getLinkTitle() != null ? " alt=\""
135 + column.getLinkTitle()/*
136 * +(column.isDeleteLink()?"
142 sb.append(column.getLinkTitle());
145 sb.append("<input type=\"");
146 if (column.getLinkImg() != null) {
147 sb.append("image\" src=\"");
148 sb.append(column.getLinkImg());
150 sb.append(column.getLinkImgSizeHtml());
151 sb.append(" border=\"0\"");
152 sb.append(column.getLinkTitle() != null ? " alt=\""
153 + column.getLinkTitle()/*
154 * +(column.isDeleteLink()?"
159 sb.append("submit\" value=\"");
160 sb.append(column.getLinkTitle());
163 sb.append(" onClick=\"");
164 if (column.getLinkConfirmMsg() != null) {
165 sb.append("if(! confirm('");
166 sb.append(column.getLinkConfirmMsg());
167 sb.append("')) return false; ");
169 sb.append(column.getLinkURL());
170 sb.append(" document.");
171 sb.append(column.getLinkForm());
173 sb.append(AppConstants.RI_REPORT_ID);
174 sb.append(".value='");
175 sb.append(nvl(linkIdValue));
177 sb.append(" document.");
178 sb.append(column.getLinkForm());
180 sb.append("refresh");
181 sb.append(".value='");
186 setDrillDownLink(sb.toString());
189 } // SearchResultField
191 public String getDisplayValue() {
195 public String getAlignment() {
199 public String getDrillDownLink() {
200 return drillDownLink;
203 public void setDisplayValue(String displayValue) {
204 this.displayValue = nvl(displayValue);
207 public void setAlignment(String alignment) {
208 this.alignment = alignment;
211 public void setDrillDownLink(String drillDownLink) {
212 this.drillDownLink = drillDownLink;
215 public String getTooltipValue() {
216 return (displayValue.length() == 0) ? " " : displayValue;
219 /*public String getAlignmentHtml() {
220 return (alignment.length() == 0) ? "" : (" align=" + alignment);
223 /*public String getDisplayValueLinkHtml() {
224 if (nvl(drillDownLink).length() == 0)
225 return getDisplayValueHtml();
227 return getDrillDownLink();
228 } // getDisplayValueLinkHtml*/
230 public String getColumnId() {
234 public void setColumnId(String columnId) {
235 this.columnId = columnId;
239 } // SearchResultField