synchronized (this) {
if (content == null || content.isConsumed()) {
content = downloadContents();
}
InputStream contentStream = content.getContentStream();
return (contentStream == null) ? null : new SimpleProperty(
Value.getBinaryValue(contentStream));
}
}
} else if (collator.equals(strPropertyName, SpiConstants.PROPNAME_MIMETYPE)) {
if (FeedType.CONTENT_FEED == getFeedType()
&& ActionType.ADD.equals(getAction())) {
synchronized (this) {
if (content == null || content.getContentType() == null) {
content = downloadContents();
}
String contentType = content.getContentType();
return (contentType == null) ? null : new SimpleProperty(
Value.getStringValue(contentType));
}
}
} else if (collator.equals(strPropertyName,
SPConstants.HTTP_STATUS_CODE)) {
if (FeedType.CONTENT_FEED == getFeedType()) {
synchronized (this) {
if (content == null) {
content = downloadContents();
}
if (content.getStatusCode() != 0) {
return new SimpleProperty(Value.getLongValue(
content.getStatusCode()));
} else {
return null;
}
}
}
} else if (collator.equals(strPropertyName, SpiConstants.PROPNAME_SEARCHURL)) {
if (FeedType.CONTENT_FEED != getFeedType()) {
// TODO Handle ACL feed here.
return new SimpleProperty(Value.getStringValue(getUrl()));
}
} else if (collator.equals(strPropertyName,
SpiConstants.PROPNAME_ACLINHERITANCETYPE)) {
if (!isWebAppPolicyDoc() && parentUrl == null) {
// Returning null as ACL information is not complete.
// Every Inherited ACL should have parentUrl other than
// web application policy document.
return null;
}
return new SimpleProperty(Value.getStringValue(
SpiConstants.AclInheritanceType.PARENT_OVERRIDES.toString()));
} else if (collator.equals(strPropertyName,
SpiConstants.PROPNAME_ACLINHERITFROM_DOCID)) {
String parentUrlToSend = getParentUrl();
if (parentUrlToSend == null) {
return null;
}
if (getFeedType() == FeedType.CONTENT_FEED) {
parentUrlToSend = parentUrlToSend + "|" + getParentId().toUpperCase();
}
return new SimpleProperty(Value.getStringValue(parentUrlToSend));
} else if (collator.equals(strPropertyName,
SpiConstants.PROPNAME_ACLINHERITFROM)) {
String parentUrlToSend = getParentUrl();
if (FeedType.CONTENT_FEED == getFeedType()) {
return null;
}
return new SimpleProperty(Value.getStringValue(parentUrlToSend));
} else if (collator.equals(strPropertyName, SpiConstants.PROPNAME_FEEDTYPE)) {
return new SimpleProperty(Value.getStringValue(feedType.toString()));
} else if (collator.equals(strPropertyName,
SpiConstants.PROPNAME_ACLINHERITFROM_FEEDTYPE)) {
return new SimpleProperty(Value.getStringValue(feedType.toString()));
} else if (collator.equals(strPropertyName, SpiConstants.PROPNAME_DISPLAYURL)) {
return new SimpleProperty(Value.getStringValue(displayUrl));
} else if (collator.equals(strPropertyName, SPConstants.PARENT_WEB_TITLE)) {
return new SimpleProperty(Value.getStringValue(getParentWebTitle()));
} else if (collator.equals(strPropertyName, SpiConstants.PROPNAME_DOCID)) {
return new SimpleProperty(Value.getStringValue(getDocId()));
} else if (collator.equals(strPropertyName, SpiConstants.PROPNAME_LASTMODIFIED)) {
return new SimpleProperty(Value.getDateValue(getLastMod()));
} else if (collator.equals(strPropertyName, SPConstants.LIST_GUID)) {
if (null != getParentList()) {
return new SimpleProperty(Value.getStringValue(
getParentList().getPrimaryKey()));
}
} else if (collator.equals(strPropertyName, SPConstants.SPAUTHOR)) {
return new SimpleProperty(Value.getStringValue(getAuthor()));
} else if (strPropertyName.equals(SPConstants.OBJECT_TYPE)) {
return new SimpleProperty(Value.getStringValue(getObjType()));
} else if (strPropertyName.equals(SpiConstants.PROPNAME_ISPUBLIC)) {
return new SimpleProperty(Value.getBooleanValue(publicDocument));
} else if (strPropertyName.equals(SpiConstants.PROPNAME_ACTION)) {
return new SimpleProperty(Value.getStringValue(getAction().toString()));
} else if (strPropertyName.equals(SpiConstants.PROPNAME_ACLDENYUSERS)) {
return getPrincipalProperty(aclDenyUsers);
} else if (strPropertyName.equals(SpiConstants.PROPNAME_ACLDENYGROUPS)) {
return getPrincipalProperty(aclDenyGroups);
} else if (strPropertyName.equals(SpiConstants.PROPNAME_ACLUSERS)) {
return getPrincipalProperty(aclUsers);
} else if (strPropertyName.equals(SpiConstants.PROPNAME_ACLGROUPS)) {
return getPrincipalProperty(aclGroups);
} else if (strPropertyName.startsWith(SpiConstants.PROPNAME_TITLE)) {
return new SimpleProperty(Value.getStringValue(title));
} else if (strPropertyName.equals(SpiConstants.PROPNAME_DOCUMENTTYPE)) {
if (documentType != null) {
return new SimpleProperty(
Value.getStringValue(documentType.toString()));
} else {
return null;
}
} else {
// FIXME: We can get rid of this if-else-if ladder here by setting all
// the relevant properties (in appropriate type) right at the time of
// document creation. After doing that, all that will be required is to
// maintain a map of all the properties with key as the prop name. This
// will also eliminate maintaining multiple member attributes in this
// class. All the attribute will be there in a common map.
for (final Iterator<Attribute> iter = getAllAttrs().iterator(); iter.hasNext();) {
final Attribute attr = iter.next();
if (collator.equals(strPropertyName, attr.getName())) {
String strAttrValue = attr.getValue().toString();
// Current approach is to parse field values for ;# characters.
// TODO Utilize SharePoint Field meta-data and process values
// for only columns with SharePoint Field type as
// "LookupMulti" or "MultiChoice"
List<Value> valuesToPass;
if (null != strAttrValue) {
List<String> values = Util.processMultiValueMetadata(strAttrValue);
valuesToPass = new ArrayList<Value>();
for (String str : values) {
valuesToPass.add(Value.getStringValue(str));
}
} else {
valuesToPass = null;
}
return new SimpleProperty(valuesToPass);
}
}
}
LOGGER.finer("no matches found for[" + strPropertyName + "]");