001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (C) Alkacon Software (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.acacia.client.export;
029
030import org.opencms.acacia.shared.CmsEntityAttribute;
031
032import org.timepedia.exporter.client.Export;
033import org.timepedia.exporter.client.ExportPackage;
034import org.timepedia.exporter.client.Exportable;
035
036/**
037 * Exportable wrapper class for an entity attribute.<p>
038 */
039@Export
040@ExportPackage("acacia")
041public class CmsEntityAttributeWrapper implements Exportable {
042
043    /** The wrapped attribute. */
044    private CmsEntityAttribute m_attribute;
045
046    /**
047     * Default constructor.<p>
048     */
049    public CmsEntityAttributeWrapper() {
050
051    }
052
053    /**
054     * Constructor.<p>
055     *
056     * @param attribute the attribute to wrap
057     */
058    public CmsEntityAttributeWrapper(CmsEntityAttribute attribute) {
059
060        m_attribute = attribute;
061    }
062
063    /**
064     * Wrapper method.<p>
065     *
066     * @return the result of the wrapped method
067     */
068    public String getAttributeName() {
069
070        return m_attribute.getAttributeName();
071    }
072
073    /**
074     * Wrapper method.<p>
075     *
076     * @return the result of the wrapped method
077     */
078    public CmsEntityWrapper getComplexValue() {
079
080        return new CmsEntityWrapper(m_attribute.getComplexValue());
081    }
082
083    /**
084     * Wrapper method.<p>
085     *
086     * @return the result of the wrapped method
087     */
088    public CmsEntityWrapper[] getComplexValues() {
089
090        return CmsWrapperUtils.arrayFromEntityList(m_attribute.getComplexValues());
091    }
092
093    /**
094     * Wrapper method.<p>
095     *
096     * @return the result of the wrapped method
097     */
098    public String getSimpleValue() {
099
100        return m_attribute.getSimpleValue();
101    }
102
103    /**
104     * Wrapper method.<p>
105     *
106     * @return the result of the wrapped method
107     */
108    public String[] getSimpleValues() {
109
110        return CmsWrapperUtils.arrayFromStringList(m_attribute.getSimpleValues());
111    }
112
113    /**
114     * Wrapper method.<p>
115     *
116     * @return the result of the wrapped method
117     */
118    public int getValueCount() {
119
120        return m_attribute.getValueCount();
121    }
122
123    /**
124     * Wrapper method.<p>
125     *
126     * @return the result of the wrapped method
127     */
128    public boolean isComplexValue() {
129
130        return m_attribute.isComplexValue();
131    }
132
133    /**
134     * Wrapper method.<p>
135     *
136     * @return the result of the wrapped method
137     */
138    public boolean isSimpleValue() {
139
140        return m_attribute.isSimpleValue();
141    }
142
143    /**
144     * Wrapper method.<p>
145     *
146     * @return the result of the wrapped method
147     */
148    public boolean isSingleValue() {
149
150        return m_attribute.isSingleValue();
151    }
152
153    /**
154     * Sets the wrapped attribute.<p>
155     *
156     * @param attribute the attribute to wrap
157     */
158    public void setAttribute(CmsEntityAttribute attribute) {
159
160        m_attribute = attribute;
161    }
162}