Beispiel #1
0
  public Boolean dataSourceExport(DataSourceUI dataSourceUI) throws ServerSideException {
    try {
      RepoxManagerDefault repoxManagerDefault =
          (RepoxManagerDefault) ConfigSingleton.getRepoxContextUtil().getRepoxManager();
      DataSourceContainer dataSourceContainer =
          repoxManagerDefault
              .getDataManager()
              .getDataSourceContainer(dataSourceUI.getDataSourceSet());

      DataSource dataSource = dataSourceContainer.getDataSource();
      dataSource.setExportDir(dataSourceUI.getExportDirectory());

      String recordsPerFile;
      if (dataSourceUI.getRecordsPerFile().equals("All")) recordsPerFile = "-1";
      else recordsPerFile = dataSourceUI.getRecordsPerFile();

      ConfigSingleton.getRepoxContextUtil()
          .getRepoxManager()
          .getDataManager()
          .startExportDataSource(
              dataSourceUI.getDataSourceSet(), recordsPerFile, dataSourceUI.getExportFormat());
    } catch (Exception e) {
      throw new ServerSideException(Util.stackTraceToString(e));
    }
    return true;
  }
Beispiel #2
0
  public String addAllOAIURL(
      String url,
      String dataProviderID,
      String dsSchema,
      String dsNamespace,
      String dsMTDFormat,
      String name,
      String nameCode,
      String exportPath,
      DataSetOperationsServiceImpl dataSetOperationsService)
      throws ServerSideException {
    try {
      // Check http URLs
      String checkUrlResult = DataSetOperationsServiceImpl.checkURL(url);
      if (checkUrlResult.equals("URL_MALFORMED")) return "URL_MALFORMED";
      else if (checkUrlResult.equals("URL_NOT_EXISTS")) return "URL_NOT_EXISTS";

      LightSaveData.addAllOAIURL(
          url.trim(),
          dataProviderID,
          dsSchema,
          dsNamespace,
          dsMTDFormat,
          dataSetOperationsService.checkOAIURL(url.trim()));
    } catch (Exception e) {
      e.printStackTrace();
      throw new ServerSideException(Util.stackTraceToString(e));
    }
    return "SUCCESS";
  }
Beispiel #3
0
 public String deleteDataSources(List<DataSourceUI> dataSourceUIs) throws ServerSideException {
   try {
     return LightSaveData.deleteDataSources(dataSourceUIs);
   } catch (Exception e) {
     e.printStackTrace();
     throw new ServerSideException(Util.stackTraceToString(e));
   }
 }
Beispiel #4
0
 public SaveDataResponse saveDataProvider(
     boolean update, DataProviderUI dataProviderUI, int pageSize) throws ServerSideException {
   try {
     return LightSaveData.saveDataProvider(update, dataProviderUI, pageSize);
   } catch (Exception e) {
     e.printStackTrace();
     throw new ServerSideException(Util.stackTraceToString(e));
   }
 }
Beispiel #5
0
 public SaveDataResponse saveDataSource(
     boolean update, String type, String originalDSset, DataSourceUI dataSourceUI, int pageSize)
     throws ServerSideException {
   try {
     return LightSaveData.saveDataSource(update, type, originalDSset, dataSourceUI, pageSize);
   } catch (Exception e) {
     e.printStackTrace();
     throw new ServerSideException(Util.stackTraceToString(e));
   }
 }
  protected static ResponseState validateTransformation(
      String id, String xslFilePath, String oldTransId) throws ServerSideException {
    try {

      ConfigSingleton.getRepoxContextUtil()
          .getRepoxManager()
          .getMetadataTransformationManager()
          .checkTransformationValidity(id, xslFilePath + XSL_END, oldTransId);

      return ResponseState.SUCCESS;
    } catch (SameStylesheetTransformationException e) {
      return ResponseState.MAPPING_SAME_XSL;
    } catch (AlreadyExistsException e) {
      return ResponseState.ALREADY_EXISTS;
    } catch (Exception e) {
      e.printStackTrace();
      throw new ServerSideException(Util.stackTraceToString(e));
    }
  }
  protected static ResponseState saveTransformationMDR(
      TransformationUI transformationUI, String oldTransId) throws ServerSideException {
    try {
      String xslFilePath =
          FilenameUtils.removeExtension(transformationUI.getXslFilePath().toLowerCase()) + XSL_END;
      // System.out.println("SERVER - XSL path: " + xslFilePath);

      MetadataTransformation mtdTransformation =
          new MetadataTransformation(
              transformationUI.getIdentifier(),
              transformationUI.getDescription(),
              transformationUI.getSrcFormat(),
              transformationUI.getDestFormat(),
              xslFilePath,
              transformationUI.isEditable(),
              transformationUI.getIsXslVersion2(),
              transformationUI.getDestSchema(),
              transformationUI.getDestMetadataNamespace());
      mtdTransformation.setSourceSchema(transformationUI.getSourceSchema());
      mtdTransformation.setMDRCompliant(transformationUI.isMDRCompliant());

      ConfigSingleton.getRepoxContextUtil()
          .getRepoxManager()
          .getMetadataTransformationManager()
          .saveMetadataTransformation(mtdTransformation, oldTransId);
      // System.out.println("SERVER - Transformation saved on the MDR");
      return ResponseState.SUCCESS;
    } catch (SameStylesheetTransformationException e) {
      return ResponseState.MAPPING_SAME_XSL;
    } catch (AlreadyExistsException e) {
      return ResponseState.ALREADY_EXISTS;
    } catch (Exception e) {
      e.printStackTrace();
      throw new ServerSideException(Util.stackTraceToString(e));
    }
  }