Search code examples
javafilenet-p8filenet-content-engine

Filenet Document property not modifying after re-upload


I have tested a simple program to change class and upload a document again. When I use it normally with my admin account it works ok, but when I log from a non admin account it does't let me edit property.

enter image description here enter image description here

 public void senddoc(String send,String clas){
    System.out.println(send);
    Document docn = Factory.Document.createInstance(os, null);
    InputStream input = null;
    ContentElementList contEleList = Factory.ContentElement.createList();
    ContentTransfer ct = Factory.ContentTransfer.createInstance();
    Folder folder = Factory.Folder.fetchInstance(os,send, null);

    ContentElementList contEleList2 = Factory.ContentElement.createList();
    ContentTransfer ct2 = Factory.ContentTransfer.createInstance();

    contEleList= doc.get_ContentElements();
    ct=(ContentTransfer) contEleList.get(0);
    input = ct.accessContentStream();
    System.out.println(input);

    ct2.setCaptureSource(input);
    ct2.set_ContentType("image/tiff");
    ct2.set_RetrievalName("New File Title");
    contEleList2.add(ct2);

    docn.set_ContentElements(contEleList2);



    Properties properties = doc.getProperties(); 

    String Title = properties.getStringValue("DocumentTitle");
    //read other 

    docn.checkin(AutoClassify.DO_NOT_AUTO_CLASSIFY, CheckinType.MAJOR_VERSION);
    docn.save(RefreshMode.REFRESH);

    ReferentialContainmentRelationship rcr = folder.file(docn,
            AutoUniqueName.AUTO_UNIQUE, "New File Title", 
            DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
    rcr.save(RefreshMode.REFRESH);
    docn.changeClass(clas);
    docn.save(RefreshMode.REFRESH);

    docn.getProperties().putValue("DocumentTitle",Title);
    //input other


    docn.save(RefreshMode.REFRESH);
    rcr.save(RefreshMode.REFRESH);

}

But the thing is when I re-upload the Document it can be only edited by the admin user, and original documents author part have been removed. So what can I do to give modification as in the original document?

Thx in any input. :)


Solution

  • after few try i have found the issue and fix it , this maybe not the optimal way of doing this but this solve my issue. I just map the access permissions to document to document like.

    docn.set_Permissions(doc.get_Permissions());
    

    i have try few bulk upload programs(as the demo code in IBM) before but i didn't add this to it , but it work ok for all documents had right permission to all users.but in this(service convert document class and index) i had to map it.

    Hope this will help anyone face this.

    Tnx