Subversion Repositories eFlore/Applications.coel

Rev

Rev 1417 | Rev 1513 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1417 Rev 1468
Line 58... Line 58...
58
	  protected BasePagingLoadResult<ModelData> newLoadResult(Object loadConfig, List<ModelData> models) {
58
	  protected BasePagingLoadResult<ModelData> newLoadResult(Object loadConfig, List<ModelData> models) {
59
	    return new BasePagingLoadResult<ModelData>(models);
59
	    return new BasePagingLoadResult<ModelData>(models);
60
	  }
60
	  }
Line 61... Line 61...
61
 
61
 
62
	  @SuppressWarnings("unchecked")
62
	  @SuppressWarnings("unchecked")
63
	  public D read(Object loadConfig, Object data) {
63
	  public D read(Object loadConfig, Object data) {		  
64
	    JSONObject jsonRoot = null;
64
	    JSONObject jsonRoot = null;
65
	    if (data instanceof JSONObject) {
65
	    if (data instanceof JSONObject) {
66
	      jsonRoot = (JSONObject) data;
66
	      jsonRoot = (JSONObject) data;
67
	    }
67
	    }
68
	    JSONArray root = (JSONArray) jsonRoot.get(modelType.getRoot());
68
	    JSONArray root = (JSONArray) jsonRoot.get(modelType.getRoot());
69
	    int size = root.size();
69
	    int size = root.size();
-
 
70
	    ArrayList<ModelData> models = new ArrayList<ModelData>();
70
	    ArrayList<ModelData> models = new ArrayList<ModelData>();
71
	    
71
	    for (int i = 0; i < size; i++) {	    	
72
	    for (int i = 0; i < size; i++) {	    	
72
	      JSONObject obj = (JSONObject) root.get(i);
73
	      JSONObject obj = (JSONObject) root.get(i);
73
	      ModelData model = newModelInstance();
74
	      ModelData model = newModelInstance();
74
	      for (int j = 0; j < modelType.getFieldCount(); j++) {
75
	      for (int j = 0; j < modelType.getFieldCount(); j++) {
Line 125... Line 126...
125
	    }
126
	    }
126
	    int totalCount = models.size();
127
	    int totalCount = models.size();
127
	    if (modelType.getTotalName() != null) {
128
	    if (modelType.getTotalName() != null) {
128
	      totalCount = getTotalCount(jsonRoot);
129
	      totalCount = getTotalCount(jsonRoot);
129
	    }
130
	    }
-
 
131
	    
130
	    return (D) createReturnData(loadConfig, models, totalCount);
132
	    return (D) createReturnData(loadConfig, models, totalCount);
131
	  }	  
133
	  }	  
Line 132... Line 134...
132
 
134