Package com.iqbon.jcms.domain

Examples of com.iqbon.jcms.domain.Model


      logger.info(ToStringBuilder.reflectionToString(model));
    }
  }

  public void testQueryModelByModelName() {
    Model model = modelDAO.queryModelByModelName("afawrwrwwerw");
    logger.info(ToStringBuilder.reflectionToString(model));
  }
View Full Code Here


 
  Model model;

  protected void setUp() throws Exception {
    modelService = (ModelService) BeanFactory.getBean("modelService");
    model = new Model();
    model.setUrl("http://localhost:8080/m/2012/8/8afwerwr.html");
    model.setContent("hello world");
    super.setUp();
  }
View Full Code Here

      String refresh = jobDetail.getJobDataMap().getString(Quartz.JOB_FRESH_MINUTE);
      List<String> modelIdList = modelService.getNeedPublishModelByRefresh(refresh);
      for (String modelName : modelIdList) {
        try {
          logger.info("刷新模板" + modelName);
          Model model = modelService.getModelInfoByModelName(modelName);
          modelService.publishModelContent(model);
        } catch (IOException e) {
          logger.error(modelName + "模板刷新失败", e);
          logEnd(start, jobName);
          quartzService.setQuartzStatus(jobName, Quartz.runningStatus.stop.ordinal());
View Full Code Here

   * 根据模板名获取模板信息
   * @param modelName
   * @return
   */
  public Model getModelInfoByModelName(String modelName) throws NotFoundException {
    Model model = modelDAO.queryModelByModelName(modelName);
    if (model.getDelete() == 1) {
      throw new NotFoundException();
    }
    return model;
  }
View Full Code Here

    modelLog.setUserName(userName);
    int logNumber = modelLogDAO.insertModelLog(modelLog);
    if (logNumber <= 0) {
      logger.error("插入模板日志失败");
    }
    Model model = modelDAO.queryModelByModelName(modelName);
    int delNum = modelDAO.deleteModel(modelName);
    if (delNum > 0) {
      model.setTimeout(DateFormatUtils.ISO_DATETIME_FORMAT.format(new Date()));
      modelDAO.updateModelRefresh(model);
    }
    return delNum;
  }
View Full Code Here

    mav.addObject("pageNum", pageNum);
    mav.addObject("model", null);
    mav.addObject("modelType", modelType);
    if (StringUtils.isNotEmpty(modelName)) {
      try {
      Model model = modelService.getModelInfoByModelName(modelName);
      List<ModelLog> modelLogList = modelService.getModelLogsByModelName(modelName);
      mav.addObject("model", model);
      mav.addObject("modelLogList", modelLogList);
      } catch (NotFoundException e) {
        logger.error("修改模板失败", e);
View Full Code Here

    User user = getUserFromSession(session);
    if (user == null) {
      return getErrorUrl(UNLOGIN_ERROR_MESSAGE);
    }
    String url = JCMSConstant.createModelUrl(modelName, suffix);
    Model model = new Model();
    model.setModelName(modelName);
    model.setTitle(title);
    model.setExtname(suffix);
    model.setKeyword(keyword);
    model.setContent(content);
    model.setStatus(status);
    model.setTopicid(topicid);
    model.setRate(refresh);
    model.setType(modelType);
    Date now = new Date();
    Date timeoutDate = DateUtils.addDays(now, timeout);
    model.setTimeout(DateFormatUtils.ISO_DATETIME_FORMAT.format(timeoutDate));
    model.setAddTime(JCMSConstant.getDateString(now));
    model.setLastModify(JCMSConstant.getDateString(now));
    model.setModifyUser(user.getUserName());
    model.setUrl(url);
    int insertModel =modelService.addModel(model);
    int insertPushRecord =pushRecordService.addBlankDoc(title, null, url, topicid, 60, user.getUserName(), null);
    if(insertModel<=0){
      logger.error("插入模板失败:" + ToStringBuilder.reflectionToString(model));
      return getErrorUrl("插入模板失败");
    }
    if(insertPushRecord<=0){
      logger.error("插入空文章失败");
      return getErrorUrl("插入空文章失败");
    }
    if (status == Model.modelStatus.publish.ordinal()) {//发布模板
      try {
        modelService.publishModelContent(model);
      } catch (IOException e) {
        logger.error("输出模板页面出错,modelName=" + model.getModelName(), e);
        return getErrorUrl("插入空文章失败");
      }
      return redirect("/admin/topic/topicPage.do?topicid=" + topicid + "&pageNum=" + pageNum
          + "&type=" + type);
View Full Code Here

    User user = getUserFromSession(session);
    if (user == null) {
      return getErrorUrl(UNLOGIN_ERROR_MESSAGE);
    }
    url = JCMSConstant.refreshModelUrl(url, suffix);
    Model model = new Model();
    model.setModelName(modelName);
    model.setTitle(title);
    model.setExtname(suffix);
    model.setKeyword(keyword);
    model.setContent(content);
    model.setStatus(status);
    model.setTopicid(topicid);
    model.setRate(refresh);
    model.setType(modelType);
    model.setUrl(url);
    Date now = new Date();
    Date timeoutDate = DateUtils.addDays(now, timeout);
    model.setTimeout(DateFormatUtils.ISO_DATETIME_FORMAT.format(timeoutDate));
    model.setLastModify(JCMSConstant.getDateString(now));
    model.setModifyUser(user.getUserName());
    int updateModel = modelService.modifyModel(model);
    if (updateModel <= 0) {
      logger.error("插入模板失败:" + ToStringBuilder.reflectionToString(model));
      return getErrorUrl("插入模板失败");
    }
    if (status == Model.modelStatus.publish.ordinal()) {
      try {
        modelService.publishModelContent(model);
      } catch (IOException e) {
        logger.error("输出模板页面出错,modelName=" + model.getModelName(), e);
        return getErrorUrl("输出模板页面出错");
      }
      return redirect("/admin/topic/topicPage.do?topicid=" + topicid + "&pageNum=" + pageNum
          + "&type=" + type);
View Full Code Here

        pushRecord = pushList.get(0);
      }
    }

    String modelName = doc.getModelName();
    Model model = modelService.getModelInfoByModelName(modelName);
    if (model == null) {
      logger.error("文章模板" + modelName + "不存在");
      return null;
    }
    String docContent = velocityService.parseDoc(model.getContent(), doc, pushRecord);
    String encoding = jcmsProperties.getOutFileCoding();
    File file = JCMSConstant.createDocOutputFile(doc.getUrl());
    if (file == null) {
      throw new IOException("获取模板uri出错");
    }
View Full Code Here

    try {
    if (pushRecord.getType() == PushRecord.PUSH_RECORD_TYPE.doc.ordinal()) {
        docService.publishDoc(pushRecord.getDocid(), String.valueOf(indexid));
        result.put(APIConstant.K_RESULT, APIConstant.V_SUCCESS);
      } else if (pushRecord.getType() == PushRecord.PUSH_RECORD_TYPE.model.ordinal()) {
        Model model = modelService.getModelInfoByModelName(pushRecord.getModelName());
        modelService.publishModelContent(model);
        result.put(APIConstant.K_RESULT, APIConstant.V_SUCCESS);
      } else {
        result.put(APIConstant.K_RESULT, APIConstant.V_FAIL);
        result.put(APIConstant.K_MESSAGE, "该类型推送记录无法刷新");
View Full Code Here

TOP

Related Classes of com.iqbon.jcms.domain.Model

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.