Package it.eng.spagobi.tools.importexport.bo

Examples of it.eng.spagobi.tools.importexport.bo.AssociationFile


    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();
View Full Code Here


    boolean alternate = false;
    Iterator iterAssFile = assFiles.iterator();
    while(iterAssFile.hasNext()) {
      rowClass = (alternate) ? "portlet-section-alternate" : "portlet-section-body";
      alternate = !alternate;
      AssociationFile assFile = (AssociationFile)iterAssFile.next();
      html += "<tr>";
      html += "<td class='"+rowClass+"'>"+assFile.getName()+"</td>";
      html += "<td class='"+rowClass+"'>"+assFile.getDescription()+"</td>";
      Date dat = new Date(assFile.getDateCreation());
      Calendar cal = new GregorianCalendar();
      cal.setTime(dat);
      String datSt = "" +  cal.get(Calendar.DAY_OF_MONTH) + "/" +
      (cal.get(Calendar.MONTH) + 1) + "/" +
      cal.get(Calendar.YEAR) "   " +
      cal.get(Calendar.HOUR_OF_DAY) + ":" +
      (cal.get(Calendar.MINUTE) < 10 ? "0" : "") +
      cal.get(Calendar.MINUTE);
      html += "<td class='"+rowClass+"'>"+datSt+"</td>";
      if(modality.equals("MANAGE")) {
        String eraseUrl = httpRequest.getContextPath(); ;
        eraseUrl += "/servlet/AdapterHTTP?ACTION_NAME=MANAGE_IMPEXP_ASS_ACTION"
        eraseUrl += "&MESSAGE=DELETE_ASSOCIATION_FILE&ID="+assFile.getId()
        String downloadUrl = httpRequest.getContextPath(); ;
        downloadUrl += "/servlet/AdapterHTTP?ACTION_NAME=MANAGE_IMPEXP_ASS_ACTION"
        downloadUrl += "&MESSAGE=DOWNLOAD_ASSOCIATION_FILE&ID="+assFile.getId()
        html += "<td class='"+rowClass+"'>\n";
        html += "<a class='link_without_dec' href='"+eraseUrl+"' style='text-decoration:none;'>\n";   
        html += "<img src='"+urlBuilder.getResourceLinkByTheme(httpRequest, "/img/erase.gif",currTheme)+"' \n" +
        "title='"+msgBuild.getMessage("impexp.erase", "component_impexp_messages", locale)+"' \n" +
        "alt='"+msgBuild.getMessage("impexp.erase", "component_impexp_messages", locale)+"' />\n";
        html += "</a>\n";   
        html += "&nbsp;&nbsp;\n";
        html += "<a class='link_without_dec' href='"+downloadUrl+"' style='text-decoration:none;'>\n";
        html += "<img src='"+urlBuilder.getResourceLinkByTheme(httpRequest, "/img/down16.gif",currTheme)+"' \n" +
        "title='"+msgBuild.getMessage("Sbi.download", "component_impexp_messages", locale)+"' \n" +
        "alt='"+msgBuild.getMessage("Sbi.download", "component_impexp_messages", locale)+"' />\n";
        html += "</a>\n";   
        html += "</td>";
      } else if(modality.equals("SELECT") ) {
        html += "<td class='"+rowClass+"'>\n";
        html += "<a class='link_without_dec' href=\"javascript:parent.selectAssFile('"+assFile.getId()+"', '"+assFile.getName()+"')\">\n";
        html += "<img src='"+urlBuilder.getResourceLinkByTheme(httpRequest, "/img/button_ok.gif",currTheme)+"' \n" +
        "title='"+msgBuild.getMessage("impexp.select", "component_impexp_messages", locale)+"' \n" +
        "alt='"+msgBuild.getMessage("mpexp.select", "component_impexp_messages", locale)+"' />\n";
        html += "</a>\n";
      }
View Full Code Here

      String folderName = httpRequest.getParameter("FOLDER_NAME");
      String name = httpRequest.getParameter("NAME");
      String description = httpRequest.getParameter("DESCRIPTION");
      String overwriteStr = httpRequest.getParameter("OVERWRITE");
      boolean overwrite = (overwriteStr == null || overwriteStr.trim().equals("")) ? false : Boolean.parseBoolean(overwriteStr);
      AssociationFile assFile = new AssociationFile();
      assFile.setDescription(description);
      assFile.setName(name);
      assFile.setDateCreation(new Date().getTime());
      assFile.setId(name);
      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);
View Full Code Here

//  UploadedFile archive = null;
//  UploadedFile associationsFile = null;
  FileItem archive = null;
  FileItem associationsFileItem = null;
  UploadedFile associationsFile = null;
  AssociationFile assFile = null;
  try {
    String assKindFromReq = (String) request.getAttribute("importAssociationKind");
    boolean isNoAssociationModality = assKindFromReq != null && assKindFromReq.equalsIgnoreCase("noassociations");
    List uplFiles = request.getAttributeAsList("UPLOADED_FILE");
    Iterator uplFilesIter = uplFiles.iterator();
View Full Code Here

      impManager = (IImportManager) session.getAttribute(ImportExportConstants.IMPORT_MANAGER);
      impManager.openSession();
      impManager.importObjects(overwrite, session);
      ImportResultInfo iri = impManager.commitAllChanges();
      response.setAttribute(ImportExportConstants.IMPORT_RESULT_INFO, iri);
    AssociationFile assFile = impManager.getAssociationFile();
    if (assFile != null) response.setAttribute(ImportExportConstants.IMPORT_ASSOCIATION_FILE, assFile);
  } catch (EMFUserError emfue) {
      if (impManager != null)
    impManager.stopImport();
      throw emfue;
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();
View Full Code Here

          return;
        }
      }
      String overwriteStr = (String)sbrequest.getAttribute("OVERWRITE");
      boolean overwrite = (overwriteStr == null || overwriteStr.trim().equals("")) ? false : Boolean.parseBoolean(overwriteStr);
      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();
View Full Code Here

    /* (non-Javadoc)
     * @see it.eng.spagobi.tools.importexport.dao.IAssociationFileDAO#loadFromID(java.lang.String)
     */
    public AssociationFile loadFromID(String id) {
  logger.debug("IN");
  AssociationFile assFile = null;
  try {
      File fileAssRepDir = getFileOfAssRepDir();
      String pathBaseDirAss = fileAssRepDir.getPath() + "/" + id;
      String pathprop = pathBaseDirAss + "/association.properties";
      FileInputStream fis = new FileInputStream(pathprop);
      Properties props = new Properties();
      props.load(fis);
      fis.close();
      assFile = new AssociationFile();
      assFile.setName(props.getProperty("name"));
      assFile.setDescription(props.getProperty("description"));
      assFile.setId(props.getProperty("id"));
      assFile.setDateCreation(new Long(props.getProperty("creationDate")).longValue());
  } catch (Exception e) {
      logger.error("Error while loading association file with id " + id + ", ", e);
      assFile = null;
  } finally {
      logger.debug("OUT");
View Full Code Here

      String pathprop = assBaseDir.getPath() + "/association.properties";
      FileInputStream fis = new FileInputStream(pathprop);
      Properties props = new Properties();
      props.load(fis);
      fis.close();
      AssociationFile assFile = new AssociationFile();
      assFile.setName(props.getProperty("name"));
      assFile.setDescription(props.getProperty("description"));
      assFile.setId(props.getProperty("id"));
      assFile.setDateCreation(new Long(props.getProperty("creationDate")).longValue());
      assFiles.add(assFile);
        }
    } catch (Exception e) {
        logger.error("Error while recovering info of the ass file with" + "id " + assBaseDir.getName()
          + "\n , ", e);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.importexport.bo.AssociationFile

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.