Hi,
maybe I'm an idiot or blind or anything else.
I have issues to get the i_folder_id value from a property set in DFS.
I export the content and wants to export content and some properties
Here is my code:
public ContentTransfer()
{
}
public void getContent(IServiceContext sContext,String repositoryName,ArrayList<String> objectID,String type,String path,IQueryService queryS,String conf,String cParam) throws ServiceException, CSVReaderException
{
dos=type;
contentParam=Integer.parseInt(cParam);
absolute=path;
serviceFactory =ServiceFactory.getInstance();
service = (IObjectService) serviceFactory.getRemoteService(IObjectService.class, sContext, "core", "http://pdeluh0002180:8080/emc-dfs/services");
objectIds = new ObjectIdentitySet();
this.repositoryName=repositoryName;
querySvc=queryS;
ConfPath=conf;
addID(objectID);
Streamout();
// BinaryContent bc = (BinaryContent) content;
// System.out.println(bc.getAsByteArray().length);
// System.out.println(bc.getAsFile().getAbsolutePath());
System.out.println("stop");
}
private OperationOptions getStreamOptions(String docType) {
streamOptions = new OperationOptions();
ContentProfile contentProfile = streamOptions.getContentProfile();
contentProfile.setFormatFilter(FormatFilter.ANY);
contentProfile.setFormat(docType);
streamOptions.setContentProfile(contentProfile);
ContentTransferProfile ctp = streamOptions.getContentTransferProfile();
ctp.setDestinationDirectory(absolute);
ctp.setTransferMode(ContentTransferMode.MTOM);
streamOptions.setContentTransferProfile(ctp);
return streamOptions;
}
private void addID(ArrayList<String>alIds)
{
it= alIds.iterator();
while(it.hasNext())
{
ObjectId objId = new ObjectId(it.next());
objectIds.addIdentity(new ObjectIdentity(objId, repositoryName));
System.out.println(objId);
}
}
private void Streamout() throws CSVReaderException, ServiceException
{
try {
OperationOptions operationOptions = new OperationOptions();
PropertyProfile propProfile = new PropertyProfile();
propProfile.setFilterMode(PropertyFilterMode.ALL);
operationOptions.setPropertyProfile(propProfile);
streamOptions =getStreamOptions(dos);
results = service.get(objectIds, streamOptions);
dataObjects = results.getDataObjects();
int z = dataObjects.size();
for (int i = 0; i < z; i++) {
dataObject = (DataObject) dataObjects.get(i);
List<Relationship> rela = dataObject.getRelationships();
docProperties = dataObject.getProperties();
dataObject.setType("basf_document");
List contents = dataObject.getContents();
int iC = contents.size();
int iSize = contents.size()-1;
if(iSize==contentParam)
{
content = (Content) contents.get(contentParam);
type = content.getFormat();
}else if(iSize<contentParam)
{
content = (Content) contents.get(iSize);
type = content.getFormat();
}
else
{
content = (Content) contents.get(0);
type = content.getFormat();
}
getContAsByte = content.canGetAsByteArray();
getContAsFile = content.canGetAsFile();
rObjId = dataObject.getIdentity().toString();
objName = docProperties.get("object_name").getValueAsString();
objName=objName.replace("\"", "");
objName=objName.replace("#", "");
objName=objName.replace("\\", "");
objName=objName.replace("$", "");
objName=objName.replace("/", "");
objName=objName.replace(":", "");
getDosExt();
String id = docProperties.get("i_folder_id").getValueAsString(); Here I get a null pointer exception
while(it.hasNext())
{
String prop;
String key;
String val;
prop = it.next().toString();
String[]ar= sUtil.split(prop, "=");
if(ar.length>1)
{
ArrayIterator<String>arIt = new ArrayIterator<String>(ar);
while (arIt.hasNext())
{
System.out.println(key=arIt.next());
val=arIt.next();
if(key.equals("r_object_id"))
{
System.out.println(val);
}
if(!val.isEmpty())
{
map.put(key,val);
}
}
}
}
File f = content.getAsFile(absolute, rObjId+"." +dos , false);
IGetFolderPath fld = new GetFolderPaths();
ArrayList<String>alFld= fld.alFldPath(dataObject);
//IWriteXML write = new WriteXML();
//write.createXML(map);
System.out.println(f.getAbsolutePath());
//readConf(ConfPath);
//setAttrList(alConf);
//write.save();
}
} catch (ServiceException ex) {
Logger.getLogger(ContentTransfer.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void getDosExt()
{
IGetDosExt ext = new GetDosExt();
dos = ext.getExt(type, repositoryName, querySvc);
}
I'm goin mad. I searched all forums and studied the dev guide for DFS. I'm using dfs client dfs API 7.1 target DFS is 6.7 sp 2.
I will be glad about any help...
Best Regards Chris