/**
   * @param documentId
   * @param result
   * @return
   */
  @RequestMapping(method = {RequestMethod.GET, RequestMethod.POST})
  public ModelAndView processSubmit(
      @ModelAttribute("command") ShowSameFolioDocumentsCommand command,
      BindingResult result,
      HttpSession session) {
    Map<String, Object> model = new HashMap<String, Object>(0);

    List<String> outputFields = new ArrayList<String>(6);
    outputFields.add("Sender");
    outputFields.add("Recipient");
    outputFields.add("Date");
    outputFields.add("Sender Location");
    outputFields.add("Recipient Location");
    outputFields.add("Volume / Insert / Folio");

    model.put("outputFields", outputFields);
    model.put("volNum", command.getVolNum());
    model.put("volLetExt", ObjectUtils.toString(command.getVolLetExt()));
    model.put("insertNum", ObjectUtils.toString(command.getInsertNum()));
    model.put("insertLet", ObjectUtils.toString(command.getInsertLet()));
    model.put("folioNum", command.getFolioNum());
    model.put("folioMod", ObjectUtils.toString(command.getFolioMod()));
    model.put("folioRectoVerso", ObjectUtils.toString(command.getFolioRectoVerso()));

    return new ModelAndView("docbase/ShowSameFolioDocuments", model);
  }
  private void addRoutes(Object handler) {
    Class clazz = handler.getClass();
    for (Method method : clazz.getMethods()) {
      int modifier = method.getModifiers();
      if (!(Modifier.isPublic(modifier))) continue;

      Class<?>[] paramTypes = method.getParameterTypes();
      if (paramTypes.length != 2
          || !paramTypes[0].equals(Request.class)
          || !paramTypes[1].equals(Response.class)) continue;

      Before beforeAnn = method.getAnnotation(Before.class);
      After afterAnn = method.getAnnotation(After.class);
      Route routeAnn = method.getAnnotation(Route.class);

      if (routeAnn != null) routes.add(new MatchEntity(handler, method, routeAnn));
      else if (beforeAnn != null) before.add(new MatchEntity(handler, method, beforeAnn));
      else if (afterAnn != null) after.add(new MatchEntity(handler, method, afterAnn));
    }

    if (L.isInfoEnabled()) {
      for (MatchEntity e : routes) L.info(null, "route " + ObjectUtils.toString(e));
      for (MatchEntity e : before) L.info(null, "before " + ObjectUtils.toString(e));
      for (MatchEntity e : after) L.info(null, "after " + ObjectUtils.toString(e));
    }
  }
 @Override
 public void deserialize(JsonNode jn) {
   setType(ObjectUtils.toString(jn.path(COL_TYPE).getTextValue(), ""));
   setInfo(ObjectUtils.toString(jn.path(COL_INFO).getTextValue(), ""));
   setPrimary(jn.path(COL_PRIMARY).getValueAsBoolean(false));
   setBinding(jn.path(COL_BINDING).getValueAsBoolean(false));
   setLabel(ObjectUtils.toString(jn.path(COL_LABEL).getTextValue(), ""));
 }
Example #4
0
  // SONAR-6522
  @Test
  public void load_user_name_in_json_report() throws Exception {
    restoreProfile("one-issue-per-line.xml");
    orchestrator.getServer().provisionProject("sample", "xoo-sample");
    orchestrator
        .getServer()
        .associateProjectToQualityProfile("sample", "xoo", "one-issue-per-line");

    // First run (publish mode)
    SonarRunner runner = configureRunner("shared/xoo-sample");
    orchestrator.executeBuild(runner);

    SonarClient client = orchestrator.getServer().adminWsClient();

    Issues issues = client.issueClient().find(IssueQuery.create());
    Issue issue = issues.list().get(0);

    UserParameters creationParameters =
        UserParameters.create()
            .login("julien")
            .name("Julien H")
            .password("password")
            .passwordConfirmation("password");
    client.userClient().create(creationParameters);

    // Assign issue
    client.issueClient().assign(issue.key(), "julien");

    // Issues
    runner = configureRunnerIssues("shared/xoo-sample");
    BuildResult result = orchestrator.executeBuild(runner);

    JSONObject obj = ItUtils.getJSONReport(result);

    Map<String, String> userNameByLogin = Maps.newHashMap();
    final JSONArray users = (JSONArray) obj.get("users");
    if (users != null) {
      for (Object user : users) {
        String login = ObjectUtils.toString(((JSONObject) user).get("login"));
        String name = ObjectUtils.toString(((JSONObject) user).get("name"));
        userNameByLogin.put(login, name);
      }
    }
    assertThat(userNameByLogin.get("julien")).isEqualTo("Julien H");

    for (Object issueJson : (JSONArray) obj.get("issues")) {
      JSONObject jsonObject = (JSONObject) issueJson;
      if (issue.key().equals(jsonObject.get("key"))) {
        assertThat(jsonObject.get("assignee")).isEqualTo("julien");
        return;
      }
    }
    fail("Issue not found");
  }
Example #5
0
  private void setRelationProperty(Object instance, FieldRecord fieldRecord)
      throws NoSuchMethodException, ClassNotFoundException, NoSuchFieldException,
          IllegalAccessException, InstantiationException, CannotCompileException {
    String fieldName = fieldRecord.getName();
    String methodName = MemberUtil.getSetterName(fieldName);
    Class<?> clazz = instance.getClass().getClassLoader().loadClass(instance.getClass().getName());
    Field field = FieldUtils.getField(clazz, fieldName, true);
    Class<?> parameterType = field.getType();
    Object value = null;
    MotechDataService serviceForRelatedClass = null;
    TypeDto type = getType(fieldRecord);

    if (StringUtils.isNotEmpty(ObjectUtils.toString(fieldRecord.getValue()))) {
      if (type.equals(TypeDto.ONE_TO_MANY_RELATIONSHIP)
          || type.equals(TypeDto.MANY_TO_MANY_RELATIONSHIP)) {
        Class<?> genericType =
            (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
        serviceForRelatedClass =
            DataServiceHelper.getDataService(bundleContext, genericType.getName());
      } else if (type.equals(TypeDto.MANY_TO_ONE_RELATIONSHIP)
          || type.equals(TypeDto.ONE_TO_ONE_RELATIONSHIP)) {
        serviceForRelatedClass =
            DataServiceHelper.getDataService(bundleContext, parameterType.getName());
      }

      value = buildRelatedInstances(serviceForRelatedClass, parameterType, fieldRecord.getValue());
    }

    Method method = MethodUtils.getAccessibleMethod(instance.getClass(), methodName, parameterType);
    invokeMethod(method, instance, value, methodName, fieldName);
  }
  @SuppressWarnings("unchecked")
  private void parseParams(HttpServletRequest req) {
    try {
      Map m = req.getParameterMap();
      for (Object e0 : m.entrySet()) {
        Map.Entry<String, ?> e = (Map.Entry<String, ?>) e0;
        Object v = e.getValue();
        String vs =
            v instanceof String[]
                ? StringUtils.join((String[]) v, "")
                : ObjectUtils.toString(v, "");
        setString(e.getKey(), vs);
      }

      if (ServletFileUpload.isMultipartContent(req)) {
        ServletFileUpload upload = createFileUpload();
        List<FileItem> fileItems = upload.parseRequest(req);
        for (FileItem fileItem : fileItems) {
          if (fileItem.isFormField()) {
            setString(fileItem.getFieldName(), fileItem.getString(Charsets.DEFAULT));
          } else {
            put(fileItem.getFieldName(), fileItem);
          }
        }
      }
    } catch (Exception e) {
      throw new WebException(e);
    }
  }
Example #7
0
  public void fillComInterviewMixInfo(ComInterview comInterview) {
    if (comInterview != null && StringUtils.isBlank(comInterview.getMixInfo())) {
      Integer perId = comInterview.getPerUserId();

      try {
        Map<String, String> map = updateResumeMixInfo(perId, " com_interview ");
        if (NumberUtils.toInt(map.get("resumeId"), 0) > 0
            && map.get("userName") != null
            && StringUtils.isNotBlank(ObjectUtils.toString(map.get("userName")))) {
          comInterview.setResumeId(NumberUtils.toInt(map.get("resumeId"), 0));
          comInterview.setUserName(map.get("userName"));
          comInterview.setGender(NumberUtils.toInt(map.get("gender"), 0));
          comInterview.setAge(NumberUtils.toInt(map.get("age"), 0));
          comInterview.setDegree(NumberUtils.toInt(map.get("degree"), 0));
          comInterview.setMixInfo(map.get("mixInfo"));
          comInterview.setSchoolName(map.get("schoolName"));
          comInterview.setSpeciality(map.get("speciality"));
          comInterview.setSchoolName(map.get("schoolName"));
          comInterview.setJobyearType(NumberUtils.toInt(map.get("jobyearType"), 0));
        } else {
          getJdbcTemplateAction()
              .update(
                  "UPDATE com_blacklist SET mix_info = ? WHERE id=?", "{}", comInterview.getId());
          comInterview.setMixInfo("{}");
        }
      } catch (Exception ex) {
        // 不处理
      }
    }
  }
Example #8
0
  public static String[] getTelInfo(Collection<TelInfo> tels) {
    if (CollectionUtils.isEmpty(tels)) return new String[0];

    LinkedHashSet<String> l = new LinkedHashSet<String>();
    for (TelInfo tel : tels) {
      if (tel != null) l.add(ObjectUtils.toString(tel.getInfo()));
    }
    return l.toArray(new String[l.size()]);
  }
 /**
  * 生成邮件验证码,此验证码自带一定的时效性 对应id如果在一定时间内生成过验证码的,不重复生成第二次,而是直接返回空字符串
  *
  * @param mail
  * @param id
  * @return
  */
 public String buildMailValidationCode(String mail, Integer id) {
   String isSendKey = Constants.REDIS_KEY_PER_MAIL_VALIDATION_IS_SEND_PREFIX + id;
   if (redisEao.isKeyExist(isSendKey)) { // 验证已经生成过了,在有此key的情况下不重新生成
     return "";
   } else {
     String validCode =
         MD5Builder.md5(
             mail, ObjectUtils.toString(System.currentTimeMillis()), ObjectUtils.toString(id));
     redisEao.writeToString(
         Constants.REDIS_KEY_PER_MAIL_VALIDATION_PREFIX + validCode, ObjectUtils.toString(id, ""));
     redisEao.setKeyExpire(
         Constants.REDIS_KEY_PER_MAIL_VALIDATION_PREFIX + validCode,
         Constants.REDIS_EXPIRE_TIME_PER_MAIL_VALIDATION);
     redisEao.writeToString(isSendKey, validCode);
     redisEao.setKeyExpire(isSendKey, Constants.REDIS_EXPIRE_TIME_PER_MAIL_VALIDATION);
     return validCode;
   }
 }
 /** @see org.andromda.metafacades.uml.ModelElementFacade#getName() */
 @Override
 public String getName() {
   String name = super.getName();
   if (StringUtils.isBlank(name) && (this.getParent() != null)) {
     name = this.getParent().getName();
   }
   return ObjectUtils.toString(
           this.getConfiguredProperty(MetaGlobals.PROPERTY_GENERALIZATION_NAME_PATTERN))
       .replaceAll("\\{0\\}", name);
 }
Example #11
0
  @Override
  public PageObject queryForMPageList(String sql, Object[] args, Map req) {
    int totalCount = 1;
    int start = NumberUtils.toInt(ObjectUtils.toString(req.get("start"), "1"));
    int limit =
        NumberUtils.toInt(
            ObjectUtils.toString(req.get("limit"), GlobalConstant.Global_PAGESIZE + ""));
    int startIndex = limit * (start - 1);
    String sort = ObjectUtils.toString(req.get("sort"));
    String dir = ObjectUtils.toString(req.get("dir"));

    StringBuffer buildsql = new StringBuffer();
    buildsql.append("select * from ( ");
    if (StringUtils.isNotBlank(sort)) {
      String pa = "order by (,|\\.|\\w|\\d| )+( asc| desc)?( Nulls last)?( Nulls first)?\\s?$";
      String re = " order by " + sort + " " + dir;
      Matcher matcher = Pattern.compile(pa, Pattern.CASE_INSENSITIVE).matcher(sql);
      if (matcher.find()) {
        buildsql.append(matcher.replaceFirst(re));
      }
    } else {
      buildsql.append(sql);
    }
    buildsql.append("	) temp LIMIT " + String.valueOf(startIndex) + "," + String.valueOf(limit));

    systemLog.debugLog(
        getClass(), buildsql.toString() + " : args is " + StringUtils.join(args, ","));
    PageObject page = new PageObject();
    try {
      List list = super.getJdbcTemplate().queryForList(buildsql.toString(), args);
      String countsql = "SELECT COUNT(*) FROM (" + sql + ") TEMP";
      totalCount = super.getJdbcTemplate().queryForInt(countsql, args);
      page.setDatasource(list);
      page.setTotalCount(totalCount);
      int _absolutePage = (int) Math.ceil(totalCount * 1.0 / limit);
      page.setAbsolutePage(_absolutePage);
      int _currentPage = start / limit + 1;
      page.setCurrentPage(_currentPage);
    } catch (Exception e) {
      systemLog.errorLog(getClass(), "--", "--", "--", "--", "--", e);
    }
    return page;
  }
 /**
  * Retrieves the identifier columns component attribute.
  *
  * @return this.identifierColumns the identifier columns component attribute.
  */
 protected String getIdentifierColumns() {
   if (this.identifierColumns == null) {
     this.identifierColumns = (String) this.getAttributes().get(IDENTIFIER_COLUMNS);
     if (this.identifierColumns == null) {
       final ValueBinding binding = this.getValueBinding(IDENTIFIER_COLUMNS);
       this.identifierColumns =
           binding == null ? null : ObjectUtils.toString(binding.getValue(getFacesContext()));
     }
   }
   return this.identifierColumns;
 }
 /**
  * 生成短信验证码,此验证码自带一定的时效性 对应id如果在一定时间内生成过验证码的,不重复生成第二次,而是直接返回空字符串
  *
  * @param mobile
  * @param id
  * @return
  */
 public String buildSMSValidationCode(String mobile, Integer id) {
   String isSendKey = Constants.REDIS_KEY_PER_SMS_VALIDATION_IS_SEND_PREFIX + id;
   if (redisEao.isKeyExist(isSendKey)) { // 验证已经生成过了,在有此key的情况下不重新生成
     return "";
   } else {
     // 随机生成6位数字
     String[] code = new String[6];
     for (int i = 0; i < 6; i++) {
       code[i] = ObjectUtils.toString((int) (Math.random() * 10));
     }
     String validCode = StringUtils.join(code);
     redisEao.writeToString(
         Constants.REDIS_KEY_PER_SMS_VALIDATION_PREFIX + validCode, ObjectUtils.toString(id, ""));
     redisEao.setKeyExpire(
         Constants.REDIS_KEY_PER_SMS_VALIDATION_PREFIX + validCode,
         Constants.REDIS_EXPIRE_TIME_PER_SMS_VALIDATION);
     redisEao.writeToString(isSendKey, validCode);
     redisEao.setKeyExpire(isSendKey, Constants.REDIS_EXPIRE_TIME_PER_SMS_VALIDATION);
     return validCode;
   }
 }
  /** {@inheritDoc} */
  public String isValid(Object value) {
    try {
      int portValue = Integer.parseInt(ObjectUtils.toString(value));
      if (portValue < Constants.MIN_PORT_NUMBER || portValue > Constants.MAX_PORT_NUMBER) {
        return NLS.bind(Messages.ValidationPortErrorInvalidPortNumber, m_i18nArguments);
      }
      return null;
    } catch (NumberFormatException nfe) {
      // Fall through
    }

    return NLS.bind(Messages.ValidationPortErrorInvalidPortNumber, m_i18nArguments);
  }
Example #15
0
  /** 将0=1/1=1/true的恒等式进行优化 */
  private static IFilter shortestFilter(IFilter root) throws EmptyResultFilterException {
    IFilter filter = FilterUtils.toDNFAndFlat(root);
    List<List<IFilter>> DNFfilter = FilterUtils.toDNFNodesArray(filter);

    List<List<IFilter>> newDNFfilter = new ArrayList<List<IFilter>>();
    for (List<IFilter> andDNFfilter : DNFfilter) {
      boolean isShortest = false;
      List<IFilter> newAndDNFfilter = new ArrayList<IFilter>();
      for (IFilter one : andDNFfilter) {
        if (one.getOperation() == OPERATION.CONSTANT) {
          boolean flag = false;
          if (((IBooleanFilter) one).getColumn() instanceof ISelectable) { // 可能是个not函数
            newAndDNFfilter.add(one); // 不能丢弃
          } else {
            String value = ((IBooleanFilter) one).getColumn().toString();
            if (StringUtils.isNumeric(value)) {
              flag = BooleanUtils.toBoolean(Integer.valueOf(value));
            } else {
              flag = BooleanUtils.toBoolean(((IBooleanFilter) one).getColumn().toString());
            }
            if (!flag) {
              isShortest = true;
              break;
            }
          }
        } else {
          newAndDNFfilter.add(one);
        }
      }

      if (!isShortest) {
        if (newAndDNFfilter.isEmpty()) {
          // 代表出现为true or xxx,直接返回true
          IBooleanFilter f = ASTNodeFactory.getInstance().createBooleanFilter();
          f.setOperation(OPERATION.CONSTANT);
          f.setColumn("1");
          f.setColumnName(ObjectUtils.toString("1"));
          return f;
        } else { // 针对非false的情况
          newDNFfilter.add(newAndDNFfilter);
        }
      }
    }

    if (newDNFfilter.isEmpty()) {
      throw new EmptyResultFilterException("空结果");
    }

    return FilterUtils.DNFToOrLogicTree(newDNFfilter);
  }
 /** @see org.andromda.cartridges.meta.metafacades.MetafacadeGeneralization#getPrecedence() */
 @Override
 protected Integer handleGetPrecedence() {
   Integer precedence = Integer.valueOf(999999999);
   String value =
       ObjectUtils.toString(
           this.findTaggedValue(MetaProfile.TAGGEDVALUE_GENERALIZATION_PRECEDENCE));
   if (StringUtils.isNotBlank(value)) {
     try {
       precedence = Integer.valueOf(value);
     } catch (NumberFormatException ex) {
       // ignore since we'll just take the large default.
     }
   }
   return precedence;
 }
Example #17
0
  private Object getDisplayValueForCombobox(FieldDto field, Object value) {
    Object displayValue;
    if (Constants.Util.FALSE.equalsIgnoreCase(
        field.getSettingsValueAsString(Constants.Settings.ALLOW_USER_SUPPLIED))) {
      String mapString = field.getSettingsValueAsString(Constants.Settings.COMBOBOX_VALUES);
      Map<String, String> comboboxValues = TypeHelper.parseStringToMap(mapString);
      if (value instanceof Collection) {
        Collection valuesToDisplay = new ArrayList();
        Collection enumList = (Collection) value;
        for (Object enumValue : enumList) {
          String valueFromMap = comboboxValues.get(ObjectUtils.toString(enumValue));
          valuesToDisplay.add(StringUtils.isNotEmpty(valueFromMap) ? valueFromMap : enumValue);
        }
        displayValue = valuesToDisplay;
      } else {
        String valueFromMap = comboboxValues.get(ObjectUtils.toString(value));
        displayValue = StringUtils.isNotEmpty(valueFromMap) ? valueFromMap : value;
      }
    } else {
      displayValue = value;
    }

    return displayValue;
  }
Example #18
0
 public static void createMarkersForJSONIssues(
     Map<String, IResource> resourcesByKey, Map<String, String> ruleByKey, JSONArray issues) {
   for (Object issueObj : issues) {
     JSONObject jsonIssue = (JSONObject) issueObj;
     String componentKey = ObjectUtils.toString(jsonIssue.get("component"));
     if (resourcesByKey.containsKey(componentKey)) {
       boolean isNew = Boolean.TRUE.equals(jsonIssue.get("isNew")); // $NON-NLS-1$
       try {
         SonarMarker.create(
             resourcesByKey.get(componentKey),
             isNew,
             new SonarIssueFromJsonReport(jsonIssue, ruleByKey));
       } catch (CoreException e) {
         LOG.error(e.getMessage(), e);
       }
     }
   }
 }
Example #19
0
  @TraceCall
  @Override
  public RecordSet searchPages(Context ctx, String kw, int page, int count) {
    String skw = "%" + ObjectUtils.toString(kw) + "%";

    String sql =
        new SQLBuilder.Select()
            .select("page_id")
            .from(pageTable)
            .where(
                "destroyed_time=0 AND (name LIKE ${v(kw)} OR name_en LIKE ${v(kw)}) OR address LIKE ${v(kw)} OR address_en LIKE ${v(kw)}",
                "kw",
                skw)
            .page(page, count)
            .toString();

    SQLExecutor se = getSqlExecutor();
    RecordSet pageIdRecs = se.executeRecordSet(sql, null);
    long[] pageIds = CollectionUtils2.toLongArray(pageIdRecs.getIntColumnValues("page_id"));
    return getPages(ctx, pageIds);
  }
Example #20
0
 @Override
 public LuaValue call(LuaValue pnts, LuaValue p) {
   Zone zone = MapTool.getFrame().getCurrentZoneRenderer().getZone();
   if (!token.isSelfOrTrusted()) {
     throw new LuaError(
         new ParserException(
             I18N.getText("macro.function.general.noPerm", "token.movedOverPoints")));
   }
   String points = pnts.checkjstring();
   if (p.isnil()) {
     Path<?> path = token.getToken().getLastPath();
     return LuaConverters.fromJson(
         TokenMoveFunctions.pathPointsToJSONArray(
             TokenMoveFunctions.crossedPoints(
                 zone, token.getToken(), points, TokenMoveFunctions.getLastPathList(path, true))));
   } else {
     String jsonPath = ObjectUtils.toString(LuaConverters.toJson(p));
     return LuaConverters.fromJson(
         TokenMoveFunctions.pathPointsToJSONArray(
             TokenMoveFunctions.crossedPoints(zone, token.getToken(), points, jsonPath)));
   }
 }
 /**
  * Discription:[写一行]
  *
  * @param row 行
  * @param keyValues 一个beanMap对象,包含着这一行中的所有数据
  * @param properties 哪些值需要写入行
  * @param dateFormat 日期格式,默认:yyyy-MM-dd
  * @author:[代超]
  * @throws Exception
  * @update:[日期YYYY-MM-DD] [更改人姓名][变更描述]
  */
 public void writeRow(Row row, Map keyValues, Map properties, String dateFormat, T t)
     throws Exception {
   // 表格内容样式
   CellStyle contentStyle = setContentSheetSysle(row.getSheet().getWorkbook());
   if (keyValues == null || keyValues.size() < 1 || row == null) {
     return;
   }
   if (dateFormat == null || "".equals(dateFormat.trim())) {
     dateFormat = "yyyy-MM-dd";
   }
   Iterator it = keyValues.entrySet().iterator();
   for (int i = 0; it.hasNext(); i++) {
     Map.Entry next = (Map.Entry) it.next();
     String dataValue = ObjectUtils.toString(properties.get(next.getKey()), "");
     if (dataValue == null || "".equals(dataValue.trim())) {
       // 无需导出当前字段
       i--;
       continue;
     }
     Object value = keyValues.get(next.getKey());
     // 值为空时仍然创建单元格并且赋予样式。
     Cell cell = row.createCell(i);
     cell.setCellStyle(contentStyle);
     if (value == null) {
       // 当值为空的时候,不必做其他操作了
       continue;
     }
     if (dataValue.toLowerCase().indexOf("formula") > -1) {
       // 公式
       String formula =
           ExcelFormula.parseFormula(value.toString())
               .replaceAll("-1", String.valueOf(cell.getRowIndex() + 1));
       cell.setCellFormula(formula);
     } else {
       Class c = PropertyUtils.getPropertyType(t, next.getKey().toString());
       writeCell(cell, value, c.getSimpleName(), dateFormat);
     }
   }
 }
Example #22
0
 @Override
 public String toString() {
   return this.instance != null
       ? this.instance.toString()
       : this.childClass.getSimpleName() + "[" + ObjectUtils.toString(this.id, null) + "]";
 }
Example #23
0
 @Override
 public String key() {
   return ObjectUtils.toString(jsonIssue.get("key")); // $NON-NLS-1$
 }
Example #24
0
 @Override
 public String ruleName() {
   return ObjectUtils.toString(ruleByKey.get(ruleKey()));
 }
Example #25
0
 @Override
 public String assignee() {
   return ObjectUtils.toString(jsonIssue.get("assignee")); // $NON-NLS-1$
 }
Example #26
0
 @Override
 public String message() {
   return ObjectUtils.toString(jsonIssue.get("message")); // $NON-NLS-1$
 }
Example #27
0
 @Override
 public boolean resolved() {
   return StringUtils.isNotBlank(
       ObjectUtils.toString(jsonIssue.get("resolution"))); // $NON-NLS-1$
 }
Example #28
0
 @Override
 public String resourceKey() {
   return ObjectUtils.toString(jsonIssue.get("component")); // $NON-NLS-1$
 }
Example #29
0
  public void fillIrcReservePerInfo(IrcReserve ircReserve) {
    if (ircReserve != null && StringUtils.isBlank(ircReserve.getUserName())) {
      Integer perId = ircReserve.getUserId();
      Integer resId = ircReserve.getResId();

      try {
        Map<String, Object> perMap =
            getJdbcTemplate().queryForMap("SELECT * FROM per_user WHERE id=?", perId);

        String birthday = ObjectUtils.toString(perMap.get("birthday"));
        Integer age = 16;
        if (StringUtils.isNotBlank(birthday)) {
          age = Years.yearsBetween(new DateTime(birthday), DateTime.now()).getYears();
          age = (age < 16 || age > 65) ? 16 : age;
        }
        String userName = ObjectUtils.toString(perMap.get("userName"));
        Integer gender = NumberUtils.toInt(ObjectUtils.toString(perMap.get("gender")), 0);
        Integer jobyearType = NumberUtils.toInt(ObjectUtils.toString(perMap.get("jobyearType")), 0);
        String schoolName = "";
        int degree = 0;
        PerUser perUser = perUserEao.get(perId);
        if (perUser != null) {
          PerResumeBo vo;
          try {
            vo = perResumeEao.getResumeVo(perUser.getResId());
          } catch (Exception ex) {
            vo = null;
          }
          if (vo != null) {
            if (vo.getEducationInfoVoList() != null) {
              for (PerResumeBo.EducationInfoVo eduVo : vo.getEducationInfoVoList()) {
                if (eduVo != null && eduVo.getDegree() != null && eduVo.getDegree() > degree) {
                  degree = eduVo.getDegree();
                  schoolName = eduVo.getSchoolName();
                }
              }
            }
          }
        }

        ircReserve.setUserName(userName);
        ircReserve.setGender(gender);
        ircReserve.setAge(age);
        ircReserve.setDegree(degree);
        ircReserve.setSchoolName(schoolName);
        ircReserve.setJobyearType(jobyearType);

        getJdbcTemplateIrc()
            .update(
                "UPDATE irc_reserve SET "
                    + " user_name = ?,"
                    + " age = ?,"
                    + " gender=?,"
                    + " jobyear_type = ? "
                    + " WHERE "
                    + " res_id=? ",
                userName,
                age,
                gender,
                jobyearType,
                resId);

      } catch (Exception e) {
        // 不处理
      }
    }
  }
Example #30
0
  public void fillBuyHistoryPerInfo(ComResumeBuyHistory comResumeBuyHistory) {
    if (comResumeBuyHistory != null && StringUtils.isBlank(comResumeBuyHistory.getSchoolName())) {
      Integer perId = comResumeBuyHistory.getPerUserId();
      Integer id = comResumeBuyHistory.getId();

      try {
        Map<String, Object> perMap =
            getJdbcTemplate().queryForMap("SELECT * FROM per_user WHERE id=?", perId);

        String birthday = ObjectUtils.toString(perMap.get("birthday"));
        Integer age = 16;
        if (StringUtils.isNotBlank(birthday)) {
          // 计算年龄的公司修改为精确到年与搜索引擎匹配
          DateTime bDate = new DateTime(birthday);
          bDate = bDate.monthOfYear().setCopy(1).dayOfMonth().setCopy(1);
          DateTime nDate = DateTime.now();
          nDate = nDate.monthOfYear().setCopy(1).dayOfMonth().setCopy(1);
          age = Years.yearsBetween(bDate, nDate).getYears();
          age = (age < 16 || age > 65) ? 16 : age;
        }
        Integer gender = NumberUtils.toInt(ObjectUtils.toString(perMap.get("gender")), 0);
        Integer jobyearType = NumberUtils.toInt(ObjectUtils.toString(perMap.get("jobyearType")), 0);
        String schoolName = "";
        String speciality = "";
        String genderStr = OptionMap.getValueByType(OptionMap.OptionType.OPT_GENDER, gender, null);

        PerUser perUser = perUserEao.get(perId);
        if (perUser != null) {
          PerResumeBo vo;
          try {
            vo = perResumeEao.getResumeVo(perUser.getResId());
          } catch (Exception ex) {
            vo = null;
          }
          if (vo != null) {
            int degree = 0;
            if (vo.getEducationInfoVoList() != null) {
              for (PerResumeBo.EducationInfoVo eduVo : vo.getEducationInfoVoList()) {
                if (eduVo != null && eduVo.getDegree() != null && eduVo.getDegree() > degree) {
                  degree = eduVo.getDegree();
                  schoolName = eduVo.getSchoolName();
                  speciality = eduVo.getSpeciality();
                }
              }
            }
          }
        }
        String degreeStr =
            OptionMap.getValueByType(OptionMap.OptionType.OPT_PER_DEGREE, gender, null);
        ;

        comResumeBuyHistory.setAge(age);
        comResumeBuyHistory.setGender(genderStr);
        comResumeBuyHistory.setDegree(degreeStr);
        comResumeBuyHistory.setSchoolName(schoolName);
        comResumeBuyHistory.setSpeciality(speciality);
        comResumeBuyHistory.setJobyear(jobyearType);

        getJdbcTemplate()
            .update(
                "UPDATE com_resume_buy_history SET "
                    + " age = ?,"
                    + " gender = ?,"
                    + " degree = ?,"
                    + " school_name = ? "
                    + " speciality = ? "
                    + " jobyear = ? "
                    + " WHERE "
                    + " id=? ",
                age,
                genderStr,
                degreeStr,
                schoolName,
                speciality,
                jobyearType,
                id);

      } catch (Exception e) {
        // 不处理
      }
    }
  }