2012-10-26 2 views
3

JDeveloper를 사용하고 있습니다. ADF Fusion Web Application에는 Input File 컨트롤과 Bean 메소드를 호출하여 UCM에 파일을 업로드하는 Send 버튼이 있습니다. 내 파일이 내 컴퓨터에있는 경우 "/home/user/myfile.txt"라고 말하면 매력적입니다. 입력 파일을 사용하려는 경우이 파일을 디스크에 저장하고이 파일을 업로드하지 않고 UCM에 파일을 업로드하는 방법을 알 수 없습니다. 제 생각에는 이런 일을하는 것이 권장되지 않습니다. 당신이 어떤 제안이있는 경우RIDC를 사용하여 ADF 입력 파일을 UCM 폴더에 업로드

// RETRIEVE THE DESTINATION PATH 
DataBinder binder = idcClient.createBinder(); 
binder.putLocal("IdcService", "COLLECTION_INFO"); 
binder.putLocal("hasCollectionPath", "true"); 
binder.putLocal("dCollectionPath", "/Contribution Folders/PDD"); // The path you are looking for 
DataBinder searchFolder = idcClient.sendRequest(idcContext, binder).getResponseAsBinder(); 

binder = idcClient.createBinder(); 
binder.putLocal ("IdcService", "CHECKIN_NEW"); 
binder.putLocal ("dDocAuthor", "weblogic"); 
binder.putLocal ("dDocTitle", "myimage2.jpg"); 
binder.putLocal ("dDocName", "myimage2.jpg"); 
binder.putLocal ("dDocType", "Document"); 
binder.putLocal("xCollectionID", searchFolder.getLocal("dCollectionID")); 
binder.putLocal ("dSecurityGroup", "Public"); 
binder.putLocal ("dDocAccount:", ""); 
binder.putLocal ("xComments", "My comment"); 
binder.addFile ("primaryFile", new File("/home/oracle/myimage.jpg")); 

// check in the file 
ServiceResponse response = idcClient.sendRequest (idcContext, binder); 

, 나는 많은 감사하겠습니다 : 여기

서버 워크 스테이션에서 오는 파일을 업로드 할 수 있습니다 내가 지금까지 가지고있는 코드입니다. 감사합니다. 이미 스스로 해결책을 발견했습니다 그래서 그냥 여기 사용해야 다른 편리한을 UploadFile 방법이 있다는 것을 언급 할

 UploadedFile uf = (UploadedFile) inputFile1.getValue(); 

     DataBinder binder = idcClient.createBinder(); 
     binder.putLocal ("IdcService", "CHECKIN_NEW"); 
     binder.putLocal ("dDocAuthor", "weblogic"); // if user is admin, can specify other user 
     binder.putLocal ("dDocTitle", uf.getFilename()); 
     binder.putLocal ("dDocName", uf.getFilename()); 
     binder.putLocal ("dDocType", "DigitalMedia"); 
     binder.putLocal("xCollectionID", getFolderCollectionId("/Contribution Folders/PDD")); // parent's folder 
     binder.putLocal ("dSecurityGroup", "Public"); 
     binder.putLocal ("dDocAccount:", ""); 
     binder.putLocal ("xComments", "Montreal comment"); 
     binder.putLocal ("xWCTags", "Montreal"); 

     binder.addFile ("primaryFile", new TransferFile(uf.getInputStream(), uf.getFilename(), getByteLenght(uf.getInputStream()))); 

     ServiceResponse response = idcClient.sendRequest (idcContext, binder); 
+0

컴퓨터에 저장되어있는 파일은 어디에 저장 되나요? – User404

+0

InputFile 컨트롤을 사용하고 사용자가 파일을 탐색 할 때 InputStream 컨트롤이 제공됩니다. 내가 원했던 것은 서버에 파일을 저장하지 않아도 UCM에이 입력 스트림을 보내는 방식으로 나에게 나쁜 습관으로 보입니다. – Benster

+0

UCM Api는 File 객체 만 받아들이 기 때문에 유일한 가능한 방법은 inputstream을 File로 변환하는 것입니다. 물론 업로드 후 파일을 삭제할 수 있습니다. 예 : File f = 새 파일(); // upload f.delete(); – User404

답변

2

: 여기


는 솔루션입니다.

getFilename(); //you've got this 
getLength(); //instead of getting byte length from stream 
getContentType(); //available MIME 

getFolderCollectionId("/Contribution Folders/PDD"))은 의도 한대로 작동합니까?

또한 파일은 크기가 100KB 미만인 경우에만 메모리에 저장되고 더 많은 경우 디스크에 기록됩니다. 각 요청 제한은 2000KB입니다. 이것은 기본값이며 서블릿 컨텍스트 초기화 매개 변수에서 변경할 수 있습니다.

<context-param> 
    <!-- Maximum memory per request (in bytes) --> 
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_MEMORY</param-name> 
    <param-value>512000</param-value> 
</context-param> 
<context-param> 
    <!-- Maximum disk space per request (in bytes) --> 
    <param-name>oracle.adf.view.faces.UPLOAD_MAX_DISK_SPACE</param-name> 
    <param-value>5120000</param-value> 
</context-param> 
<context-param> 
    <!-- directory to store temporary files --> 
    <param-name>oracle.adf.view.faces.UPLOAD_TEMP_DIR</param-name> 
    <param-value>/tmp/ADFUploads/</param-value> 
</context-param> 

<!-- This filter is always required by ADF; one of its functions is file upload. --> 
<filter> 
    <filter-name>adfFaces</filter-name> 
    <filter-class>oracle.adf.view.faces.webapp.AdfFacesFilter</filter-class> 
</filter> 
+0

이 @Benster 게시물에 대한 질문, 의견 및 답변은 ​​다음과 같습니다. 실제로'new TransferFile (file.getInputStream(), file.getFilename(), file.getLength(), file.getContentType()'을 사용하면 완벽하게 작동합니다. [기본 링크] (http://docs.oracle.com/ cd/E10316_01/ContentIntegration/ridc/Javadoc/oracle/stellent/ridc/model/TransferFile.html). – 32U