Hello,
I am really having trouble getting this method call to work. Java, DFS 6.5, separate tiers. Any help is appreciated!
I can get as far as calling Content.canGetAsFile() successfully, but the next call which should get the actual file fails with no errors. I then tried using Content.canGetAsByteArray(), which also returned true, so I tried Content.getAsByteArray[] and finally received an error:
com.emc.documentum.fs.rt.ServiceInvocationRuntimeException ] Current method should be overridden: "class com.emc.documentum.fs.datamodel.core.content.UrlContent"com.emc.documentum.fs.rt.ServiceInvocationRuntimeException: Current method should be overridden: "class com.emc.documentum.fs.datamodel.core.content.UrlContent"
at com.emc.documentum.fs.datamodel.core.content.Content.throwOverrideException(Content.java:331)
at com.emc.documentum.fs.datamodel.core.content.Content.canGetAsFile(Content.java:157)
at com.emc.documentum.fs.datamodel.core.content.UrlContent.canGetAsByteArray(UrlContent.java:86)
This is pretty confusing. First, why am I receiving UrlContent objects instead of a more usable type like FileContent or BinaryContent? Second, what does this error mean and how can I get around it? The object I am trying to return is a normal 183kb .PDF file on a local server.
This is the code I am using to retrieve the object:
ObjectIdentity<ObjectId> objIdentity = new ObjectIdentity<ObjectId>(new ObjectId(sObjId), sRepository);
ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
objectIdSet.addIdentity(objIdentity);
DataObject dataObj = null;
try {
ServiceFactory sf = ServiceFactory.getInstance();
IObjectService os = sf.getRemoteService(IObjectService.class, context);
PropertyProfile pp = new PropertyProfile(PropertyFilterMode.ALL);
ContentProfile cp = new ContentProfile();
OperationOptions oo = new OperationOptions();
ContentTransferProfile ctp = new ContentTransferProfile();
if (includePermissions) {
//logger.debug("Include permissions (object).");
PermissionProfile permissionProfile = new PermissionProfile();
permissionProfile.setPermissionTypeFilter(PermissionTypeFilter.ANY);
oo.setPermissionProfile(permissionProfile);
}
ctp.setTransferMode(ContentTransferMode.MTOM);
cp.setFormatFilter(ff);
oo.setContentTransferProfile(ctp);
oo.setPropertyProfile(pp);
oo.setContentProfile(cp);
oo.setProfile(cp);
DataPackage dataPackage = os.get(objectIdSet, oo);
if (dataPackage.getDataObjects().size() > 0)
dataObj = dataPackage.getDataObjects().get(0);
}
catch(ServiceInvocationException exc){
throw new Exception(exc) ;
}
catch(CoreServiceException exc){
throw new Exception(exc) ;
}
catch(ServiceException exc){
throw new Exception(exc) ;
}
return dataObj;
And this is the code I am using to try to pull out the contents. It fails on the bolded lines. In order to actually "see" the error caught and logged, I have to comment out the File attempt and try the ByteArray. The File produces no errors but causes the server to halt:
if (dataObj.getContents().size() > 0) {
Content contentObj = dataObj.getContents().get(0);
if (contentObj.canGetAsFile()) {
File file = contentObj.getAsFile();
}
if (contentObj.canGetAsByteArray()) {
new ByteArrayInputStream(contentObj.getAsByteArray());
}
}