public static List < String > getImageIds ( String formString ) throws Exception { List < String > imageIds = new ArrayList < String > ( ) ; if ( formString != null && formString . length ( ) > 0 ) { JSONObject sectionObject = new JSONObject ( formString ) ; List < String > formsNames = Utilities . getFormNames4Section ( sectionObject ) ; for ( String formName : formsNames ) { JSONObject form4Name = Utilities . getForm4Name ( formName , sectionObject ) ; JSONArray formItems = Utilities . getFormItems ( form4Name ) ; for ( int i = 0 ; i < formItems . length ( ) ; i ++ ) { JSONObject formItem = formItems . getJSONObject ( i ) ; if ( ! formItem . has ( Utilities . TAG_KEY ) ) { continue ; } String type = formItem . getString ( Utilities . TAG_TYPE ) ; String value = "" ; if ( formItem . has ( Utilities . TAG_VALUE ) ) value = formItem . getString ( Utilities . TAG_VALUE ) ; if ( type . equals ( Utilities . TYPE_PICTURES ) ) { if ( value . trim ( ) . length ( ) == 0 ) { continue ; } String [ ] imageSplit = value . split ( ";" ) ; Collections . addAll ( imageIds , imageSplit ) ; } else if ( type . equals ( Utilities . TYPE_MAP ) ) { if ( value . trim ( ) . length ( ) == 0 ) { continue ; } String image = value . trim ( ) ; imageIds . add ( image ) ; } else if ( type . equals ( Utilities . TYPE_SKETCH ) ) { if ( value . trim ( ) . length ( ) == 0 ) { continue ; } String [ ] imageSplit = value . split ( ";" ) ; Collections . addAll ( imageIds , imageSplit ) ; } } } } return imageIds ; }
Get the images paths out of a form string .