Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.

Possible fix for #575 and interface correction #593

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ protected ServiceObject(ExchangeService service) throws Exception {
this.propertyBag = new PropertyBag(this);
}

protected ServiceObject() {
this.propertyBag = new PropertyBag(this);
}

/**
* Gets the schema associated with this type of object.
*
Expand Down Expand Up @@ -391,18 +395,23 @@ public void load() throws Exception {
* @return The value of specified property in this instance.
* @throws Exception the exception
*/
public Object getObjectFromPropertyDefinition(
PropertyDefinitionBase propertyDefinition) throws Exception {
PropertyDefinition propDef = (PropertyDefinition) propertyDefinition;
public Object getObjectFromPropertyDefinition(PropertyDefinitionBase propertyDefinition) throws Exception {
OutParam<Object> propertyValue = new OutParam<Object>();

if (propDef != null) {
return this.getPropertyBag().getObjectFromPropertyDefinition(propDef);
} else {
// E14:226103 -- Other subclasses of PropertyDefinitionBase are not supported.
throw new UnsupportedOperationException(String.format(
"This operation isn't supported for property definition type %s.",
propertyDefinition.getType().getName()));
}
if (propertyDefinition instanceof PropertyDefinition) {
return getPropertyBag().getObjectFromPropertyDefinition((PropertyDefinition) propertyDefinition);
}

if (propertyDefinition instanceof ExtendedPropertyDefinition) {
if (this.tryGetExtendedProperty(Object.class, (ExtendedPropertyDefinition) propertyDefinition, propertyValue)) {
return propertyValue;
}
}

// E14:226103 -- Other subclasses of PropertyDefinitionBase are not supported.
throw new UnsupportedOperationException(String.format(
"This operation isn't supported for property definition type %s.",
propertyDefinition.getType().getName()));
}

/**
Expand Down Expand Up @@ -449,18 +458,19 @@ public boolean tryGetProperty(PropertyDefinitionBase propertyDefinition, OutPara
* @return true, if successful
* @throws Exception the exception
*/
public <T> boolean tryGetProperty(Class<T> cls, PropertyDefinitionBase propertyDefinition,
OutParam<T> propertyValue) throws Exception {
public <T> boolean tryGetProperty(Class<T> cls, PropertyDefinitionBase propertyDefinition, OutParam<T> propertyValue) throws Exception {
if (propertyDefinition instanceof PropertyDefinition) {
return getPropertyBag().tryGetPropertyType(cls, (PropertyDefinition) propertyDefinition, propertyValue);
}

PropertyDefinition propDef = (PropertyDefinition) propertyDefinition;
if (propDef != null) {
return this.getPropertyBag().tryGetPropertyType(cls, propDef, propertyValue);
} else {
// E14:226103 -- Other subclasses of PropertyDefinitionBase are not supported.
throw new UnsupportedOperationException(String.format(
"This operation isn't supported for property definition type %s.",
propertyDefinition.getType().getName()));
if (propertyDefinition instanceof ExtendedPropertyDefinition) {
return this.tryGetExtendedProperty(cls, (ExtendedPropertyDefinition) propertyDefinition, propertyValue);
}

// E14:226103 -- Other subclasses of PropertyDefinitionBase are not supported.
throw new UnsupportedOperationException(String.format(
"This operation isn't supported for property definition type %s.",
propertyDefinition.getType().getName()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.EnumSet;

/**
* Represents a generic folder.
*/
@ServiceObjectDefinition(xmlElementName = XmlElementNames.Folder)
public class Folder extends ServiceObject {
public class Folder extends ServiceObject implements Serializable {

private static final long serialVersionUID = -1821642181310536327L;
private static final Log LOG = LogFactory.getLog(Folder.class);

/**
Expand Down