Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private String uploadFile(UploadedFile doc) {
- UploadedFile myDoc = doc;
- String path = null;
- if (myDoc == null) {
- } else {
- path =
- FILE_PATH + File.separator + new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date()) + "_" + myDoc.getFilename();
- System.out.println(path + " PATH + FILENAME ");
- InputStream inputStream = null;
- try {
- FileOutputStream out = new FileOutputStream(path);
- inputStream = myDoc.getInputStream();
- byte[] buffer = new byte[8192];
- int bytesRead = 0;
- while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
- out.write(buffer, 0, bytesRead);
- }
- out.flush();
- out.close();
- } catch (Exception ex) {
- log.error(ex.getMessage(), ex);
- } finally {
- try {
- inputStream.close();
- } catch (IOException ioex) {
- log.error(ioex.getMessage(), ioex);
- }
- }
- }
- return path;
- }
- public void setDocumentData(String path, int contentType, String fileName) {
- AppModuleImpl am = (AppModuleImpl)ADFUtils.getApplicationModuleForDataControl("AppModuleDataControl");
- DCIteratorBinding attachDocIterator = ADFUtils.findIterator("AttachDocView2Iterator");
- //ViewObject attachDocVo = am.getAttachDocView2();
- Row newAttachDoc = attachDocIterator.getRowSetIterator().createRow();
- newAttachDoc.setAttribute("DocumentDate", new oracle.jbo.domain.Date().getCurrentDate());
- newAttachDoc.setAttribute("Name", fileName);
- newAttachDoc.setAttribute("FilePath", path);
- newAttachDoc.setAttribute("ContentTypeId", contentType);
- attachDocIterator.getRowSetIterator().insertRow(newAttachDoc);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement