001: /*
002: * BEGIN_HEADER - DO NOT EDIT
003: *
004: * The contents of this file are subject to the terms
005: * of the Common Development and Distribution License
006: * (the "License"). You may not use this file except
007: * in compliance with the License.
008: *
009: * You can obtain a copy of the license at
010: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
011: * See the License for the specific language governing
012: * permissions and limitations under the License.
013: *
014: * When distributing Covered Code, include this CDDL
015: * HEADER in each file and include the License file at
016: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
017: * If applicable add the following below this CDDL HEADER,
018: * with the fields enclosed by brackets "[]" replaced with
019: * your own identifying information: Portions Copyright
020: * [year] [name of copyright owner]
021: */
022:
023: /*
024: * @(#)DataBean.java
025: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
026: *
027: * END_HEADER - DO NOT EDIT
028: */
029: package org.openesb.tools.charting.persist;
030:
031: import org.openesb.tools.extchart.exception.ChartException;
032: import org.openesb.tools.extchart.jfchart.data.DataAccess;
033: import org.openesb.tools.extchart.jfchart.data.SQLDataAccess;
034: import org.openesb.tools.extchart.jfchart.data.SampleDemoDataAccess;
035:
036: /**
037: *
038: * @author rdwivedi
039: */
040: public class DataBean {
041:
042: private String dbJndiName = null;
043: private String displayName = null;
044: private String mId = null;
045: private String mQuery = null;
046: private String mParentName = null;
047: private String dataSetType = null;
048: private String grpID = null;
049:
050: public DataBean(String dN, String pName) {
051: displayName = dN;
052: mParentName = pName;
053: grpID = "12";
054: }
055:
056: public String getDisplayName() {
057: return displayName;
058: }
059:
060: public String getJNDIName() {
061: return dbJndiName;
062: }
063:
064: public void setJNDIName(String jn) {
065: dbJndiName = jn;
066: }
067:
068: public void setID(String id) {
069: mId = id;
070: }
071:
072: public String getGroupID() {
073: return grpID;
074: }
075:
076: public String getParentDisplayName() {
077: return mParentName;
078: }
079:
080: public void setQuery(String query) {
081: mQuery = query;
082: }
083:
084: public String getQuery() {
085: return mQuery;
086: }
087:
088: public void createNewID() {
089: mId = "_d" + System.currentTimeMillis();
090: }
091:
092: public String getID() {
093: return mId;
094: }
095:
096: public String getDataSetType() {
097: return dataSetType;
098: }
099:
100: public void setDataSetType(String ddsType) {
101: dataSetType = ddsType;
102: }
103:
104: public DataAccess getDataAccessObject() {
105: if (dbJndiName == null || dbJndiName.length() < 1) {
106: return new SampleDemoDataAccess(dataSetType);
107: } else {
108: return new SQLDataAccess(dbJndiName, dataSetType,
109: getQuery());
110: }
111:
112: }
113:
114: public boolean validate() throws ChartException {
115: Object obj = getDataAccessObject().getDataSet();
116: return obj != null;
117:
118: }
119: }
|