From 6beb446925c967aca92f5513adf36c5db77c00d6 Mon Sep 17 00:00:00 2001 From: TATTAVARADA Date: Thu, 27 Apr 2017 07:53:18 -0400 Subject: [PORTAL-7] Rebase This rebasing includes common libraries and common overlays projects abstraction of components Change-Id: Ia1efa4deacdc5701e6205104ac021a6c80ed60ba Signed-off-by: st782s --- .../analytics/model/search/ReportSearchResult.java | 84 ------- .../model/search/ReportSearchResultJSON.java | 251 -------------------- .../analytics/model/search/SearchResult.java | 213 ----------------- .../analytics/model/search/SearchResultColumn.java | 254 --------------------- .../analytics/model/search/SearchResultField.java | 212 ----------------- .../analytics/model/search/SearchResultJSON.java | 80 ------- .../analytics/model/search/SearchResultRow.java | 92 -------- 7 files changed, 1186 deletions(-) delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java delete mode 100644 ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java (limited to 'ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search') diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java deleted file mode 100644 index ec7999e0..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResult.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -import org.openecomp.portalsdk.analytics.system.AppUtils; -import org.openecomp.portalsdk.analytics.system.Globals; -import org.openecomp.portalsdk.analytics.util.AppConstants; - -public class ReportSearchResult extends SearchResult { - private static final String HTML_FORM = "forma"; - - public ReportSearchResult(int pageNo) { - this(pageNo, Globals.getDefaultPageSize(), -1, -1); - } // ReportSearchResult - - public ReportSearchResult(int pageNo, int writeAccessColIndex, int ownerIndicatorColIndex) { - this(pageNo, Globals.getDefaultPageSize(), writeAccessColIndex, ownerIndicatorColIndex); - } // ReportSearchResult - - public ReportSearchResult(int pageNo, int pageSize, int writeAccessColIndex, - int ownerIndicatorColIndex) { - super(pageNo, pageSize, writeAccessColIndex, ownerIndicatorColIndex); - - addColumn(new SearchResultColumn("no","No", "5%", "Center")); - addColumn(new SearchResultColumn("rep_id","Report ID", "5%", "Center")); - addColumn(new SearchResultColumn("rep_name","Report Name", "25%", "Left")); - addColumn(new SearchResultColumn("descr","Description", "30%", "Left")); - addColumn(new SearchResultColumn("owner","Report Owner", "10%", "Center")); - addColumn(new SearchResultColumn("create_date","Create Date", "10%", "Center")); - addColumn(new SearchResultColumn("copy","  Copy  ", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.copy';", "Copy report", HTML_FORM, - "Are you sure you want to create a copy of this report?", AppUtils - .getImgFolderURL() - + "modify_icon.gif", "13", "12", true, false, false)); - /*addColumn(new SearchResultColumn("  Schedule  ", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.schedule_only';", "Schedule report", HTML_FORM, - null, AppUtils - .getImgFolderURL() - + "calendar_icon.gif", "13", "12", true, false, false)); - */ - - addColumn(new SearchResultColumn("edit","  Edit  ", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.edit';", "Edit report", HTML_FORM, null, AppUtils - .getImgFolderURL() - + "pen_paper.gif", "12", "12", false, true, false)); - addColumn(new SearchResultColumn("delete","Delete", "5%", "Center", "document." + HTML_FORM - + "." + AppConstants.RI_ACTION + ".value='report.delete';", "Delete report", - HTML_FORM, "Are you sure you want to delete this report?", AppUtils - .getImgFolderURL() - + "deleteicon.gif", "12", "12", false, false, true)); - addColumn(new SearchResultColumn("schedule","Schedule", "5%", "Center", "document." + HTML_FORM - + "." + AppConstants.RI_ACTION + ".value='report.schedule.report.submit_wmenu';", "Schedule report", - HTML_FORM, null, AppUtils - .getImgFolderURL() - + "calendar_icon.gif", "20", "20", false, false, false, true)); - addColumn(new SearchResultColumn("run","  Run  ", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.run';", "Run report", HTML_FORM, null, AppUtils - .getImgFolderURL() - + "test_run.gif", "12", "12")); - } // ReportSearchResult - -} // ReportSearchResult - diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java deleted file mode 100644 index fda50d54..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/ReportSearchResultJSON.java +++ /dev/null @@ -1,251 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -import java.util.ArrayList; - -import javax.servlet.http.HttpServletRequest; - -import org.openecomp.portalsdk.analytics.error.RaptorException; -import org.openecomp.portalsdk.analytics.system.AppUtils; -import org.openecomp.portalsdk.analytics.system.Globals; -import org.openecomp.portalsdk.analytics.util.AppConstants; -import org.openecomp.portalsdk.analytics.util.DataSet; - -import com.fasterxml.jackson.databind.ObjectMapper; - -class MetaReport { - private boolean pagination = true; - private int pageSize; - private int totalSize; - private int pageNo; - public boolean isPagination() { - return pagination; - } - public void setPagination(boolean pagination) { - this.pagination = pagination; - } - public int getPageSize() { - return pageSize; - } - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - public int getTotalSize() { - return totalSize; - } - public void setTotalSize(int totalSize) { - this.totalSize = totalSize; - } - public int getPageNo() { - return pageNo; - } - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } - - -} -class SearchReport { - private MetaReport metaReport; - public MetaReport getMetaReport() { - return metaReport; - } - public void setMetaReport(MetaReport metaReport) { - this.metaReport = metaReport; - } - private ArrayList> columns = new ArrayList>(); - private ArrayList> rows = new ArrayList>(); - public ArrayList> getColumns() { - return columns; - } - public void setColumns(ArrayList> columns) { - this.columns = columns; - } - public ArrayList> getRows() { - return rows; - } - public void setRows(ArrayList> rows) { - this.rows = rows; - } - -} - -public class ReportSearchResultJSON extends SearchResultJSON { - private static final String HTML_FORM = "forma"; - private String JSONString= ""; - private SearchReport searchReport; - //private ArrayList> columns = new ArrayList>(); - //private ArrayList> rows = new ArrayList>(); - - - public ReportSearchResultJSON(int pageNo) { - this(pageNo, Globals.getDefaultPageSize(), -1, -1); - } // ReportSearchResult - - public ReportSearchResultJSON(int pageNo, int writeAccessColIndex, int ownerIndicatorColIndex) { - this(pageNo, Globals.getDefaultPageSize(), writeAccessColIndex, ownerIndicatorColIndex); - } // ReportSearchResult - - public ReportSearchResultJSON(int pageNo, int pageSize, int writeAccessColIndex, - int ownerIndicatorColIndex) { - - searchReport = new SearchReport(); - MetaReport metaReport = new MetaReport(); - //if(searchReport.getMetaReport()!=null) - searchReport.setMetaReport(metaReport); - metaReport.setPageNo(pageNo); - metaReport.setPageSize(pageSize); - metaReport.setPagination(true); - addColumn(new SearchResultColumn("no", "No", "5%", "Center")); - addColumn(new SearchResultColumn("rep_id", "Report ID", "5%", "Center")); - addColumn(new SearchResultColumn("rep_name", "Report Name", "25%", "Left")); - addColumn(new SearchResultColumn("descr", "Description", "30%", "Left")); - addColumn(new SearchResultColumn("owner", "Report Owner", "10%", "Center")); - addColumn(new SearchResultColumn("create_date", "Create Date", "10%", "Center")); - addColumn(new SearchResultColumn("copy", "Copy", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.copy';", "Copy report", HTML_FORM, - "Are you sure you want to create a copy of this report?", AppUtils - .getImgFolderURL() - + "modify_icon.gif", "13", "12", true, false, false)); - /*addColumn(new SearchResultColumn("  Schedule  ", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.schedule_only';", "Schedule report", HTML_FORM, - null, AppUtils - .getImgFolderURL() - + "calendar_icon.gif", "13", "12", true, false, false)); - */ - - addColumn(new SearchResultColumn("edit", "Edit", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.edit';", "Edit report", HTML_FORM, null, AppUtils - .getImgFolderURL() - + "pen_paper.gif", "12", "12", false, true, false)); - addColumn(new SearchResultColumn("delete", "Delete", "5%", "Center", "document." + HTML_FORM - + "." + AppConstants.RI_ACTION + ".value='report.delete';", "Delete report", - HTML_FORM, "Are you sure you want to delete this report?", AppUtils - .getImgFolderURL() - + "deleteicon.gif", "12", "12", false, false, true)); - addColumn(new SearchResultColumn("schedule", "Schedule", "5%", "Center", "document." + HTML_FORM - + "." + AppConstants.RI_ACTION + ".value='report.schedule.report.submit_wmenu';", "Schedule report", - HTML_FORM, null, AppUtils - .getImgFolderURL() - + "calendar_icon.gif", "20", "20", false, false, false, true)); - addColumn(new SearchResultColumn("run", "Run", "5%", "Center", - "document." + HTML_FORM + "." + AppConstants.RI_ACTION - + ".value='report.run';", "Run report", HTML_FORM, null, AppUtils - .getImgFolderURL() - + "test_run.gif", "12", "12")); - searchReport.getColumns().add(searchResultColumns); - } // ReportSearchResult - - public void parseData(DataSet ds, HttpServletRequest request, int pageNo, int pageSize, int writeAccessColIndex, int ownerIndicatorColIndex) throws RaptorException { - // Presumes single ID field in the first column of the DataSet and row - // number in the first SearchResultColumn - - pageNo = AppUtils.getRequestNvlValue(request, "r_page").length()>0?Integer.parseInt(AppUtils.getRequestNvlValue(request, "r_page")):0; - String userID = AppUtils.getUserID(request); - int dataSize = ds.getRowCount(); - //pageSize = 0; - - if(searchReport.getMetaReport()!=null) { - searchReport.getMetaReport().setPageNo(pageNo); - //searchReport.getMetaReport().setPageSize(pageSize); - pageSize = searchReport.getMetaReport().getPageSize(); - searchReport.getMetaReport().setTotalSize(dataSize); - } - int startRow = (pageNo >= 0) ? (pageNo * pageSize) : 0; - int endRow = (pageNo >= 0) ? Math.min(startRow + pageSize, ds.getRowCount()) : ds - .getRowCount(); - for (int r = startRow; r < endRow; r++) { - SearchResultRow row = new SearchResultRow(); - searchResultRows.add(row); - - String idValue = ds.getString(r, 0); - - boolean bCanEdit = true; - if (writeAccessColIndex >= 0) { - String isReadOnlyValue = nvl(ds.getString(r, writeAccessColIndex), "Y"); - bCanEdit = AppUtils.isSuperUser(request) || AppUtils.isAdminUser(request) - || isReadOnlyValue.equals("N"); - } - - boolean bCanDelete = bCanEdit; - if (Globals.getDeleteOnlyByOwner() && ownerIndicatorColIndex >= 0) { - String isOwnedByUserRecord = nvl(ds.getString(r, ownerIndicatorColIndex), "N"); - bCanDelete = AppUtils.isSuperUser(request) || isOwnedByUserRecord.equals("Y"); - } - - boolean bCanSchedule = ds.getString(r, getNumColumns()-3).equals("Y"); - - row.addColumnContent(new ColumnContent(getColumn(0).getColumnId(), new SearchResultField("" + (r + 1), idValue, - getColumn(0), true))); - boolean isAuthorized = true; - for (int c = 1; c < getNumColumns(); c++) { - SearchResultColumn column = getColumn(c); - isAuthorized = true; - - if(column.isCopyLink()) - isAuthorized = Globals.getCanCopyOnReadOnly()? true:bCanEdit; - else if (column.isDeleteLink()) - isAuthorized = bCanDelete; - else if (column.isEditLink()) - isAuthorized = bCanEdit; - else if (column.isScheduleLink()) - isAuthorized = bCanSchedule; - row.addColumnContent(new ColumnContent(column.getColumnId(), new SearchResultField( - (column.getLinkURL() == null) ? ds.getString(r, c) : column - .getLinkTitle(), idValue, column, isAuthorized - ))); - } // for - } // for - searchReport.getRows().add(searchResultRows); - ObjectMapper mapper = new ObjectMapper(); - String jsonInString = ""; - try { - jsonInString = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(searchReport); - } catch (Exception ex) { - ex.printStackTrace(); - - } - System.out.println(jsonInString); - this.JSONString = jsonInString; - } // parseData - - private String nvl(String s) { - return (s == null) ? "" : s; - } - - private String nvl(String s, String sDefault) { - return nvl(s).equals("") ? sDefault : s; - } - - public String getJSONString() { - return JSONString; - } - - public void setJSONString(String jSONString) { - JSONString = jSONString; - } - - -} // ReportSearchResult - diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java deleted file mode 100644 index 5ab75590..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResult.java +++ /dev/null @@ -1,213 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -import java.util.ArrayList; - -import javax.servlet.http.HttpServletRequest; - -import org.openecomp.portalsdk.analytics.error.RaptorException; -import org.openecomp.portalsdk.analytics.system.AppUtils; -import org.openecomp.portalsdk.analytics.system.Globals; -import org.openecomp.portalsdk.analytics.util.DataSet; - -public class SearchResult{ - private int pageNo = -1; - - private int pageSize = 50; - - private int dataSize = -1; - - private int writeAccessColIndex = -1; - - private int ownerIndicatorColIndex = -1; - - private String csvPageFileName = null; - - - - private String csvAllRowsFileName = null; - - private String excelAllRowsFileName = null; - - public ArrayList searchResultColumns = new ArrayList(); - - public ArrayList searchResultRows = new ArrayList(); - - public SearchResult(int pageNo) { - this(pageNo, Globals.getDefaultPageSize()); - } // SearchResult - - public SearchResult(int pageNo, int pageSize) { - this(pageNo, pageSize, -1, -1); - } // SearchResult - - public SearchResult(int pageNo, int pageSize, int writeAccessColIndex, - int ownerIndicatorColIndex) { - super(); - - this.pageNo = pageNo; - this.pageSize = pageSize; - - this.writeAccessColIndex = writeAccessColIndex; - this.ownerIndicatorColIndex = ownerIndicatorColIndex; - } // SearchResult - - public int getPageNo() { - return pageNo; - } - - public int getPageSize() { - return pageSize; - } - - public int getDataSize() { - return dataSize; - } - - public String getCsvPageFileName() { - return csvPageFileName; - } - - public String getCsvAllRowsFileName() { - return csvAllRowsFileName; - } - - public String getExcelAllRowsFileName() { - return excelAllRowsFileName; - } - - private void setDataSize(int dataSize) { - this.dataSize = dataSize; - } - - public void setCsvPageFileName(String csvPageFileName) { - this.csvPageFileName = csvPageFileName; - } - - - - public void setCsvAllRowsFileName(String csvAllRowsFileName) { - this.csvAllRowsFileName = csvAllRowsFileName; - } - - - - public void addColumn(SearchResultColumn column) { - searchResultColumns.add(column); - } // addColumn - - public SearchResultColumn getColumn(int index) { - return (SearchResultColumn) searchResultColumns.get(index); - } // getColumn - - public int getNumColumns() { - return searchResultColumns.size(); - } // getNumColumns - - public int getNumRows() { - return searchResultRows.size(); - } // getNumRows - - public SearchResultRow getRow(int index) { - return (SearchResultRow) searchResultRows.get(index); - } // getRow - - public void parseData(DataSet ds, HttpServletRequest request) throws RaptorException { - // Presumes single ID field in the first column of the DataSet and row - // number in the first SearchResultColumn - String userID = AppUtils.getUserID(request); - setDataSize(ds.getRowCount()); - - int startRow = (pageNo >= 0) ? (pageNo * pageSize) : 0; - int endRow = (pageNo >= 0) ? Math.min(startRow + pageSize, ds.getRowCount()) : ds - .getRowCount(); - for (int r = startRow; r < endRow; r++) { - SearchResultRow row = new SearchResultRow(); - searchResultRows.add(row); - - String idValue = ds.getString(r, 0); - - boolean bCanEdit = true; - if (writeAccessColIndex >= 0) { - String isReadOnlyValue = nvl(ds.getString(r, writeAccessColIndex), "Y"); - bCanEdit = AppUtils.isSuperUser(request) || AppUtils.isAdminUser(request) - || isReadOnlyValue.equals("N"); - } - - boolean bCanDelete = bCanEdit; - if (Globals.getDeleteOnlyByOwner() && ownerIndicatorColIndex >= 0) { - String isOwnedByUserRecord = nvl(ds.getString(r, ownerIndicatorColIndex), "N"); - bCanDelete = AppUtils.isSuperUser(request) || isOwnedByUserRecord.equals("Y"); - } - - boolean bCanSchedule = ds.getString(r, getNumColumns()-3).equals("Y"); - - row.addSearchResultField(new SearchResultField("" + (r + 1), idValue, - getColumn(0), true)); - boolean isAuthorized = true; - for (int c = 1; c < getNumColumns(); c++) { - SearchResultColumn column = getColumn(c); - isAuthorized = true; - - if(column.isCopyLink()) - isAuthorized = Globals.getCanCopyOnReadOnly()? true:bCanEdit; - else if (column.isDeleteLink()) - isAuthorized = bCanDelete; - else if (column.isEditLink()) - isAuthorized = bCanEdit; - else if (column.isScheduleLink()) - isAuthorized = bCanSchedule; - - row.addSearchResultField(new SearchResultField( - (column.getLinkURL() == null) ? ds.getString(r, c) : column - .getLinkTitle(), idValue, column, isAuthorized - )); - } // for - } // for - } // parseData - - public void truncateToPage(int pageNo) { - if (this.pageNo >= 0 || pageNo < 0) - return; - - this.pageNo = pageNo; - - int startRow = pageNo * pageSize; - int endRow = Math.min(startRow + pageSize, dataSize); - - for (int r = getNumRows() - 1; r >= endRow; r--) - searchResultRows.remove(r); - - for (int r = startRow - 1; r >= 0; r--) - searchResultRows.remove(r); - } // truncateToPage - - /** *********************************************************************** */ - - private String nvl(String s) { - return (s == null) ? "" : s; - } - - private String nvl(String s, String sDefault) { - return nvl(s).equals("") ? sDefault : s; - } - -} // SearchResult diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java deleted file mode 100644 index bca1f4cf..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultColumn.java +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -public class SearchResultColumn extends org.openecomp.portalsdk.analytics.RaptorObject { - private String columnId = ""; - private String columnTitle = ""; - - private String columnWidth = ""; - - private String alignment = "Left"; - - private String linkURL = null; // if not null => display link instead of - // text - - private String linkTitle = null; // if img => hint, otherwise link - // display text - - private String linkForm = null; // if not null => displays input submit - // instead of link - - private String linkConfirmMsg = null; // if not null => display conf. box - // on link click - - private String linkImg = null; // if not null => link shows image, not text - - private String linkImgWidth = null; // optional - - private String linkImgHeight = null; // optional - - private boolean copyLink = false; // optional - - private boolean editLink = false; // optional - - private boolean deleteLink = false; // optional - - private boolean scheduleLink = false; // optional - - public SearchResultColumn(String columnId, String columnTitle) { - super(); - setColumnId(columnId); - setColumnTitle(columnTitle); - } // SearchResultColumn - - public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment) { - super(); - setColumnId(columnId); - setColumnTitle(columnTitle); - setColumnWidth(columnWidth); - setAlignment(alignment); - } // SearchResultColumn - - public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment, - String linkURL, String linkTitle, String linkForm, String linkConfirmMsg, - String linkImg) { - super(); - setColumnId(columnId); - setColumnTitle(columnTitle); - setColumnWidth(columnWidth); - setAlignment(alignment); - setLinkURL(linkURL); - setLinkTitle(linkTitle); - setLinkForm(linkForm); - setLinkConfirmMsg(linkConfirmMsg); - setLinkImg(linkImg); - } // SearchResultColumn - - public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment, - String linkURL, String linkTitle, String linkForm, String linkConfirmMsg, - String linkImg, String linkImgWidth, String linkImgHeight) { - this(columnId, columnTitle, columnWidth, alignment, linkURL, linkTitle, linkForm, - linkConfirmMsg, linkImg); - - setLinkWidth(linkImgWidth); - setLinkHeight(linkImgHeight); - } // SearchResultColumn - - public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment, - String linkURL, String linkTitle, String linkForm, String linkConfirmMsg, - String linkImg, String linkImgWidth, String linkImgHeight, boolean copyLink, - boolean editLink, boolean deleteLink) { - this(columnId, columnTitle, columnWidth, alignment, linkURL, linkTitle, linkForm, - linkConfirmMsg, linkImg, linkImgWidth, linkImgHeight); - - setCopyLink(copyLink); - setEditLink(editLink); - setDeleteLink(deleteLink); - } // SearchResultColumn - - public SearchResultColumn(String columnId, String columnTitle, String columnWidth, String alignment, - String linkURL, String linkTitle, String linkForm, String linkConfirmMsg, - String linkImg, String linkImgWidth, String linkImgHeight, boolean copyLink, - boolean editLink, boolean deleteLink, boolean scheduleLink) { - this(columnId, columnTitle, columnWidth, alignment, linkURL, linkTitle, linkForm, - linkConfirmMsg, linkImg, linkImgWidth, linkImgHeight); - - setCopyLink(copyLink); - setEditLink(editLink); - setDeleteLink(deleteLink); - setScheduleLink(scheduleLink); - } // SearchResultColumn - - public String getColumnTitle() { - return columnTitle; - } - - public String getColumnWidth() { - return columnWidth; - } - - public String getAlignment() { - return alignment; - } - - public String getLinkURL() { - return linkURL; - } - - public String getLinkTitle() { - return linkTitle; - } - - public String getLinkForm() { - return linkForm; - } - - public String getLinkConfirmMsg() { - return linkConfirmMsg; - } - - public String getLinkImg() { - return linkImg; - } - - public String getLinkImgWidth() { - return linkImgWidth; - } - - public String getLinkImgHeight() { - return linkImgHeight; - } - - public boolean isCopyLink() { - return copyLink; - } - - public boolean isEditLink() { - return editLink; - } - - public boolean isDeleteLink() { - return deleteLink; - } - - public void setColumnTitle(String columnTitle) { - this.columnTitle = nvl(columnTitle); - } - - public void setColumnWidth(String columnWidth) { - this.columnWidth = nvl(columnWidth); - } - - public void setAlignment(String alignment) { - this.alignment = alignment; - } - - public void setLinkURL(String linkURL) { - this.linkURL = linkURL; - } - - public void setLinkTitle(String linkTitle) { - this.linkTitle = linkTitle; - } - - public void setLinkForm(String linkForm) { - this.linkForm = linkForm; - } - - public void setLinkConfirmMsg(String linkConfirmMsg) { - this.linkConfirmMsg = linkConfirmMsg; - } - - public void setLinkImg(String linkImg) { - this.linkImg = linkImg; - } - - public void setLinkWidth(String linkImgWidth) { - this.linkImgWidth = linkImgWidth; - } - - public void setLinkHeight(String linkImgHeight) { - this.linkImgHeight = linkImgHeight; - } - - public void setCopyLink(boolean copyLink) { - this.copyLink = copyLink; - } - - public void setEditLink(boolean editLink) { - this.editLink = editLink; - } - - public void setDeleteLink(boolean deleteLink) { - this.deleteLink = deleteLink; - } - - public String getColumnTitleHtml() { - return (columnTitle.length() == 0) ? " " : columnTitle; - } - - public String getColumnWidthHtml() { - return (columnWidth.length() == 0) ? "" : (" width=" + columnWidth); - } - - public String getLinkImgSizeHtml() { - return ((nvl(linkImgWidth).length() > 0) ? " width=\"" + linkImgWidth + "\"" : "") - + ((nvl(linkImgHeight).length() > 0) ? " height=\"" + linkImgHeight + "\"" - : ""); - } - - public boolean isScheduleLink() { - return scheduleLink; - } - - public void setScheduleLink(boolean scheduleLink) { - this.scheduleLink = scheduleLink; - } - - public String getColumnId() { - return columnId; - } - - public void setColumnId(String columnId) { - this.columnId = columnId; - } - -} // SearchResultColumn diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java deleted file mode 100644 index a0621553..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultField.java +++ /dev/null @@ -1,212 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -import org.openecomp.portalsdk.analytics.util.AppConstants; - -public class SearchResultField extends org.openecomp.portalsdk.analytics.RaptorObject { - private String columnId; - private String displayValue = ""; - - private String alignment = "Left"; - - private String drillDownLink = null; - - private String drillDownImage = null; - - private String confirmationText = null; - - - - public String getConfirmationText() { - return confirmationText; - } - - public void setConfirmationText(String confirmationText) { - this.confirmationText = confirmationText; - } - - public String getDrillDownImage() { - return drillDownImage; - } - - public void setDrillDownImage(String drillDownImage) { - this.drillDownImage = drillDownImage; - } - - public SearchResultField() { - } - - public SearchResultField(String displayValue, String linkIdValue, - SearchResultColumn column, boolean isAuthorized) { - super(); - - if (!isAuthorized) - return; - - setColumnId(column.getColumnId()); - setDisplayValue(displayValue); - setAlignment(column.getAlignment()); - if(column.getColumnId().equals("edit")) { - setDrillDownLink("report_wizard.htm?action=report.edit&c_master="+linkIdValue); - setDrillDownImage(column.getLinkImg()); - setConfirmationText(null); - } else if(column.getColumnId().equals("copy")) { - setDrillDownLink("report_wizard.htm?action=report.copy&c_master="+linkIdValue); - setDrillDownImage(column.getLinkImg()); - setConfirmationText(column.getLinkConfirmMsg()); - } else if(column.getColumnId().equals("delete")) { - setDrillDownLink("raptor.htm?action=report.delete&c_master="+linkIdValue); - setDrillDownImage(column.getLinkImg()); - setConfirmationText(column.getLinkConfirmMsg()); - } else if(column.getColumnId().equals("schedule")) { - setDrillDownLink("report_wizard.htm?action=report.schedule.report.submit_wmenu&c_master="+linkIdValue+"&refresh=Y"); - setDrillDownImage(column.getLinkImg()); - setConfirmationText(null); - } else if(column.getColumnId().equals("run")) { - setDrillDownLink("raptor.htm?action=report.run.container&c_master="+linkIdValue+"&refresh=Y"); - setDrillDownImage(column.getLinkImg()); - setConfirmationText(null); - } else { - if (column.getLinkURL() != null) { - StringBuffer sb = new StringBuffer(); - - if (column.getLinkForm() == null) { - sb.append(""); - if (column.getLinkImg() != null) { - sb.append("\"""); - } else - sb.append(column.getLinkTitle()); - sb.append(""); - } else { - sb.append(""); - } // else - - setDrillDownLink(sb.toString()); - } // if - } - } // SearchResultField - - public String getDisplayValue() { - return displayValue; - } - - public String getAlignment() { - return alignment; - } - - public String getDrillDownLink() { - return drillDownLink; - } - - public void setDisplayValue(String displayValue) { - this.displayValue = nvl(displayValue); - } - - public void setAlignment(String alignment) { - this.alignment = alignment; - } - - public void setDrillDownLink(String drillDownLink) { - this.drillDownLink = drillDownLink; - } - - public String getTooltipValue() { - return (displayValue.length() == 0) ? " " : displayValue; - } - - /*public String getAlignmentHtml() { - return (alignment.length() == 0) ? "" : (" align=" + alignment); - }*/ - - /*public String getDisplayValueLinkHtml() { - if (nvl(drillDownLink).length() == 0) - return getDisplayValueHtml(); - else - return getDrillDownLink(); - } // getDisplayValueLinkHtml*/ - - public String getColumnId() { - return columnId; - } - - public void setColumnId(String columnId) { - this.columnId = columnId; - } - - -} // SearchResultField diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java deleted file mode 100644 index 00e18f12..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultJSON.java +++ /dev/null @@ -1,80 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -import java.util.ArrayList; - -public class SearchResultJSON{ - - public ArrayList searchResultColumns = new ArrayList(); - - public ArrayList searchResultRows = new ArrayList(); - - - - - - - public ArrayList getSearchResultColumns() { - return searchResultColumns; - } - - public void setSearchResultColumns(ArrayList searchResultColumns) { - this.searchResultColumns = searchResultColumns; - } - - public ArrayList getSearchResultRows() { - return searchResultRows; - } - - public void setSearchResultRows(ArrayList searchResultRows) { - this.searchResultRows = searchResultRows; - } - - public void addColumn(SearchResultColumn column) { - searchResultColumns.add(column); - } // addColumn - - public SearchResultColumn getColumn(int index) { - return (SearchResultColumn) searchResultColumns.get(index); - } // getColumn - - public int getNumColumns() { - return searchResultColumns.size(); - } // getNumColumns - - public int getNumRows() { - return searchResultRows.size(); - } // getNumRows - - public SearchResultRow getRow(int index) { - return (SearchResultRow) searchResultRows.get(index); - } // getRow - - - private String nvl(String s) { - return (s == null) ? "" : s; - } - - private String nvl(String s, String sDefault) { - return nvl(s).equals("") ? sDefault : s; - } - -} // SearchResultJSON diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java deleted file mode 100644 index 21fb0254..00000000 --- a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/model/search/SearchResultRow.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ================================================================================ - */ -package org.openecomp.portalsdk.analytics.model.search; - -import java.util.ArrayList; - -class ColumnContent { - String columnId; - SearchResultField searchresultField; - - public ColumnContent(String columnId, SearchResultField searchresultField) { - this.columnId = columnId; - this.searchresultField = searchresultField; - } - public String getColumnId() { - return columnId; - } - public void setColumnId(String columnId) { - this.columnId = columnId; - } - public SearchResultField getSearchresultField() { - return searchresultField; - } - public void setSearchresultField(SearchResultField searchresultField) { - this.searchresultField = searchresultField; - } - - - -} -public class SearchResultRow extends ArrayList { - - - //private SearchResultField searchresultField; - private int nextElemIdx = 0; - - public void resetNext() { - resetNext(0); - } // resetNext - - public void resetNext(int toPos) { - nextElemIdx = toPos; - } // resetNext - - public boolean hasNext() { - return (nextElemIdx < size()); - } // hasNext - - public SearchResultField getNext() { - return hasNext() ? getSearchResultField(nextElemIdx++) : null; - } // getNext - - public SearchResultField getSearchResultField(int idx) { - return (SearchResultField) get(idx); - } // getRowHeader - - public void addSearchResultField(SearchResultField searchResultField) { - add(searchResultField); - } // addSearchResultField - - public void addSearchResultField(int idx, SearchResultField searchResultField) { - add(idx, searchResultField); - } // addSearchResultField - - public void addColumnContent(ColumnContent cc ) { - - add(cc); - } // addSearchResultField - - public void addColumnContent(int idx, ColumnContent cc) { - add(idx, cc); - } // addSearchResultField - - -} // SearchResultRow -- cgit 1.2.3-korg