public void updateJavaCFX ( String name , ClassDefinition cd ) throws PageException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_CFX_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to change cfx settings" ) ; if ( name == null || name . length ( ) == 0 ) throw new ExpressionException ( "class name can't be a empty value" ) ; renameOldstyleCFX ( ) ; Element tags = _getRootElement ( "ext-tags" ) ; // Update Element [ ] children = XMLConfigWebFactory . getChildren ( tags , "ext-tag" ) ; for ( int i = 0 ; i < children . length ; i ++ ) { String n = children [ i ] . getAttribute ( "name" ) ; if ( n != null && n . equalsIgnoreCase ( name ) ) { Element el = children [ i ] ; if ( ! "java" . equalsIgnoreCase ( el . getAttribute ( "type" ) ) ) throw new ExpressionException ( "there is already a c++ cfx tag with this name" ) ; setClass ( el , CustomTag . class , "" , cd ) ; el . setAttribute ( "type" , "java" ) ; return ; } } // Insert Element el = doc . createElement ( "ext-tag" ) ; tags . appendChild ( el ) ; setClass ( el , CustomTag . class , "" , cd ) ; el . setAttribute ( "name" , name ) ; el . setAttribute ( "type" , "java" ) ; }
insert or update a Java CFX Tag