FileNet P8 Content Engine, 버전 4.0.+              

문서 파일링 핸들러

이 핸들러는 문서에서 실행된 이벤트로 판별된 지정 폴더에 문서를 파일링합니다.

문서 파일링 핸들러
Content Engine 3.5.x JScript 버전
function OnEvent (Event, Subscription) 
{ 
var doc = Event.SourceObject; 
if (Event.IsOfClass("CreationEvent")) 
{ 
FileDocInFolder("/Docs", doc); 
} 
else if (Event.IsOfClass("ChangeClassEvent")) 
{ 
FileDocInFolder("/Archives", doc); 
} 
} 
function FileDocInFolder(otherFolderName, doc) 
{ 
var os = doc.ObjectStore; 
var rootFld = os.RootFolder; 
var fldSet = new Enumerator(rootFld.SubFolders); 
var subFld; 
for (; !fldSet.atEnd(); fldSet.moveNext()) 
{ 
subFld = fldSet.item(); if (subFld.Name == otherFolderName) 
{ subFld.File(doc, 0, doc.DocumentTitle);
 }
 }
 } 
Content Engine 4.x Java 버전
import com.filenet.api.constants.*; 
import com.filenet.api.constants.DefineSecurityParentage; 
import com.filenet.api.core.*; 
import com.filenet.api.engine.EventActionHandler; 
import com.filenet.api.events.ObjectChangeEvent; 
import com.filenet.api.exception.EngineRuntimeException; 
import com.filenet.api.exception.ExceptionCode; 
import com.filenet.api.util.Id; public class FileDocumentAction implements 
EventActionHandler { 

public void onEvent(ObjectChangeEvent event, Id subscriptionId) throws 
EngineRuntimeException 
{ 
Document doc = (Document)event.get_SourceObject(); 
try 
{ 
if (event.getClassName().equalsIgnoreCase("CreationEvent")) 
FileDocInFolder("/docs", doc); 
else if (event.getClassName().equalsIgnoreCase("ChangeClassEvent")) 
FileDocInFolder("/Archives", doc); 
} 
catch (Exception e) 
{ 
throw new EngineRuntimeException(ExceptionCode.E_FAILED); 
} 
}  
public void fileDocInFolder(String folderName, Document doc) 
{ 
try 
{ 
Folder folder = (Folder)doc.getObjectStore().getObject("Folder", folderName); 
ReferentialContainmentRelationship rel = folder.file (doc, 
AutoUniqueName.AUTO_UNIQUE, doc.get_Name(), 
DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE); 
rel.save(RefreshMode.NO_REFRESH); 
} 
catch (Exception e) 
{ 
e.printStackTrace(); 
} 
} 
} 


피드백

마지막 업데이트 날짜: 2010년 11월


© Copyright IBM Corp. 2010.
이 Information Center는 Eclipse 기술로 구현됩니다. (http://www.eclipse.org)