001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.uml.core.requirementsframework;
043:
044: import org.netbeans.modules.uml.core.support.umlsupport.IComparableTreeData;
045: import org.netbeans.modules.uml.core.support.umlutils.ETList;
046:
047: /**
048: * @author brettb
049: *
050: * To change the template for this generated type comment go to
051: * Window>Preferences>Java>Code Generation>Code and Comments
052: */
053: public class RequirementSource implements IRequirementSource,
054: IComparableTreeData {
055: private boolean m_bRequiresLogin; // does source require login
056: private String m_strId = ""; // XML id of the requirement
057: private String m_strDispName = ""; // name to display in the tree
058: private String m_strProvider = ""; // registered name of provider
059: private String m_strLocation = ""; // location of the requirements file
060: private String m_strProxyFile = ""; // location of the proxy file
061:
062: /// Collection of Requirements for this Requirement Source.
063: ETList<IRequirement> m_Requirements = null;
064:
065: /**
066: *
067: * Get the path/file location of the proxy file for this
068: * requirements source.
069: *
070: * @param *pVal[out] Proxy file location.
071: *
072: * @return void
073: *
074: */
075: public String getProxyFile() {
076: return m_strProxyFile;
077: }
078:
079: /**
080: *
081: * Set the path/file location of the proxy file for this
082: * requirements source.
083: *
084: * @param newVal[in] Proxy file location.
085: *
086: * @return void
087: *
088: */
089: public void setProxyFile(String newVal) {
090: m_strProxyFile = newVal;
091: }
092:
093: /**
094: *
095: * Get the path/file location of the requirements file for this
096: * requirements source.
097: *
098: * @param *pVal[out] Requirements file location.
099: *
100: * @return void
101: *
102: */
103: public String getLocation() {
104: return m_strLocation;
105: }
106:
107: /**
108: *
109: * Set the path/file location of the requirements file for this
110: * requirements source.
111: *
112: * @param newVal[in] Requirements file location.
113: *
114: * @return void
115: *
116: */
117: public void setLocation(String newVal) {
118: m_strLocation = newVal;
119: }
120:
121: /**
122: *
123: * Get the registered name of the Requirements Provider addin
124: * that manages this requirements source.
125: *
126: * @param *pVal[out] The prog ID.
127: *
128: * @return void
129: *
130: */
131: public String getProvider() {
132: return m_strProvider;
133: }
134:
135: /**
136: *
137: * Set the registered name of the Requirements Provider addin
138: * that manages this requirements source.
139: *
140: * @param newVal[in] The prog ID.
141: *
142: * @return void
143: *
144: */
145: public void setProvider(String newVal) {
146: m_strProvider = newVal;
147: }
148:
149: /**
150: *
151: * Get the name displayed for this requirement source in the
152: * Design Center tree.
153: *
154: * @param *pVal[out] The displayed name.
155: *
156: * @return void
157: *
158: */
159: public String getDisplayName() {
160: return m_strDispName;
161: }
162:
163: /**
164: *
165: * Set the name displayed for this requirement source in the
166: * Design Center tree.
167: *
168: * @param newVal[in] The displayed name.
169: *
170: * @return void
171: *
172: */
173: public void setDisplayName(String newVal) {
174: m_strDispName = newVal;
175: }
176:
177: /**
178: *
179: * Get the XML ID of this Requirement source (the ID used in
180: * the RequirementSources.edt file).
181: *
182: * @param *pVal[out] The ID of this requirement source.
183: *
184: * @return void
185: *
186: */
187: public String getID() {
188: return m_strId;
189: }
190:
191: /**
192: *
193: * Set the XML ID for this Requirement source (the ID used in
194: * the RequirementSources.edt file).
195: *
196: * @param newVal[in] The ID of this requirement source.
197: *
198: * @return void
199: *
200: */
201: public void setID(String newVal) {
202: m_strId = newVal;
203: }
204:
205: /**
206: *
207: * Returns true if this requirement source requires a login.
208: *
209: * @param *pVal[out] Value of the RequiresLogin property.
210: *
211: * @return void
212: *
213: */
214: public boolean getRequiresLogin() {
215: return m_bRequiresLogin;
216: }
217:
218: /**
219: *
220: * Sets whether this requirement source requires a login.
221: *
222: * @param newVal[in] true indicates a login is needed.
223: *
224: * @return void
225: *
226: */
227: public void setRequiresLogin(boolean newVal) {
228: m_bRequiresLogin = newVal;
229: }
230:
231: public boolean isSame(IComparableTreeData otherData) {
232: if (null == otherData)
233: throw new IllegalArgumentException();
234:
235: boolean bIsSame = false;
236:
237: if (otherData instanceof IRequirementSource) {
238: IRequirementSource requirementSource = (IRequirementSource) otherData;
239:
240: String strId = requirementSource.getID();
241: String strProvider = requirementSource.getProvider();
242:
243: if (strId.equals(m_strId)
244: && strProvider.equals(m_strProvider)) {
245: bIsSame = true;
246: }
247: }
248:
249: return bIsSame;
250: }
251:
252: }
|