2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 package org.openecomp.portalsdk.analytics.model.base;
24 import org.openecomp.portalsdk.analytics.error.RaptorException;
25 import org.openecomp.portalsdk.analytics.system.*;
27 public class IdNameList extends Vector {
28 protected int pageNo = -1;
30 protected int pageSize = 50;
32 private int nextElemIdx = 0;
34 private String oldSql = null;
38 pageSize = Globals.getFormFieldsListSize();
41 public int getPageNo() {
45 public int getPageSize() {
49 public int getDataSize() {
53 public void resetNext() {
57 public void resetNext(int toPos) {
61 public boolean hasNext() {
62 return (nextElemIdx < size());
65 public IdNameValue getNext() {
66 return hasNext() ? getValue(nextElemIdx++) : null;
69 public int getCount() {
73 public IdNameValue getValue(int idx) {
74 return (IdNameValue) get(idx);
77 public void addValue(IdNameValue value) {
81 public void addValue(String id, String name, boolean defaultValue) {
82 addValue(new IdNameValue(id, name, defaultValue));
85 public void addValue(String id, String name, boolean defaultValue, boolean readOnly) {
86 addValue(new IdNameValue(id, name, defaultValue, readOnly));
89 public void addValue(String id, String name) {
90 addValue(new IdNameValue(id, name));
93 public void addValue(int idx, IdNameValue value) {
97 public void addValue(int idx, String id, String name) {
98 addValue(idx, new IdNameValue(id, name));
101 public String getNameById(String id) {
102 for (int i = 0; i < size(); i++) {
103 IdNameValue value = getValue(i);
104 if (value.getId().equals(id))
105 return value.getName();
111 public String getIdByName(String name) {
112 for (int i = 0; i < size(); i++) {
113 IdNameValue value = getValue(i);
114 if (value.getName().equals(name))
115 return value.getId();
121 public boolean canUseSearchString() {
125 public String getBaseSQL() {
129 public String getOldSql() {
133 public void setOldSql(String oldSql) {
134 this.oldSql = oldSql;
136 public String getBaseWholeSQL() {
140 public String getBaseWholeReadonlySQL() {
144 public String getBaseSQLForPDFExcel(boolean multiParam) {
148 public void clearData() {
151 public void loadData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {}
152 public void loadUserData(String pageNo, String searchString, String dbInfo,String userId) throws RaptorException {}
153 public void loadUserData(int pageNo, String searchString, String dbInfo, String userId) throws RaptorException {}
154 public void loadUserData(String searchString, int pageNo, String dbInfo) throws RaptorException {}
156 public void loadData(String pageNo) throws RaptorException {}
157 public void loadData(int pageNo) throws RaptorException {}
158 public void loadData(String pageNo, String searchString, String dbInfo) throws RaptorException {}
159 private void loadData(int pageNo, String searchString, String dbInfo) throws RaptorException {}
162 public void loadData(int pageNo, String dbInfo) throws RaptorException {
165 public void loadUserData(int pageNo, String dbInfo, String userId) throws RaptorException {
171 public void loadData(String pageNo, String searchString) throws RaptorException {
175 protected static String nvl(String s) {
176 return (s == null) ? "" : s;
179 protected static String nvl(String s, String sDefault) {
180 return nvl(s).equals("") ? sDefault : s;