Example #1
0
 @Override
 protected void childrenElements(XmlStringBuilder builder) {
   if (nickName != null) {
     builder.halfOpenElement("member").attribute("nickname", nickName).closeEmptyElement();
   }
   builder.optElement("reason", reason);
   super.childrenElements(builder);
 }
Example #2
0
  /** 该userId包含任意一个roleTypes中的权限,则返回true */
  public static boolean checkRoleContains(Long userId, String roleTypes[]) {
    boolean booRet = false;
    try {
      if (userId.intValue() == 0 && Operate.arrayContains(roleTypes, "admin")) {
        booRet = true;
      } else {
        ArrayList roleList = getAtomRole(userId);

        for (int i = 0; i < roleTypes.length; i++) {

          if (roleTypes[i].equals("RECEPTION")) {
            if (roleList.contains(new Long(RECEPTION))) booRet = true;
          } else if (roleTypes[i].equals("PIC")) { // 仓库管理员
            if (roleList.contains(new Long(PIC))) booRet = true;
          } else if (roleTypes[i].equals("SYSTEM")) {
            if (roleList.contains(new Long(SYSTEM))) booRet = true;
          } else if (roleTypes[i].equals("REPORT")) {
            if (roleList.contains(new Long(REPORT))) booRet = true;
          } else if (roleTypes[i].equals("REPAIRMAN")) { // 维修员
            if (roleList.contains(new Long(REPAIRMAN))) booRet = true;

          } else if (roleTypes[i].equals("REPAIRMANAGER")) {
            if (roleList.contains(new Long(REPAIRMANAGER))) booRet = true;
          } else if (roleTypes[i].equals("LOGISTICMANAGER")) {
            if (roleList.contains(new Long(LOGISTICMANAGER))) booRet = true;
          } else if (roleTypes[i].equals("MANAGER")) {
            if (roleList.contains(new Long(MANAGER))) booRet = true;
          }
        }
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return booRet;
  }