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============================================
36 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
38 package org.onap.portalsdk.analytics.model.search;
40 import org.onap.portalsdk.analytics.util.*;
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;
56 public String getConfirmationText() {
57 return confirmationText;
60 public void setConfirmationText(String confirmationText) {
61 this.confirmationText = confirmationText;
64 public String getDrillDownImage() {
65 return drillDownImage;
68 public void setDrillDownImage(String drillDownImage) {
69 this.drillDownImage = drillDownImage;
72 public SearchResultField() {
75 public SearchResultField(String displayValue, String linkIdValue,
76 SearchResultColumn column, boolean isAuthorized) {
82 setColumnId(column.getColumnId());
83 setDisplayValue(displayValue);
84 setAlignment(column.getAlignment());
85 if(column.getColumnId().equals("edit")) {
86 // setDrillDownLink("report_wizard.htm?action=report.edit&c_master="+linkIdValue);
87 setDrillDownLink("report#/report_wizard/"+linkIdValue);
88 setDrillDownImage(column.getLinkImg());
89 setConfirmationText(null);
90 } else if(column.getColumnId().equals("copy")) {
91 // setDrillDownLink("report_wizard.htm?action=report.copy&c_master="+linkIdValue);
92 setDrillDownLink("report#/report_wizard/copy/"+linkIdValue);
93 setDrillDownImage(column.getLinkImg());
94 setConfirmationText(column.getLinkConfirmMsg());
95 } else if(column.getColumnId().equals("delete")) {
96 setDrillDownLink("raptor.htm?action=report.delete&c_master="+linkIdValue);
97 setDrillDownImage(column.getLinkImg());
98 setConfirmationText(column.getLinkConfirmMsg());
99 } else if(column.getColumnId().equals("schedule")) {
100 setDrillDownLink("report_wizard.htm?action=report.schedule.report.submit_wmenu&c_master="+linkIdValue+"&refresh=Y");
101 setDrillDownImage(column.getLinkImg());
102 setConfirmationText(null);
103 } else if(column.getColumnId().equals("run")) {
104 setDrillDownLink("raptor.htm?action=report.run.container&c_master="+linkIdValue+"&refresh=Y");
105 setDrillDownImage(column.getLinkImg());
106 setConfirmationText(null);
108 if (column.getLinkURL() != null) {
109 StringBuffer sb = new StringBuffer();
111 if (column.getLinkForm() == null) {
112 sb.append("<a href=\"");
113 sb.append(column.getLinkURL());
114 sb.append(nvl(linkIdValue));
115 if (column.getLinkConfirmMsg() != null) {
116 sb.append(" onClick=\"return confirm('");
117 sb.append(column.getLinkConfirmMsg());
121 if (column.getLinkImg() != null) {
122 sb.append("<img src=\"");
123 sb.append(column.getLinkImg());
125 sb.append(column.getLinkImgSizeHtml());
126 sb.append(" border=\"0\"");
127 sb.append(column.getLinkTitle() != null ? " alt=\""
128 + column.getLinkTitle()/*
129 * +(column.isDeleteLink()?"
135 sb.append(column.getLinkTitle());
138 sb.append("<input type=\"");
139 if (column.getLinkImg() != null) {
140 sb.append("image\" src=\"");
141 sb.append(column.getLinkImg());
143 sb.append(column.getLinkImgSizeHtml());
144 sb.append(" border=\"0\"");
145 sb.append(column.getLinkTitle() != null ? " alt=\""
146 + column.getLinkTitle()/*
147 * +(column.isDeleteLink()?"
152 sb.append("submit\" value=\"");
153 sb.append(column.getLinkTitle());
156 sb.append(" onClick=\"");
157 if (column.getLinkConfirmMsg() != null) {
158 sb.append("if(! confirm('");
159 sb.append(column.getLinkConfirmMsg());
160 sb.append("')) return false; ");
162 sb.append(column.getLinkURL());
163 sb.append(" document.");
164 sb.append(column.getLinkForm());
166 sb.append(AppConstants.RI_REPORT_ID);
167 sb.append(".value='");
168 sb.append(nvl(linkIdValue));
170 sb.append(" document.");
171 sb.append(column.getLinkForm());
173 sb.append("refresh");
174 sb.append(".value='");
179 setDrillDownLink(sb.toString());
182 } // SearchResultField
184 public String getDisplayValue() {
188 public String getAlignment() {
192 public String getDrillDownLink() {
193 return drillDownLink;
196 public void setDisplayValue(String displayValue) {
197 this.displayValue = nvl(displayValue);
200 public void setAlignment(String alignment) {
201 this.alignment = alignment;
204 public void setDrillDownLink(String drillDownLink) {
205 this.drillDownLink = drillDownLink;
208 public String getTooltipValue() {
209 return (displayValue.length() == 0) ? " " : displayValue;
212 /*public String getAlignmentHtml() {
213 return (alignment.length() == 0) ? "" : (" align=" + alignment);
216 /*public String getDisplayValueLinkHtml() {
217 if (nvl(drillDownLink).length() == 0)
218 return getDisplayValueHtml();
220 return getDrillDownLink();
221 } // getDisplayValueLinkHtml*/
223 public String getColumnId() {
227 public void setColumnId(String columnId) {
228 this.columnId = columnId;
232 } // SearchResultField