コード例 #1
0
  // 保存工作组
  public String saveGroupRule() {
    String name = getParaValue("name");
    String desciption = getParaValue("description");
    String[] id = getParaArrayValue("checkbox");
    String ids = "";
    if (ids != null) {
      for (int i = 0; i < id.length; i++) {
        ids = ids + id[i] + ",";
      }
    }
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    User user = (User) session.getAttribute(SessionConstant.CURRENT_USER);
    CompGroupRule vo = new CompGroupRule();
    vo.setName(name);

    vo.setDescription(desciption);
    vo.setRuleId(ids);
    vo.setCreatedBy(user.getName());
    vo.setCreatedTime(sdf.format(date));
    vo.setLastModifiedBy(user.getName());
    vo.setLastModifiedTime(sdf.format(date));
    CompGroupRuleDao dao = new CompGroupRuleDao();
    dao.save(vo);
    return null;
  }
コード例 #2
0
  // 保存策略
  public String saveStrategy() {
    String name = getParaValue("name");
    String description = getParaValue("description");
    int type = getParaIntValue("type");
    int violateType = getParaIntValue("violateType");
    String[] temp = getParaArrayValue("checkbox");
    StringBuffer ids = new StringBuffer();
    if (temp != null) {
      for (int i = 0; i < temp.length; i++) {
        ids.append(temp[i] + ",");
      }
    }

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    User user = (User) session.getAttribute(SessionConstant.CURRENT_USER);
    CompStrategy vo = new CompStrategy();
    vo.setName(name);
    vo.setDescription(description);
    vo.setType(type);
    vo.setViolateType(violateType);
    vo.setGroupId(ids.toString());
    vo.setCreateBy(user.getName());
    vo.setCreateTime(sdf.format(date));
    vo.setLastModifiedBy(user.getName());
    vo.setLastModifiedTime(sdf.format(date));
    CompStrategyDao dao = new CompStrategyDao();
    dao.save(vo);

    return null;
  }
コード例 #3
0
  // 修改工作组
  public String updateGroupRule() {
    int id = getParaIntValue("id");
    String name = getParaValue("name");
    String desciption = getParaValue("description");
    String[] temp = getParaArrayValue("checkbox");

    StringBuffer ids = new StringBuffer();
    if (temp != null) {
      for (int i = 0; i < temp.length; i++) {
        ids.append(temp[i] + ",");
      }
    }
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    User user = (User) session.getAttribute(SessionConstant.CURRENT_USER);
    CompGroupRule vo = new CompGroupRule();
    vo.setId(id);
    vo.setName(name);

    vo.setDescription(desciption);
    vo.setRuleId(ids.toString());
    vo.setLastModifiedBy(user.getName());
    vo.setLastModifiedTime(sdf.format(date));
    CompGroupRuleDao dao = new CompGroupRuleDao();
    dao.update(vo);
    return null;
  }
コード例 #4
0
  public CompRule loadRule() {

    String rule_name = getParaValue("rule_name");
    String des = getParaValue("des");
    int standard = getParaIntValue(("standard"));
    int level = getParaIntValue("level");
    String add_des = getParaValue("add_des");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date date = new Date();
    User user = (User) session.getAttribute(SessionConstant.CURRENT_USER);
    CompRule rule = new CompRule();
    rule.setComprule_name(rule_name);
    rule.setDescription(des);
    rule.setSelect_type(standard);
    rule.setCreate_time(sdf.format(date));
    rule.setLast_modified_time(sdf.format(date));
    rule.setCreated_by(user.getName());
    rule.setLast_modified_by(user.getName()); // 在修改时不变
    rule.setViolation_severity(level);
    rule.setRemediation_descr(add_des);
    return rule;
  }