View Javadoc
1   /**
2    * Copyright By Grandsoft Company Limited.  
3    * 2012-2-16 下午03:34:12
4    */
5   package gboat2.base.core.web;
6   
7   import gboat2.base.bridge.debug.DefaultDebugHook;
8   import net.sf.json.JSONArray;
9   import net.sf.json.JSONObject;
10  
11  
12  /**
13   * 
14   * 拆分元数据
15   * @author zhangxj-a
16   * @since jdk1.6
17   * @date 2013-5-21
18   *  
19   */
20  public  class MetadataEdit extends SplitMetadataStrategy {
21  	
22  	private static SplitMetadataStrategy instance = new MetadataEdit();
23  	
24  	public   JSONObject decorateMetadata(JSONObject returned, String invokeMethod, BaseActionSupport action){
25  		JSONArray operations = (JSONArray) returned.get("operations");
26  	 	
27  		if (operations == null) {
28  			operations = new JSONArray();
29  		}
30  		
31  		if (DefaultDebugHook.getInstance().devMode) {
32  			//增加设计、属性按钮
33  			operations.addAll(getSystemButtonsJSON(action, invokeMethod));
34  		}
35  		
36  		operations = filtMetaOperas(operations, action);
37  		returned.put("operations", operations);
38  		
39  		return returned;
40  	}
41  
42  	public static SplitMetadataStrategy getInstance() {
43  		return instance;
44  	}
45  }