You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by ip...@apache.org on 2005/03/25 02:45:19 UTC

svn commit: r158977 - in incubator/muse/trunk/src/java/org/apache/ws/muws/impl: ./ AbstractCategory.java

Author: ips
Date: Thu Mar 24 17:45:18 2005
New Revision: 158977

URL: http://svn.apache.org/viewcvs?view=rev&rev=158977
Log:
abstract impl of the Category interface

Added:
    incubator/muse/trunk/src/java/org/apache/ws/muws/impl/
    incubator/muse/trunk/src/java/org/apache/ws/muws/impl/AbstractCategory.java

Added: incubator/muse/trunk/src/java/org/apache/ws/muws/impl/AbstractCategory.java
URL: http://svn.apache.org/viewcvs/incubator/muse/trunk/src/java/org/apache/ws/muws/impl/AbstractCategory.java?view=auto&rev=158977
==============================================================================
--- incubator/muse/trunk/src/java/org/apache/ws/muws/impl/AbstractCategory.java (added)
+++ incubator/muse/trunk/src/java/org/apache/ws/muws/impl/AbstractCategory.java Thu Mar 24 17:45:18 2005
@@ -0,0 +1,77 @@
+/*=============================================================================*
+ *  Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.muws.impl;
+
+import org.apache.ws.muws.Category;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.CategoryType;
+
+import javax.xml.namespace.QName;
+
+/**
+ * An XMLBeans-based implementation of a MUWS {@link Category}.
+ */
+public abstract class AbstractCategory implements Category, XmlObjectWrapper
+{
+
+    private QName m_name;
+    private Category m_generalization;
+
+    public AbstractCategory( QName name )
+    {
+        m_name = name;
+    }
+
+    public AbstractCategory( QName name, Category generalization )
+    {
+        m_name = name;
+        m_generalization = generalization;
+    }
+
+    public QName getName()
+    {
+        return m_name;
+    }
+
+    public Category getGeneralization()
+    {
+        return m_generalization;
+    }
+
+    public boolean hasGeneralization()
+    {
+        return m_generalization != null;
+    }
+
+    public void setGeneralization( Category category )
+    {
+        m_generalization = category;
+    }
+
+    public XmlObject getXmlObject()
+    {
+        XmlObject categoryXBean = CategoryType.Factory.newInstance();
+        XmlObject xBean = categoryXBean;
+        for ( Category category = this; category != null; category = category.getGeneralization() )
+        {
+            xBean = XmlBeanUtils.addChildElement( xBean, category.getName() );
+        }
+        return categoryXBean;
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-dev-help@ws.apache.org