2016-06-24 25 views
1

在使用FileNet P8的內容平臺引擎5.2.1和WebSphere 8.5.5.3我當前的項目,IBM RAD 9.5和Apache Maven的3.3.1IBM FileNet P8的變化預處理器Java實現無法找到

我想部署鏈接到某個文檔類的更改預處理器。 每次將文檔添加到此類或子類時,我都希望CP更改一些屬性。

我上傳的操作處理程序的類的代碼模塊,以同樣的方式,我通常用於訂閱做:

Code modules folder

在更新文檔屬性CP對象的內容元素標籤顯示如下:

Code module content elements

我在文檔類Change Preprocessor Definitions選項卡中使用ACCE正確配置了預處理器定義:

Document class' Change Preprocessor Definition tab

JavaScript實現的動作作品

// Set NumeroContratto property to certain value when a new document is created. 
    importClass(Packages.com.filenet.api.action.Create); 
    function preprocessObjectChange (sourceObj) 
    { 
     // Verify that the pending action is a create action. 
     var actions = sourceObj.getPendingActions(); 
     for (var i = 0; i < actions.length; i++) 
     { 
     if (actions[i] instanceof Create) 
     { 
      // Set NumeroContratto property to "777" 
      sourceObj.getProperties().putValue("NumeroContratto", "777"); 
      return true; 
     } 
     } 
     return false; 
    } 

,這是Java實現:

package com.finmeccanica.spc.ecm.filenet.cp.actionhandler; 

import com.filenet.api.action.*; 
import com.filenet.api.core.IndependentlyPersistableObject; 

public class AddPropertiesToObjectCP implements 
     com.filenet.api.engine.ChangePreprocessor { 
    public boolean preprocessObjectChange(
      IndependentlyPersistableObject sourceObj) { 
     try { 
      PendingAction actions[] = sourceObj.getPendingActions(); 
      for (int i = 0; i < actions.length; i++) { 
       if (actions[i] instanceof Create) { 
        sourceObj.getProperties() 
          .putValue("NumeroContratto", "777"); 
        return true; 
       } 
      } 
      return false; 
     } catch (Exception e) { 
      throw new RuntimeException(e); 
     } 
    } 
} 

問題是什麼?
我無法讓預處理器在Java中實現它。儘管我滿山遍野的Java類處理程序的名稱和代碼模塊標題

Change preprocessor action Java class

當我點擊保存更改預處理操作,系統總是告訴我,它無法找到類:

FNRAC1005E'PDGOV CP Add PropertiesToDocument Action'對象爲 未保存。

用戶響應:刷新對象,重新輸入更改,然後再次嘗試 ,或與系統管理員聯繫。

異常詳細信息:無法從任一 相關聯的代碼模塊或系統類路徑加載事件處理程序類: com.finmeccanica.spc.ecm.filenet.cp.actionhandler.AddPropertiesToObjectCP。 信息是: com.finmeccanica.spc.ecm.filenet.cp.actionhandler.AddPropertiesToObjectCP

我上傳的罐子中包含正確的包和代碼模塊的內容類沒有被破壞。

我錯過了什麼嗎?我需要配置其他東西嗎?

回答

3

你不錯過代碼中的某些東西。當我試圖將現有的Change Preprocessor Action從JavaScript類型轉換爲Java類類型時,我複製了您的步驟,並收到相同的錯誤。它找不到代碼模塊。

但是,當我使用相同的CodeModule創建新的更改預處理器操作時,它工作正常。不同的是當你創建一個新的,你會被提示瀏覽你的代碼模塊而不是輸入它的名字。

要修復,請不要將現有操作轉換爲JavaScript類型。相反,創建一個新的更改預處理器操作,從一開始就選擇Java類型。

+0

它的工作!我運用了你的建議,你完全正確。 – abarisone