src/net/fortuna/ical4j/model/property/Clazz.java

Tue, 10 Feb 2015 19:58:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 10 Feb 2015 19:58:00 +0100
changeset 4
45d57ecba757
permissions
-rw-r--r--

Upgrade the upgraded ical4j component to use org.apache.commons.lang3.

     1 /**
     2  * Copyright (c) 2012, Ben Fortuna
     3  * All rights reserved.
     4  *
     5  * Redistribution and use in source and binary forms, with or without
     6  * modification, are permitted provided that the following conditions
     7  * are met:
     8  *
     9  *  o Redistributions of source code must retain the above copyright
    10  * notice, this list of conditions and the following disclaimer.
    11  *
    12  *  o Redistributions in binary form must reproduce the above copyright
    13  * notice, this list of conditions and the following disclaimer in the
    14  * documentation and/or other materials provided with the distribution.
    15  *
    16  *  o Neither the name of Ben Fortuna nor the names of any other contributors
    17  * may be used to endorse or promote products derived from this software
    18  * without specific prior written permission.
    19  *
    20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    31  */
    32 package net.fortuna.ical4j.model.property;
    34 import net.fortuna.ical4j.model.ParameterList;
    35 import net.fortuna.ical4j.model.Property;
    36 import net.fortuna.ical4j.model.PropertyFactoryImpl;
    37 import net.fortuna.ical4j.model.ValidationException;
    39 /**
    40  * $Id$
    41  * 
    42  * Created: [Apr 6, 2004]
    43  *
    44  * Defines a CLASS iCalendar property.
    45  * 
    46  * <pre>
    47  *     4.8.1.3 Classification
    48  *     
    49  *        Property Name: CLASS
    50  *     
    51  *        Purpose: This property defines the access classification for a
    52  *        calendar component.
    53  *     
    54  *        Value Type: TEXT
    55  *     
    56  *        Property Parameters: Non-standard property parameters can be
    57  *        specified on this property.
    58  *     
    59  *        Conformance: The property can be specified once in a &quot;VEVENT&quot;,
    60  *        &quot;VTODO&quot; or &quot;VJOURNAL&quot; calendar components.
    61  *     
    62  *        Description: An access classification is only one component of the
    63  *        general security system within a calendar application. It provides a
    64  *        method of capturing the scope of the access the calendar owner
    65  *        intends for information within an individual calendar entry. The
    66  *        access classification of an individual iCalendar component is useful
    67  *        when measured along with the other security components of a calendar
    68  *        system (e.g., calendar user authentication, authorization, access
    69  *        rights, access role, etc.). Hence, the semantics of the individual
    70  *        access classifications cannot be completely defined by this memo
    71  *        alone. Additionally, due to the &quot;blind&quot; nature of most exchange
    72  *        processes using this memo, these access classifications cannot serve
    73  *        as an enforcement statement for a system receiving an iCalendar
    74  *        object. Rather, they provide a method for capturing the intention of
    75  *        the calendar owner for the access to the calendar component.
    76  *     
    77  *        Format Definition: The property is defined by the following notation:
    78  *     
    79  *          class      = &quot;CLASS&quot; classparam &quot;:&quot; classvalue CRLF
    80  *     
    81  *          classparam = *(&quot;;&quot; xparam)
    82  *     
    83  *          classvalue = &quot;PUBLIC&quot; / &quot;PRIVATE&quot; / &quot;CONFIDENTIAL&quot; / iana-token
    84  *                     / x-name
    85  *          ;Default is PUBLIC
    86  *     
    87  *        Example: The following is an example of this property:
    88  *     
    89  *          CLASS:PUBLIC
    90  * </pre>
    91  * 
    92  * @author Ben Fortuna
    93  */
    94 public class Clazz extends Property {
    96     private static final long serialVersionUID = 4939943639175551481L;
    98     /**
    99      * Constant for public classification.
   100      */
   101     public static final Clazz PUBLIC = new ImmutableClazz("PUBLIC");
   103     /**
   104      * Constant for private classification.
   105      */
   106     public static final Clazz PRIVATE = new ImmutableClazz("PRIVATE");
   108     /**
   109      * Constant for confidential classification.
   110      */
   111     public static final Clazz CONFIDENTIAL = new ImmutableClazz("CONFIDENTIAL");
   113     /**
   114      * @author Ben Fortuna An immutable instance of Clazz.
   115      */
   116     private static final class ImmutableClazz extends Clazz {
   118         private static final long serialVersionUID = 5978394762293365042L;
   120         /**
   121          * @param value
   122          */
   123         private ImmutableClazz(final String value) {
   124             super(new ParameterList(true), value);
   125         }
   127         /**
   128          * {@inheritDoc}
   129          */
   130         public void setValue(final String aValue) {
   131             throw new UnsupportedOperationException(
   132                     "Cannot modify constant instances");
   133         }
   134     }
   136     private String value;
   138     /**
   139      * Default constructor.
   140      */
   141     public Clazz() {
   142         super(CLASS, PropertyFactoryImpl.getInstance());
   143     }
   145     /**
   146      * @param aValue a value string for this component
   147      */
   148     public Clazz(final String aValue) {
   149         super(CLASS, PropertyFactoryImpl.getInstance());
   150         this.value = aValue;
   151     }
   153     /**
   154      * @param aList a list of parameters for this component
   155      * @param aValue a value string for this component
   156      */
   157     public Clazz(final ParameterList aList, final String aValue) {
   158         super(CLASS, aList, PropertyFactoryImpl.getInstance());
   159         this.value = aValue;
   160     }
   162     /**
   163      * {@inheritDoc}
   164      */
   165     public void setValue(final String aValue) {
   166         this.value = aValue;
   167     }
   169     /**
   170      * {@inheritDoc}
   171      */
   172     public final String getValue() {
   173         return value;
   174     }
   176     /**
   177      * {@inheritDoc}
   178      */
   179     public final void validate() throws ValidationException {
   180         // TODO: Auto-generated method stub
   181     }
   182 }

mercurial