@ SuppressWarnings ( "null" ) protected final JSONObject getPage ( Page page ) throws JSONException { Resource resource = page . adaptTo ( Resource . class ) ; JSONObject pageObject = new JSONObject ( ) ; // node name pageObject . put ( "name" , page . getName ( ) ) ; // node title text String title = page . getTitle ( ) ; if ( StringUtils . isEmpty ( title ) ) { title = page . getName ( ) ; } pageObject . put ( "text" , title ) ; // resource type pageObject . put ( "type" , resource . getResourceType ( ) ) ; // template String template = page . getProperties ( ) . get ( NameConstants . PN_TEMPLATE , String . class ) ; if ( StringUtils . isNotEmpty ( template ) ) { pageObject . put ( "template" , template ) ; } // css class for icon pageObject . put ( "cls" , "page" ) ; return pageObject ; }
Generate JSON object for page