public int validate() {
   String name = DataUtil.toTextRow(getName());
   if (DataUtil.isEmpty(name)) {
     return Err.INFORMATION_NAME_ERROR;
   }
   if (name.length() > 16) {
     return Err.INFORMATION_NAME_LEN_TOOLONG;
   }
   if (getUserId() <= 0) {
     return Err.USERID_ERROR;
   }
   if (DataUtil.isEmpty(getTag())) {
     return Err.INFORMATION_TAG_ERROR;
   }
   if (DataUtil.toTextRow(getTag()).length() > 15) {
     return Err.INFORMATION_TAG_LEN_TOOLONG;
   }
   String intro = DataUtil.toText(getIntro());
   if (!DataUtil.isEmpty(intro)) {
     if (intro.length() > 300) {
       return Err.INFROMATION_INTRO_LEN_TOOLONG;
     }
   }
   return Err.SUCCESS;
 }
Beispiel #2
0
 public int validate() {
   String s = DataUtil.toTextRow(this.qq);
   if (DataUtil.isEmpty(s) || s.length() > 20) {
     return Err.CMPCONTACT_QQ_ERROR;
   }
   if (DataUtil.isEmpty(qqhtml) || this.qqhtml.length() > 1000) {
     return Err.CMPCONTACT_QQHTML_ERROR;
   }
   if (!HkValidate.validateLength(this.name, true, 20)) {
     return Err.CMPCONTACT_NAME_ERROR;
   }
   return Err.SUCCESS;
 }
 /**
  * 为栏目选择专业
  *
  * @param req
  * @param resp
  * @return
  * @throws Exception 2010-7-11
  */
 public String selkind(HkRequest req, HkResponse resp) throws Exception {
   long companyId = req.getLong("companyId");
   long oid = req.getLongAndSetAttr("oid");
   CmpNav cmpNav = this.cmpNavService.getCmpNav(oid);
   req.setAttribute("cmpNav", cmpNav);
   if (this.isForwardPage(req)) {
     String name = req.getHtmlRow("name");
     long parentId = req.getLongAndSetAttr("parentId");
     CmpStudyKind parent = this.cmpStudyKindService.getCmpStudyKind(companyId, parentId);
     req.setAttribute("parent", parent);
     SimplePage page = req.getSimplePage(20);
     List<CmpStudyKind> list =
         this.cmpStudyKindService.getCmpStudyKindListByCompanyIdAndParentIdEx(
             companyId, parentId, name, page.getBegin(), page.getSize() + 1);
     this.processListForPage(page, list);
     req.setAttribute("list", list);
     return this.getWebPath("admin/cmpnav/selkind.jsp");
   }
   long kindId = req.getLong("kindId");
   if (cmpNav != null) {
     CmpStudyKind cmpStudyKind = this.cmpStudyKindService.getCmpStudyKind(companyId, kindId);
     if (cmpStudyKind == null) {
       return null;
     }
     cmpNav.setKindId(kindId);
     this.cmpNavService.updateCmpNav(cmpNav);
     this.setOpFuncSuccessMsg(req);
   }
   String return_url = req.getReturnUrl();
   if (DataUtil.isEmpty(return_url)) {
     return null;
   }
   return "r:" + return_url;
 }
Beispiel #4
0
 /**
  * 如果喇叭内容除了人名,没有其他任何内容,不允许提交
  *
  * @return
  */
 public boolean isEmptyContent() {
   String s = this.parsedContent.replaceAll(DataUtil.nickNameRegx, "");
   if (DataUtil.isEmpty(s)) {
     return true;
   }
   return false;
 }