0

我已经使用 API 检索了一个工作项并使用更改了附件字段setParameterValue,使用保存工作后stepElement.doSave(true),我可以通过流程管理控制台在流程跟踪器中看到添加的附件,但我的问题是它在导航器和工作场所XT 中没有显示它也在说"Attachment may be corrupted or deleted"

下面是我用来创建附件的代码

        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,内容平台引擎

4

1 回答 1

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);
于 2014-05-20T09:39:34.927 回答