SCENARIO: This is an ADF application where the user will enter metadata fields about the content file, upload the content in UCM. The application will call the CHECKIN_NEW service using RIDC. On successful upload, it will display a message.
PREREQUISITES: Set IntradocServerPort=4444 in the intradoc.cfg file, if it is not present.
Append *.*.*.* to SocketHostAddressSecurityFilter parameter in config.cfg file, to enable connection via RIDC API remote connection.
This sample application was created using JDev 11.1.1.7. This is the main code:
Download RIDCCheckin.rar, the sample application from the file cabinet.
PREREQUISITES: Set IntradocServerPort=4444 in the intradoc.cfg file, if it is not present.
Append *.*.*.* to SocketHostAddressSecurityFilter parameter in config.cfg file, to enable connection via RIDC API remote connection.
This sample application was created using JDev 11.1.1.7. This is the main code:
public void onFileUpload(ActionEvent actionEvent) {
try {
IdcClientManager manager = new IdcClientManager();
IdcClient idcClient =
manager.createClient("idc://192.168.2.8:4444");
IdcContext userContext = new IdcContext("sysadmin");
UploadedFile uploadedFile = (UploadedFile)file.getValue();
DataBinder serviceBinder = idcClient.createBinder();
serviceBinder.putLocal("IdcService", "CHECKIN_NEW"); //CHECKIN_UNIVERSAL
serviceBinder.putLocal("dDocType", dDocType);
serviceBinder.putLocal("dDocTitle", dDocTitle);
serviceBinder.putLocal("dDocAuthor",
ADFContext.getCurrent().getSecurityContext().getUserName());
serviceBinder.putLocal("dSecurityGroup", "Public");
try {
serviceBinder.addFile("primaryFile",
new TransferFile(uploadedFile.getInputStream(),
uploadedFile.getFilename(),
uploadedFile.getLength()));
} catch (IOException e) {
throw new UCMException("Primary File Error: " +
e.getMessage());
}
ServiceResponse response =
idcClient.sendRequest(userContext, serviceBinder);
DataBinder responseBinder = response.getResponseAsBinder();
System.out.println(responseBinder);
DataObject localData = responseBinder.getLocalData();
if (localData.get("StatusCode").equals("0")) {
addFacesMessage(FacesMessage.SEVERITY_INFO,
localData.get("StatusMessage"));
}
} catch (IdcClientException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
Download RIDCCheckin.rar, the sample application from the file cabinet.
No comments:
Post a Comment