@Override
 protected void removeEntityObject(EntityObject selectedRecord) {
   try {
     ParagraphProperties paragraphProperties = (ParagraphProperties) selectedRecord;
     NliMultiMediaServiceProxy.getInstance().removeEntityObject(paragraphProperties);
   } catch (Exception exp) {
     Util.processException(exp);
   }
 }
 public void returnFullTextDialogValue(ReturnEvent event) {
   Integer confirm = (Integer) event.getReturnValue();
   if (confirm == 0) {
     try {
       multiMediaBean.getContentManagement().setFullText(true);
       NliMultiMediaServiceProxy.getInstance()
           .updateVirtualContentManagement(multiMediaBean.getContentManagement(), null, false);
       contentManagementRowData.setFullText(true);
     } catch (Exception e) {
       e.printStackTrace();
       ErrorReportingUtils.getInstance().reportError(e);
     }
   }
 }
  public String getCreateComplementaryInfo() {
    try {
      if (isBiblioRecord) {
        BibliographicRecord biblioRecord =
            CMSUtil.createNewBibliographic(contentManagementRowData.getTitle());
        biblioRecord.setWorkGroup(getMultiMedia().getGroup());
        biblioRecord.setAccessModule(getMultiMedia().getModule());

        biblioRecord =
            (BibliographicRecord)
                NliUnimarcStorageServiceProxy.getInstance().saveRecord(biblioRecord);
        getMultiMedia().setRecordId(biblioRecord.getId());
        getMultiMedia().setRecordType(MultiMediaConstants.BIBLIO_RECORD);
      } else {
        TempBibliographicRecord tmpBiblioRecord =
            CMSUtil.createNewTempBibliographic(contentManagementRowData.getTitle());
        tmpBiblioRecord.setWorkGroup(getMultiMedia().getGroup());
        tmpBiblioRecord.setAccessModule(getMultiMedia().getModule());

        tmpBiblioRecord =
            (TempBibliographicRecord)
                NliUnimarcStorageServiceProxy.getInstance().saveRecord(tmpBiblioRecord);
        getMultiMedia().setRecordId(tmpBiblioRecord.getId());
        getMultiMedia().setRecordType(MultiMediaConstants.TEMP_BIBLIO_RECORD);
      }
      getMultiMedia().setComplementryInfo(true);
      getMultiMedia().setLcc(contentManagementRowData.getContentManagement().getLcc());
      getMultiMedia().setLccCode(contentManagementRowData.getContentManagement().getLccCode());
      NliMultiMediaServiceProxy.getInstance()
          .saveContent(
              getMultiMedia(),
              contentManagementRowData.getContentManagement(),
              false,
              true,
              false,
              0);
      contentManagementRowData.setHasCompelementaryInfo(true);
      this.complementryInfo = true;
      JsfUtils.storeOnPageFlow(CMSConstants.KEY_COMPLEMENTARY_INFO, true);
      JsfUtils.ShowMessageDialog("complementary_record_created", 300, 130);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return "";
  }
  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);
  }
 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);
     }
   }
 }
 public String doConfirm() {
   try {
     NliMultiMediaServiceProxy.getInstance()
         .updateVirtualContentManagement(multiMediaBean.getContentManagement(), multiMedia, false);
     Long recordId = (Long) JsfUtils.getFromPageFlow(Constants.RECORD_ID);
     if (recordId != null) {
       updateDigitalResourceIndexes(
           multiMediaBean.getContentManagement(),
           recordId,
           true,
           DigitalresourcesSchema.UPDATE_INDEX);
     }
     return goBack();
   } catch (Exception e) {
     e.printStackTrace();
     ErrorReportingUtils.getInstance().reportError(e);
     return "";
   }
 }
Beispiel #7
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();
    }
  }