Ejemplo n.º 1
0
  /**
   * 合并参数列表
   *
   * @param p0
   * @param p1
   * @return
   */
  public static Hashtable join(Hashtable p0, Hashtable p1) {
    if (p0 != null && p1 != null) {

      Hashtable p = new Hashtable();
      for (Enumeration e = p0.keys(); e.hasMoreElements(); ) {
        String key = (String) e.nextElement();
        String value = (String) p0.get(key);
        p.put(key, value);
      }

      for (Enumeration e = p1.keys(); e.hasMoreElements(); ) {
        String key = (String) e.nextElement();
        if (!p0.containsKey(key)) {
          p.put(key, p1.get(key));
        }
      }

      return p;
    }
    return p0;
  }
Ejemplo n.º 2
0
  // ------------------------------------------------------------------------------------------------
  // 描述:
  // 设计: Skyline(2001.12.29)
  // 实现: Skyline
  // 修改:
  // ------------------------------------------------------------------------------------------------
  public JFunctionStub getFunctionByID(String ID, Object OwnerObject) {
    IFunction IF = null;
    JFunctionStub FS = null;
    String FT;
    try {
      for (int i = 0; i < FunctionList.size(); i++) {
        FS = (JFunctionStub) FunctionList.get(i);
        //        System.out.println(FS.FunctionID);
        FT = FS.FunctionID + "_";
        if (FS.FunctionID.equals(ID) || FT.equals(ID)) {
          if (FS.Function == null) {
            FS.FunctionClass = Class.forName(FS.ClassName);
            FS.Function = (IFunction) FS.FunctionClass.newInstance();
            FS.Function.InitFunction(FS);
          }
          /* else { // modify by liukun 找到了就直接返回吧 20100715
            return FS;
          }
          */
          //
          if (OwnerObject != null && OwnerObject instanceof Hashtable) {
            Hashtable OTable = (Hashtable) OwnerObject;
            JFunctionStub fs = (JFunctionStub) OTable.get(ID);
            if (fs == null) {
              fs = new JFunctionStub();
              fs.ClassName = FS.ClassName;
              fs.FunctionClass = FS.FunctionClass;
              fs.FunctionID = FS.FunctionID;
              OTable.put(ID, fs);
            }
            if (fs.Function == null) {
              fs.FunctionClass = Class.forName(FS.ClassName);
              fs.Function = (IFunction) FS.FunctionClass.newInstance();
              fs.Function.InitFunction(FS);
            }
            FS = fs;
          } else {
            /**
             * 如果不在用户列表中则需要重新初始化函数 不能直接用系统缓存因为系统缓存只在登录时初始 这样对于像BB类函数,缓冲坐标的行为就可能会出错(中间修改过行列) modified
             * by hufeng 2007.11.20
             */
            FS.Function = (IFunction) FS.FunctionClass.newInstance();
            FS.Function.InitFunction(FS);
          }

          return FS;
        }
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
Ejemplo n.º 3
0
 /**
  * 解析参数 形式:BBLX:TZ01,BBBH:0110,CS:@CQSM@;@YYYY@2004
  *
  * @param params
  * @return
  */
 public static Hashtable parseQueryParams(String params) {
   try {
     if (params != null && params.length() > 0) {
       String[] keys = params.split(",");
       Hashtable map = new Hashtable();
       for (int i = 0; i < keys.length; i++) {
         String crtStr = keys[i];
         int index = crtStr.indexOf(":");
         String key = crtStr.substring(0, index); // 去除:
         String value = crtStr.substring(index + 1);
         map.put(key, value);
       }
       return map;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return null;
 }
Ejemplo n.º 4
0
 /**
  * 解析参数
  *
  * @param params
  * @return
  */
 public static Hashtable parseParams(String params) {
   try {
     if (params != null && params.length() > 0) {
       String[] keys = params.split(";");
       Hashtable map = new Hashtable();
       for (int i = 0; i < keys.length; i++) {
         String crtStr = keys[i];
         int index = crtStr.lastIndexOf("@") + 1;
         String key = crtStr.substring(1, index - 1); // 去除@
         String value = crtStr.substring(index);
         map.put(key, value);
       }
       return map;
     }
   } catch (Exception e) {
     System.out.println("解析参数出现错误:" + params);
     e.printStackTrace();
   }
   return new Hashtable();
 }