if ("".equals(pid)) {
logger.debug("no pid");
return null;
}
logger.debug("getResourceAttribute {}, pid={}", attributeId, pid);
DOReader reader = null;
try {
logger.debug("pid={}", pid);
reader =
doManager.getReader(Server.USE_DEFINITIVE_STORE,
ReadOnlyContext.EMPTY,
pid);
} catch (ServerException e) {
logger.debug("couldn't get object reader");
return null;
}
String[] values = null;
if (Constants.OBJECT.STATE.uri.equals(attributeId)) {
try {
values = new String[1];
values[0] = reader.GetObjectState();
logger.debug("got " + Constants.OBJECT.STATE.uri + "="
+ values[0]);
} catch (ServerException e) {
logger.debug("failed getting " + Constants.OBJECT.STATE.uri,e);
return null;
}
}
else if (Constants.OBJECT.OWNER.uri.equals(attributeId)) {
try {
logger.debug("ResourceAttributeFinder.getAttributeLocally using ownerIdSeparator==["
+ ownerIdSeparator + "]");
String ownerId = reader.getOwnerId();
if (ownerId == null) {
values = new String[0];
} else {
values = reader.getOwnerId().split(ownerIdSeparator);
}
String temp = "got " + Constants.OBJECT.OWNER.uri + "=";
for (int i = 0; i < values.length; i++) {
temp += (" [" + values[i] + "]");
}
logger.debug(temp);
} catch (ServerException e) {
logger.debug("failed getting " + Constants.OBJECT.OWNER.uri,e);
return null;
}
} else if (Constants.MODEL.HAS_MODEL.uri.equals(attributeId)) {
Set<String> models = new HashSet<String>();
try {
models.addAll(reader.getContentModels());
} catch (ServerException e) {
logger.debug("failed getting " + Constants.MODEL.HAS_MODEL.uri,e);
return null;
}
values = models.toArray(new String[0]);
} else if (Constants.OBJECT.CREATED_DATETIME.uri.equals(attributeId)) {
try {
values = new String[1];
values[0] =
DateUtility.convertDateToString(reader
.getCreateDate());
logger.debug("got " + Constants.OBJECT.CREATED_DATETIME.uri
+ "=" + values[0]);
} catch (ServerException e) {
logger.debug("failed getting "
+ Constants.OBJECT.CREATED_DATETIME.uri);
return null;
}
} else if (Constants.OBJECT.LAST_MODIFIED_DATETIME.uri
.equals(attributeId)) {
try {
values = new String[1];
values[0] =
DateUtility.convertDateToString(reader
.getLastModDate());
logger.debug("got "
+ Constants.OBJECT.LAST_MODIFIED_DATETIME.uri + "="
+ values[0]);
} catch (ServerException e) {
logger.debug("failed getting "
+ Constants.OBJECT.LAST_MODIFIED_DATETIME.uri);
return null;
}
} else if (Constants.DATASTREAM.STATE.uri.equals(attributeId)
|| Constants.DATASTREAM.CONTROL_GROUP.uri
.equals(attributeId)
|| Constants.DATASTREAM.FORMAT_URI.uri.equals(attributeId)
|| Constants.DATASTREAM.CREATED_DATETIME.uri
.equals(attributeId)
|| Constants.DATASTREAM.INFO_TYPE.uri.equals(attributeId)
|| Constants.DATASTREAM.LOCATION.uri.equals(attributeId)
|| Constants.DATASTREAM.LOCATION_TYPE.uri
.equals(attributeId)
|| Constants.DATASTREAM.MIME_TYPE.uri.equals(attributeId)
|| Constants.DATASTREAM.CONTENT_LENGTH.uri
.equals(attributeId)) {
String datastreamId = getDatastreamId(context);
if ("".equals(datastreamId)) {
logger.debug("no datastreamId");
return null;
}
logger.debug("datastreamId=" + datastreamId);
Datastream datastream;
try {
datastream = reader.GetDatastream(datastreamId, new Date()); //right import (above)?
} catch (ServerException e) {
logger.debug("couldn't get datastream");
return null;
}
if (datastream == null) {