Skip to content

Commit

Permalink
Added custom groupwise and exchange properties
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna committed Jan 17, 2010
1 parent ceba786 commit 34bdb5f
Show file tree
Hide file tree
Showing 10 changed files with 1,082 additions and 0 deletions.
@@ -0,0 +1,105 @@
/**
* Copyright (c) 2009, Ben Fortuna
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* o Neither the name of Ben Fortuna nor the names of any other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.fortuna.ical4j.extensions.property;

import net.fortuna.ical4j.model.Parameter;
import net.fortuna.ical4j.model.ParameterList;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.PropertyFactory;
import net.fortuna.ical4j.model.ValidationException;
import net.fortuna.ical4j.util.ParameterValidator;

/**
* @author fortuna
*
*/
public class GwAutodateKey extends Property {

private static final String NAME = "X-GWAUTODATE-KEY";

public static final PropertyFactory FACTORY = new Factory();

private String value;

/**
* @param factory
*/
public GwAutodateKey(PropertyFactory factory) {
super(NAME, factory);
}

/**
* @param aList
* @param factory
*/
public GwAutodateKey(ParameterList aList, PropertyFactory factory, String value) {
super(NAME, aList, factory);
setValue(value);
}

/**
* {@inheritDoc}
*/
@Override
public void setValue(String aValue) {
this.value = aValue;
}

/**
* {@inheritDoc}
*/
@Override
public void validate() throws ValidationException {
ParameterValidator.getInstance().assertOneOrLess(Parameter.VALUE,
getParameters());
}

/**
* {@inheritDoc}
*/
@Override
public String getValue() {
return value;
}

private static class Factory implements PropertyFactory {

public Property createProperty(String name) {
return new GwAutodateKey(this);
}

public Property createProperty(String name, ParameterList parameters, String value) {
GwAutodateKey property = new GwAutodateKey(parameters, this, value);
return property;
}
}
}
111 changes: 111 additions & 0 deletions src/main/java/net/fortuna/ical4j/extensions/property/GwItemType.java
@@ -0,0 +1,111 @@
/**
* Copyright (c) 2009, Ben Fortuna
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* o Neither the name of Ben Fortuna nor the names of any other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.fortuna.ical4j.extensions.property;

import net.fortuna.ical4j.model.ParameterList;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.PropertyFactory;
import net.fortuna.ical4j.model.ValidationException;

/**
* @author fortuna
*
*/
public class GwItemType extends Property {

private static final String NAME = "X-GWITEM-TYPE";

public static final PropertyFactory FACTORY = new Factory();

public static final GwItemType APPOINTMENT = new GwItemType(new ParameterList(true), FACTORY, "APPOINTMENT");

private String value;

/**
* @param factory
*/
public GwItemType(PropertyFactory factory) {
super(NAME, factory);
}

/**
* @param aList
* @param factory
*/
public GwItemType(ParameterList aList, PropertyFactory factory, String value) {
super(NAME, aList, factory);
setValue(value);
}

/**
* {@inheritDoc}
*/
@Override
public void setValue(String aValue) {
this.value = aValue;
}

/**
* {@inheritDoc}
*/
@Override
public void validate() throws ValidationException {
// TODO Auto-generated method stub

}

/**
* {@inheritDoc}
*/
@Override
public String getValue() {
return value;
}

private static class Factory implements PropertyFactory {

public Property createProperty(String name) {
return new GwItemType(this);
}

public Property createProperty(String name, ParameterList parameters, String value) {
GwItemType property = null;
if (APPOINTMENT.getValue().equals(value)) {
property = APPOINTMENT;
}
else {
property = new GwItemType(parameters, this, value);
}
return property;
}
}
}
105 changes: 105 additions & 0 deletions src/main/java/net/fortuna/ical4j/extensions/property/GwMessageId.java
@@ -0,0 +1,105 @@
/**
* Copyright (c) 2009, Ben Fortuna
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* o Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* o Neither the name of Ben Fortuna nor the names of any other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.fortuna.ical4j.extensions.property;

import net.fortuna.ical4j.model.Parameter;
import net.fortuna.ical4j.model.ParameterList;
import net.fortuna.ical4j.model.Property;
import net.fortuna.ical4j.model.PropertyFactory;
import net.fortuna.ical4j.model.ValidationException;
import net.fortuna.ical4j.util.ParameterValidator;

/**
* @author fortuna
*
*/
public class GwMessageId extends Property {

private static final String NAME = "X-GWMESSAGEID";

public static final PropertyFactory FACTORY = new Factory();

private String value;

/**
* @param factory
*/
public GwMessageId(PropertyFactory factory) {
super(NAME, factory);
}

/**
* @param aList
* @param factory
*/
public GwMessageId(ParameterList aList, PropertyFactory factory, String value) {
super(NAME, aList, factory);
setValue(value);
}

/**
* {@inheritDoc}
*/
@Override
public void setValue(String aValue) {
this.value = aValue;
}

/**
* {@inheritDoc}
*/
@Override
public void validate() throws ValidationException {
ParameterValidator.getInstance().assertOneOrLess(Parameter.VALUE,
getParameters());
}

/**
* {@inheritDoc}
*/
@Override
public String getValue() {
return value;
}

private static class Factory implements PropertyFactory {

public Property createProperty(String name) {
return new GwMessageId(this);
}

public Property createProperty(String name, ParameterList parameters, String value) {
GwMessageId property = new GwMessageId(parameters, this, value);
return property;
}
}
}

0 comments on commit 34bdb5f

Please sign in to comment.