src/net/fortuna/ical4j/model/component/VVenue.java

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

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 10 Feb 2015 19:38:00 +0100
changeset 3
73bdfa70b04e
permissions
-rw-r--r--

Upgrade embedded ical4j from ancient whatever to upstream version 1.0.6.

michael@0 1 /**
michael@0 2 * Copyright (c) 2012, Ben Fortuna
michael@0 3 * All rights reserved.
michael@0 4 *
michael@0 5 * Redistribution and use in source and binary forms, with or without
michael@0 6 * modification, are permitted provided that the following conditions
michael@0 7 * are met:
michael@0 8 *
michael@0 9 * o Redistributions of source code must retain the above copyright
michael@0 10 * notice, this list of conditions and the following disclaimer.
michael@0 11 *
michael@0 12 * o Redistributions in binary form must reproduce the above copyright
michael@0 13 * notice, this list of conditions and the following disclaimer in the
michael@0 14 * documentation and/or other materials provided with the distribution.
michael@0 15 *
michael@0 16 * o Neither the name of Ben Fortuna nor the names of any other contributors
michael@0 17 * may be used to endorse or promote products derived from this software
michael@0 18 * without specific prior written permission.
michael@0 19 *
michael@0 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@0 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
michael@0 24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
michael@0 25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
michael@0 26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
michael@0 27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
michael@0 28 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
michael@0 29 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
michael@0 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 31 */
michael@0 32 package net.fortuna.ical4j.model.component;
michael@0 33
michael@0 34 import net.fortuna.ical4j.model.Property;
michael@0 35 import net.fortuna.ical4j.model.PropertyList;
michael@0 36 import net.fortuna.ical4j.model.ValidationException;
michael@0 37 import net.fortuna.ical4j.model.Validator;
michael@0 38 import net.fortuna.ical4j.model.property.Method;
michael@0 39 import net.fortuna.ical4j.util.PropertyValidator;
michael@0 40 import net.fortuna.ical4j.util.Strings;
michael@0 41
michael@0 42 /**
michael@0 43 * $Id $ [Apr 5, 2004]
michael@0 44 *
michael@0 45 * Defines an iCalendar VVENUE component.
michael@0 46 *
michael@0 47 * <pre>
michael@0 48 * 4. Venue Component
michael@0 49 *
michael@0 50 * Component Name: "VVENUE"
michael@0 51 *
michael@0 52 * Purpose: Provide a grouping of component properties that describe an
michael@0 53 * event venue.
michael@0 54 *
michael@0 55 * Format Definition: A "VVENUE" calendar component is defined by the
michael@0 56 * following notation:
michael@0 57 * venuec = "BEGIN" ":" "VVENUE" CRLF
michael@0 58 * venueprop
michael@0 59 * "END" ":" "VVENUE" CRLF
michael@0 60 *
michael@0 61 * venueprop = *(
michael@0 62 *
michael@0 63 * ; the following are all REQUIRED,
michael@0 64 * ; but MUST NOT occur more than once
michael@0 65 *
michael@0 66 * uid
michael@0 67 *
michael@0 68 * ; the following are optional,
michael@0 69 * ; but MUST NOT occur more than once
michael@0 70 *
michael@0 71 * name / description / street-address / extended-address /
michael@0 72 * locality / region / country / postal-code / tzid / geo /
michael@0 73 * location-type / categories
michael@0 74 *
michael@0 75 * ; the following are optional,
michael@0 76 * ; and MAY occur more than once
michael@0 77 *
michael@0 78 * tel / url
michael@0 79 * )
michael@0 80 *
michael@0 81 * Description: A "VVENUE" calendar component is a grouping of component
michael@0 82 * properties that represent a venue where an event occurs. This
michael@0 83 * extends the "LOCATION" property of "VEVENT" and "TODO" components,
michael@0 84 * providing the ability to specify detailed information about the event
michael@0 85 * venue.
michael@0 86 *
michael@0 87 * </pre>
michael@0 88 *
michael@0 89 * @author Ben Fortuna
michael@0 90 * @author Mike Douglass
michael@0 91 */
michael@0 92 public class VVenue extends CalendarComponent {
michael@0 93
michael@0 94 private static final long serialVersionUID = 4502423035501438515L;
michael@0 95
michael@0 96 /**
michael@0 97 * Default constructor.
michael@0 98 */
michael@0 99 public VVenue() {
michael@0 100 super(VVENUE);
michael@0 101 }
michael@0 102
michael@0 103 /**
michael@0 104 * Constructs a new instance containing the specified properties.
michael@0 105 * @param properties a list of properties
michael@0 106 */
michael@0 107 public VVenue(final PropertyList properties) {
michael@0 108 super(VVENUE, properties);
michael@0 109 }
michael@0 110
michael@0 111 /**
michael@0 112 * {@inheritDoc}
michael@0 113 */
michael@0 114 public final String toString() {
michael@0 115 final StringBuffer b = new StringBuffer();
michael@0 116 b.append(BEGIN);
michael@0 117 b.append(':');
michael@0 118 b.append(getName());
michael@0 119 b.append(Strings.LINE_SEPARATOR);
michael@0 120 b.append(getProperties());
michael@0 121 b.append(END);
michael@0 122 b.append(':');
michael@0 123 b.append(getName());
michael@0 124 b.append(Strings.LINE_SEPARATOR);
michael@0 125 return b.toString();
michael@0 126 }
michael@0 127
michael@0 128 /**
michael@0 129 * {@inheritDoc}
michael@0 130 */
michael@0 131 public final void validate(final boolean recurse)
michael@0 132 throws ValidationException {
michael@0 133
michael@0 134 /*
michael@0 135 * ; 'uiid' is required, but MUST NOT occur more ; than once uiid /
michael@0 136 */
michael@0 137 PropertyValidator.getInstance().assertOne(Property.UID,
michael@0 138 getProperties());
michael@0 139
michael@0 140 /*
michael@0 141 * ; the following are optional,
michael@0 142 * ; but MUST NOT occur more than once
michael@0 143 *
michael@0 144 * name / description / street-address / extended-address /
michael@0 145 * locality / region / country / postal-code / tzid / geo /
michael@0 146 * location-type / categories /
michael@0 147 * dtstamp / created / last-modified
michael@0 148 */
michael@0 149 PropertyValidator.getInstance().assertOneOrLess(Property.NAME,
michael@0 150 getProperties());
michael@0 151 PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION,
michael@0 152 getProperties());
michael@0 153 PropertyValidator.getInstance().assertOneOrLess(Property.STREET_ADDRESS,
michael@0 154 getProperties());
michael@0 155 PropertyValidator.getInstance().assertOneOrLess(Property.EXTENDED_ADDRESS,
michael@0 156 getProperties());
michael@0 157 PropertyValidator.getInstance().assertOneOrLess(Property.LOCALITY,
michael@0 158 getProperties());
michael@0 159 PropertyValidator.getInstance().assertOneOrLess(Property.REGION,
michael@0 160 getProperties());
michael@0 161 PropertyValidator.getInstance().assertOneOrLess(Property.COUNTRY,
michael@0 162 getProperties());
michael@0 163 PropertyValidator.getInstance().assertOneOrLess(Property.POSTALCODE,
michael@0 164 getProperties());
michael@0 165 PropertyValidator.getInstance().assertOneOrLess(Property.TZID,
michael@0 166 getProperties());
michael@0 167 PropertyValidator.getInstance().assertOneOrLess(Property.GEO,
michael@0 168 getProperties());
michael@0 169 PropertyValidator.getInstance().assertOneOrLess(Property.LOCATION_TYPE,
michael@0 170 getProperties());
michael@0 171 PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES,
michael@0 172 getProperties());
michael@0 173 PropertyValidator.getInstance().assertOneOrLess(Property.DTSTAMP,
michael@0 174 getProperties());
michael@0 175 PropertyValidator.getInstance().assertOneOrLess(Property.CREATED,
michael@0 176 getProperties());
michael@0 177 PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED,
michael@0 178 getProperties());
michael@0 179
michael@0 180 /*
michael@0 181 * ; the following is optional, ; and MAY occur more than once tel / url / x-prop
michael@0 182 */
michael@0 183
michael@0 184 if (recurse) {
michael@0 185 validateProperties();
michael@0 186 }
michael@0 187 }
michael@0 188
michael@0 189 /**
michael@0 190 * {@inheritDoc}
michael@0 191 */
michael@0 192 protected Validator getValidator(Method method) {
michael@0 193 // No method validation required..
michael@0 194 return EMPTY_VALIDATOR;
michael@0 195 }
michael@0 196 }

mercurial