}
}
public void fromJSON( JSONObject json ) throws JSONException {
try {
BASE64Decoder base64Decoder = new BASE64Decoder();
String _description, _name, _id, _key, _user, _solution, _path, _file;
Date _timestamp;
JSONObject jsonUserData, jsonParams;
Map<String, Object> _params = new HashMap<String, Object>(), _userData = new HashMap<String, Object>();
_description = json.optString( "description" );
_name = json.getString( "name" );
_id = json.getString( "id" );
_timestamp = new Date( json.optLong( "timestamp", 0 ) );
_user = json.getString( "user" );
_key = json.isNull( "key" ) ? null : json.optString( "key" );
_solution = json.getString( "solution" );
_path = json.getString( "path" );
_file = json.getString( "file" );
String p = json.getString( "params" );
try {
jsonParams = new JSONObject( new String( base64Decoder.decodeBuffer( p ) ) );
} catch ( IOException e ) {
logger.error( e );
throw new JSONException( e );
}
JSONArray jsonUnbound = json.getJSONArray( "unbound" );
String[] keys = JSONObject.getNames( jsonParams );
if ( keys != null ) {
for ( String k : keys ) {
_params.put( k, jsonParams.get( k ) );
}
}
List<String> _unbound = new ArrayList<String>();
for ( int i = 0; i < jsonUnbound.length(); i++ ) {
_unbound.add( jsonUnbound.getString( i ) );
}
if ( json.has( "userData" ) ) {
String u = json.getString( "userData" );
try {
jsonUserData = new JSONObject( new String( base64Decoder.decodeBuffer( u ) ) );
} catch ( IOException e ) {
logger.error( e );
throw new JSONException( e );
}
String[] userDataKeys = JSONObject.getNames( jsonUserData );