001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (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 GmbH & Co. KG, 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.workplace.tools.content.check;
029
030import java.util.Collections;
031import java.util.List;
032
033/**
034 * This class encapsulates the configuration of one property check used by the
035 * property content check.<p>
036 *
037 * @since 6.1.2
038 */
039public class CmsContentCheckPropertyObject {
040
041    /** Constant for type file or folder.*/
042    public static final String TYPE_BOTH = "both";
043
044    /** Constant for type file. */
045    public static final String TYPE_FILE = "file";
046
047    /** Constant for type folder. */
048    public static final String TYPE_FOLDER = "folder";
049
050    /** Flag for checking if the property value is empty. */
051    private boolean m_empty;
052
053    /** Flag for checking if the property value contains the filename. */
054    private boolean m_filename;
055
056    /** The minimum length of the property value. */
057    private int m_length;
058
059    /** The propertyname. */
060    private String m_propertyname;
061
062    /** The resourcetype (file or folder). */
063    private String m_type;
064
065    /** The property value to check for. */
066    private List m_value;
067
068    /**
069     * Constructor, creates a new empty CmsContentCheckProperetyObject.<p>     *
070     */
071    public CmsContentCheckPropertyObject() {
072
073        m_propertyname = null;
074        m_type = TYPE_BOTH;
075        m_empty = false;
076        m_filename = false;
077        m_length = -1;
078        m_value = Collections.EMPTY_LIST;
079    }
080
081    /**
082     * Returns the minimum length.<p>
083     *
084     * @return the minimum length
085     */
086    public int getLength() {
087
088        return m_length;
089    }
090
091    /**
092     * Returns the propertyname.<p>
093     *
094     * @return the propertyname
095     */
096    public String getPropertyname() {
097
098        return m_propertyname;
099    }
100
101    /**
102     * Returns the type.<p>
103     *
104     * @return the type
105     */
106    public String getType() {
107
108        return m_type;
109    }
110
111    /**
112     * Returns the value.<p>
113     *
114     * @return the value
115     */
116    public List getValue() {
117
118        return m_value;
119    }
120
121    /**
122     * Returns the empty flag.<p>
123     *
124     * @return the empty flag
125     */
126    public boolean isEmpty() {
127
128        return m_empty;
129    }
130
131    /**
132     * Returns the filename flag.<p>
133     *
134     * @return the filename flag
135     */
136    public boolean isFilename() {
137
138        return m_filename;
139    }
140
141    /**
142     * Sets the empty flag.<p>
143     *
144     * @param empty the empty flag to set
145     */
146    public void setEmpty(boolean empty) {
147
148        m_empty = empty;
149    }
150
151    /**
152     * Sets the filename flag.<p>
153     *
154     * @param filename the filename flag to set
155     */
156    public void setFilename(boolean filename) {
157
158        m_filename = filename;
159    }
160
161    /**
162     * Sets the minimum length.<p>
163     *
164     * @param length the minimum length to set
165     */
166    public void setLength(int length) {
167
168        m_length = length;
169    }
170
171    /**
172     * Sets the propertyname.<p>
173     *
174     * @param propertyname the propertyname to set
175     */
176    public void setPropertyname(String propertyname) {
177
178        m_propertyname = propertyname;
179    }
180
181    /**
182     * Sets the type.<p>
183     *
184     * @param type the type to set
185     */
186    public void setType(String type) {
187
188        m_type = type;
189    }
190
191    /**
192     * Sets the value.<p>
193     *
194     * @param value the value to set
195     */
196    public void setValue(List value) {
197
198        m_value = value;
199    }
200
201    /**
202     *
203     * @see java.lang.Object#toString()
204     */
205    @Override
206    public String toString() {
207
208        StringBuffer buf = new StringBuffer();
209        buf.append(this.getClass().getName());
210        buf.append(" [Propertyname=");
211        buf.append(m_propertyname);
212        buf.append(" Type=");
213        buf.append(m_type);
214        buf.append(" emptycheck=");
215        buf.append(m_empty);
216        buf.append(" filenamecheck=");
217        buf.append(m_filename);
218        buf.append(" min length=");
219        buf.append(m_length);
220        buf.append(" value=");
221        buf.append(m_value);
222        buf.append("]");
223        return buf.toString();
224    }
225
226}