@@ -60,7 +60,7 @@ public class LocalEnsemble {
60
60
61
61
public LocalEnsemble (JSONObject ensemble , String storage , Integer max )
62
62
throws Exception {
63
- this (ensemble );
63
+ this (ensemble , max );
64
64
}
65
65
66
66
/**
@@ -74,11 +74,16 @@ public LocalEnsemble(JSONObject ensemble) throws Exception {
74
74
if (ensemble .get ("objects" ) != null ) {
75
75
throw new IllegalArgumentException ("Embedded objects unsupported" );
76
76
} else {
77
- this .ensembleId = (String ) ensemble .get ("resource" );
77
+ String prefix = Utils .getJSONObject (ensemble , "object" ) != null ? "object."
78
+ : "" ;
79
+
80
+ this .ensembleId = (String ) Utils .getJSONObject (ensemble ,
81
+ prefix + "resource" );
82
+
78
83
JSONArray modelsJson = (JSONArray ) Utils .getJSONObject (ensemble ,
79
- "models" );
84
+ prefix + "models" );
80
85
distribution = (JSONArray ) Utils .getJSONObject (ensemble ,
81
- "distributions" );
86
+ prefix + "distributions" );
82
87
83
88
84
89
int mn = modelsJson .size ();
@@ -112,11 +117,15 @@ public LocalEnsemble(JSONObject ensemble, Integer maxModels) throws Exception {
112
117
if (ensemble .get ("objects" ) != null ) {
113
118
throw new IllegalArgumentException ("Embedded objects unsupported" );
114
119
} else {
115
- this .ensembleId = (String ) ensemble .get ("resource" );
120
+ String prefix = Utils .getJSONObject (ensemble , "object" ) != null ? "object."
121
+ : "" ;
122
+
123
+ this .ensembleId = (String ) Utils .getJSONObject (ensemble ,
124
+ prefix + "resource" );
116
125
JSONArray modelsJson = (JSONArray ) Utils .getJSONObject (ensemble ,
117
- "models" );
126
+ prefix + "models" );
118
127
distribution = (JSONArray ) Utils .getJSONObject (ensemble ,
119
- "distributions" );
128
+ prefix + "distributions" );
120
129
121
130
int mn = modelsJson .size ();
122
131
modelsIds = new String [mn ];
0 commit comments