All Downloads are FREE. Search and download functionalities are using the official Maven repository.

microsoft.exchange.webservices.data.EffectiveRightsPropertyDefinition Maven / Gradle / Ivy

Go to download

The source came from http://archive.msdn.microsoft.com/ewsjavaapi Support for Maven has been added.

The newest version!
/**************************************************************************
 * copyright file="EffectiveRightsPropertyDefinition.java" company="Microsoft"
 *     Copyright (c) Microsoft Corporation.  All rights reserved.
 * 
 * Defines the EffectiveRightsPropertyDefinition.java.
 **************************************************************************/
package microsoft.exchange.webservices.data;

import java.util.EnumSet;

/***
 * Represents effective rights property definition.
 */
final class EffectiveRightsPropertyDefinition extends PropertyDefinition {

	/**
	 * Initializes a new instance of the EffectiveRightsPropertyDefinition.
	 * 
	 * @param xmlElementName
	 *            the xml element name
	 * @param uri
	 *            the uri
	 * @param flags
	 *            the flags
	 * @param version
	 *            the version
	 */
	protected EffectiveRightsPropertyDefinition(String xmlElementName,
			String uri, EnumSet flags,
			ExchangeVersion version) {
		super(xmlElementName, uri, flags, version);

	}

	/**
	 * Loads from XML.
	 * 
	 * @param reader
	 *            the reader
	 * @param propertyBag
	 *            the property bag
	 * @throws Exception
	 *             the exception
	 */
	protected  void loadPropertyValueFromXml(EwsServiceXmlReader reader,
			PropertyBag propertyBag) throws Exception {
		EnumSet value = EnumSet.noneOf(EffectiveRights.class);
		value.add(EffectiveRights.None);

		reader.ensureCurrentNodeIsStartElement(XmlNamespace.Types, this
				.getXmlElement());

		if (!reader.isEmptyElement()) {
			do {
				reader.read();

				if (reader.isStartElement()) {

					if (reader.getLocalName().equals(
							XmlElementNames.CreateAssociated)) {

						if (reader.readElementValue(Boolean.class)) {
							value.add(EffectiveRights.CreateAssociated);
						}
					} else if (reader.getLocalName().equals(
							XmlElementNames.CreateContents)) {

						if (reader.readElementValue(Boolean.class)) {
							value.add(EffectiveRights.CreateContents);
						}
					} else if (reader.getLocalName().equals(
							XmlElementNames.CreateHierarchy)) {

						if (reader.readElementValue(Boolean.class)) {
							value.add(EffectiveRights.CreateHierarchy);
						}
					} else if (reader.getLocalName().equals(
							XmlElementNames.Delete)) {

						if (reader.readElementValue(Boolean.class)) {
							value.add(EffectiveRights.Delete);
						}
					} else if (reader.getLocalName().equals(
							XmlElementNames.Modify)) {

						if (reader.readElementValue(Boolean.class)) {
							value.add(EffectiveRights.Modify);
						}
					} else if (reader.getLocalName().equals(XmlElementNames.Read)) {
						if (reader.readElementValue(Boolean.class)) {
							value.add(EffectiveRights.Read);
						}else if(reader.getLocalName().equals(XmlElementNames.ViewPrivateItems)){							
							if (reader.readElementValue(Boolean.class)){                           
								value.add(EffectiveRights.ViewPrivateItems);
							}
						}

					}
				}

			} while (!reader.isEndElement(XmlNamespace.Types, this
					.getXmlElement()));
		}
		propertyBag.setObjectFromPropertyDefinition(this, value);
	}

	/**
	 * Writes to XML.
	 * 
	 * @param writer
	 *            the writer
	 * @param propertyBag
	 *            the property bag
	 * @param isUpdateOperation
	 *            the is update operation
	 */
	protected void writePropertyValueToXml(EwsServiceXmlWriter writer,
			PropertyBag propertyBag, boolean isUpdateOperation) {
		// EffectiveRights is a read-only property, no need to implement this.
	}

	/**
	 * Gets the property type.
	 */
	@Override
	public Class getType() {
		return EffectiveRights.class; 
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy