Package it.eng.spagobi.tools.importexport.dao

Examples of it.eng.spagobi.tools.importexport.dao.IAssociationFileDAO


  }

  private void checkIfExistsHandler(SourceBean sbrequest) {
    logger.debug("IN");
    String id = (String) sbrequest.getAttribute("ID");
    IAssociationFileDAO assfiledao = new AssociationFileDAO();
    String htmlResp = Boolean.toString(assfiledao.exists(id));
    try {
      httpResponse.getOutputStream().write(htmlResp.getBytes());
      httpResponse.getOutputStream().flush()
    } catch (Exception e){
      logger.error("Error while sending response to the client, " + e);
View Full Code Here


  private void downloadAssHandler(SourceBean sbrequest) {
    logger.debug("IN");
    try {
      String idass = (String) sbrequest.getAttribute("ID");
      IAssociationFileDAO assfiledao = new AssociationFileDAO();
      AssociationFile assFile = assfiledao.loadFromID(idass);
      byte[] content = assfiledao.getContent(assFile);
      httpResponse.setHeader("Content-Disposition", "attachment; filename=\"associations.xml \";");
      httpResponse.setContentLength(content.length);
      httpResponse.getOutputStream().write(content);
      httpResponse.getOutputStream().flush();
    } catch (Exception e) {
View Full Code Here

      AssociationFile assFile = new AssociationFile();
      assFile.setDescription(description);
      assFile.setName(name);
      assFile.setDateCreation(new Date().getTime());
      assFile.setId(name);
      IAssociationFileDAO assfiledao = new AssociationFileDAO();
      if (assfiledao.exists(assFile.getId())) {
        if (overwrite) {
          assfiledao.deleteAssociationFile(assFile);
          assfiledao.saveAssociationFile(assFile, content);
        } else {
          logger.warn("Overwrite parameter is false: association file with id=[" + assFile.getId() + "] " +
              "and name=[" + assFile.getName() + "] will not be saved.");
        }
      } else {
        assfiledao.saveAssociationFile(assFile, content);
      }
      List assFiles = assfiledao.getAssociationFiles();
      String html = generateHtmlJsCss();
      html += "<br/>";
      html += generateHtmlForInsertNewForm();
      html += "<br/>";
      html += generateHtmlForList(assFiles, modality);
View Full Code Here

  private void deleteAssHandler(SourceBean sbrequest) {
    logger.debug("IN");
    try {
      String modality = "MANAGE";
      String idass = (String) sbrequest.getAttribute("ID");
      IAssociationFileDAO assfiledao = new AssociationFileDAO();
      AssociationFile assFile = assfiledao.loadFromID(idass);
      assfiledao.deleteAssociationFile(assFile);
      List assFiles = assfiledao.getAssociationFiles();
      String html = generateHtmlJsCss();
      html += "<br/>";
      html += generateHtmlForInsertNewForm();
      html += "<br/>";
      html += generateHtmlForList(assFiles, modality);
View Full Code Here

  private void getAssListHandler(SourceBean sbrequest) {
    logger.debug("IN");
    try {
      String modality = (String) sbrequest.getAttribute("MODALITY");
      IAssociationFileDAO assfiledao = new AssociationFileDAO();
      List assFiles = assfiledao.getAssociationFiles();
      String html = generateHtmlJsCss();
      if (modality.equals("MANAGE")) {
        html += "<br/>";
        html += generateHtmlForInsertNewForm();
      }
View Full Code Here

      String pathExportFolder = ImportUtilities.getImportTempFolderPath();
      File file = new File(pathExportFolder + "/" + folderName + "/" + associationFileName + ".xml");
      FileInputStream fis = new FileInputStream(file);
      byte[] fileAssContent = GeneralUtilities.getByteArrayFromInputStream(fis);
      fis.close();
      IAssociationFileDAO assfiledao = new AssociationFileDAO();
      if (assfiledao.exists(assFile.getId())) {
        if (overwrite) {
          assfiledao.deleteAssociationFile(assFile);
          assfiledao.saveAssociationFile(assFile, fileAssContent);
        } else {
          logger.warn("Overwrite parameter is false: association file with id=[" + assFile.getId() + "] " +
              "and name=[" + assFile.getName() + "] will not be saved.");
        }
      } else {
        assfiledao.saveAssociationFile(assFile, fileAssContent);
      }
      htmlResp = msgBuild.getMessage("Sbi.saved.ok", "component_impexp_messages", locale);
    } catch (Exception e) {
      logger.error("Error wile saving the association file, ", e);
      htmlResp = msgBuild.getMessage("Sbi.saved.ko", "component_impexp_messages", locale);
View Full Code Here

      // association id
      // rebuild the uploaded file and assign it to associationsFile variable
      if (associationsFile == null) {
          String assId = (String) request.getAttribute("hidAssId");
          if ((assId != null) && !assId.trim().equals("")) {
        IAssociationFileDAO assfiledao = new AssociationFileDAO();
        assFile = assfiledao.loadFromID(assId);
        byte[] content = assfiledao.getContent(assFile);
        UploadedFile uplFile = new UploadedFile();
        uplFile.setSizeInBytes(content.length);
        uplFile.setFileContent(content);
        uplFile.setFileName("association.xml");
        uplFile.setFieldNameInForm("");
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.importexport.dao.IAssociationFileDAO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.