@Override
  public void createThemeFolder(String projectPath, String projectModuleName, String themeId) {
    String runtimeDir =
        RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName;
    String filePath =
        getPortalSpecPath(projectPath, projectModuleName) + "/ftl/portaldefine/skin/" + themeId;
    File file = new File(filePath);
    file.mkdir();

    File layoutFile = new File(filePath + "/layout");
    layoutFile.mkdir();

    File pageFile = new File(filePath + "/page");
    pageFile.mkdir();

    File portletFile = new File(filePath + "/portlet");
    portletFile.mkdir();

    /* 同步到portalhome下 */
    File runtimePath = new File(runtimeDir + "/portalspec");
    if (runtimePath.exists()) {
      String themePath = runtimeDir + "/portalspec/ftl/portaldefine/skin/" + themeId;
      file = new File(themePath);
      file.mkdir();

      layoutFile = new File(themePath + "/layout");
      layoutFile.mkdir();

      pageFile = new File(themePath + "/page");
      pageFile.mkdir();

      portletFile = new File(themePath + "/portlet");
      portletFile.mkdir();
    }
  }
 @Override
 public void deployPortal(String projectModuleName) {
   String runtimeDir =
       RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName;
   PortalDeployDefinition define = parseModule(runtimeDir);
   new PtModuleDepoly().deploy(define);
 }
  @Override
  public PortalDeployDefinition[] getPortalModules() {
    List<PortalDeployDefinition> moduleList = new ArrayList<PortalDeployDefinition>();
    String dir = RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR;
    File f = new File(dir);
    File[] fs = f.listFiles();
    for (int i = 0; i < fs.length; i++) {
      File mDir = fs[i];
      if (mDir.isDirectory()) {
        File specDir = new File(mDir.getAbsolutePath() + "/portalspec");
        if (specDir.exists() && specDir.isDirectory()) {
          File specFile = new File(specDir.getAbsolutePath() + "/portal.xml");
          if (specFile.exists() && specFile.isFile()) {
            PortalDeployDefinition definition = parseModule(mDir.getAbsolutePath());
            if (definition != null) moduleList.add(definition);
          }
        }
      }
    }

    try {
      return PortalModuleUtil.sortDefinition(moduleList);
    } catch (PortalServiceException e) {
      LfwLogger.info("Error:" + e.getMessage());
      return new PortalDeployDefinition[0];
    }
  }
 @Override
 public void deployPtPlugin(String projectModuleName) {
   String runtimeDir =
       RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName;
   PortalDeployDefinition define = parseModule(runtimeDir);
   new PtPluginDeploy().deploy(define);
   PluginManager.newIns().refresh();
 }
 @Override
 public void deployPortletApp(String projectModuleName) {
   String runtimeDir =
       RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName;
   PortalDeployDefinition define = parseModule(runtimeDir);
   new PtPortletDeploy().deploy(define);
   PortalCacheManager.notify(CacheKeys.PORTLETS_CACHE, CacheKeys.USER_DIY_PORTLETS_CACHE);
   PortalCacheManager.notify(CacheKeys.PORTLETS_CACHE, CacheKeys.GROUP_PORTLETS_CACHE);
   PortalCacheManager.notify(CacheKeys.PORTLETS_CACHE, CacheKeys.SYSTEM_PORTLETS_CACHE);
 }
  @Override
  public List<Display> getAllDisplays(String projectPath, String projectModuleName) {

    String runtimeDir = RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR;

    List<Display> displays = new ArrayList<Display>();
    InputStream is = null;
    // 取项目自身displays
    String displayFile = getPortalSpecPath(projectPath, projectModuleName) + "/display.xml";
    try {
      is = new FileInputStream(displayFile);
      BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
      StringBuffer buffer = new StringBuffer();
      String line = "";
      while ((line = in.readLine()) != null) {
        buffer.append(line);
      }
      String xml = buffer.toString();
      Display display = JaxbMarshalFactory.newIns().encodeXML(Display.class, xml);
      displays.add(display);
    } catch (IOException e) {
      LfwLogger.error(e.getMessage(), e);
    }

    // 获得所有依赖的module
    List<String> modules = new ArrayList<String>();
    PortalModule portalModule = getPortal(projectPath, projectModuleName);
    getDependModules(modules, portalModule, projectModuleName, projectPath, runtimeDir);
    for (String module : modules) {
      String file = runtimeDir + "/" + module + "/portalspec/display.xml";
      try {
        is = new FileInputStream(file);
        BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8"));
        StringBuffer buffer = new StringBuffer();
        String line = "";
        while ((line = in.readLine()) != null) {
          buffer.append(line);
        }
        String xml = buffer.toString();
        Display display = JaxbMarshalFactory.newIns().encodeXML(Display.class, xml);
        displays.add(display);
      } catch (IOException e) {
        LfwLogger.error(e.getMessage(), e);
      }
    }
    return displays;
  }
  @Override
  public void deployPage(String projectModuleName, String pageName) {
    String runtimeDir =
        RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName;
    try {
      /*从数据库中删除page,重新部署*/
      IPtPortalPageService prs = NCLocator.getInstance().lookup(IPtPortalPageService.class);
      //	    	PortalServiceUtil.getPageService();
      prs.delete(projectModuleName, pageName);

      PortalDeployDefinition define = parseModule(runtimeDir);
      new PtPageDeploy().deploy(define);

      PortalCacheManager.clearCache(CacheKeys.PORTTAL_PAGES_CACHE, CacheKeys.GROUP_PAGES_CACHE);
    } catch (Exception e) {
      LfwLogger.error(e.getMessage(), e);
    }
  }
  @Override
  public List<Skin> getAllSkins(String projectPath, String projectModuleName, String type) {
    List<Skin> skins = new ArrayList<Skin>();
    String runtimeDir = RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR;

    // 获得所有依赖的module
    List<String> modules = new ArrayList<String>();
    modules.add(projectModuleName);
    PortalModule portalModule = getPortal(projectPath, projectModuleName);
    getDependModules(modules, portalModule, projectModuleName, projectPath, runtimeDir);

    for (String module : modules) {
      String skinDirs = runtimeDir + "/" + module + "/portalspec/ftl/portaldefine/skin/";
      File f = new File(skinDirs);
      if (f.exists() && f.isDirectory()) {
        addSkins(skins, f, module, type);
      }
    }
    return skins;
  }
  @Override
  public void saveLookAndFeelToXml(
      String projectPath, String projectModuleName, LookAndFeel lookAndFeel) {
    String runtimeDir =
        RuntimeEnv.getInstance().getNCHome() + PortalEnv.PORTAL_HOME_DIR + "/" + projectModuleName;
    String filePath = projectPath + "/web/WEB-INF/conf";
    File f = new File(filePath);
    if (!f.exists()) f.mkdirs();
    File file = new File(filePath + "/look-and-feel.xml");
    String d = JaxbMarshalFactory.newIns().decodeXML(lookAndFeel);
    try {
      if (!file.exists()) file.createNewFile();
      FileUtils.writeStringToFile(file, d, "UTF-8");

      /* 重新部署*/
      File runtimePath = new File(runtimeDir + "/portalspec");
      if (runtimePath.exists()) {
        deployLookAndFeel();
      }
    } catch (Exception e) {
      LfwLogger.error(e.getMessage(), e);
      throw new LfwRuntimeException(e);
    }
  }
Esempio n. 10
0
  // 季凌峰 2012/12/25 附件解密
  public String loupadate(
      String opensource, String pk_xy_proj_main, String pk_xy_pub_step, String price_type) {
    String keyValue = null;
    // 附件解密方法
    Properties props = new Properties();
    // 文件存放的路径。评标会解密的附件压缩
    String ebsfile = "";
    BaseDAO dao = new BaseDAO();
    InputStream is = null;
    try {
      // 读取应用下的配置文件
      String path =
          RuntimeEnv.getInstance().getNCHome()
              + File.separatorChar
              + "hotwebs"
              + File.separatorChar
              + "ebscg"
              + File.separatorChar
              + "WEB-INF"
              + File.separatorChar
              + "conf"
              + File.separatorChar
              + "system.properties";
      is = new FileInputStream(path);
      props.load(is);
      keyValue = props.getProperty(EbsOperaitonConst.CHECK_KEY);
    } catch (Exception e) {
      Logger.error("读取系统配置错误!", e);
      try {
        if (is != null) is.close();
      } catch (Exception et) {
        Logger.error("读取系统配置错误!", et);
      }
    } finally {
      try {
        if (is != null) is.close();
      } catch (IOException e) {
        Logger.error("读取系统配置错误!", e);
      }
    }

    // 如果为1的时候则对文件解密
    if (keyValue != null) {

      // 因为没有从js获取,没有打开界面调用数据,所以参数需要自己定义和获取。
      String openvalue = "2";

      // 模块类型  model_type    7门户上传附件
      String modelType = "7";
      // 来源单据类型  bill_type  //发标应答  E059   发布应答     E05A
      String billType = "E059"; // 发标应答  E059
      if (opensource != null && opensource.equals("0")) {
        billType = "E05A"; // 发布应答     E05A				
      }
      // 所属单据ID bill_id   采购方案主键
      String billId = pk_xy_proj_main;
      // 所属单据明细ID itemid  供应商确定主键
      try {

        String sql =
            "select * from ebs_xy_proj_item_sup_cfm  where pk_xy_proj_main = '"
                + pk_xy_proj_main
                + "' and isnull(dr,0) = 0 ";
        List<ProjItemSupCfmVO> sp =
            (List<ProjItemSupCfmVO>)
                dao.executeQuery(sql, new BeanListProcessor(ProjItemSupCfmVO.class));
        if (sp != null && sp.size() > 0) {
          for (ProjItemSupCfmVO sup : sp) {
            // 获取每次供应商的附件
            // 修改下面的方法,主要是为了取得对应的附件类型。

            String sqls =
                "select * from ebs_da_att where model_type='"
                    + modelType
                    + "' and bill_type= '"
                    + billType
                    + "' and bill_id='"
                    + billId
                    + "' and itemid='"
                    + sup.getPk_xy_proj_item_sup_cfm()
                    + "' and zdy3='"
                    + pk_xy_pub_step
                    + "' and price_type in ("
                    + price_type
                    + ") and ISNULL(dr,0) = 0      ";

            List<AttVO> list =
                (List<AttVO>) dao.executeQuery(sqls, new BeanListProcessor(AttVO.class));
            // List<AttVO> list = getOpenQueryService().getCaFileByPara(modelType, billType, billId,
            // sup.getPk_xy_proj_item_sup_cfm());
            EbscgFileUploadHandler fileHandler =
                (EbscgFileUploadHandler)
                    LfwClassUtil.newInstance(EbscgFileUploadHandler.class.getName());
            if (list != null && list.size() > 0) {
              SignVO signvo = null;
              byte[] baOutPlaintext = null;
              for (AttVO attvo : list) {
                if (attvo != null && attvo.getAfter_ca() != null && attvo.getAfter_ca() == 1) {
                  continue;
                }
                try {
                  // 采用数据库读取文件数据
                  DataFileFactory dff = DataFileFactory.getInstance();
                  IDataBaseFileOper ibfo = dff.getFileDealServer();
                  byte[] content = null;
                  content = ibfo.obtainFileMess(attvo.getPk_da_att(), "ca_content");

                  EncrypteDecrypte3DES des = new EncrypteDecrypte3DES();
                  BASE64Decoder base64 = new BASE64Decoder();
                  des.setKey(base64.decodeBuffer(keyValue));
                  des.setIv(base64.decodeBuffer("zz7cZtYpVR4="));

                  baOutPlaintext = des.decrypt(base64.decodeBuffer(new String(content).trim()));
                  ibfo.updateFileMess(attvo.getPk_da_att(), baOutPlaintext, "content");

                  attvo.setAfter_ca(1);
                  // 设置文档解密状态
                  dao.updateVO(attvo, new String[] {"after_ca"});
                } catch (Exception ex) {
                  // TODO Auto-generated catch block
                  logger.error(ex.getMessage(), ex);
                  return "文件解密失败";
                  /*throw new LfwRuntimeException("文件解密失败");*/
                }
              }
            }
          }
        }
      } catch (Exception e) {
        logger.error(e.getMessage(), e);
        return "文件解密失败";
        /*throw new LfwRuntimeException("文件解密失败");*/
      }
    }
    return "ok";
  }