private static void parseOutgoings ( ArrayList < Shape > shapes , JSONObject modelJSON , Shape current ) throws JSONException { if ( modelJSON . has ( "outgoing" ) ) { ArrayList < Shape > outgoings = new ArrayList < Shape > ( ) ; JSONArray outgoingObject = modelJSON . getJSONArray ( "outgoing" ) ; for ( int i = 0 ; i < outgoingObject . length ( ) ; i ++ ) { Shape out = getShapeWithId ( outgoingObject . getJSONObject ( i ) . getString ( "resourceId" ) , shapes ) ; outgoings . add ( out ) ; out . addIncoming ( current ) ; } if ( outgoings . size ( ) > 0 ) { current . setOutgoings ( outgoings ) ; } } }
parse the outgoings form an json object and add all shape references to the current shapes add new shapes to the shape array