Ejemplo n.º 1
0
 public void returnDeleteHighVersionDialogValue(ReturnEvent event) {
   Integer deleteConfirm = (Integer) event.getReturnValue();
   if (deleteConfirm == 0) {
     try {
       addMultiMediaBean.setLargeThumbFileName("");
       multiMedia.setLargeThumbnail(null);
       multiMedia.setLargeThumbSystemic(true);
     } catch (Exception e) {
       e.printStackTrace();
       ErrorReportingUtils.getInstance().reportError(e);
     }
   }
 }
Ejemplo n.º 2
0
 public void returnDeleteFulltextArchiveDialogValue(ReturnEvent event) {
   Integer deleteConfirm = (Integer) event.getReturnValue();
   if (deleteConfirm == 0) {
     try {
       addMultiMediaBean.setFulltextFileName("");
       multiMedia.setFulltextFile(null);
       multiMedia.setFulltextFileSystemic(true);
     } catch (Exception e) {
       e.printStackTrace();
       ErrorReportingUtils.getInstance().reportError(e);
     }
   }
 }
Ejemplo n.º 3
0
 public void uploadHighVersion(ValueChangeEvent event) {
   try {
     UploadedFile file = (UploadedFile) event.getNewValue();
     if (file != null) {
       addMultiMediaBean.setLargeThumbFileName(
           file.getFilename() + "(" + String.valueOf(file.getLength()) + " Bytes" + ")");
       MultiMediaFile mediaFile = CMSUtil.uploadFile(file);
       multiMedia.setLargeThumbnail(mediaFile);
       uploading = true;
       multiMedia.setLargeThumbSystemic(false);
     }
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 4
0
 public void returnDeleteDialogValue(ReturnEvent event) {
   Integer deleteConfirm = (Integer) event.getReturnValue();
   if (deleteConfirm == 0) {
     try {
       MultiMedia multiMedia =
           CMSUtil.getMultiMedia(multiMediaBean.getContentManagement(), false, false, false);
       NliMultiMediaServiceProxy.getInstance()
           .removeContent(
               multiMediaBean.getContentManagement().getArchiveId(),
               multiMediaBean.getContentManagement().getId(),
               multiMedia.getId(),
               1,
               multiMedia.getFileContent().getFileFormate());
     } catch (Exception e) {
       e.printStackTrace();
       ErrorReportingUtils.getInstance().reportError(e);
     }
   }
 }
Ejemplo n.º 5
0
  public ViewDocumentInfoBean() {
    multiMediaBean = MultiMediaBean.getInstance();
    addMultiMediaBean = AddMultiMediaBean.getInstance();
    contentManagementRowData =
        (MultiMediaContentRowData)
            JsfUtils.getFromPageFlow(CMSConstants.VIRTUAL_CONTENT_MANAGEMENT);
    biblioMaterialType = (String) JsfUtils.getFromPageFlow(Constants.BIBLIO_MATERIAL_TYPE);
    multiMediaBean.setContentManagement(
        (VirtualContentManagement) getContentManagementRowData().getEntity());
    addMultiMediaBean.setMultiMedia(getMultiMedia());
    if (multiMedia.getLargeThumbnail() != null)
      addMultiMediaBean.setLargeThumbFileName(multiMedia.getLargeThumbnail().getFileName());
    if (multiMedia.getSmallThumbnail() != null)
      addMultiMediaBean.setSmallThumbFileName(multiMedia.getSmallThumbnail().getFileName());
    if (multiMedia.getLowQualityFile() != null)
      addMultiMediaBean.setLowQualityFileName(multiMedia.getLowQualityFile().getFileName());
    if (multiMedia.getFulltextFile() != null)
      addMultiMediaBean.setFulltextFileName(multiMedia.getFulltextFile().getFileName());
    selectedContentType = contentManagementRowData.getFileFormat();
    if (contentManagementRowData.getRecordType() == MultiMediaConstants.TEMP_BIBLIO_RECORD)
      isBiblioRecord = false;

    if (contentManagementRowData.getDigitalVerNum() == null)
      contentManagementRowData.setDigitalVerNum((Float) 1f);

    ResultPage resultPage =
        NliMultiMediaServiceProxy.getInstance()
            .findBiblioRecordIdByVCMId(
                contentManagementRowData.getRecordType(),
                contentManagementRowData.getContentManagement().getId(),
                true,
                0,
                20,
                new GridFilter());
    if (resultPage != null) {
      if (!resultPage.getResult().isEmpty()) {
        complementaryRecordId = (Long) resultPage.getResult().get(0);
        complementryInfo = false;
        JsfUtils.storeOnPageFlow(CMSConstants.KEY_COMPLEMENTARY_INFO, false);
      }
    }

    JsfUtils.storeOnPageFlow(CMSConstants.KEY_COMPLEMENTARY_INFO, true);
  }
Ejemplo n.º 6
0
  /**
   * @param request
   * @param response
   */
  private void serveASX(HttpServletRequest request, HttpServletResponse response) {
    ServletOutputStream ouputStream = null;
    InputStream inputStream = null;
    try {
      long vcmid = Long.parseLong(request.getParameter("id"));
      System.out.println("vcm id = " + vcmid);
      int fileFormat = Integer.parseInt(request.getParameter("fileFormat"));
      int downloadFileType = Integer.parseInt(request.getParameter("downloadFileType"));
      if (downloadFileType == 0) {
        downloadFileType = MultiMediaConstants.LOW_QUALITY_FILE_DOWNLOAD_TYPE;
      }
      //            String fileName = "";
      //            fileName += (request.getParameter("fileName"));
      boolean hasPermission = true; // TODO check Permission
      if (hasPermission) {
        Long multiMediaID = null;
        VirtualContentManagement vcmObject =
            (VirtualContentManagement) NliMultiMediaServiceProxy.getInstance().findVCMById(vcmid);
        System.out.println("vcm = " + vcmObject);
        if (multiMediaID == null || multiMediaID == 0) {
          multiMediaID = vcmObject.getImageId();
        }
        if (multiMediaID == null || multiMediaID == 0) {
          multiMediaID = vcmObject.getAudioId();
        }
        if (multiMediaID == null || multiMediaID == 0) {
          multiMediaID = vcmObject.getVideoId();
        }
        if (multiMediaID == null || multiMediaID == 0) {
          multiMediaID = vcmObject.getDocId();
        }
        if (multiMediaID == null || multiMediaID == 0) {
          multiMediaID = vcmObject.getOtherFormatId();
        }
        MultiMedia multiMedia =
            NliMultiMediaServiceProxy.getInstance().retrieveSearchData(fileFormat, multiMediaID);

        StreamObject streamObject = new StreamObject();
        streamObject.setStreamUrl(WebApplicationData.getInstance().getStreamServerUrl());
        streamObject.setStreamUrl2(WebApplicationData.getInstance().getStreamServerUrl2());
        streamObject.setStreamUrl3(WebApplicationData.getInstance().getStreamServerUrl3());
        // TODO: windows media do not support utf in title!
        //            	streamObject.setTitle(vcmObject.getTitle());
        streamObject.setVcmId(vcmObject.getId());
        streamObject.setVcmDownloadFileType(downloadFileType);
        streamObject.setVcmFileFormat(fileFormat);
        streamObject.setFileName(multiMedia.getFileContent().getFileName());
        System.out.println("repository type = " + multiMedia.getRepositoryType());
        streamObject.setRepositoryType(multiMedia.getRepositoryType());

        //                if (WebApplicationData.getInstance().getStreamServerUrl2()!= null &&
        // WebApplicationData.getInstance().getStreamServerUrl2().length() != 0)
        //
        //	streamObject.setRepositoryType(MultiMediaConstants.NEW_FILE_REPOSITORY_TYPE/*multiMedia.getRepositoryType()*/);
        //                else
        //
        //	streamObject.setRepositoryType(MultiMediaConstants.DB_REPOSITORY_TYPE/*multiMedia.getRepositoryType()*/);

        long from = Long.parseLong(request.getParameter("from"));
        if (from > 0) streamObject.setFrom(from);
        else streamObject.setFrom(vcmObject.getFrom());

        long to = Long.parseLong(request.getParameter("to"));
        if (to > 0) streamObject.setTo(to);
        else streamObject.setTo(vcmObject.getTo());

        streamObject.setAbstractText(vcmObject.getDescription());
        streamObject.setBannerUrl(request.getContextPath() + "/tempMultimedia?masterId=-2");
        if (MultiMediaConstants.AUDIO_TYPE == fileFormat) response.setContentType("audio/x-ms-asf");
        else response.setContentType("video/x-ms-asf");
        response.getWriter().write(streamObject.toASX());

        //                ouputStream = response.getOutputStream();
        //
        //                if (inputStream != null) {
        //                    FileCopyUtils.copy(inputStream, ouputStream);
        //                }
      } else {
        response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "You don't have access!");
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }