001: /*
002: * Copyright 2001-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.ws.scout.registry.infomodel;
018:
019: import javax.xml.registry.JAXRException;
020: import javax.xml.registry.LifeCycleManager;
021: import javax.xml.registry.infomodel.ClassificationScheme;
022: import javax.xml.registry.infomodel.Concept;
023: import javax.xml.registry.infomodel.RegistryObject;
024:
025: /**
026: * Implements JAXR Classification Interface.
027: * For futher details, look into the JAXR API Javadoc.
028: *
029: * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
030: * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
031: */
032: public class ClassificationImpl extends RegistryObjectImpl implements
033: javax.xml.registry.infomodel.Classification {
034:
035: private ClassificationScheme scheme = new ClassificationSchemeImpl(
036: null);
037: private Concept concept = new ConceptImpl(null);
038: private boolean external = false;
039: private String value;
040:
041: private RegistryObject classfiedobj = null;
042:
043: /**
044: * Creates a new instance of ClassificationImpl
045: */
046: public ClassificationImpl(LifeCycleManager lifeCycleManager) {
047: super (lifeCycleManager);
048: }
049:
050: public ClassificationScheme getClassificationScheme()
051: throws JAXRException {
052: return scheme;
053: }
054:
055: public RegistryObject getClassifiedObject() throws JAXRException {
056: return classfiedobj;
057: }
058:
059: public Concept getConcept() throws JAXRException {
060: return concept;
061: }
062:
063: /**
064: *
065: * @return he value of the taxonomy element if external Classification;
066: * the value of the Concept representing the taxonomy element
067: * if internal Classification
068: * @throws JAXRException
069: */
070: public String getValue() throws JAXRException {
071: if (isExternal()) {
072: return value;
073: } else {
074: return concept.getValue();
075: }
076: }
077:
078: public void setExternal(boolean b) {
079: this .external = b;
080: }
081:
082: public boolean isExternal() throws JAXRException {
083: return external;
084: }
085:
086: public void setClassificationScheme(ClassificationScheme cscheme)
087: throws JAXRException {
088: scheme = cscheme;
089:
090: /*
091: * not 100% clear, but I *think* the JavaDoc indicates that if
092: * our internality dictates that of the scheme.
093: */
094:
095: ((ClassificationSchemeImpl) scheme).setExternal(isExternal());
096: }
097:
098: public void setClassifiedObject(RegistryObject registryObject)
099: throws JAXRException {
100: classfiedobj = registryObject;
101: }
102:
103: public void setConcept(Concept cpt) throws JAXRException {
104: concept = cpt;
105: }
106:
107: public void setValue(String str) throws JAXRException {
108: value = str;
109: }
110:
111: }
|