001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019:
020: /*
021: *
022: * Copyright 2005 Sun Microsystems, Inc.
023: *
024: * Licensed under the Apache License, Version 2.0 (the "License");
025: * you may not use this file except in compliance with the License.
026: * You may obtain a copy of the License at
027: *
028: * http://www.apache.org/licenses/LICENSE-2.0
029: *
030: * Unless required by applicable law or agreed to in writing, software
031: * distributed under the License is distributed on an "AS IS" BASIS,
032: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
033: * See the License for the specific language governing permissions and
034: * limitations under the License.
035: *
036: */
037: package org.netbeans.modules.jdbcwizard.builder.dbmodel.impl;
038:
039: import org.netbeans.modules.jdbcwizard.builder.dbmodel.DBObject;
040: import java.util.ResourceBundle;
041: import org.openide.util.NbBundle;
042:
043: public class DBObjectImpl implements DBObject {
044: private String name;
045:
046: private String javaName;
047:
048: private String description;
049:
050: private String schema;
051:
052: private String catalog;
053:
054: // private DBObjectModel parent;
055:
056: public DBObjectImpl() {
057: }
058:
059: /*
060: * public DBObjectImpl(DBObject src) { this(); if (src == null) { ResourceBundle cMessages =
061: * NbBundle.getBundle(DBObjectImpl.class); throw new IllegalArgumentException(
062: * cMessages.getString("ERROR_NULL_DBOBJECT")+("ERROR_NULL_DBOBJECT"));//NO i18n }
063: * copyFrom(src); }
064: */
065:
066: public DBObjectImpl(final String objectName,
067: final String schemaName, final String catalogName) {
068: this .name = objectName;
069: this .schema = schemaName;
070: this .catalog = catalogName;
071: }
072:
073: /**
074: * Performs deep copy of contents of given DBObject. We deep copy (that is, the method clones
075: * all child objects such as columns) because columns have a parent-child relationship that must
076: * be preserved internally.
077: *
078: * @param source JDBC- providing contents to be copied.
079: */
080: public void copyFrom(final DBObject source) {
081: if (source == null) {
082: final ResourceBundle cMessages = NbBundle
083: .getBundle(DBObjectImpl.class);
084: throw new IllegalArgumentException(cMessages
085: .getString("ERROR_NULL_REF")
086: + "ERROR_NULL_REF");// NO
087: // i18n
088: } else if (source == this ) {
089: return;
090: }
091:
092: this .name = source.getName();
093: this .description = source.getDescription();
094: this .schema = source.getSchema();
095: this .catalog = source.getCatalog();
096:
097: // parent = source.getParent();
098: this .deepCopyReferences(source);
099: }
100:
101: public String getName() {
102: return this .name;
103: }
104:
105: public String getDescription() {
106: return this .description;
107: }
108:
109: public String getSchema() {
110: return this .schema;
111: }
112:
113: public String getCatalog() {
114: return this .catalog;
115: }
116:
117: /*
118: * public DBObjectModel getParent() { return this.parent; }
119: */
120: /*
121: * Perform deep copy of columns. @param source JDBCTable whose columns are to be copied.
122: */
123: private void deepCopyReferences(final DBObject source) {
124: // PP:ToDO
125: }
126:
127: /*
128: * public void setParent(DBObjectModel databaseObject) { this.parent = databaseObject; }
129: */
130: public String getJavaName() {
131: return this .javaName;
132: }
133:
134: public void setName(final String name) {
135: this .name = name;
136: }
137:
138: public void setJavaName(final String javaName) {
139: this .javaName = javaName;
140: }
141:
142: public void setCatalog(final String catalog) {
143: this .catalog = catalog;
144: }
145:
146: public void setSchema(final String schema) {
147: this.schema = schema;
148: }
149: }
|