2015-01-03 7 views
1

다른 이름의 폴더에 문서 수를 표시해야하는 FileNet 프로젝트에서 작업하고 있습니다. CE API를 통해 쉽게 할 수 있지만이 정보가 FileNet DB에 저장되는 위치를 알아야합니다.FileNet : FileNet 폴더의 총 문서 수

문서 수 DocVersion이라는 테이블에서 얻을 수있는 폴더 정보는 Container 테이블에 저장됩니다. 내가 원하는 쿼리는 다음과 같습니다.

SELECT COUNT(*) FROM DOCVERSION D, CONTAINER C WHERE --container name is 'Others' 

모든 도움을 주실 수 있습니다. 당신의 생각이 당신을 도울 것입니다

+0

이름 대신 폴더 ID (fn 내부 GUID/UUID)를 사용해 보셨습니까? –

답변

0

나는 그것이 같은 것, 응용 프로그램의 코드를 시도하지만,하지 ..

SELECT count (*) as Row_Count 

FROM Container c, DocVersion d 

WHERE c.object_id = d.object_class_id 

AND c.name = 'Others' 

희망.

2

당신 말이 맞습니다. DocVersion에 배치 된 문서, Folders는 컨테이너 테이블에 배치됩니다. 그러나 관계 테이블에 배치 된 문서와 폴더 사이의 링크.

당신이 파일 넷 API를 사용하는 경우 다음 FN 쿼리를

Select d.Id from Document d 
where d.This INFOLDER '/bla/bla/bla' 

또는 INSUBFOLDER 연산자를 사용하려고 할 수 있습니다. 그리고 다음 단계에서 결과 세트를 계산해야합니다.

데이터베이스에서 직접 정보를 얻으려면 다음 쿼리를 사용해보십시오.

select count(r.Object_Id) from DocVersion d, Container c, Relationship r 
where r.Head_Id = c.Object_Id 
and d.Object_Id = r.Tail_Id --// you can exclude this if in the Folder filed only documents and not custom objects. 
and c.Object_Id = {folder-id} --// or use c.Name = 'Other' - you can't use PathName field in DB query. 
0

이 특정 폴더에 문서의 총량을 얻을 수있는 권리 쿼리입니다 ...이 쿼리 '오류'에서

db2 "select count(*) from OSDBUSER.Relationship r, OSDBUSER.Container c, OSDBUSER.DOCVERSION d where r.Tail_Id = c.Object_Id and r.Head_Id = d.Object_Id and c.name = 'Error'" 

는 문서를 계산하는 폴더의 이름입니다. ...

1

귀하의 질문에 감사 드리며 그것을 시도했습니다. 검색어에 문제가 하나 있습니다. head_id 및 tail_id를 잘못된 방향으로 사용했습니다. 올바른 쿼리는 다음과 같아야합니다. 여기

select count(r.Object_Id) 
from DocVersion d, Container c, Relationship r 
where r.Tail_Id = c.Object_Id and d.Object_Id = r.Head_Id --// you can exclude this if in the Folder filed only documents and not custom objects. 
and c.Object_Id = {folder-id} --// or use c.Name = 'Other' - you can't use PathName field in DB query. 
0

직접 DB 쿼리 (안 ACCE/FEM의 SQL) 미분류 문서를 찾을 수 있지만, 특정 폴더에 제출 한 개체를 찾을 수 변경 될 수 있습니다에 대한 몇 가지 더 예. (where rel.Head_id IS NULL을 (를) 폴더로 변경하십시오)

MS SQL에서 테스트하고 실행하십시오.

--Count by Doc Class 
SELECT Doc.object_class_id, count(distinct Doc.version_series_id) as '# Docs' , ClassDef.symbolic_name as ClassName 
FROM DocVersion doc 
LEFT JOIN Relationship rel ON doc.object_id = rel.Head_id 
INNER JOIN ClassDefinition ClassDef ON doc.object_class_id = ClassDef.[object_id] 
where rel.Head_id IS NULL and doc.is_current=1 
group by Doc.object_class_id, ClassDef.symbolic_name 
order by '# Docs' desc 

--by creator 
SELECT Doc.creator, count(distinct Doc.version_series_id) as '# Docs' 
FROM DocVersion doc 
LEFT JOIN Relationship rel ON doc.object_id = rel.Head_id 
where rel.Head_id IS NULL and doc.is_current=1 
group by Doc.creator 
order by '# Docs' desc 

--list Of Docs 
SELECT Doc.creator, doc.create_date, doc.u32_documenttitle , doc.modify_date ,doc.modify_user , ClassDef.symbolic_name as ClassName 
FROM DocVersion doc 
LEFT JOIN Relationship rel ON doc.object_id = rel.Head_id 
INNER JOIN ClassDefinition ClassDef ON doc.object_class_id = ClassDef.[object_id] 
where rel.Head_id IS NULL and doc.is_current=1 
order by Doc.create_date 
-1

희망 사항.

public void countobjectsinAllOS() { 
    Connection conn = Factory.Connection.getConnection(ConfigInfo.CE_URI); 
    Domain domain = Factory.Domain.fetchInstance(conn, null, null); 

    Iterator<ObjectStoreSet> it = domain.get_ObjectStores().iterator(); 

    int countofos = 0; 
    while (it.hasNext()) { 

     ObjectStore os = (ObjectStore)it.next(); 
     String osname = os.get_DisplayName(); 

     System.out.println("Working on Object Store " +osname); 
     countofos++; 
     countObjectsInAnOS(osname); 
    } 
    System.out.println("\n\n"); 
    //System.out.println("Number of Object Stores found in doamin >>\t" + domain.get_Name() + "\t<< is " + countofos); 
} 

public void countObjectsInAnOS(String OSName) { 
    Connection conn = Factory.Connection.getConnection(ConfigInfo.CE_URI); 
    Domain domain = Factory.Domain.fetchInstance(conn, null, null); 
    ObjectStore os = Factory.ObjectStore.fetchInstance(domain, OSName, null); 
    // Create a SearchSQL instance and specify the SQL statement (using the 
    // helper methods). 
    SearchSQL sqlObject = new SearchSQL(); 
    sqlObject.setSelectList("*"); 
    //sqlObject.setMaxRecords(10); 
    sqlObject.setWhereClause("f.This INSUBFOLDER '/'"); 
    sqlObject.setFromClauseInitialValue("Folder", "f", false); 
    domain.get_ObjectStores(); 
    // Uncomment below lines for Documents  
    // sqlObject.setSelectList("d.DocumentTitle, d.Id"); 
    // sqlObject.setMaxRecords(20); 
    // sqlObject.setFromClauseInitialValue("Document", "d", false); 
    // Check the SQL statement.   

    //Uncomment to see the SQL 

    //System.out.println("SQL: " + sqlObject.toString()); 

    // Create a SearchScope instance. (Assumes you have the object store 
    // object.) 
    Boolean continuable = new Boolean(true); 

    // Set the page size (Long) to use for a page of query result data. This value is passed 
    // in the pageSize parameter. If null, this defaults to the value of 
    // ServerCacheConfiguration.QueryPageDefaultSize. 
    Integer myPageSize = new Integer(10); 

    // Specify a property filter to use for the filter parameter, if needed. 
    // This can be null if you are not filtering properties. 
    //  PropertyFilter myFilter = new PropertyFilter(); 
    //  int myFilterLevel = 1; 
    //  myFilter.setMaxRecursion(myFilterLevel); 
    //  myFilter.addIncludeType(new FilterElement(null, null, null, FilteredPropertyType.ANY, null)); 

    // Set the (Boolean) value for the continuable parameter. This indicates 
    // whether to iterate requests for subsequent pages of result data when the end of the 
    // first page of results is reached. If null or false, only a single page of results is 
    // returned. 
    // Execute the fetchObjects method using the specified parameters. 
    //IndependentObjectSet myObjects = search.fetchObjects(sqlObject, myPageSize, myFilter, continuable); 
    SearchScope searchScope = new SearchScope(os); 
    RepositoryRowSet rowSet = searchScope.fetchRows(sqlObject, myPageSize, null, continuable); 
    long count = 0; 
    Iterator<RepositoryRow> it = rowSet.iterator(); 
    while (it.hasNext()) { 
     it.next(); 
     count++; 
    } 
    //System.out.println("Total number of Documents >>\t\t" + count + "\n\n"); 
    System.out.println("Total number of Folders >>\t\t" + count + "\n\n"); 

} 
+0

인터넷에서 복사 한 것 같습니다. 항상 출처를 포함하십시오. – LarsTech

+1

죄송합니다. 내 블로그에서 복사하여 붙여 넣기 - https://abcdjavaee.blogspot.com/2017/09/filenet-apis-quick-reference.html?_sm_au_=iVV3nZnqPjr663gR – ajayfn