summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view')
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java239
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java100
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java74
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java75
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java98
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java56
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java169
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java359
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java205
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java71
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java812
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java72
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java71
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java119
-rw-r--r--ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java156
15 files changed, 2676 insertions, 0 deletions
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java
new file mode 100644
index 00000000..c52125e5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeader.java
@@ -0,0 +1,239 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+public class ColumnHeader extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String columnTitle = "";
+
+ private String columnWidth = "";
+
+ private String alignment = "center";
+
+ private int rowSpan = 1;
+
+ private int actualColSpan = 1;
+
+ private int visibleColSpan = 1;
+
+ private String linkColId = null;
+
+ private int columnSort = 0;
+
+ private String colId = "";
+
+ private int groupLevel =0;
+
+ private int startGroup = 0;
+
+ private int colSpanGroup = 0;
+
+ private boolean sortable = false;
+
+
+ public ColumnHeader() {
+ super();
+ }
+
+ public ColumnHeader(String columnTitle) {
+ this();
+ setColumnTitle(columnTitle);
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, Integer columnSort) {
+ this();
+ setColumnTitle(columnTitle);
+ setColumnSort(columnSort.intValue());
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth) {
+ this(columnTitle);
+ setColumnWidth(columnWidth);
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth, int colSpan) {
+ this(columnTitle, columnWidth);
+ setColSpan(colSpan);
+ } // ColumnHeader
+
+ //public ColumnHeader(String columnTitle, String columnWidth, int colSpan, String linkColId) {
+ //this(columnTitle, columnWidth, colSpan);
+ //setLinkColId(linkColId);
+ //} // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth, String alignment, int colSpan, String linkColId) {
+ this(columnTitle, columnWidth, colSpan);
+ setAlignment(alignment);
+ setLinkColId(linkColId);
+ } // ColumnHeader
+
+ public ColumnHeader(String columnTitle, String columnWidth, int colSpan, int rowSpan) {
+ this(columnTitle, columnWidth, colSpan);
+ setRowSpan(rowSpan);
+ } // ColumnHeader
+
+ public String getColumnTitle() {
+ return columnTitle;
+ }
+
+ public String getColumnWidth() {
+ return columnWidth;
+ }
+
+ public int getRowSpan() {
+ return rowSpan;
+ }
+
+ public int getColSpan() {
+ return actualColSpan;
+ }
+
+ public boolean isVisible() {
+ return (visibleColSpan > 0) && (rowSpan > 0);
+ }
+
+ public String getLinkColId() {
+ return linkColId;
+ }
+
+ public void setColumnTitle(String columnTitle) {
+ this.columnTitle = nvl(columnTitle);
+ }
+
+ public void setColumnWidth(String columnWidth) {
+ this.columnWidth = columnWidth;
+ }
+
+ public void setLinkColId(String linkColId) {
+ this.linkColId = linkColId;
+ }
+
+ public void setRowSpan(int rowSpan) {
+ this.rowSpan = rowSpan;
+ }
+
+ public void setColSpan(int colSpan) {
+ this.visibleColSpan = colSpan;
+ this.actualColSpan = colSpan;
+ }
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ if (visibleColSpan < actualColSpan)
+ visibleColSpan++;
+ } else {
+ if (visibleColSpan > 0)
+ visibleColSpan--;
+ }
+ } // setVisible
+
+ public String getColumnWidthHtml() {
+ return (columnWidth.length() == 0) ? "" : (" width=" + columnWidth);
+ }
+
+ public String getRowSpanHtml() {
+ return (rowSpan == 1) ? "" : (" rowspan=" + rowSpan);
+ }
+
+ public String getColSpanHtml() {
+ return (visibleColSpan == 1) ? "" : (" colspan=" + visibleColSpan);
+ }
+
+ public String getColumnTitleHtml() {
+ if (linkColId == null)
+ return (columnTitle.length() == 0) ? "&nbsp;" : columnTitle;
+ else
+ return "<a href=\"javascript:performSortBy('" + linkColId
+ + "')\" title=\"Sort by column " + columnTitle + "\" class=rcolheader>"
+ + ((columnTitle.length() == 0) ? "[NULL]" : columnTitle) + "</a>";
+ } // getColumnTitleHtml
+
+ /**
+ * @return the columnSort
+ */
+ public int getColumnSort() {
+ return columnSort;
+ }
+
+ /**
+ * @param columnSort the columnSort to set
+ */
+ public void setColumnSort(int columnSort) {
+ this.columnSort = columnSort;
+ }
+
+ /**
+ * @return the colId
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * @param colId the colId to set
+ */
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setAlignment(String alignment) {
+ if(nvl(alignment).length()>0)
+ this.alignment = alignment;
+ }
+
+ public int getGroupLevel() {
+ return groupLevel;
+ }
+
+ public void setGroupLevel(int groupLevel) {
+ this.groupLevel = groupLevel;
+ }
+
+ public int getStartGroup() {
+ return startGroup;
+ }
+
+ public void setStartGroup(int startGroup) {
+ this.startGroup = startGroup;
+ }
+
+ public int getColSpanGroup() {
+ return colSpanGroup;
+ }
+
+ public void setColSpanGroup(int colSpanGroup) {
+ this.colSpanGroup = colSpanGroup;
+ }
+
+ public boolean isSortable() {
+ return sortable;
+ }
+
+ public void setSortable(boolean sortable) {
+ this.sortable = sortable;
+ }
+
+
+
+} // ColumnHeader
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java
new file mode 100644
index 00000000..b1f581ed
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnHeaderRow.java
@@ -0,0 +1,100 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+public class ColumnHeaderRow extends Vector {
+ private String rowHeight = "";
+
+ private String displayWidth = "";
+
+ private String alignment = "center";
+
+ 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 ColumnHeader getNext() {
+ return hasNext() ? getColumnHeader(nextElemIdx++) : null;
+ } // getNext
+
+ public ColumnHeader getColumnHeader(int idx) {
+ return (ColumnHeader) get(idx);
+ } // getColumnHeader
+
+ public void addColumnHeader(ColumnHeader columnHeader) {
+ add(columnHeader);
+ } // addColumnHeader
+
+ public void addColumnHeader(int idx, ColumnHeader columnHeader) {
+ add(idx, columnHeader);
+ } // addColumnHeader
+
+ public String getRowHeightHtml() {
+ return (rowHeight.length() == 0) ? "" : (" height=" + rowHeight);
+ }
+
+ public String getRowHeight() {
+ return rowHeight;
+ }
+
+ public void setRowHeight(String rowHeight) {
+ this.rowHeight = nvl(rowHeight);
+ }
+
+ public void setDisplayWidth(String displayWidth) {
+ this.displayWidth = nvl(displayWidth);
+ }
+
+ public String getDisplayWidth() {
+ return this.displayWidth;
+ }
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setAlignment(String alignment) {
+ if(nvl(alignment).length()>0)
+ this.alignment = alignment;
+ }
+
+} // ColumnHeaderRow
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java
new file mode 100644
index 00000000..5045cd58
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ColumnVisual.java
@@ -0,0 +1,74 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class ColumnVisual extends RaptorObject {
+ private String colId = null;
+
+ private String colDisplay = null;
+
+ private boolean visible = true;
+
+ private String sortType = null;
+
+ public ColumnVisual(String colId, String colDisplay, boolean visible, String sortType) {
+ super();
+
+ setColId(colId);
+ setColDisplay(colDisplay);
+ setVisible(visible);
+ setSortType(sortType);
+ } // ColumnVisual
+
+ public String getColId() {
+ return colId;
+ }
+
+ public String getColDisplay() {
+ return colDisplay;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public String getSortType() {
+ return sortType;
+ }
+
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+ public void setColDisplay(String colDisplay) {
+ this.colDisplay = colDisplay;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public void setSortType(String sortType) {
+ this.sortType = sortType;
+ }
+
+} // ColumnVisual
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java
new file mode 100644
index 00000000..34cc10d3
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabColumnValues.java
@@ -0,0 +1,75 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.system.ConnectionUtils;
+import org.openecomp.portalsdk.analytics.util.DataSet;
+
+public class CrossTabColumnValues extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String colId = null;
+
+ private Vector columnValues = null;
+
+ public CrossTabColumnValues(String colId, String loadValuesSQL, String dbInfo)
+ throws RaptorException {
+ this.colId = colId;
+ DataSet ds = ConnectionUtils.getDataSet(loadValuesSQL, dbInfo);
+ // DataSet ds = DbUtils.executeQuery(loadValuesSQL);
+ columnValues = new Vector(ds.getRowCount());
+ for (int i = 0; i < ds.getRowCount(); i++)
+ columnValues.add(ds.getString(i, 0));
+ } // CrossTabColumnValues
+
+ public String getColId() {
+ return colId;
+ }
+
+ public Vector getColumnValues() {
+ return columnValues;
+ }
+
+ public int getValuesCount() {
+ return columnValues.size();
+ }
+
+ public String getValueAt(int idx) {
+ return (String) columnValues.get(idx);
+ }
+
+ public int getIndexOf(String value) {
+ for (int i = 0; i < getValuesCount(); i++)
+ if (value.equals(getValueAt(i)))
+ return i;
+
+ return -1;
+ } // getIndexOf
+
+ public int getIndexOf(int value) {
+ for (int i = 0; i < getValuesCount(); i++)
+ if (value == new Integer(getValueAt(i)).intValue())
+ return i;
+
+ return -1;
+ } // getIndexOf
+
+} // CrossTabColumnValues
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java
new file mode 100644
index 00000000..55c2c757
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabOrderManager.java
@@ -0,0 +1,98 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+import org.openecomp.portalsdk.analytics.error.RaptorException;
+import org.openecomp.portalsdk.analytics.model.runtime.ReportRuntime;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.xmlobj.DataColumnType;
+
+public class CrossTabOrderManager extends RaptorObject {
+ private Vector colHeaderValues = null;
+
+ private Vector rowHeaderValues = null;
+
+
+ public CrossTabOrderManager(ReportRuntime rr, String userId,HttpServletRequest request) throws RaptorException {
+ colHeaderValues = new Vector();
+ rowHeaderValues = new Vector();
+
+ for (Iterator iter = rr.getAllColumns().iterator(); iter.hasNext();) {
+ DataColumnType dct = (DataColumnType) iter.next();
+ if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN)) {
+ if(rr.getColumnById(dct.getColId()+"_sort")!=null) {
+ dct = rr.getColumnById(dct.getColId()+"_sort");
+ colHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ } else
+ colHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ }
+ else if (nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW))
+ rowHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ else if (nvl(dct.getCrossTabValue()).trim().length()<=0)
+ rowHeaderValues.add(new CrossTabColumnValues(dct.getColId(), rr
+ .generateDistinctValuesSQL(dct, userId,request), rr.getDbInfo()));
+ } // for
+ } // CrossTabOrderManager
+
+ public int getIndexOfColHeaderValue(int colIdx, String value) {
+ return ((CrossTabColumnValues) colHeaderValues.get(colIdx)).getIndexOf(value);
+ } // getIndexOfColHeaderValue
+
+ public int getIndexOfColHeaderValue(int colIdx, int value) {
+ return ((CrossTabColumnValues) colHeaderValues.get(colIdx)).getIndexOf(value);
+ } // getIndexOfColHeaderValue
+
+ public boolean isAfterColHeaderValue(int colIdx, String curValue, String newValue) {
+ return (getIndexOfColHeaderValue(colIdx, curValue) > getIndexOfColHeaderValue(colIdx,
+ newValue));
+ } // isBeforeColHeaderValue
+
+ public boolean isAfterColHeaderValue(int colIdx, int curValue, Integer newValue) {
+ return (getIndexOfColHeaderValue(colIdx, curValue) > getIndexOfColHeaderValue(colIdx,
+ newValue.intValue()));
+ } // isBeforeColHeaderValue
+
+ public int getIndexOfRowHeaderValue(int rowIdx, String value) {
+ return ((CrossTabColumnValues) rowHeaderValues.get(rowIdx)).getIndexOf(value);
+ } // getIndexOfRowHeaderValue
+
+ public boolean isAfterRowHeaderValue(int rowIdx, String curValue, String newValue) {
+ return (getIndexOfRowHeaderValue(rowIdx, curValue) > getIndexOfRowHeaderValue(rowIdx,
+ newValue));
+ } // isBeforeRowHeaderValue
+
+ public Vector getRowHeaderValues() {
+ return rowHeaderValues;
+ }
+
+ public void setRowHeaderValues(Vector rowHeaderValues) {
+ this.rowHeaderValues = rowHeaderValues;
+ }
+
+} // CrossTabOrderManager
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java
new file mode 100644
index 00000000..bb5e9dc6
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/CrossTabTotalValue.java
@@ -0,0 +1,56 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+public class CrossTabTotalValue extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private Vector headerValues = null;
+
+ private String totalValue = null;
+
+ public CrossTabTotalValue() {
+ super();
+ }
+
+ public CrossTabTotalValue(Vector headerValues, String totalValue) {
+ this();
+
+ setHeaderValues(headerValues);
+ setTotalValue(totalValue);
+ } // CrossTabTotalValue
+
+ public Vector getHeaderValues() {
+ return headerValues;
+ }
+
+ public String getTotalValue() {
+ return totalValue;
+ }
+
+ public void setHeaderValues(Vector headerValues) {
+ this.headerValues = headerValues;
+ }
+
+ public void setTotalValue(String totalValue) {
+ this.totalValue = totalValue;
+ }
+
+} // CrossTabTotalValue
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java
new file mode 100644
index 00000000..aa53be1d
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataRow.java
@@ -0,0 +1,169 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.ArrayList;
+import java.util.Vector;
+
+public class DataRow/* extends Vector*/ {
+
+ private ArrayList dataValueList = new ArrayList();
+ private HtmlFormatter rowFormatter = null;
+
+ private int nextElemIdx = 0;
+
+ private boolean rowFormat = false;
+
+ private String formatId = null;
+
+ private int rowNum = -1;
+
+ private Vector<DataValue> rowValues;
+
+ /**
+ * @return the rowNum
+ */
+ public int getRowNum() {
+ return rowNum;
+ }
+
+
+ /**
+ * @param rowNum the rowNum to set
+ * Used for crosstab
+ */
+ public void setRowNum(int rowNum) {
+ this.rowNum = rowNum;
+ }
+
+
+ public String getFormatId() {
+ return formatId;
+ }
+
+
+ public void setFormatId(String formatId) {
+ this.formatId = formatId;
+ }
+
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < dataValueList.size());
+ } // hasNext
+
+ public DataValue getNext() {
+ return hasNext() ? getDataValue(nextElemIdx++) : null;
+ } // getNext
+
+ public DataValue getDataValue(int idx) {
+ return (DataValue) dataValueList.get(idx);
+ } // getRowHeader
+
+ public void addDataValue(DataValue dataValue) {
+ if (rowFormatter != null)
+ dataValue.setRowFormatter(rowFormatter);
+ dataValueList.add(dataValue);
+ } // addDataValue
+
+ public void addDataValue(int idx, DataValue dataValue) {
+ if (rowFormatter != null)
+ dataValue.setRowFormatter(rowFormatter);
+ dataValueList.add(idx, dataValue);
+ } // addDataValue
+
+ public void setDataValue(int idx, DataValue dataValue) {
+ if (rowFormatter != null)
+ dataValue.setRowFormatter(rowFormatter);
+ dataValueList.set(idx, dataValue);
+ } // addDataValue
+
+ public HtmlFormatter getRowFormatter() {
+ return rowFormatter;
+ }
+
+ public void setRowFormat(boolean b) {
+ rowFormat = b;
+ }
+ public boolean isRowFormat() {
+ return rowFormat;
+ }
+
+ public void setRowFormatter(HtmlFormatter rowFormatter) {
+ this.rowFormatter = rowFormatter;
+
+ for (int i = 0; i < dataValueList.size(); i++)
+ ((DataValue) dataValueList.get(i)).setRowFormatter(rowFormatter);
+ } // setRowFormatter
+
+ public String getBgColorHtml() {
+ if (rowFormatter != null && rowFormatter.getBgColor().length() > 0)
+ return " bgcolor=" + rowFormatter.getBgColor();
+ else
+ return "";
+ } // getBgColorHtml
+
+ public String getDataValue(String colId) {
+ String v_ColId = "";
+ for (int i = 0; i < dataValueList.size(); i++) {
+ v_ColId = ((DataValue) dataValueList.get(i)).getColId();
+ if(v_ColId.equals(colId)) {
+ return ((DataValue) dataValueList.get(i)).getDisplayValue();
+ }
+ }
+ return null;
+
+ }
+
+
+ /**
+ * @return the dataValueList
+ */
+ public ArrayList getDataValueList() {
+ return dataValueList;
+ }
+
+
+ /**
+ * @param dataValueList the dataValueList to set
+ */
+ public void setDataValueList(ArrayList dataValueList) {
+ this.dataValueList = dataValueList;
+ }
+
+
+ public Vector<DataValue> getRowValues() {
+ return rowValues;
+ }
+
+
+ public void setRowValues(Vector<DataValue> rowValues) {
+ this.rowValues = rowValues;
+ }
+
+} // DataRow
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java
new file mode 100644
index 00000000..605cb226
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/DataValue.java
@@ -0,0 +1,359 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+public class DataValue extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String displayValue = "";
+
+ private String displayCalculatedValue = "";
+
+ private String drillDownURL = null;
+
+ private boolean drillDowninPoPUp = false;
+
+ private String indentation = "";
+
+ private String alignment = "Left";
+
+ private boolean visible = true;
+
+ private boolean hidden = false;
+
+ private boolean bold = false;
+
+ private HtmlFormatter cellFormatter = null;
+
+ private HtmlFormatter rowFormatter = null;
+
+ private String formatId = null;
+
+ private boolean cellFormat = false;
+
+ private String colId = null;
+
+ private String displayTotal = null;
+
+ private String colName = null;
+
+ private String displayName = null;
+
+ private String nowrap = "False";
+
+ private String hyperlinkURL = "";
+
+ private String displayType = "";
+
+ private String actionImg = "";
+
+
+ public String getColName() {
+
+ return colName;
+ }
+
+
+ public void setColName(String colName) {
+
+ this.colName = colName;
+ }
+
+ public DataValue() {
+ super();
+ }
+
+ public String getFormatId() {
+ return formatId;
+ }
+
+
+ public void setFormatId(String formatId) {
+ this.formatId = formatId;
+ }
+
+ public void setCellFormat(boolean b) {
+ cellFormat = b;
+ }
+ public boolean isCellFormat() {
+ return cellFormat;
+ }
+
+ public String getDisplayValue() {
+ return displayValue;
+ }
+
+ public String getDrillDownURL() {
+ return drillDownURL;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public boolean isBold() {
+ return bold;
+ }
+
+ public HtmlFormatter getCellFormatter() {
+ return cellFormatter;
+ }
+
+ public HtmlFormatter getRowFormatter() {
+ return rowFormatter;
+ }
+
+ public void setDisplayValue(String displayValue) {
+ this.displayValue = nvl(displayValue);
+ }
+
+ public void setDrillDownURL(String drillDownURL) {
+ this.drillDownURL = drillDownURL;
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = alignment;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ public void setBold(boolean bold) {
+ this.bold = bold;
+ }
+
+ public void setCellFormatter(HtmlFormatter cellFormatter) {
+ this.cellFormatter = cellFormatter;
+ }
+
+ public void setRowFormatter(HtmlFormatter rowFormatter) {
+ this.rowFormatter = rowFormatter;
+ }
+
+ private String getFormattedValue(String value) {
+ value = nvl(value.trim()).length()<=0 ? "&nbsp":value;
+ if (cellFormatter != null)
+ return cellFormatter.formatValue(value);
+ else if (rowFormatter != null)
+ return rowFormatter.formatValue(value);
+ else
+ return value;
+ } // getFormattedValue
+
+ private String getFormattedLink(String value) {
+ if (cellFormatter != null)
+ return cellFormatter.formatLink(value, drillDownURL, isDrillDowninPoPUp());
+ else if (rowFormatter != null)
+ return rowFormatter.formatLink(value, drillDownURL, isDrillDowninPoPUp());
+ else {
+ if(!isDrillDowninPoPUp()) {
+ return "<a href=\"" + drillDownURL + "\">" + value + "</a>";
+ } else {
+ return "<a href=\"#\" onClick=\"showDrillDownInPopup('" + drillDownURL + "&noFormFields=Y&isEmbedded=Y&show_back_btn=N"+ "')\">" + value + "</a>";
+ }
+
+ }
+ } // getFormattedValue
+
+ private String getValueHtml() {
+ return (nvl(displayValue).trim().length() == 0) ? "&nbsp;" : displayValue;
+ }
+
+ public String getDisplayValueHtml() {
+ return getFormattedValue(getValueHtml());
+ }
+
+ public String getDisplayValueLinkHtml() {
+ if (nvl(drillDownURL).length() == 0)
+ return getDisplayValueHtml();
+ else
+ return getFormattedLink(getValueHtml());
+ // return getFormattedValue("<a
+ // href=\""+drillDownURL+"\">"+getValueHtml()+"</a>");
+ } // getDisplayValueLinkHtml
+
+ public String getAlignmentHtml() {
+ if (cellFormatter != null && cellFormatter.getAlignment().length() > 0)
+ return " align=" + cellFormatter.getAlignment();
+ else if (rowFormatter != null && rowFormatter.getAlignment().length() > 0)
+ return " align=" + rowFormatter.getAlignment();
+ else
+ return (alignment.length() == 0) ? "" : (" align=" + alignment);
+ } // getAlignmentHtml
+
+ public String getBgColorHtml() {
+ if (cellFormatter != null && cellFormatter.getBgColor().length() > 0)
+ return " bgcolor=" + cellFormatter.getBgColor();
+ else if (rowFormatter != null && rowFormatter.getBgColor().length() > 0)
+ return " bgcolor=" + rowFormatter.getBgColor();
+ else
+ return "";
+ } // getBgColorHtml
+
+
+ public String getColId() {
+
+ return colId;
+ }
+
+
+ public void setColId(String colId) {
+
+ this.colId = colId;
+ }
+
+
+ public String getDisplayTotal() {
+
+ return displayTotal;
+ }
+
+
+ public void setDisplayTotal(String displayTotal) {
+
+ this.displayTotal = displayTotal;
+ }
+
+
+
+ public String getDisplayName() {
+
+ return displayName;
+ }
+
+
+
+ public void setDisplayName(String displayName) {
+
+ this.displayName = displayName;
+ }
+
+
+ public boolean isHidden() {
+ return hidden;
+ }
+
+
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ public String getNowrap() {
+ return nowrap;
+ }
+
+
+ public void setNowrap(String nowrap) {
+ this.nowrap = nowrap;
+ }
+
+ public boolean isDrillDowninPoPUp() {
+ return drillDowninPoPUp;
+ }
+
+
+ public void setDrillDowninPoPUp(boolean drillDowninPoPUp) {
+ this.drillDowninPoPUp = drillDowninPoPUp;
+ }
+
+
+ /**
+ * @return the displayCalculatedValue
+ */
+ public String getDisplayCalculatedValue() {
+ return displayCalculatedValue;
+ }
+
+
+ /**
+ * @param displayCalculatedValue the displayCalculatedValue to set
+ */
+ public void setDisplayCalculatedValue(String displayCalculatedValue) {
+ this.displayCalculatedValue = displayCalculatedValue;
+ }
+
+
+ /**
+ * @return the indentation
+ */
+ public String getIndentation() {
+ return indentation;
+ }
+
+
+ /**
+ * @param indentation the indentation to set
+ */
+ public void setIndentation(String indentation) {
+ this.indentation = indentation;
+ }
+
+
+ /**
+ * @return the hyperlinkURL
+ */
+ public String getHyperlinkURL() {
+ return hyperlinkURL;
+ }
+
+
+ /**
+ * @param hyperlinkURL the hyperlinkURL to set
+ */
+ public void setHyperlinkURL(String hyperlinkURL) {
+ this.hyperlinkURL = hyperlinkURL;
+ }
+
+
+ /**
+ * @return the displayType
+ */
+ public String getDisplayType() {
+ return displayType;
+ }
+
+
+ /**
+ * @param displayType the displayType to set
+ */
+ public void setDisplayType(String displayType) {
+ this.displayType = displayType;
+ }
+
+
+ /**
+ * @return the actionImg
+ */
+ public String getActionImg() {
+ return actionImg;
+ }
+
+
+ /**
+ * @param actionImg the actionImg to set
+ */
+ public void setActionImg(String actionImg) {
+ this.actionImg = actionImg;
+ }
+
+} // DataValue
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java
new file mode 100644
index 00000000..fa54a1d9
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/HtmlFormatter.java
@@ -0,0 +1,205 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import org.openecomp.portalsdk.analytics.RaptorObject;
+
+public class HtmlFormatter extends RaptorObject {
+ private boolean bold = false;
+
+ private boolean italic = false;
+
+ private boolean underline = false;
+
+ private String bgColor = "";
+
+ private String fontColor = "";
+
+ private String fontFace = "";
+
+ private String fontSize = "";
+
+ private String alignment = "";
+
+ private String formatId = "";
+
+ public HtmlFormatter() {
+ super();
+ }
+
+ public HtmlFormatter(boolean bold, boolean italic, boolean underline, String bgColor,
+ String fontColor, String fontFace, String fontSize) {
+ this();
+
+ setBold(bold);
+ setItalic(italic);
+ setUnderline(underline);
+ setBgColor(bgColor);
+ setFontColor(fontColor);
+ setFontFace(fontFace);
+ setFontSize(fontSize);
+ } // HtmlFormatter
+
+ public HtmlFormatter(boolean bold, boolean italic, boolean underline, String bgColor,
+ String fontColor, String fontFace, String fontSize, String alignment) {
+ this(bold, italic, underline, bgColor, fontColor, fontFace, fontSize);
+ setAlignment(alignment);
+ } // HtmlFormatter
+
+ public boolean isBold() {
+ return bold;
+ }
+
+ public boolean isItalic() {
+ return italic;
+ }
+
+ public boolean isUnderline() {
+ return underline;
+ }
+
+ public String getBgColor() {
+ return bgColor;
+ }
+
+ public String getFontColor() {
+ return fontColor;
+ }
+
+ public String getFontFace() {
+ return fontFace;
+ }
+
+ public String getFontSize() {
+ return fontSize;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ public void setBold(boolean bold) {
+ this.bold = bold;
+ }
+
+ public void setItalic(boolean italic) {
+ this.italic = italic;
+ }
+
+ public void setUnderline(boolean underline) {
+ this.underline = underline;
+ }
+
+ public void setBgColor(String bgColor) {
+ this.bgColor = nvl(bgColor);
+ }
+
+ public void setFontColor(String fontColor) {
+ this.fontColor = nvl(fontColor);
+ }
+
+ public void setFontFace(String fontFace) {
+ this.fontFace = nvl(fontFace);
+ }
+
+ public void setFontSize(String fontSize) {
+ this.fontSize = nvl(fontSize);
+ }
+
+ public void setAlignment(String alignment) {
+ this.alignment = nvl(alignment);
+ }
+
+ private String generateStyleHtml() {
+ StringBuffer sb = new StringBuffer();
+
+ if (isBold())
+ sb.append("font-weight:bold;");
+ if (isItalic())
+ sb.append("font-style:italic;");
+ if (isUnderline())
+ sb.append("text-decoration:underline;");
+ // if(getBgColor().length()>0)
+ // sb.append("background-color:"+getBgColor()+";");
+ if (getFontColor().length() > 0)
+ sb.append("color:" + getFontColor() + ";");
+ if (getFontFace().length() > 0)
+ sb.append("font-family:" + getFontFace() + ";");
+ if (getFontSize().length() > 0)
+ sb.append("font-size:" + getFontSize() + "px;");
+ if (getAlignment().length() > 0)
+ sb.append("text-align:" + getAlignment() + ";");
+
+ if (sb.length() > 0) {
+ sb.insert(0, " style=\"");
+ sb.append("\"");
+ } // if
+
+ return sb.toString();
+ } // generateStyleHtml
+
+ public String generateStyleForZK() {
+ StringBuffer sb = new StringBuffer();
+
+ if (isBold())
+ sb.append("font-weight:bold;");
+ if (isItalic())
+ sb.append("font-style:italic;");
+ if (isUnderline())
+ sb.append("text-decoration:underline;");
+ // if(getBgColor().length()>0)
+ // sb.append("background-color:"+getBgColor()+";");
+ if (getFontColor().length() > 0)
+ sb.append("color:" + getFontColor() + ";");
+ if (getFontFace().length() > 0)
+ sb.append("font-family:" + getFontFace() + ";");
+ if (getFontSize().length() > 0)
+ sb.append("font-size:" + getFontSize() + "px;");
+ if (getAlignment().length() > 0)
+ sb.append("text-align:" + getAlignment() + ";");
+
+ return sb.toString();
+ } // generateStyleHtml
+
+ public String formatValue(String value) {
+ String style = generateStyleHtml();
+ if (style.length() > 0)
+ return "<font" + style + ">" + value + "</font>";
+ else
+ return value;
+ } // formatValue
+
+ public String formatLink(String value, String url, boolean drillDowninPoPUp) {
+ if(!drillDowninPoPUp) {
+ return "<a href=\"" + url + "\"" + generateStyleHtml() + ">" + value + "</a>";
+ } else {
+ return "<a href=\"#\" onClick=\"showDrillDownInPopup('" + url + "&noFormFields=Y&isEmbedded=Y&show_back_btn=N"+ "')\"" + generateStyleHtml() + ">" + value + "</a>";
+ }
+ } // formatLink
+
+ public String getFormatId() {
+ return formatId;
+ }
+
+ public void setFormatId(String formatId) {
+ this.formatId = formatId;
+ }
+
+} // HtmlFormatter
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java
new file mode 100644
index 00000000..6bbe0127
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportColumnHeaderRows.java
@@ -0,0 +1,71 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+public class ReportColumnHeaderRows extends Vector {
+ 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 ColumnHeaderRow getNext() {
+ return hasNext() ? getColumnHeaderRow(nextElemIdx++) : null;
+ } // getNext
+
+ public ColumnHeader getColumnHeader(int rowIdx, int colIdx) {
+ return getColumnHeaderRow(rowIdx).getColumnHeader(colIdx);
+ } // getColumnHeader
+
+ public ColumnHeaderRow getColumnHeaderRow(int idx) {
+ return (ColumnHeaderRow) get(idx);
+ } // getColumnHeaderRow
+
+ public void addColumnHeaderRow(ColumnHeaderRow columnHeaderRow) {
+ add(columnHeaderRow);
+ } // addColumnHeaderRow
+
+ public void addColumnHeaderRow(int idx, ColumnHeaderRow columnHeaderRow) {
+ add(idx, columnHeaderRow);
+ } // addColumnHeaderRow
+
+ public int getRowCount() {
+ return size();
+ } // getRowCount
+
+ public int getColumnCount() {
+ int cSize = 0;
+ if (getRowCount() > 0)
+ cSize = getColumnHeaderRow(getRowCount() - 1).size();
+
+ return cSize;
+ } // getColumnCount
+
+} // ReportColumnHeaderRows
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java
new file mode 100644
index 00000000..5ef15dc4
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportData.java
@@ -0,0 +1,812 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import org.openecomp.portalsdk.analytics.model.runtime.FormatProcessor;
+import org.openecomp.portalsdk.analytics.model.runtime.VisualManager;
+import org.openecomp.portalsdk.analytics.system.AppUtils;
+import org.openecomp.portalsdk.analytics.util.AppConstants;
+import org.openecomp.portalsdk.analytics.util.Utils;
+
+public class ReportData extends org.openecomp.portalsdk.analytics.RaptorObject implements Serializable {
+ // private static final boolean sortData = true; // sort cross-tab data by
+ // row/col name while being added
+ private static final int MAX_NUM_COLS = 150; // -1 => no restriction
+
+ private int pageNo = -1;
+
+ private int pageSetNo = -1;
+
+ public ReportColumnHeaderRows reportColumnHeaderRows = null;
+
+ public ReportRowHeaderCols reportRowHeaderCols = null;
+
+ public ReportDataRows reportDataRows = null;
+
+ public ReportDataRows reportDataTotalRow = null;
+
+ public ReportRowHeaderCols reportTotalRowHeaderCols = null;
+
+ public List reportDataList = null;
+
+ private boolean canSortAtRuntime = false;
+
+ private Vector columnVisuals = null; // Contains actual column Ids for
+ // linear or last header col values
+ // for cross-tab
+
+ public ReportData(int pageNo, boolean canSortAtRuntime) {
+ super();
+
+ this.pageNo = pageNo;
+ this.canSortAtRuntime = canSortAtRuntime;
+
+ reportColumnHeaderRows = new ReportColumnHeaderRows();
+ reportRowHeaderCols = new ReportRowHeaderCols();
+ reportDataRows = new ReportDataRows();
+
+ columnVisuals = new Vector();
+ } // ReportData
+
+ public int getPageNo() {
+ return pageNo;
+ } // pageNo
+
+ public int getPageSetNo() {
+ return pageSetNo;
+ } // pageSetNo
+
+ public int getHeaderRowCount() {
+ return reportColumnHeaderRows.getRowCount();
+ } // getHeaderRowCount
+
+ public int getDataRowCount() {
+ if(reportDataRows!=null && reportDataRows.getRowCount()>0)
+ return reportDataRows.getRowCount();
+ else if(getReportDataList()!=null)
+ return getReportDataList().size();
+ else
+ return 0;
+ } // getDataRowCount
+
+ public int getTotalRowCount() {
+ return getHeaderRowCount() + getDataRowCount();
+ } // getTotalRowCount
+
+ public int getHeaderColumnCount() {
+ return reportRowHeaderCols.getColumnCount();
+ } // getHeaderColumnCount
+
+ public int getDataColumnCount() {
+ int cCount = reportDataRows.getColumnCount();
+ if (cCount == 0)
+ cCount = reportColumnHeaderRows.getColumnCount();
+
+ return cCount;
+ } // getDataColumnCount
+
+ public int getTotalColumnCount() {
+ return getHeaderColumnCount() + getDataColumnCount();
+ } // getTotalColumnCount
+
+ // Cross-tab data section
+ private void insertColumn(int colIdx, Vector colNameValues, Vector colNameSortValues, List dataList, String alignment) {
+ int r = 0;
+ for (reportColumnHeaderRows.resetNext(); reportColumnHeaderRows.hasNext();) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getNext();
+ if(colNameSortValues!=null) {
+ ColumnHeader ch = new ColumnHeader(((DataValue) colNameValues.get(r)).getDisplayValue(), Integer.valueOf(((DataValue)colNameSortValues.get(r)).getDisplayValue()) );
+ ch.setColumnWidth(chr.getDisplayWidth());
+ ch.setAlignment(alignment);
+ chr.addColumnHeader(colIdx, ch);
+ }
+ else {
+ ColumnHeader ch = new ColumnHeader(((DataValue) colNameValues.get(r)).getDisplayValue());
+ ch.setColumnWidth(chr.getDisplayWidth());
+ ch.setAlignment(alignment);
+ chr.addColumnHeader(colIdx, ch);
+ }
+ r++;
+ } // for
+
+/* for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
+ DataRow dr = reportDataRows.getNext();
+ dr.addDataValue(colIdx, new DataValue());
+ } // for
+ */
+ for(int j = 0; j < dataList.size(); j++) {
+ DataRow dr = (DataRow) dataList.get(j);
+ dr.addDataValue(colIdx, new DataValue());
+ }
+ } // insertColumn
+
+ private boolean prevColNamesChanged(int colIdx, Vector prevColNames) {
+ for (int k = 0; k < prevColNames.size(); k++)
+ if (!nvl((String) prevColNames.get(k)).equals(
+ reportColumnHeaderRows.getColumnHeader(k, colIdx).getColumnTitle()))
+ return true;
+
+ return false;
+ } // prevColNamesChanged
+
+ private int findColumnIdx(Vector colNameValues, Vector colNameSortValues, CrossTabOrderManager crossTabOrderManager,
+ boolean createIfMissing, List dataList) {
+ int colIdx = 0;
+ try {
+
+ boolean nameFound = false;
+ // String prevColName = null;
+ Vector prevColNames = new Vector();
+ int columnSort = -1;
+ for (int r = 0; r < colNameValues.size(); r++) {
+ //String colName = (String) colNameValues.get(r);
+ String colName = ((DataValue) colNameValues.get(r)).getDisplayValue();
+ Integer colSortName = null;
+ if(colNameSortValues!=null)
+ colSortName = Integer.valueOf(((DataValue)colNameSortValues.get(r)).getDisplayValue());
+ ColumnHeaderRow chr = reportColumnHeaderRows.getColumnHeaderRow(r);
+
+ chr.resetNext(colIdx);
+ nameFound = false;
+ boolean posFound = false;
+ while ((!nameFound) && (!posFound) && chr.hasNext()) {
+ ColumnHeader ch = chr.getNext();
+ columnSort = ch.getColumnSort();
+ if (colName.equals(ch.getColumnTitle())) {
+ if (prevColNamesChanged(colIdx, prevColNames))
+ posFound = true;
+ else
+ nameFound = true;
+ } else if (crossTabOrderManager != null) {
+ if( colNameSortValues!=null && crossTabOrderManager.isAfterColHeaderValue(r, columnSort,
+ colSortName))
+ posFound = true;
+ else if (colNameSortValues == null && crossTabOrderManager.isAfterColHeaderValue(r, ch.getColumnTitle(),
+ colName)) {
+ posFound = true;
+ }
+ }
+ else if (crossTabOrderManager == null) {
+ if( colNameSortValues!=null && colSortName.compareTo(ch.getColumnSort()) < 0)
+ posFound = true;
+ else if (colNameSortValues==null && colName.compareTo(ch.getColumnTitle()) < 0)
+ posFound = true;
+ }
+ else // if(prevColName!=null&&(!
+ // prevColName.equals(reportColumnHeaderRows.getColumnHeader(r-1,
+ // colIdx).getColumnTitle())))
+ if (prevColNamesChanged(colIdx, prevColNames))
+ posFound = true;
+
+ if ((!nameFound) && (!posFound))
+ colIdx++;
+ } // while
+
+ if (!nameFound)
+ if (createIfMissing && (MAX_NUM_COLS >= 0) && (colIdx <= MAX_NUM_COLS)) {
+ insertColumn(colIdx, colNameValues, colNameSortValues, dataList, chr.getAlignment());
+ return colIdx;
+ } else
+ return -1;
+
+ prevColNames.add(r, colName);
+ } // for
+ if (!nameFound)
+ if (createIfMissing && (MAX_NUM_COLS >= 0) && (colIdx <= MAX_NUM_COLS))
+ insertColumn(colIdx, colNameValues, colNameSortValues, dataList, "center");
+ else
+ return -1;
+ } catch (Exception ex) {ex.printStackTrace();}
+
+ return colIdx;
+ } // findColumnIdx
+
+ private void insertRow(int rowIdx, Vector rowNameValues, List dataList, CrossTabOrderManager crossTabOrderManager) {
+ int c = 0;
+ DataRow dr = new DataRow();
+ int dataRowIdx = 0;
+ for (reportRowHeaderCols.resetNext(); reportRowHeaderCols.hasNext();) {
+ if((c+1)==reportRowHeaderCols.size()) {
+ dataRowIdx = crossTabOrderManager.getIndexOfRowHeaderValue(c, ((DataValue) rowNameValues.get(c)).getDisplayValue());
+ }
+ RowHeaderCol rhc = reportRowHeaderCols.getNext();
+ rhc.addRowHeader(rowIdx, new RowHeader(((DataValue) rowNameValues.get(c)).getDisplayValue()));
+ c++;
+ } // for
+
+ dr.setRowNum(dataRowIdx);
+ for (c = 0; c < getDataColumnCount(); c++) {
+ dr.addDataValue(new DataValue());
+ }
+
+ //reportDataRows.addDataRow(rowIdx, dr);
+ //dr.setRowNum(dataList.size()==0?1:dataList.size());
+ dataList.add(rowIdx, dr);
+
+ } // insertRow
+
+ private boolean prevRowNamesChanged(int rowIdx, Vector prevRowNames) {
+ for (int k = 0; k < prevRowNames.size(); k++)
+ if (!nvl((String) prevRowNames.get(k)).equals(
+ reportRowHeaderCols.getRowHeader(k, rowIdx).getRowTitle()))
+ return true;
+
+ return false;
+ } // prevRowNamesChanged
+
+ private int findRowIdx(Vector rowNameValues, CrossTabOrderManager crossTabOrderManager,
+ boolean createIfMissing, List dataList) {
+ int rowIdx = 0;
+ boolean nameFound = false;
+ Vector prevRowNames = new Vector();
+ for (int c = 0; c < rowNameValues.size(); c++) {
+ //String rowName = (String) rowNameValues.get(c);
+ String rowName = ((DataValue) rowNameValues.get(c)).getDisplayValue();
+
+ RowHeaderCol rhc = reportRowHeaderCols.getRowHeaderCol(c);
+
+ rhc.resetNext(rowIdx);
+ nameFound = false;
+ boolean posFound = false;
+ while ((!nameFound) && (!posFound) && rhc.hasNext()) {
+ RowHeader rh = rhc.getNext();
+ if (rowName.equals(rh.getRowTitle())) {
+ if (prevRowNamesChanged(rowIdx, prevRowNames))
+ posFound = true;
+ else
+ nameFound = true;
+ } else if (crossTabOrderManager != null
+ && crossTabOrderManager.isAfterRowHeaderValue(c, rh.getRowTitle(),
+ rowName))
+ posFound = true;
+ else if (crossTabOrderManager == null
+ && rowName.compareTo(rh.getRowTitle()) < 0)
+ posFound = true;
+ else if (prevRowNamesChanged(rowIdx, prevRowNames))
+ posFound = true;
+
+ if ((!nameFound) && (!posFound))
+ rowIdx++;
+ } // while
+
+ if (!nameFound)
+ if (createIfMissing) {
+ insertRow(rowIdx, rowNameValues, dataList, crossTabOrderManager);
+ return rowIdx;
+ } else
+ return -1;
+
+ prevRowNames.add(c, rowName);
+ } // for
+ if (!nameFound)
+ if (createIfMissing)
+ insertRow(rowIdx, rowNameValues, dataList, crossTabOrderManager);
+ else
+ return -1;
+
+ return rowIdx;
+ } // findRowIdx
+
+ public void setDataValue(Vector rowNameValues, Vector colNameValues, Vector colNameSortValues, DataValue value,
+ FormatProcessor formatProcessor, CrossTabOrderManager crossTabOrderManager, List dataList) {
+ int rowIdx = findRowIdx(rowNameValues, crossTabOrderManager, true, dataList);
+ int colIdx = findColumnIdx(colNameValues, colNameSortValues, crossTabOrderManager, true, dataList);
+
+ if ((rowIdx >= 0) && (colIdx >= 0)) {
+ //DataRow dr = reportDataRows.getDataRow(rowIdx);
+ DataRow dr = (DataRow)dataList.get(rowIdx);
+ dr.setRowValues(rowNameValues);
+ dr.setDataValue(colIdx, value);
+ formatProcessor.setHtmlFormatters(value, dr, false);
+ } // if
+ } // setDataValue
+
+ public void consolidateColumnHeaders(VisualManager visualManager) {
+ // Setting column visuals
+ for (int i = 0; i < reportColumnHeaderRows.getColumnHeaderRow(
+ reportColumnHeaderRows.getRowCount() - 1).size(); i++) {
+ StringBuffer sb = new StringBuffer();
+
+ for (int ir = 0; ir < reportColumnHeaderRows.getRowCount(); ir++) {
+ ColumnHeader ch = reportColumnHeaderRows.getColumnHeaderRow(ir)
+ .getColumnHeader(i);
+ if (sb.length() > 0)
+ sb.append('|');
+ sb.append(Utils.replaceInString(ch.getColumnTitle(), "|", " "));
+ } // for
+
+ String colValue = sb.toString();
+ columnVisuals.add(new ColumnVisual(colValue, colValue, visualManager
+ .isColumnVisible(colValue), /* visualManager.getSortByColId().equals(colValue)?visualManager.getSortByAscDesc(): */
+ null));
+ } // for
+
+ // Consolidating column headers
+ for (int r = reportColumnHeaderRows.getRowCount() - 1; r >= 0; r--) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getColumnHeaderRow(r);
+
+ if (chr.size() > 0) {
+ ColumnHeader baseCH = chr.getColumnHeader(0);
+ int c = 1;
+ int c_shift = 0;
+ while (c < chr.size()) {
+ ColumnHeader ch = chr.getColumnHeader(c);
+
+ boolean performMerge = true;
+ for (int ir = r; ir >= 0; ir--) {
+ ColumnHeaderRow ichr = reportColumnHeaderRows.getColumnHeaderRow(ir);
+ ColumnHeader ch0 = ichr.getColumnHeader(c + ((ir == r) ? 0 : c_shift));
+ ColumnHeader ch1 = ichr.getColumnHeader(c + ((ir == r) ? 0 : c_shift)
+ - 1);
+ if (!ch0.getColumnTitle().equals(ch1.getColumnTitle()))
+ performMerge = false;
+ } // for
+
+ if (performMerge) {
+ c_shift++;
+ baseCH.setColSpan(baseCH.getColSpan() + 1);
+ chr.remove(c);
+ } else {
+ baseCH = ch;
+ c++;
+ }
+ } // while
+ } // if
+ } // for
+ } // consolidateColumnHeaders
+
+ public void consolidateRowHeaders() {
+ for (int c = reportRowHeaderCols.getColumnCount() - 1; c >= 0; c--) {
+ RowHeaderCol rhc = reportRowHeaderCols.getRowHeaderCol(c);
+
+ if (rhc.size() > 0) {
+ RowHeader baseRH = rhc.getRowHeader(0);
+ int r = 1;
+ while (r < rhc.size()) {
+ RowHeader rh = rhc.getRowHeader(r);
+
+ boolean performMerge = rh.getRowTitle().equals(baseRH.getRowTitle());
+ for (int ic = c - 1; ic >= 0; ic--) {
+ RowHeaderCol irhc = reportRowHeaderCols.getRowHeaderCol(ic);
+ RowHeader rh0 = irhc.getRowHeader(r);
+ RowHeader rh1 = irhc.getRowHeader(r - 1);
+ if (!rh0.getRowTitle().equals(rh1.getRowTitle()))
+ performMerge = false;
+ } // for
+
+ if (performMerge)
+ rh.setRowTitle(null);
+ else
+ baseRH = rh;
+
+ r++;
+ } // while
+ } // if
+ } // for
+ } // consolidateRowHeaders
+
+ public void addRowNumbers(int pageNo, List dataList) {
+ pageNo = 0;
+ //int startRowNum = ((pageNo < 0) ? 0 : pageNo) * pageSize + 1;
+ int startRowNum = 0;
+ RowHeaderCol rhc = new RowHeaderCol();
+ reportRowHeaderCols.addRowHeaderCol(0, rhc);
+ //rhc.setColumnWidth("5%");
+ for (int r = 0; r < dataList.size(); r++) {
+ rhc.add(new RowHeader(startRowNum + r+""));
+ ((DataRow)dataList.get(r)).setRowNum(r);
+ }
+ } // addRowNumbers
+
+ private void removeRow(int rowIdx) {
+ for (reportRowHeaderCols.resetNext(); reportRowHeaderCols.hasNext();) {
+ RowHeaderCol rhc = reportRowHeaderCols.getNext();
+ rhc.remove(rowIdx);
+ } // for
+
+ reportDataRows.remove(rowIdx);
+ } // removeRow
+
+ public void truncateData(int startRow, int endRow) {
+ if( endRow != -1){
+ for (int r = getDataRowCount() - 1; r > endRow; r--)
+ removeRow(r);
+ }
+
+ for (int r = startRow - 1; r >= 0; r--)
+ removeRow(r);
+ } // truncateData
+
+ /** *********************************************************************************** */
+
+ public void createColumn(String colId, String displayName, String displayWidthInPxls, String alignment,
+ boolean currentlyVisible, String currentSort, boolean isRuntimeColSortDisabled, int level, int start, int colspan, boolean sortable) {
+ ColumnHeaderRow chr = null;
+ if (getHeaderRowCount() > 0)
+ chr = reportColumnHeaderRows.getColumnHeaderRow(0);
+ else {
+ chr = new ColumnHeaderRow();
+ reportColumnHeaderRows.addColumnHeaderRow(chr);
+ chr.setRowHeight("30");
+ } // if
+ /*ColumnHeader ch = new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
+ + displayWidth + "%"), alignment, 1, isRuntimeColSortDisabled ? null : colId);
+ */
+ ColumnHeader ch = new ColumnHeader(displayName, displayWidthInPxls, alignment, 1, isRuntimeColSortDisabled ? null : colId);
+ ch.setGroupLevel(level);
+ ch.setStartGroup(start);
+ ch.setColSpanGroup(colspan);
+ ch.setColId(colId);
+ ch.setSortable(sortable);
+ //chr.addColumnHeader(new ColumnHeader(displayName, (displayWidth > 100) ? "10%" : (""
+ // + displayWidth + "%"), 1, isRuntimeColSortDisabled ? null : colId));
+ chr.addColumnHeader(ch);
+ columnVisuals.add(new ColumnVisual(colId, displayName, currentlyVisible, currentSort));
+ } // createColumn
+
+ public void columnVisualShowHide(String colId, boolean newVisible) {
+ for (int i = 0; i < columnVisuals.size(); i++) {
+ ColumnVisual col = (ColumnVisual) columnVisuals.get(i);
+ if (col.getColId().equals(colId)) {
+ col.setVisible(newVisible);
+ applyColumnVisibility(i, newVisible);
+ break;
+ } // if
+ } // for
+ } // columnVisualShowHide
+
+ private void applyColumnVisibility(int colIdx, boolean newVisible) {
+ boolean isLast = true;
+ for (int r = reportColumnHeaderRows.getRowCount() - 1; r >= 0; r--) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getColumnHeaderRow(r);
+
+ if (isLast) {
+ chr.getColumnHeader(colIdx).setVisible(newVisible);
+ isLast = false;
+ } else {
+ int curStartIdx = 0;
+ for (chr.resetNext(); chr.hasNext();) {
+ ColumnHeader ch = chr.getNext();
+ if (colIdx >= curStartIdx && colIdx <= curStartIdx + ch.getColSpan() - 1) {
+ ch.setVisible(newVisible);
+ break;
+ } else
+ curStartIdx += ch.getColSpan();
+ } // for
+ } // else
+ } // for
+ int row = 0;
+ for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
+ //reportDataRows.getNext().getDataValue(colIdx).setVisible(newVisible);
+ DataRow dr = reportDataRows.getNext();
+ if(colIdx < dr.getDataValueList().size()) {
+ DataValue dv = dr.getDataValue(colIdx);
+ dr.getDataValueList().remove(colIdx);
+ if(!dv.isHidden())
+ dv.setVisible(newVisible);
+ else
+ dv.setVisible(false);
+ dr.addDataValue(colIdx, dv);
+ }
+ reportDataRows.removeElementAt(row);
+ reportDataRows.addDataRow(row, dr);
+ row++;
+ }
+ } // applyColumnVisibility
+
+ public void applyVisibility() {
+ for (int i = 0; i < columnVisuals.size(); i++)
+ applyColumnVisibility(i, ((ColumnVisual) columnVisuals.get(i)).isVisible());
+ } // applyVisibility
+
+ public void resetVisualSettings() {
+ // No need to reset sort - if sort exists, the report data is reloaded
+ for (int i = 0; i < columnVisuals.size(); i++)
+ ((ColumnVisual) columnVisuals.get(i)).setVisible(true);
+
+ applyVisibility();
+ } // resetVisualSettings
+
+ /** *********************************************************************************** */
+
+ private int nextVisualIdx = 0;
+
+ public void resetNextVisual() {
+ resetNextVisual(0);
+ } // resetNext
+
+ public void resetNextVisual(int toPos) {
+ nextVisualIdx = toPos;
+ } // resetNext
+
+ public boolean hasNextVisual() {
+ return (nextVisualIdx < columnVisuals.size());
+ } // hasNext
+
+ public String getNextHiddenColLinks(int toPos) {
+ resetNextVisual(toPos);
+ return getNextHiddenColLinks();
+ } // getNextHiddenColLinks
+
+ public String getNextHiddenColLinks() {
+ if (!hasNextVisual())
+ return "";
+
+ StringBuffer sb = new StringBuffer();
+ ColumnVisual col = (ColumnVisual) columnVisuals.get(nextVisualIdx);
+
+ while (!col.isVisible()) {
+ if(!col.getColDisplay().equals(AppConstants.HIDDEN)) {
+ sb.append("<input type=image border=0 src='");
+ sb.append(AppUtils.getImgFolderURL());
+ sb.append("plus.gif' alt=\"Show column ");
+ sb.append(col.getColDisplay());
+ sb.append("\" width=11 height=11 onClick=\"document.formd.");
+ sb.append(AppConstants.RI_VISUAL_ACTION);
+ sb.append(".value='");
+ sb.append(AppConstants.VA_SHOW);
+ sb.append("';document.formd.");
+ sb.append(AppConstants.RI_DETAIL_ID);
+ sb.append(".value='");
+ sb.append(col.getColId());
+ sb.append("';document.formd.submit();\">");
+ }
+
+ if (!(nextVisualIdx + 1 < columnVisuals.size()))
+ break;
+ col = (ColumnVisual) columnVisuals.get(++nextVisualIdx);
+ } // while
+
+ return sb.toString();
+ } // getNextHiddenColLinks
+
+ public String getNextVisual() {
+ if (!hasNextVisual())
+ return null;
+
+ ColumnVisual col = (ColumnVisual) columnVisuals.get(nextVisualIdx++);
+
+ StringBuffer sb = new StringBuffer();
+
+ if (!col.isVisible() || col.getColDisplay().equals(AppConstants.HIDDEN))
+ return null;
+
+ sb.append("\n\t\t\t<table width=100% border=0 cellspacing=0 cellpadding=0><tr>\n");
+ sb
+ .append("\t\t\t\t<td style=\"background:#ffffff;\" align=left valign=middle nowrap><input type=image border=0 src='");
+ sb.append(AppUtils.getImgFolderURL());
+ sb.append("minus.gif' alt=\"Hide column ");
+ sb.append(col.getColDisplay());
+ sb.append("\" width=11 height=11 onClick=\"document.formd.");
+ sb.append(AppConstants.RI_VISUAL_ACTION);
+ sb.append(".value='");
+ sb.append(AppConstants.VA_HIDE);
+ sb.append("';document.formd.");
+ sb.append(AppConstants.RI_DETAIL_ID);
+ sb.append(".value='");
+ sb.append(col.getColId());
+ sb.append("';document.formd.submit();");
+ sb.append("\"></td>\n");
+ sb.append("\t\t\t\t<td style=\"background:#ffffff;\" align=center valign=middle width=95% nowrap>");
+ if (col.getSortType() != null) {
+ sb.append("<img border=0 src='");
+ sb.append(AppUtils.getImgFolderURL());
+ if (col.getSortType().equals(AppConstants.SO_ASC))
+ sb.append("grnarrowdn.gif");
+ else
+ sb.append("grnarrowup.gif");
+ sb.append("' alt=\"Sorted by column ");
+ sb.append(col.getColDisplay());
+ if (col.getSortType().equals(AppConstants.SO_ASC))
+ sb.append(" ascending");
+ else
+ sb.append(" descending");
+ sb.append("\" width=13 height=11>");
+ }
+ sb.append("</td>\n");
+ sb.append("\t\t\t\t<td style=\"background:#ffffff;\" align=right valign=middle nowrap>");
+ sb.append(getNextHiddenColLinks());
+ sb.append("</td>\n");
+ sb.append("\t\t\t</tr></table>\n\t\t");
+
+ return sb.toString();
+ } // getNext
+
+ /** *********************************************************************************** */
+
+ public void setColumnDataTotalsLinear(DataRow colDataTotals, String colTotalLabel) {
+ //commented so that we could differentiate data rows with total rows
+ //reportDataRows.addDataRow(colDataTotals);
+ RowHeader rh = new RowHeader(colTotalLabel, "45", 1, reportRowHeaderCols.getColumnCount(),true);
+ if(reportRowHeaderCols.size()>0)
+ reportRowHeaderCols.getRowHeaderCol(0).add(rh);
+
+ reportDataTotalRow = new ReportDataRows();
+ reportDataTotalRow.addDataRow(colDataTotals);
+ RowHeaderCol rhc = new RowHeaderCol();
+ rhc.add(rh);
+ reportTotalRowHeaderCols = new ReportRowHeaderCols();
+ reportTotalRowHeaderCols.addRowHeaderCol(0, rhc);
+ } // setColumnDataTotalsLinear
+
+ public void setCrossTabColumnTotalLabel(String colTotalLabel) {
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1)
+ .setRowTitle("");
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1).setColSpan(
+ 0);
+ reportRowHeaderCols.getRowHeaderCol(1).set(
+ getDataRowCount() - 1,
+ new RowHeader(colTotalLabel, "45", 1, reportRowHeaderCols.getColumnCount(),
+ true));
+ } // setCrossTabColumnTotalLabel
+
+ public void setCrossTabColumnTotalLabel(int reportDataSize, String colTotalLabel) {
+
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1)
+ .setRowTitle("");
+ reportRowHeaderCols.getRowHeaderCol(0).getRowHeader(getDataRowCount() - 1).setColSpan(
+ 0);
+ reportRowHeaderCols.getRowHeaderCol(1).set(
+ getDataRowCount() - 1,
+ new RowHeader(colTotalLabel, "45", 1, reportRowHeaderCols.getColumnCount(),
+ true));
+ } // setCrossTabColumnTotalLabel
+
+ public void setColumnDataTotalsCrossTab(Vector colDataTotals, String totalsAlignment,
+ String colDisplayTotal, CrossTabOrderManager crossTabOrderManager, List dataList) {
+ DataRow totalsDataRow = new DataRow();
+ for (int c = 0; c < getDataColumnCount(); c++)
+ totalsDataRow.addDataValue(new DataValue());
+
+ for (Iterator iter = colDataTotals.iterator(); iter.hasNext();) {
+ CrossTabTotalValue tVal = (CrossTabTotalValue) iter.next();
+
+ int colIdx = findColumnIdx(tVal.getHeaderValues(), null, crossTabOrderManager, false, dataList);
+ if (colIdx >= 0) {
+ DataValue dataValue = new DataValue();
+
+ String totalValue = tVal.getTotalValue();
+ // if(colDisplayTotal.length()>0&&(!
+ // colDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ // totalValue =
+ // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(colDisplayTotal))+":
+ // "+totalValue;
+ dataValue.setDisplayValue(totalValue);
+ //added below statement for displaying in excel as number
+ dataValue.setDisplayTotal("SUM(");
+ dataValue.setAlignment(totalsAlignment);
+ dataValue.setBold(true);
+ totalsDataRow.setDataValue(colIdx, dataValue);
+
+ //totalsDataRow.addDataValue(dataValue);
+
+ } // if
+ } // for
+
+ //reportDataRows.addDataRow(totalsDataRow);
+ //dr.setRowValues(rowNameValues);
+ Vector rowNameValues = new Vector();
+ for (int i=0; i < reportRowHeaderCols.size(); i++) {
+ if(i==0) {
+ DataValue dataValue = new DataValue();
+ dataValue.setBold(true);
+ dataValue.setAlignment("center");
+ dataValue.setDisplayValue("Total");
+ rowNameValues.add(dataValue);
+ //rowNameValues.add("Total");
+ } else {
+ //rowNameValues.add("");
+ DataValue dataValue = new DataValue();
+ dataValue.setDisplayValue("");
+ rowNameValues.add(dataValue);
+
+ }
+ }
+ totalsDataRow.setRowValues(rowNameValues);
+ totalsDataRow.setRowNum(dataList.size());
+ dataList.add(totalsDataRow);
+ //reportRowHeaderCols.getNext().addRowHeader(new RowHeader("", "30", 1, 0));
+ } // setColumnDataTotalsCrossTab
+
+ public void setRowDataTotalsCrossTab(Vector rowDataTotals, String totalsAlignment,
+ String rowDisplayTotal, CrossTabOrderManager crossTabOrderManager, List dataList) {
+ int colIdx = getDataColumnCount();
+
+ boolean isFirst = true;
+ for (reportColumnHeaderRows.resetNext(); reportColumnHeaderRows.hasNext();) {
+ ColumnHeaderRow chr = reportColumnHeaderRows.getNext();
+ if (isFirst) {
+ String totalLabel = "Total";
+ if (rowDisplayTotal.length() > 0
+ && (!rowDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ totalLabel = nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(rowDisplayTotal));
+ chr.addColumnHeader(colIdx, new ColumnHeader(totalLabel, "", 1,
+ reportColumnHeaderRows.getRowCount()));
+ isFirst = false;
+ } else
+ chr.addColumnHeader(colIdx, new ColumnHeader("", "", 1, 0));
+ } // for
+
+ for (reportDataRows.resetNext(); reportDataRows.hasNext();) {
+ DataRow dr = reportDataRows.getNext();
+ dr.addDataValue(colIdx, new DataValue());
+ } // for
+
+ for (Iterator iter = rowDataTotals.iterator(); iter.hasNext();) {
+ CrossTabTotalValue tVal = (CrossTabTotalValue) iter.next();
+
+ int rowIdx = findRowIdx(tVal.getHeaderValues(), crossTabOrderManager, false, dataList);
+ if (rowIdx >= 0) {
+ DataValue dataValue = new DataValue();
+
+ String totalValue = tVal.getTotalValue();
+ // if(rowDisplayTotal.length()>0&&(!
+ // rowDisplayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ // totalValue =
+ // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(rowDisplayTotal))+":
+ // "+totalValue;
+ dataValue.setDisplayValue(totalValue);
+ //added below statement for displaying in excel as number
+ dataValue.setDisplayTotal("SUM(");
+ dataValue.setAlignment(totalsAlignment);
+ dataValue.setBold(true);
+
+ //reportDataRows.getDataRow(rowIdx).getDataValueList().add(colIdx, dataValue);
+ ((DataRow)dataList.get(rowIdx)).addDataValue(colIdx, dataValue);
+ } // if
+ } // for
+ } // setRowDataTotalsCrossTab
+
+ public void setGrandTotalCrossTab(String totalValue, String totalAlignment,
+ String displayTotal, List dataList) {
+ DataValue dataValue = new DataValue();
+
+ // if(displayTotal.length()>0&&(!
+ // displayTotal.equals(AppConstants.TOTAL_SUM_ID)))
+ // totalValue =
+ // nvl(AppConstants.TOTAL_FUNCTIONS.getNameById(displayTotal))+":
+ // "+totalValue;
+ dataValue.setDisplayValue(totalValue);
+ //added below statement for displaying in excel as number
+ dataValue.setDisplayTotal("SUM(");
+ dataValue.setAlignment(totalAlignment);
+ dataValue.setBold(true);
+
+ //int colIdx = getDataColumnCount() - 1;
+ int rowIdx = getDataRowCount() - 1;
+ //reportDataRows.getDataRow(rowIdx).getDataValueList().add(colIdx, dataValue);
+ DataRow dr = (DataRow)dataList.get(rowIdx);
+ dr.addDataValue(dr.getDataValueList().size(), dataValue);
+ } // setGrandTotalCrossTab
+
+ public List getReportDataList() {
+ return reportDataList;
+ }
+
+ public void setReportDataList(List reportDataList) {
+ this.reportDataList = reportDataList;
+ }
+
+} // ReportData
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java
new file mode 100644
index 00000000..e2c9a6e5
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportDataRows.java
@@ -0,0 +1,72 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+public class ReportDataRows extends Vector {
+ 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 DataRow getNext() {
+ return hasNext() ? getDataRow(nextElemIdx++) : null;
+ } // getNext
+
+ public DataValue getDataValue(int rowIdx, int colIdx) {
+ return getDataRow(rowIdx).getDataValue(colIdx);
+ } // getDataValue
+
+ public DataRow getDataRow(int idx) {
+ return (DataRow) get(idx);
+ } // getDataRow
+
+ public void addDataRow(DataRow dataRow) {
+ add(dataRow);
+ } // addDataRow
+
+ public void addDataRow(int idx, DataRow dataRow) {
+ add(idx, dataRow);
+ } // addDataRow
+
+ public int getRowCount() {
+ return size();
+ } // getRowCount
+
+ public int getColumnCount() {
+ int cSize = 0;
+ if (getRowCount() > 0)
+ cSize = getDataRow(0).getDataValueList().size();
+
+ return cSize;
+ } // getColumnCount
+
+} // ReportDataRows
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java
new file mode 100644
index 00000000..e3e4f817
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/ReportRowHeaderCols.java
@@ -0,0 +1,71 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+public class ReportRowHeaderCols extends Vector {
+ 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 RowHeaderCol getNext() {
+ return hasNext() ? getRowHeaderCol(nextElemIdx++) : null;
+ } // getNext
+
+ public RowHeader getRowHeader(int colIdx, int rowIdx) {
+ return getRowHeaderCol(colIdx).getRowHeader(rowIdx);
+ } // getRowHeader
+
+ public RowHeaderCol getRowHeaderCol(int idx) {
+ return (RowHeaderCol) get(idx);
+ } // getRowHeaderCol
+
+ public void addRowHeaderCol(RowHeaderCol rowHeaderCol) {
+ add(rowHeaderCol);
+ } // addRowHeaderCol
+
+ public void addRowHeaderCol(int idx, RowHeaderCol rowHeaderCol) {
+ add(idx, rowHeaderCol);
+ } // addRowHeaderCol
+
+ public int getRowCount() {
+ int cSize = 0;
+ if (getColumnCount() > 0)
+ cSize = getRowHeaderCol(0).size();
+
+ return cSize;
+ } // getRowCount
+
+ public int getColumnCount() {
+ return size();
+ } // getColumnCount
+
+} // ReportRowHeaderCols
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java
new file mode 100644
index 00000000..c4c6b1be
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeader.java
@@ -0,0 +1,119 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+public class RowHeader extends org.openecomp.portalsdk.analytics.RaptorObject {
+ private String rowTitle = "";
+
+ private String rowHeight = "";
+
+ private int rowSpan = 1;
+
+ private int colSpan = 1;
+
+ private boolean bold = false;
+
+ public RowHeader() {
+ super();
+ }
+
+ public RowHeader(String rowTitle) {
+ this();
+ setRowTitle(rowTitle);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight) {
+ this(rowTitle);
+ setRowHeight(rowHeight);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight, int rowSpan) {
+ this(rowTitle, rowHeight);
+ setRowSpan(rowSpan);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight, int rowSpan, int colSpan) {
+ this(rowTitle, rowHeight, rowSpan);
+ setColSpan(colSpan);
+ } // RowHeader
+
+ public RowHeader(String rowTitle, String rowHeight, int rowSpan, int colSpan, boolean bold) {
+ this(rowTitle, rowHeight, rowSpan, colSpan);
+ setBold(bold);
+ } // RowHeader
+
+ public String getRowTitle() {
+ return rowTitle;
+ }
+
+ public String getRowHeight() {
+ return rowHeight;
+ }
+
+ public int getRowSpan() {
+ return rowSpan;
+ }
+
+ public int getColSpan() {
+ return colSpan;
+ }
+
+ public boolean isBold() {
+ return bold;
+ }
+
+ public void setRowTitle(String rowTitle) {
+ this.rowTitle = nvl(rowTitle);
+ }
+
+ public void setRowHeight(String rowHeight) {
+ this.rowHeight = rowHeight;
+ }
+
+ public void setRowSpan(int rowSpan) {
+ this.rowSpan = rowSpan;
+ }
+
+ public void setColSpan(int colSpan) {
+ this.colSpan = colSpan;
+ }
+
+ public void setBold(boolean bold) {
+ this.bold = bold;
+ }
+
+ public String getRowTitleHtml() {
+ return (rowTitle.length() == 0) ? "&nbsp;" : rowTitle;
+ }
+
+ public String getRowHeightHtml() {
+ return (rowHeight.length() == 0) ? "" : (" height=" + rowHeight);
+ }
+
+ public String getRowSpanHtml() {
+ return (rowSpan == 1) ? "" : (" rowspan=" + rowSpan);
+ }
+
+ public String getColSpanHtml() {
+ return (colSpan == 1) ? "" : (" colspan=" + colSpan);
+ }
+
+} // RowHeader
+
diff --git a/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java
new file mode 100644
index 00000000..2b405e84
--- /dev/null
+++ b/ecomp-sdk/sdk-analytics/src/main/java/org/openecomp/portalsdk/analytics/view/RowHeaderCol.java
@@ -0,0 +1,156 @@
+/*-
+ * ================================================================================
+ * 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.view;
+
+import java.util.Vector;
+
+public class RowHeaderCol extends Vector {
+ private String columnWidth = "";
+
+ private String columnTitle = "";
+
+ private String alignment = "";
+
+ private String displayHeaderAlignment = "";
+
+ private int nextElemIdx = 0;
+
+ private boolean visible = true;
+
+ private String colId = "";
+
+ private String nowrap = "False";
+
+ public void resetNext() {
+ resetNext(0);
+ } // resetNext
+
+ public void resetNext(int toPos) {
+ nextElemIdx = toPos;
+ } // resetNext
+
+ public boolean hasNext() {
+ return (nextElemIdx < size());
+ } // hasNext
+
+ public RowHeader getNext() {
+ return hasNext() ? getRowHeader(nextElemIdx++) : null;
+ } // getNext
+
+ public RowHeader getRowHeader(int idx) {
+ return (RowHeader) get(idx);
+ } // getRowHeader
+
+ public void addRowHeader(RowHeader rowHeader) {
+ add(rowHeader);
+ } // addRowHeader
+
+ public void addRowHeader(int idx, RowHeader rowHeader) {
+ add(idx, rowHeader);
+ } // addRowHeader
+
+ public String getColumnTitle() {
+ return columnTitle;
+ }
+
+ public String getColumnWidth() {
+ return columnWidth;
+ }
+
+ public String getAlignment() {
+ return alignment;
+ }
+
+ 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 String getColumnTitleHtml() {
+ return (columnTitle.length() == 0) ? "&nbsp;" : columnTitle;
+ }
+
+ public String getColumnWidthHtml() {
+ return (columnWidth.length() == 0) ? "" : (" width=" + columnWidth);
+ }
+
+ public String getAlignmentHtml() {
+ return " align=" + nvl(alignment, "center");
+ }
+
+ /** ************************************************************************************************* */
+
+ private String nvl(String s) {
+ return (s == null) ? "" : s;
+ }
+
+ private String nvl(String s, String sDefault) {
+ return nvl(s).equals("") ? sDefault : s;
+ }
+
+ public String getNowrap() {
+ return nowrap;
+ }
+
+ public void setNowrap(String nowrap) {
+ this.nowrap = nowrap;
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ public void setVisible(boolean visible) {
+ this.visible = visible;
+ }
+
+ /**
+ * @return the colId
+ */
+ public String getColId() {
+ return colId;
+ }
+
+ /**
+ * @param colId the colId to set
+ */
+ public void setColId(String colId) {
+ this.colId = colId;
+ }
+
+ public String getDisplayHeaderAlignment() {
+ return displayHeaderAlignment;
+ }
+
+ public void setDisplayHeaderAlignment(String displayHeaderAlignment) {
+ this.displayHeaderAlignment = displayHeaderAlignment;
+ }
+
+
+
+} // RowHeaderCol
+