0

我已經使用API​​檢索了工作項並使用setParameterValue更改了附件字段,使用stepElement.doSave(true)保存工作後,我可以通過流程管理控制檯在流程追蹤器中看到添加的附件,但我的問題是,它沒有顯示出來的情況下,導航和workplaceXT也跟它"Attachment may be corrupted or deleted"通過API添加的VWA附件未顯示在CM 5.2中

下面

是我用來創建附件

 tempAtt.setAttachmentName("check.png"); 
     tempAtt.setAttachmentDescription("Added by code"); 
     tempAtt.setType(VWAttachmentType.ATTACHMENT_TYPE_DOCUMENT); 
     tempAtt.setLibraryType(VWLibraryType.LIBRARY_TYPE_CONTENT_ENGINE); 
     tempAtt.setLibraryName("TOS"); 
     tempAtt.setId(doc.getVersionSeries().getId()); 
tempAttA[0] = tempAtt; 
stepElement.setParameterValue("Zip", tempAttA, true); 

我不明白的地方我錯了,請建議代碼。

// FileNet P8的5.2,內容平臺引擎

回答

0

得到敲我的頭幾個小時,張貼整個代碼後的解決方案,可以爲別人

 //Connect to PE 
     //Query the queue with wobnum and get the workobject 
        queryIndex = "F_WobNum"; 
        queryMin[0] = wob; 
        queryMax[0] = wob; 
        queryFlag = VWQueue.QUERY_MIN_VALUES_INCLUSIVE + VWQueue.QUERY_MAX_VALUES_INCLUSIVE; 
        queryType = VWFetchType.FETCH_TYPE_WORKOBJECT; 
        queryTypeStepElement = VWFetchType.FETCH_TYPE_STEP_ELEMENT; 
        queue = session.getQueue("Queue_Name"); 
        query = queue.createQuery(queryIndex, queryMin, queryMax, queryFlag, null, null, queryType); 
        System.out.println("count " + query.fetchCount()); 
        workObject = (VWWorkObject) query.next(); 
    //get the stepelement 
        stepElement = workObject.fetchStepElement(); 
        parameters = stepElement.getParameters(VWFieldType.ALL_FIELD_TYPES, VWStepElement.FIELD_USER_AND_SYSTEM_DEFINED); 

    //get the existing attachment value 
     tempAttA= (VWAttachment[]) stepElement.getParameterValue("attachment_field_name"); 
//attachment is VWAttachment array   
attachment=tempAttA; 
//lock the item for working 
      stepElement.doLock(true); 
//set the new values for the new attachment to be added   
      tempAtt=new VWAttachment(); 
      tempAtt.setAttachmentName("Attachment_name"); 
      tempAtt.setAttachmentDescription("Added by code"); 
      tempAtt.setType(VWAttachmentType.ATTACHMENT_TYPE_DOCUMENT); 
      tempAtt.setLibraryType(VWLibraryType.LIBRARY_TYPE_CONTENT_ENGINE); 
      tempAtt.setLibraryName("TOS"); 
//vs id of the existing CE document , note that adding attachment means refering a CE object , so the document u want to attach should be stored in CE before. 
      tempAtt.setId(doc.getVersionSeries().getId()); 
      attachment=tempAttA; 
//law is a arraylist of VWAttachment type , so u dont override any existing attachments 
      law.add(attachment[0]); 
      law.add(tempAtt); 
//set the attchment field with new values 
      stepElement.setParameterValue("attachment_name", law.toArray(), true); 
有幫助