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);
     }
   }
 }
Exemple #2
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();
    }
  }