idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
22,800 | public void sleep ( int time ) { if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "sleep(" + time + ")" ) ; } sleeper . sleep ( time ) ; } | Robotium will sleep for the specified time . |
22,801 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private static int initializeTimeout ( String property , int defaultValue ) { try { Class clazz = Class . forName ( "android.os.SystemProperties" ) ; Method method = clazz . getDeclaredMethod ( "get" , String . class ) ; String value = ( String ) method . invoke ( null , property ) ; return Integer . parseInt ( value ) ; } catch ( Exception e ) { return defaultValue ; } } | Parse a timeout value set using adb shell . |
22,802 | public void setUrlpath ( String urlpath ) { if ( StringUtil . isEmpty ( urlpath ) ) return ; this . urlpath = urlpath . toLowerCase ( ) . trim ( ) ; } | set the value urlpath Specifies the URL path for files if type = file and type = path . When the collection is searched with cfsearch the pathname is automatically be prepended to filenames and returned as the url attribute . |
22,803 | public void setType ( String type ) throws PageException { if ( type == null ) return ; try { this . type = toType ( type ) ; } catch ( SearchException e ) { throw Caster . toPageException ( e ) ; } } | set the value type Specifies the type of entity being indexed . Default is CUSTOM . |
22,804 | public void setLanguage ( String language ) { if ( StringUtil . isEmpty ( language ) ) return ; this . language = Collection . validateLanguage ( language ) ; } | set the value language |
22,805 | public void setExtensions ( String extensions ) throws PageException { if ( extensions == null ) return ; this . extensions = ListUtil . toStringArrayTrim ( ListUtil . listToArray ( extensions , ',' ) ) ; } | set the value extensions |
22,806 | public void setCollection ( String collection ) throws PageException { try { this . collection = pageContext . getConfig ( ) . getSearchEngine ( pageContext ) . getCollectionByName ( collection . toLowerCase ( ) . trim ( ) ) ; } catch ( SearchException e ) { throw Caster . toPageException ( e ) ; } } | set the value collection Specifies a collection name . If you are indexing an external collection external = Yes specify the collection name including fully qualified path . |
22,807 | private void doDelete ( ) throws PageException , SearchException { required ( "index" , action , "collection" , collection ) ; if ( type != SearchIndex . TYPE_CUSTOM ) required ( "index" , action , "key" , key ) ; if ( type == - 1 ) { if ( query != null ) { type = SearchIndex . TYPE_CUSTOM ; } else { Resource file = null ; try { file = ResourceUtil . toResourceExisting ( pageContext , key ) ; pageContext . getConfig ( ) . getSecurityManager ( ) . checkFileLocation ( file ) ; } catch ( ExpressionException e ) { } if ( file != null && file . exists ( ) && file . isFile ( ) ) type = SearchIndex . TYPE_FILE ; else if ( file != null && file . exists ( ) && file . isDirectory ( ) ) type = SearchIndex . TYPE_PATH ; else { try { new URL ( key ) ; type = SearchIndex . TYPE_URL ; } catch ( MalformedURLException e ) { } } } } collection . deleteIndex ( pageContext , key , type , query ) ; } | delete a collection |
22,808 | private void doUpdate ( ) throws PageException , SearchException , IOException { required ( "index" , action , "collection" , collection ) ; required ( "index" , action , "key" , key ) ; if ( type == - 1 ) type = ( query == null ) ? SearchIndex . TYPE_FILE : SearchIndex . TYPE_CUSTOM ; if ( type == SearchIndex . TYPE_CUSTOM ) { required ( "index" , action , "body" , body ) ; } IndexResult result ; result = collection . index ( pageContext , key , type , urlpath , title , body , language , extensions , query , recurse , categoryTree , category , timeout , custom1 , custom2 , custom3 , custom4 ) ; if ( ! StringUtil . isEmpty ( status ) ) pageContext . setVariable ( status , toStruct ( result ) ) ; } | update a collection |
22,809 | public Resource _getResource ( String name ) { Resource f = directory . getRealResource ( name ) ; if ( f != null && f . exists ( ) && f . isFile ( ) ) return f ; return null ; } | returns matching File Object or null if file not exust |
22,810 | public long getOffset ( ) throws IOException { DatagramSocket socket = null ; try { socket = new DatagramSocket ( ) ; socket . setSoTimeout ( 20000 ) ; InetAddress address = InetAddress . getByName ( serverName ) ; byte [ ] buf = new NtpMessage ( ) . toByteArray ( ) ; DatagramPacket packet = new DatagramPacket ( buf , buf . length , address , 123 ) ; NtpMessage . encodeTimestamp ( packet . getData ( ) , 40 , ( System . currentTimeMillis ( ) / 1000.0 ) + 2208988800.0 ) ; socket . send ( packet ) ; packet = new DatagramPacket ( buf , buf . length ) ; socket . receive ( packet ) ; double destinationTimestamp = ( System . currentTimeMillis ( ) / 1000.0 ) + 2208988800.0 ; NtpMessage msg = new NtpMessage ( packet . getData ( ) ) ; double localClockOffset = ( ( msg . receiveTimestamp - msg . originateTimestamp ) + ( msg . transmitTimestamp - destinationTimestamp ) ) / 2 ; return ( long ) ( localClockOffset * 1000 ) ; } finally { IOUtil . closeEL ( socket ) ; } } | returns the offest from the ntp server to local system |
22,811 | public static Object call ( PageContext pc , String sql , Object params , Struct options , String name ) throws PageException { PageContextImpl pci = ( PageContextImpl ) pc ; lucee . runtime . tag . Query qry = ( lucee . runtime . tag . Query ) pci . use ( lucee . runtime . tag . Query . class . getName ( ) , "cfquery" , TagLibTag . ATTRIBUTE_TYPE_FIXED ) ; try { try { qry . hasBody ( true ) ; qry . setReturnVariable ( true ) ; qry . setName ( StringUtil . isEmpty ( name ) ? "QueryExecute" : name ) ; if ( options != null ) TagUtil . setAttributeCollection ( pc , qry , null , options , TagLibTag . ATTRIBUTE_TYPE_FIXED ) ; qry . setParams ( params ) ; int res = qry . doStartTag ( ) ; pc . initBody ( qry , res ) ; pc . forceWrite ( sql ) ; qry . doAfterBody ( ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; try { qry . doCatch ( t ) ; } catch ( Throwable t2 ) { ExceptionUtil . rethrowIfNecessary ( t ) ; throw Caster . toPageException ( t2 ) ; } } finally { pc . popBody ( ) ; qry . doFinally ( ) ; } qry . doEndTag ( ) ; return qry . getReturnVariable ( ) ; } finally { pci . reuse ( qry ) ; } } | name is set by evaluator |
22,812 | public static String toStringPriority ( int priority ) { if ( priority == Thread . NORM_PRIORITY ) return "NORMAL" ; if ( priority == Thread . MAX_PRIORITY ) return "HIGH" ; if ( priority == Thread . MIN_PRIORITY ) return "LOW" ; return null ; } | return priority as a String representation |
22,813 | public static int toIntPriority ( String strPriority ) { strPriority = strPriority . trim ( ) . toLowerCase ( ) ; if ( "low" . equals ( strPriority ) ) return Thread . MIN_PRIORITY ; if ( "min" . equals ( strPriority ) ) return Thread . MIN_PRIORITY ; if ( "high" . equals ( strPriority ) ) return Thread . MAX_PRIORITY ; if ( "max" . equals ( strPriority ) ) return Thread . MAX_PRIORITY ; if ( "normal" . equals ( strPriority ) ) return Thread . NORM_PRIORITY ; if ( "norm" . equals ( strPriority ) ) return Thread . NORM_PRIORITY ; return - 1 ; } | return priority as a int representation |
22,814 | public void start ( ) throws MessagingException { Properties properties = new Properties ( ) ; String type = getTypeAsString ( ) ; properties . put ( "mail." + type + ".host" , server ) ; properties . put ( "mail." + type + ".port" , new Double ( port ) ) ; properties . put ( "mail." + type + ".connectiontimeout" , String . valueOf ( timeout ) ) ; properties . put ( "mail." + type + ".timeout" , String . valueOf ( timeout ) ) ; if ( secure ) { properties . put ( "mail." + type + ".ssl.enable" , "true" ) ; } if ( TYPE_IMAP == getType ( ) ) { properties . put ( "mail.imap.partialfetch" , "false" ) ; } _session = username != null ? Session . getInstance ( properties , new _Authenticator ( username , password ) ) : Session . getInstance ( properties ) ; _store = _session . getStore ( type ) ; if ( ! StringUtil . isEmpty ( username ) ) _store . connect ( server , username , password ) ; else _store . connect ( ) ; } | connects to pop server |
22,815 | public void deleteMails ( String as [ ] , String as1 [ ] ) throws MessagingException , IOException { Folder folder ; Message amessage [ ] ; folder = _store . getFolder ( "INBOX" ) ; folder . open ( 2 ) ; Map < String , Message > map = getMessages ( null , folder , as1 , as , startrow , maxrows , false ) ; Iterator < String > iterator = map . keySet ( ) . iterator ( ) ; amessage = new Message [ map . size ( ) ] ; int i = 0 ; while ( iterator . hasNext ( ) ) { amessage [ i ++ ] = map . get ( iterator . next ( ) ) ; } try { folder . setFlags ( amessage , new Flags ( javax . mail . Flags . Flag . DELETED ) , true ) ; } finally { folder . close ( true ) ; } } | delete all message in ibox that match given criteria |
22,816 | public Query getMails ( String [ ] messageNumbers , String [ ] uids , boolean all ) throws MessagingException , IOException { Query qry = new QueryImpl ( all ? _fldnew : _flddo , 0 , "query" ) ; Folder folder = _store . getFolder ( "INBOX" ) ; folder . open ( Folder . READ_ONLY ) ; try { getMessages ( qry , folder , uids , messageNumbers , startrow , maxrows , all ) ; } finally { folder . close ( false ) ; } return qry ; } | return all messages from inbox |
22,817 | private Map < String , Message > getMessages ( Query qry , Folder folder , String [ ] uids , String [ ] messageNumbers , int startRow , int maxRow , boolean all ) throws MessagingException { Message [ ] messages = folder . getMessages ( ) ; Map < String , Message > map = qry == null ? new HashMap < String , Message > ( ) : null ; int k = 0 ; if ( uids != null || messageNumbers != null ) { startRow = 0 ; maxRow = - 1 ; } Message message ; for ( int l = startRow ; l < messages . length ; l ++ ) { if ( maxRow != - 1 && k == maxRow ) { break ; } message = messages [ l ] ; int messageNumber = message . getMessageNumber ( ) ; String id = getId ( folder , message ) ; if ( uids == null ? messageNumbers == null || contains ( messageNumbers , messageNumber ) : contains ( uids , id ) ) { k ++ ; if ( qry != null ) { toQuery ( qry , message , id , all ) ; } else map . put ( id , message ) ; } } return map ; } | gets all messages from given Folder that match given criteria |
22,818 | private void getContent ( Query query , Message message , int row ) throws MessagingException , IOException { StringBuffer body = new StringBuffer ( ) ; Struct cids = new StructImpl ( ) ; query . setAtEL ( CIDS , row , cids ) ; if ( message . isMimeType ( "text/plain" ) ) { String content = getConent ( message ) ; query . setAtEL ( TEXT_BODY , row , content ) ; body . append ( content ) ; } else if ( message . isMimeType ( "text/html" ) ) { String content = getConent ( message ) ; query . setAtEL ( HTML_BODY , row , content ) ; body . append ( content ) ; } else { Object content = message . getContent ( ) ; if ( content instanceof MimeMultipart ) { Array attachments = new ArrayImpl ( ) ; Array attachmentFiles = new ArrayImpl ( ) ; getMultiPart ( query , row , attachments , attachmentFiles , cids , ( MimeMultipart ) content , body ) ; if ( attachments . size ( ) > 0 ) { try { query . setAtEL ( ATTACHMENTS , row , ListUtil . arrayToList ( attachments , "\t" ) ) ; } catch ( PageException pageexception ) { } } if ( attachmentFiles . size ( ) > 0 ) { try { query . setAtEL ( ATTACHMENT_FILES , row , ListUtil . arrayToList ( attachmentFiles , "\t" ) ) ; } catch ( PageException pageexception1 ) { } } } } query . setAtEL ( BODY , row , body . toString ( ) ) ; } | write content data to query |
22,819 | public void setFinally ( Body body , Position finallyLine ) { body . setParent ( this ) ; this . finallyBody = body ; this . finallyLine = finallyLine ; } | sets finally body |
22,820 | private void writeOutTypeCondition ( BytecodeContext bc ) throws TransformerException { WhileVisitor whileVisitor = new WhileVisitor ( ) ; loopVisitor = whileVisitor ; whileVisitor . visitBeforeExpression ( bc ) ; bc . getFactory ( ) . toExprBoolean ( getAttribute ( "condition" ) . getValue ( ) ) . writeOut ( bc , Expression . MODE_VALUE ) ; whileVisitor . visitAfterExpressionBeforeBody ( bc ) ; getBody ( ) . writeOut ( bc ) ; whileVisitor . visitAfterBody ( bc , getEnd ( ) ) ; } | write out condition loop |
22,821 | public static String call ( PageContext pc , Object object ) throws PageException { return call ( pc , object , null , true , 9999 , null , null , null , null , 9999 , true , true ) ; } | private static final int FORMAT_TYPE_TEXT = 1 ; |
22,822 | public static Compress getInstance ( Resource zipFile , int format , boolean caseSensitive ) throws IOException { ConfigImpl config = ( ConfigImpl ) ThreadLocalPageContext . getConfig ( ) ; return config . getCompressInstance ( zipFile , format , caseSensitive ) ; } | return zip instance matching the zipfile singelton instance only 1 zip for one file |
22,823 | public void setRequesttimeout ( double requesttimeout ) { long rt ; if ( requesttimeout <= 0 ) rt = Long . MAX_VALUE ; else rt = ( long ) ( requesttimeout * 1000 ) ; pageContext . setRequestTimeout ( rt ) ; } | set the value requesttimeout |
22,824 | public void setEnablecfoutputonly ( Object enablecfoutputonly ) throws PageException { if ( enablecfoutputonly instanceof String && Caster . toString ( enablecfoutputonly ) . trim ( ) . equalsIgnoreCase ( "reset" ) ) { pageContext . setCFOutputOnly ( ( short ) 0 ) ; } else { pageContext . setCFOutputOnly ( Caster . toBooleanValue ( enablecfoutputonly ) ) ; } } | set the value enablecfoutputonly Yes or No . When set to Yes cfsetting blocks output of HTML that resides outside cfoutput tags . |
22,825 | public String transform ( String html , URL url , boolean setBaseTag ) throws PageException { StringBuffer target = new StringBuffer ( ) ; SourceCode cfml = new SourceCode ( html , false , CFMLEngine . DIALECT_CFML ) ; while ( ! cfml . isAfterLast ( ) ) { if ( cfml . forwardIfCurrent ( '<' ) ) { target . append ( '<' ) ; try { for ( int i = 0 ; i < tags . length ; i ++ ) { if ( cfml . forwardIfCurrent ( tags [ i ] . tag + " " ) ) { target . append ( tags [ i ] . tag + " " ) ; transformTag ( target , cfml , tags [ i ] , url ) ; } } } catch ( MalformedURLException me ) { throw Caster . toPageException ( me ) ; } } else { target . append ( cfml . getCurrent ( ) ) ; cfml . next ( ) ; } } if ( ! setBaseTag ) return target . toString ( ) ; html = target . toString ( ) ; String prefix = "" , postfix = "" ; int index = StringUtil . indexOfIgnoreCase ( html , "</head>" ) ; if ( index == - 1 ) { prefix = "<head>" ; postfix = "</head>" ; index = StringUtil . indexOfIgnoreCase ( html , "</html>" ) ; } if ( index != - 1 ) { StringBuffer sb = new StringBuffer ( ) ; sb . append ( html . substring ( 0 , index ) ) ; String port = url . getPort ( ) == - 1 ? "" : ":" + url . getPort ( ) ; sb . append ( prefix + "<base href=\"" + ( url . getProtocol ( ) + "://" + url . getHost ( ) + port ) + "\">" + postfix ) ; sb . append ( html . substring ( index ) ) ; html = sb . toString ( ) ; } return html ; } | transform the HTML String |
22,826 | public DatasourceConnection getDatasourceConnection ( Config config , DataSource datasource , String user , String pass ) throws PageException { config = ThreadLocalPageContext . getConfig ( config ) ; if ( StringUtil . isEmpty ( user ) ) { user = datasource . getUsername ( ) ; pass = datasource . getPassword ( ) ; } if ( pass == null ) pass = "" ; DCStack stack = getDCStack ( datasource , user , pass ) ; int max = datasource . getConnectionLimit ( ) ; DatasourceConnection rtn ; boolean wait = false ; outer : while ( true ) { rtn = null ; if ( wait ) { SystemUtil . wait ( waiter , WAIT ) ; wait = false ; } synchronized ( stack ) { if ( max != - 1 ) { RefInteger _counter = stack . getCounter ( ) ; if ( max <= _counter . toInt ( ) ) { wait = true ; continue outer ; } } while ( ! stack . isEmpty ( ) ) { DatasourceConnection dc = ( DatasourceConnection ) stack . get ( ) ; if ( dc != null ) { rtn = dc ; break ; } } _inc ( stack , datasource , user , pass ) ; if ( rtn == null ) { try { rtn = loadDatasourceConnection ( config , datasource , user , pass ) ; } catch ( PageException pe ) { _dec ( stack , datasource , user , pass ) ; throw pe ; } if ( rtn instanceof DatasourceConnectionImpl ) ( ( DatasourceConnectionImpl ) rtn ) . using ( ) ; return rtn ; } } if ( isValid ( rtn , Boolean . TRUE ) ) { if ( rtn instanceof DatasourceConnectionImpl ) ( ( DatasourceConnectionImpl ) rtn ) . using ( ) ; return rtn ; } synchronized ( stack ) { _dec ( stack , datasource , user , pass ) ; SystemUtil . notify ( waiter ) ; } IOUtil . closeEL ( rtn . getConnection ( ) ) ; rtn = null ; } } | !!! do not change used in hibernate extension |
22,827 | public Map < String , Integer > openConnections ( ) { Map < String , Integer > map = new HashMap < String , Integer > ( ) ; Iterator < DCStack > it = dcs . values ( ) . iterator ( ) ; DCStack dcstack ; while ( it . hasNext ( ) ) { dcstack = it . next ( ) ; Integer val = map . get ( dcstack . getDatasource ( ) . getName ( ) ) ; if ( val == null ) val = dcstack . openConnections ( ) ; else val = val . intValue ( ) + dcstack . openConnections ( ) ; map . put ( dcstack . getDatasource ( ) . getName ( ) , val ) ; } return map ; } | do not change interface used by argus monitor |
22,828 | public static Array listToArray ( String list , char delimiter ) { if ( list . length ( ) == 0 ) return new ArrayImpl ( ) ; int len = list . length ( ) ; int last = 0 ; Array array = new ArrayImpl ( ) ; try { for ( int i = 0 ; i < len ; i ++ ) { if ( list . charAt ( i ) == delimiter ) { array . append ( list . substring ( last , i ) ) ; last = i + 1 ; } } if ( last <= len ) array . append ( list . substring ( last ) ) ; } catch ( PageException e ) { } return array ; } | casts a list to Array object |
22,829 | public static Array listToArrayRemoveEmpty ( String list , char delimiter ) { int len = list . length ( ) ; ArrayImpl array = new ArrayImpl ( ) ; if ( len == 0 ) return array ; int last = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( list . charAt ( i ) == delimiter ) { if ( last < i ) array . appendEL ( list . substring ( last , i ) ) ; last = i + 1 ; } } if ( last < len ) array . appendEL ( list . substring ( last ) ) ; return array ; } | casts a list to Array object remove Empty Elements |
22,830 | public static Array listToArrayTrim ( String list , char delimiter ) { if ( list . length ( ) == 0 ) return new ArrayImpl ( ) ; while ( list . indexOf ( delimiter ) == 0 ) { list = list . substring ( 1 ) ; } int len = list . length ( ) ; if ( len == 0 ) return new ArrayImpl ( ) ; while ( list . lastIndexOf ( delimiter ) == len - 1 ) { list = list . substring ( 0 , len - 1 < 0 ? 0 : len - 1 ) ; len = list . length ( ) ; } return listToArray ( list , delimiter ) ; } | casts a list to Array object remove all empty items at start and end of the list |
22,831 | public static int listFind ( String list , String value , String delimiter ) { Array arr = listToArrayTrim ( list , delimiter ) ; int len = arr . size ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { if ( arr . get ( i , "" ) . equals ( value ) ) return i - 1 ; } return - 1 ; } | finds a value inside a list do not case sensitive |
22,832 | public static int listFindIgnoreEmpty ( String list , String value , char delimiter ) { if ( list == null ) return - 1 ; int len = list . length ( ) ; if ( len == 0 ) return - 1 ; int last = 0 ; int count = 0 ; for ( int i = 0 ; i < len ; i ++ ) { if ( list . charAt ( i ) == delimiter ) { if ( last < i ) { if ( list . substring ( last , i ) . equals ( value ) ) return count ; count ++ ; } last = i + 1 ; } } if ( last < len ) { if ( list . substring ( last ) . equals ( value ) ) return count ; } return - 1 ; } | finds a value inside a list case sensitive ignore empty items |
22,833 | public static int listContainsNoCase ( String list , String value , String delimiter , boolean includeEmptyFields , boolean multiCharacterDelimiter ) { if ( StringUtil . isEmpty ( value ) ) return - 1 ; Array arr = listToArray ( list , delimiter , includeEmptyFields , multiCharacterDelimiter ) ; int len = arr . size ( ) ; for ( int i = 1 ; i <= len ; i ++ ) { if ( StringUtil . indexOfIgnoreCase ( arr . get ( i , "" ) . toString ( ) , value ) != - 1 ) return i - 1 ; } return - 1 ; } | returns if a value of the list contains given value ignore case |
22,834 | public static String arrayToListTrim ( String [ ] array , String delimiter ) { return trim ( arrayToList ( array , delimiter ) , delimiter , false ) ; } | convert a string array to string list removes empty values at begin and end of the list |
22,835 | public static String arrayToList ( String [ ] array , String delimiter ) { if ( ArrayUtil . isEmpty ( array ) ) return "" ; StringBuilder sb = new StringBuilder ( array [ 0 ] ) ; if ( delimiter . length ( ) == 1 ) { char c = delimiter . charAt ( 0 ) ; for ( int i = 1 ; i < array . length ; i ++ ) { sb . append ( c ) ; sb . append ( array [ i ] ) ; } } else { for ( int i = 1 ; i < array . length ; i ++ ) { sb . append ( delimiter ) ; sb . append ( array [ i ] ) ; } } return sb . toString ( ) ; } | convert a string array to string list |
22,836 | public static String arrayToList ( Array array , String delimiter ) throws PageException { if ( array . size ( ) == 0 ) return "" ; StringBuilder sb = new StringBuilder ( Caster . toString ( array . get ( 1 , "" ) ) ) ; int len = array . size ( ) ; for ( int i = 2 ; i <= len ; i ++ ) { sb . append ( delimiter ) ; sb . append ( Caster . toString ( array . get ( i , "" ) ) ) ; } return sb . toString ( ) ; } | convert Array Object to string list |
22,837 | public static String [ ] trim ( String [ ] array ) { int from = 0 ; int to = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { from = i ; if ( array [ i ] . length ( ) != 0 ) break ; } for ( int i = array . length - 1 ; i >= 0 ; i -- ) { to = i ; if ( array [ i ] . length ( ) != 0 ) break ; } int newLen = to - from + 1 ; if ( newLen < array . length ) { String [ ] rtn = new String [ newLen ] ; System . arraycopy ( array , from , rtn , 0 , newLen ) ; return rtn ; } return array ; } | trims a string array removes all empty array positions at the start and the end of the array |
22,838 | public static String [ ] toStringArrayTrim ( Array array ) throws PageException { String [ ] arr = new String [ array . size ( ) ] ; for ( int i = 0 ; i < arr . length ; i ++ ) { arr [ i ] = Caster . toString ( array . get ( i + 1 , "" ) ) . trim ( ) ; } return arr ; } | cast a Object Array to a String Array and trim all values |
22,839 | public static String first ( String list , String delimiter ) { return first ( list , delimiter , true , 1 ) ; } | return first element of the list |
22,840 | public static String getAt ( String list , String delimiter , int position , boolean ignoreEmpty , String defaultValue ) { if ( delimiter . length ( ) == 1 ) return getAt ( list , delimiter . charAt ( 0 ) , position , ignoreEmpty , defaultValue ) ; int len = list . length ( ) ; if ( len == 0 ) return defaultValue ; int last = - 1 ; int count = - 1 ; char [ ] del = delimiter . toCharArray ( ) ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = list . charAt ( i ) ; for ( int y = 0 ; y < del . length ; y ++ ) { if ( c == del [ y ] ) { if ( ignoreEmpty && ( last + 1 ) == i ) { last = i ; break ; } count ++ ; if ( count == position ) { return list . substring ( last + 1 , i ) ; } last = i ; break ; } } } if ( position == count + 1 ) { if ( ! ignoreEmpty || last + 1 < len ) return list . substring ( last + 1 ) ; } return defaultValue ; } | gets a value from list |
22,841 | public static String getAt ( String list , char delimiter , int position , boolean ignoreEmpty , String defaultValue ) { int len = list . length ( ) ; if ( len == 0 ) return defaultValue ; int last = - 1 ; int count = - 1 ; for ( int i = 0 ; i < len ; i ++ ) { if ( list . charAt ( i ) == delimiter ) { if ( ignoreEmpty && ( last + 1 ) == i ) { last = i ; continue ; } count ++ ; if ( count == position ) { return list . substring ( last + 1 , i ) ; } last = i ; } } if ( position == count + 1 ) { if ( ! ignoreEmpty || last + 1 < len ) return list . substring ( last + 1 ) ; } return defaultValue ; } | get a elemnt at a specified position in list |
22,842 | public static int getDelimIndex ( StringBuilder sb , int itemPos , char [ ] delims , boolean ignoreEmpty ) { if ( StringUtil . isEmpty ( sb ) ) return - 1 ; int curr = - 1 , listIndex = 0 ; int len = sb . length ( ) ; for ( int i = 0 ; i < len ; i ++ ) { if ( contains ( delims , sb . charAt ( i ) ) ) { curr = i ; if ( ignoreEmpty ) { if ( i == 0 || ( i + 1 < len && contains ( delims , sb . charAt ( i + 1 ) ) ) ) { sb . delete ( curr , curr + 1 ) ; len -- ; i -- ; curr -- ; continue ; } } if ( ++ listIndex == itemPos ) break ; } } if ( listIndex < itemPos ) return len ; return curr ; } | returns the 0 - based delimiter position for the specified item |
22,843 | protected Data init ( Data data ) { if ( JSON_ARRAY == null ) JSON_ARRAY = getFLF ( data , "_literalArray" ) ; if ( JSON_STRUCT == null ) JSON_STRUCT = getFLF ( data , "_literalStruct" ) ; if ( GET_STATIC_SCOPE == null ) GET_STATIC_SCOPE = getFLF ( data , "_getStaticScope" ) ; if ( GET_SUPER_STATIC_SCOPE == null ) GET_SUPER_STATIC_SCOPE = getFLF ( data , "_getSuperStaticScope" ) ; return data ; } | Initialmethode wird aufgerufen um den internen Zustand des Objektes zu setzten . |
22,844 | public static boolean verify ( String host , String username , String password , int port ) throws SMTPException { try { return _verify ( host , username , password , port ) ; } catch ( MessagingException e ) { if ( ! StringUtil . isEmpty ( username ) ) { try { _verify ( host , null , null , port ) ; throw new SMTPExceptionImpl ( "can't connect to mail server, authentication settings are invalid" ) ; } catch ( MessagingException e1 ) { } } if ( port > 0 && port != 25 ) { try { _verify ( host , null , null , 25 ) ; throw new SMTPExceptionImpl ( "can't connect to mail server, port definition is invalid" ) ; } catch ( MessagingException e1 ) { } } throw new SMTPExceptionImpl ( "can't connect to mail server" ) ; } } | verify mail server |
22,845 | protected ConfigWebImpl getConfigWebImpl ( String realpath ) { Iterator < String > it = initContextes . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { ConfigWebImpl cw = ( ( CFMLFactoryImpl ) initContextes . get ( it . next ( ) ) ) . getConfigWebImpl ( ) ; if ( ReqRspUtil . getRootPath ( cw . getServletContext ( ) ) . equals ( realpath ) ) return cw ; } return null ; } | returns CongigWeb Implementtion |
22,846 | protected void fillDecoded ( URLItem [ ] raw , String encoding , boolean scriptProteced , boolean sameAsArray ) throws UnsupportedEncodingException { clear ( ) ; String name , value ; for ( int i = 0 ; i < raw . length ; i ++ ) { name = raw [ i ] . getName ( ) ; value = raw [ i ] . getValue ( ) ; if ( raw [ i ] . isUrlEncoded ( ) ) { name = URLDecoder . decode ( name , encoding , true ) ; value = URLDecoder . decode ( value , encoding , true ) ; } if ( name . indexOf ( '.' ) != - 1 ) { StringList list = ListUtil . listToStringListRemoveEmpty ( name , '.' ) ; if ( list . size ( ) > 0 ) { Struct parent = this ; while ( list . hasNextNext ( ) ) { parent = _fill ( parent , list . next ( ) , new CastableStruct ( Struct . TYPE_LINKED ) , false , scriptProteced , sameAsArray ) ; } _fill ( parent , list . next ( ) , value , true , scriptProteced , sameAsArray ) ; } } _fill ( this , name , value , true , scriptProteced , sameAsArray ) ; } } | fill th data from given strut and decode it |
22,847 | public void setType ( String type ) throws ApplicationException { if ( StringUtil . isEmpty ( type , true ) ) return ; type = type . toLowerCase ( ) . trim ( ) ; if ( type . equals ( "url" ) ) param . setType ( HttpParamBean . TYPE_URL ) ; else if ( type . equals ( "formfield" ) || type . equals ( "form" ) ) param . setType ( HttpParamBean . TYPE_FORM ) ; else if ( type . equals ( "cgi" ) ) param . setType ( HttpParamBean . TYPE_CGI ) ; else if ( type . startsWith ( "head" ) || type . startsWith ( "header" ) ) param . setType ( HttpParamBean . TYPE_HEADER ) ; else if ( type . equals ( "cookie" ) ) param . setType ( HttpParamBean . TYPE_COOKIE ) ; else if ( type . equals ( "file" ) ) param . setType ( HttpParamBean . TYPE_FILE ) ; else if ( type . equals ( "xml" ) ) param . setType ( HttpParamBean . TYPE_XML ) ; else if ( type . equals ( "body" ) ) param . setType ( HttpParamBean . TYPE_BODY ) ; else throw new ApplicationException ( "invalid type [" + type + "], valid types are [body,cgi,cookie,file,form,head,url,xml]" ) ; } | set the value type The transaction type . |
22,848 | public Object getValue ( Query qr , int row ) throws PageException { if ( col == null ) col = qr . getColumn ( getColumn ( ) ) ; return QueryUtil . getValue ( col , row ) ; } | MUST hanle null correctly |
22,849 | public static Tag getParentTag ( Tag tag ) { Statement p = tag . getParent ( ) ; if ( p == null ) return null ; p = p . getParent ( ) ; if ( p instanceof Tag ) return ( Tag ) p ; return null ; } | Gibt das uebergeordnete CFXD Tag Element zurueck falls dies nicht existiert wird null zurueckgegeben . |
22,850 | public static boolean hasSisterTagAfter ( Tag tag , String nameToFind ) { Body body = ( Body ) tag . getParent ( ) ; List < Statement > stats = body . getStatements ( ) ; Iterator < Statement > it = stats . iterator ( ) ; Statement other ; boolean isAfter = false ; while ( it . hasNext ( ) ) { other = it . next ( ) ; if ( other instanceof Tag ) { if ( isAfter ) { if ( ( ( Tag ) other ) . getTagLibTag ( ) . getName ( ) . equals ( nameToFind ) ) return true ; } else if ( other == tag ) isAfter = true ; } } return false ; } | Prueft ob das das angegebene Tag in der gleichen Ebene nach dem angegebenen Tag vorkommt . |
22,851 | public static void remove ( Tag tag ) { Body body = ( Body ) tag . getParent ( ) ; body . getStatements ( ) . remove ( tag ) ; } | remove this tag from his parent body |
22,852 | public static void replace ( Tag src , Tag trg , boolean moveBody ) { trg . setParent ( src . getParent ( ) ) ; Body p = ( Body ) src . getParent ( ) ; List < Statement > stats = p . getStatements ( ) ; Iterator < Statement > it = stats . iterator ( ) ; Statement stat ; int count = 0 ; while ( it . hasNext ( ) ) { stat = it . next ( ) ; if ( stat == src ) { if ( moveBody && src . getBody ( ) != null ) src . getBody ( ) . setParent ( trg ) ; stats . set ( count , trg ) ; break ; } count ++ ; } } | replace src with trg |
22,853 | public static Type toValueType ( Type type ) { if ( type == Types . BYTE ) return Types . BYTE_VALUE ; if ( type == Types . BOOLEAN ) return Types . BOOLEAN_VALUE ; if ( type == Types . CHARACTER ) return Types . CHAR ; if ( type == Types . DOUBLE ) return Types . DOUBLE_VALUE ; if ( type == Types . FLOAT ) return Types . FLOAT_VALUE ; if ( type == Types . INTEGER ) return Types . INT_VALUE ; if ( type == Types . LONG ) return Types . LONG_VALUE ; if ( type == Types . SHORT ) return Types . SHORT_VALUE ; return type ; } | return value type only when there is one |
22,854 | private void _serializeDate ( Date date , StringBuilder sb ) throws ConverterException { _serializeDateTime ( new DateTimeImpl ( date ) , sb ) ; } | serialize a Date |
22,855 | public String serialize ( Object object ) throws ConverterException { deep = 0 ; StringBuilder sb = new StringBuilder ( ) ; _serialize ( object , sb , new HashSet < Object > ( ) ) ; return sb . toString ( ) ; } | serialize a Object to his literal Format |
22,856 | public void setDatasource ( Object datasource ) throws PageException , ClassException , BundleException { if ( datasource == null ) return ; data . rawDatasource = datasource ; data . datasource = toDatasource ( pageContext , datasource ) ; } | set the value datasource The name of the data source from which this query should retrieve data . |
22,857 | public static boolean call ( PageContext pc , String type , Object value ) throws ExpressionException { type = type . trim ( ) ; if ( "range" . equalsIgnoreCase ( type ) ) throw new FunctionException ( pc , "isValid" , 1 , "type" , "for [range] you have to define a min and max value" ) ; if ( "regex" . equalsIgnoreCase ( type ) || "regular_expression" . equalsIgnoreCase ( type ) ) throw new FunctionException ( pc , "isValid" , 1 , "type" , "for [regex] you have to define a pattern" ) ; return Decision . isValid ( type , value ) ; } | check for many diff types |
22,858 | public static final void merge ( InputStream in1 , InputStream in2 , OutputStream out , boolean closeIS1 , boolean closeIS2 , boolean closeOS ) throws IOException { try { merge ( in1 , in2 , out , 0xffff ) ; } finally { if ( closeIS1 ) closeEL ( in1 ) ; if ( closeIS2 ) closeEL ( in2 ) ; if ( closeOS ) closeEL ( out ) ; } } | copy a inputstream to a outputstream |
22,859 | public void copy ( File in , File out ) throws IOException { InputStream is = null ; OutputStream os = null ; try { is = new BufferedFileInputStream ( in ) ; os = new BufferedFileOutputStream ( out ) ; } catch ( IOException ioe ) { closeEL ( is , os ) ; throw ioe ; } copy ( is , os , true , true ) ; } | copy content of in file to out File |
22,860 | public static void closeEL ( InputStream is ) { try { if ( is != null ) is . close ( ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } } | close inputstream without a Exception |
22,861 | public static void closeEL ( OutputStream os ) { try { if ( os != null ) os . close ( ) ; } catch ( Throwable t ) { ExceptionUtil . rethrowIfNecessary ( t ) ; } } | close outputstream without a Exception |
22,862 | public static void closeEL ( Reader r ) { try { if ( r != null ) r . close ( ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; } } | close Reader without a Exception |
22,863 | public static void closeEL ( Closeable c ) { try { if ( c != null ) c . close ( ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; } } | close Closeable without a Exception |
22,864 | public static void closeEL ( Object obj ) { if ( obj instanceof InputStream ) IOUtil . closeEL ( ( InputStream ) obj ) ; else if ( obj instanceof OutputStream ) IOUtil . closeEL ( ( OutputStream ) obj ) ; else if ( obj instanceof Writer ) IOUtil . closeEL ( ( Writer ) obj ) ; else if ( obj instanceof Reader ) IOUtil . closeEL ( ( Reader ) obj ) ; else if ( obj instanceof Closeable ) IOUtil . closeEL ( ( Closeable ) obj ) ; else if ( obj instanceof ZipFile ) IOUtil . closeEL ( ( ZipFile ) obj ) ; else if ( obj instanceof ResultSet ) IOUtil . closeEL ( ( ResultSet ) obj ) ; else if ( obj instanceof Connection ) IOUtil . closeEL ( ( Connection ) obj ) ; else { try { Method method = obj . getClass ( ) . getMethod ( "close" , new Class [ 0 ] ) ; method . invoke ( obj , new Object [ 0 ] ) ; } catch ( Throwable e ) { ExceptionUtil . rethrowIfNecessary ( e ) ; } } } | call close method from any Object with a close method . |
22,865 | public static void checkEncoding ( String encoding ) throws IOException { try { URLEncoder . encode ( "" , encoding ) ; } catch ( UnsupportedEncodingException e ) { throw new IOException ( "invalid encoding [" + encoding + "]" ) ; } } | check if given encoding is ok |
22,866 | public static boolean isValidEmail ( Object value ) { InternetAddress addr = parseEmail ( value , null ) ; if ( addr != null ) { String address = addr . getAddress ( ) ; if ( address . contains ( ".." ) ) return false ; int pos = address . indexOf ( '@' ) ; if ( pos < 1 || pos == address . length ( ) - 1 ) return false ; String local = address . substring ( 0 , pos ) ; String domain = address . substring ( pos + 1 ) ; if ( domain . charAt ( 0 ) == '.' || local . charAt ( 0 ) == '.' || local . charAt ( local . length ( ) - 1 ) == '.' ) return false ; pos = domain . lastIndexOf ( '.' ) ; if ( pos > 0 && pos < domain . length ( ) - 2 ) { if ( StringUtil . isAllAlpha ( domain . substring ( pos + 1 ) ) ) return true ; try { addr . validate ( ) ; return true ; } catch ( AddressException e ) { } } } return false ; } | returns true if the passed value is a in valid email address format |
22,867 | public static InternetAddress parseEmail ( Object value , InternetAddress defaultValue ) { String str = Caster . toString ( value , "" ) ; if ( str . indexOf ( '@' ) > - 1 ) { try { str = fixIDN ( str ) ; InternetAddress addr = new InternetAddress ( str ) ; return addr ; } catch ( AddressException ex ) { } } return defaultValue ; } | returns an InternetAddress object or null if the parsing fails . to be be used in multiple places . |
22,868 | public static String fixIDN ( String addr ) { int pos = addr . indexOf ( '@' ) ; if ( pos > 0 && pos < addr . length ( ) - 1 ) { String domain = addr . substring ( pos + 1 ) ; if ( ! StringUtil . isAscii ( domain ) ) { domain = IDN . toASCII ( domain ) ; return addr . substring ( 0 , pos ) + "@" + domain ; } } return addr ; } | converts IDN to ASCII if needed |
22,869 | public void reuse ( Tag tag ) { tag . release ( ) ; Queue < Tag > queue = getQueue ( tag . getClass ( ) . getName ( ) ) ; queue . add ( tag ) ; } | free a tag for reusing |
22,870 | public static String executeQuery ( String [ ] cmd ) throws IOException , InterruptedException { return Command . execute ( cmd ) . getOutput ( ) ; } | execute a String query on command line |
22,871 | public static RegistryEntry getValue ( String branch , String entry , short type ) throws RegistryException , IOException , InterruptedException { String [ ] cmd = new String [ ] { "reg" , "query" , cleanBrunch ( branch ) , "/v" , entry } ; RegistryEntry [ ] rst = filter ( executeQuery ( cmd ) , branch , type ) ; if ( rst . length == 1 ) { return rst [ 0 ] ; } return null ; } | gets a single value form the registry |
22,872 | public static RegistryEntry [ ] getValues ( String branch , short type ) throws RegistryException , IOException , InterruptedException { String [ ] cmd = new String [ ] { "reg" , "query" , branch } ; return filter ( executeQuery ( cmd ) , cleanBrunch ( branch ) , type ) ; } | gets all entries of one branch |
22,873 | public static void setValue ( String branch , String entry , short type , String value ) throws RegistryException , IOException , InterruptedException { if ( type == RegistryEntry . TYPE_KEY ) { String fullKey = ListUtil . trim ( branch , "\\" ) + "\\" + ListUtil . trim ( entry , "\\" ) ; String [ ] cmd = new String [ ] { "reg" , "add" , cleanBrunch ( fullKey ) , "/f" } ; executeQuery ( cmd ) ; } else { if ( type == RegistryEntry . TYPE_DWORD ) value = Caster . toString ( Caster . toIntValue ( value , 0 ) ) ; String [ ] cmd = new String [ ] { "reg" , "add" , cleanBrunch ( branch ) , "/v" , entry , "/t" , RegistryEntry . toStringType ( type ) , "/d" , value , "/f" } ; executeQuery ( cmd ) ; } } | writes a value to registry |
22,874 | public static void deleteValue ( String branch , String entry ) throws IOException , InterruptedException { if ( entry == null ) { String [ ] cmd = new String [ ] { "reg" , "delete" , cleanBrunch ( branch ) , "/f" } ; executeQuery ( cmd ) ; } else { String [ ] cmd = new String [ ] { "reg" , "delete" , cleanBrunch ( branch ) , "/v" , entry , "/f" } ; executeQuery ( cmd ) ; } } | deletes a value or a key |
22,875 | private static RegistryEntry [ ] filter ( String string , String branch , short type ) throws RegistryException { branch = ListUtil . trim ( branch , "\\" ) ; StringBuffer result = new StringBuffer ( ) ; ArrayList array = new ArrayList ( ) ; String [ ] arr = string . split ( "\n" ) ; for ( int i = 0 ; i < arr . length ; i ++ ) { String line = arr [ i ] . trim ( ) ; int indexDWORD = line . indexOf ( RegistryEntry . REGDWORD_TOKEN ) ; int indexSTRING = line . indexOf ( RegistryEntry . REGSTR_TOKEN ) ; if ( ( indexDWORD != - 1 ) || ( indexSTRING != - 1 ) ) { int index = ( indexDWORD == - 1 ) ? indexSTRING : indexDWORD ; int len = ( indexDWORD == - 1 ) ? lenSTRING : lenDWORD ; short _type = ( indexDWORD == - 1 ) ? RegistryEntry . TYPE_STRING : RegistryEntry . TYPE_DWORD ; if ( result . length ( ) > 0 ) result . append ( "\n" ) ; String _key = line . substring ( 0 , index ) . trim ( ) ; String _value = StringUtil . substringEL ( line , index + len + 1 , "" ) . trim ( ) ; if ( _key . equals ( NO_NAME ) ) _key = "" ; if ( _type == RegistryEntry . TYPE_DWORD ) _value = String . valueOf ( ParseNumber . invoke ( _value . substring ( 2 ) , "hex" , 0 ) ) ; RegistryEntry re = new RegistryEntry ( _type , _key , _value ) ; if ( type == RegistryEntry . TYPE_ANY || type == re . getType ( ) ) array . add ( re ) ; } else if ( line . indexOf ( branch ) == 0 && ( type == RegistryEntry . TYPE_ANY || type == RegistryEntry . TYPE_KEY ) ) { line = ListUtil . trim ( line , "\\" ) ; if ( branch . length ( ) < line . length ( ) ) { array . add ( new RegistryEntry ( RegistryEntry . TYPE_KEY , ListUtil . last ( line , "\\" , true ) , "" ) ) ; } } } return ( RegistryEntry [ ] ) array . toArray ( new RegistryEntry [ array . size ( ) ] ) ; } | filter registry entries from the raw result |
22,876 | public Object touch ( int row ) { if ( row < 1 || row > size ) return NullSupportHelper . full ( ) ? null : "" ; Object o = data [ row - 1 ] ; if ( o != null ) return o ; return setEL ( row , new StructImpl ( ) ) ; } | touch the given line on the column at given row |
22,877 | public static Object toCFTypex ( SQLItem item ) throws PageException { try { return _toCFTypex ( item ) ; } catch ( PageException e ) { if ( item . isNulls ( ) ) return item . getValue ( ) ; throw e ; } } | cast a Value to a correspondance CF Type |
22,878 | public static String toStringType ( int type , String defaultValue ) { switch ( type ) { case Types . ARRAY : return "CF_SQL_ARRAY" ; case Types . BIGINT : return "CF_SQL_BIGINT" ; case Types . BINARY : return "CF_SQL_BINARY" ; case Types . BIT : return "CF_SQL_BIT" ; case Types . BOOLEAN : return "CF_SQL_BOOLEAN" ; case Types . BLOB : return "CF_SQL_BLOB" ; case Types . CHAR : return "CF_SQL_CHAR" ; case Types . CLOB : return "CF_SQL_CLOB" ; case Types . DATALINK : return "CF_SQL_DATALINK" ; case Types . DATE : return "CF_SQL_DATE" ; case Types . DISTINCT : return "CF_SQL_DISTINCT" ; case Types . NUMERIC : return "CF_SQL_NUMERIC" ; case Types . DECIMAL : return "CF_SQL_DECIMAL" ; case Types . DOUBLE : return "CF_SQL_DOUBLE" ; case Types . REAL : return "CF_SQL_REAL" ; case Types . FLOAT : return "CF_SQL_FLOAT" ; case Types . TINYINT : return "CF_SQL_TINYINT" ; case Types . SMALLINT : return "CF_SQL_SMALLINT" ; case Types . STRUCT : return "CF_SQL_STRUCT" ; case Types . INTEGER : return "CF_SQL_INTEGER" ; case Types . VARCHAR : return "CF_SQL_VARCHAR" ; case Types . NVARCHAR : return "CF_SQL_NVARCHAR" ; case CFTypes . VARCHAR2 : return "CF_SQL_VARCHAR2" ; case Types . LONGVARBINARY : return "CF_SQL_LONGVARBINARY" ; case Types . VARBINARY : return "CF_SQL_VARBINARY" ; case Types . LONGVARCHAR : return "CF_SQL_LONGVARCHAR" ; case Types . TIME : return "CF_SQL_TIME" ; case Types . TIMESTAMP : return "CF_SQL_TIMESTAMP" ; case Types . REF : return "CF_SQL_REF" ; case CFTypes . CURSOR : return "CF_SQL_REFCURSOR" ; case Types . OTHER : return "CF_SQL_OTHER" ; case Types . NULL : return "CF_SQL_NULL" ; default : return null ; } } | returns CF SQL Type as String |
22,879 | public void setMailLog ( String logFile , String level ) throws PageException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_MAIL ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update mail server settings" ) ; ConfigWebUtil . getFile ( config , config . getRootDirectory ( ) , logFile , FileUtil . TYPE_FILE ) ; Element logging = XMLConfigWebFactory . getChildByName ( doc . getDocumentElement ( ) , "logging" ) ; Element [ ] children = XMLUtil . getChildElementsAsArray ( logging ) ; Element logger = null ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( children [ i ] . getTagName ( ) . equals ( "logger" ) && "mail" . equalsIgnoreCase ( children [ i ] . getAttribute ( "name" ) ) ) { logger = children [ i ] ; break ; } } if ( logger == null ) { logger = doc . createElement ( "logger" ) ; logging . appendChild ( logger ) ; } logger . setAttribute ( "name" , "mail" ) ; if ( "console" . equalsIgnoreCase ( logFile ) ) { setClass ( logger , null , "appender-" , Log4jUtil . appenderClassDefintion ( "console" ) ) ; setClass ( logger , null , "layout-" , Log4jUtil . layoutClassDefintion ( "pattern" ) ) ; } else { setClass ( logger , null , "appender-" , Log4jUtil . appenderClassDefintion ( "resource" ) ) ; setClass ( logger , null , "layout-" , Log4jUtil . layoutClassDefintion ( "classic" ) ) ; logger . setAttribute ( "appender-arguments" , "path:" + logFile ) ; } logger . setAttribute ( "log-level" , level ) ; } | sets Mail Logger to Config |
22,880 | public void setMailSpoolEnable ( Boolean spoolEnable ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_MAIL ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update mail server settings" ) ; Element mail = _getRootElement ( "mail" ) ; mail . setAttribute ( "spool-enable" , Caster . toString ( spoolEnable , "" ) ) ; } | sets if spool is enable or not |
22,881 | public void setMailTimeout ( Integer timeout ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_MAIL ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update mail server settings" ) ; Element mail = _getRootElement ( "mail" ) ; mail . setAttribute ( "timeout" , Caster . toString ( timeout , "" ) ) ; } | sets the timeout for the spooler for one job |
22,882 | public void setMailDefaultCharset ( String charset ) throws PageException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_MAIL ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update mail server settings" ) ; if ( ! StringUtil . isEmpty ( charset ) ) { try { IOUtil . checkEncoding ( charset ) ; } catch ( IOException e ) { throw Caster . toPageException ( e ) ; } } Element mail = _getRootElement ( "mail" ) ; mail . setAttribute ( "default-encoding" , charset ) ; } | sets the charset for the mail |
22,883 | public void updateMailServer ( int id , String hostName , String username , String password , int port , boolean tls , boolean ssl , long lifeTimeSpan , long idleTimeSpan , boolean reuseConnections ) throws PageException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_MAIL ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update mail server settings" ) ; Element mail = _getRootElement ( "mail" ) ; if ( port < 1 ) port = 21 ; if ( hostName == null || hostName . trim ( ) . length ( ) == 0 ) throw new ExpressionException ( "Host (SMTP) can be a empty value" ) ; hostName = hostName . trim ( ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( mail , "server" ) ; boolean checkId = id > 0 ; Element server = null ; String _hostName , _username ; for ( int i = 0 ; i < children . length ; i ++ ) { Element el = children [ i ] ; if ( checkId ) { if ( i + 1 == id ) { server = el ; break ; } } else { _hostName = StringUtil . emptyIfNull ( el . getAttribute ( "smtp" ) ) ; _username = StringUtil . emptyIfNull ( el . getAttribute ( "username" ) ) ; if ( _hostName . equalsIgnoreCase ( hostName ) && _username . equals ( StringUtil . emptyIfNull ( username ) ) ) { server = el ; break ; } } } if ( server == null ) { server = doc . createElement ( "server" ) ; mail . appendChild ( XMLCaster . toRawNode ( server ) ) ; } server . setAttribute ( "smtp" , hostName ) ; server . setAttribute ( "username" , username ) ; server . setAttribute ( "password" , ConfigWebUtil . encrypt ( password ) ) ; server . setAttribute ( "port" , Caster . toString ( port ) ) ; server . setAttribute ( "tls" , Caster . toString ( tls ) ) ; server . setAttribute ( "ssl" , Caster . toString ( ssl ) ) ; server . setAttribute ( "life" , Caster . toString ( lifeTimeSpan ) ) ; server . setAttribute ( "idle" , Caster . toString ( idleTimeSpan ) ) ; server . setAttribute ( "reuse-connection" , Caster . toString ( reuseConnections ) ) ; } | insert or update a mailserver on system |
22,884 | public void removeMailServer ( String hostName , String username ) throws SecurityException { checkWriteAccess ( ) ; Element mail = _getRootElement ( "mail" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( mail , "server" ) ; String _hostName , _username ; if ( children . length > 0 ) { for ( int i = 0 ; i < children . length ; i ++ ) { Element el = children [ i ] ; _hostName = el . getAttribute ( "smtp" ) ; _username = el . getAttribute ( "username" ) ; if ( StringUtil . emptyIfNull ( _hostName ) . equalsIgnoreCase ( StringUtil . emptyIfNull ( hostName ) ) && StringUtil . emptyIfNull ( _username ) . equalsIgnoreCase ( StringUtil . emptyIfNull ( username ) ) ) { mail . removeChild ( children [ i ] ) ; } } } } | removes a mailserver from system |
22,885 | public void updateMapping ( String virtual , String physical , String archive , String primary , short inspect , boolean toplevel , int listenerMode , int listenerType , boolean readOnly ) throws ExpressionException , SecurityException { checkWriteAccess ( ) ; _updateMapping ( virtual , physical , archive , primary , inspect , toplevel , listenerMode , listenerType , readOnly ) ; } | insert or update a mapping on system |
22,886 | public void removeCustomTag ( String virtual ) throws SecurityException { checkWriteAccess ( ) ; Element mappings = _getRootElement ( "custom-tag" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( mappings , "mapping" ) ; for ( int i = 0 ; i < children . length ; i ++ ) { if ( virtual . equals ( createVirtual ( children [ i ] ) ) ) mappings . removeChild ( children [ i ] ) ; } } | delete a customtagmapping on system |
22,887 | public void updateCustomTag ( String virtual , String physical , String archive , String primary , short inspect ) throws ExpressionException , SecurityException { checkWriteAccess ( ) ; _updateCustomTag ( virtual , physical , archive , primary , inspect ) ; } | insert or update a mapping for Custom Tag |
22,888 | 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" ) ; 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 ; } } 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 |
22,889 | public static boolean fixSalt ( Document doc ) { Element root = doc . getDocumentElement ( ) ; String salt = root . getAttribute ( "salt" ) ; if ( StringUtil . isEmpty ( salt , true ) || ! Decision . isUUId ( salt ) ) { root . setAttribute ( "salt" , CreateUUID . invoke ( ) ) ; return true ; } return false ; } | make sure every context has a salt |
22,890 | public void removeCFX ( String name ) throws ExpressionException , SecurityException { checkWriteAccess ( ) ; if ( name == null || name . length ( ) == 0 ) throw new ExpressionException ( "name for CFX Tag can be a empty value" ) ; renameOldstyleCFX ( ) ; Element mappings = _getRootElement ( "ext-tags" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( mappings , "ext-tag" ) ; for ( int i = 0 ; i < children . length ; i ++ ) { String n = children [ i ] . getAttribute ( "name" ) ; if ( n != null && n . equalsIgnoreCase ( name ) ) { mappings . removeChild ( children [ i ] ) ; } } } | remove a CFX Tag |
22,891 | public void removeDataSource ( String name ) throws ExpressionException , SecurityException { checkWriteAccess ( ) ; if ( name == null || name . length ( ) == 0 ) throw new ExpressionException ( "name for Datasource Connection can be a empty value" ) ; Element datasources = _getRootElement ( "data-sources" ) ; Element [ ] children = XMLConfigWebFactory . getChildren ( datasources , "data-source" ) ; for ( int i = 0 ; i < children . length ; i ++ ) { String n = children [ i ] . getAttribute ( "name" ) ; if ( n != null && n . equalsIgnoreCase ( name ) ) { datasources . removeChild ( children [ i ] ) ; } } } | remove a DataSource Connection |
22,892 | public void updatePSQ ( Boolean psq ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_DATASOURCE ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update datsource connections" ) ; Element datasources = _getRootElement ( "data-sources" ) ; datasources . setAttribute ( "psq" , Caster . toString ( psq , "" ) ) ; if ( datasources . hasAttribute ( "preserve-single-quote" ) ) datasources . removeAttribute ( "preserve-single-quote" ) ; } | update PSQ State |
22,893 | public void updateAllowImplicidQueryCall ( Boolean allow ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element scope = _getRootElement ( "scope" ) ; scope . setAttribute ( "cascade-to-resultset" , Caster . toString ( allow , "" ) ) ; } | sets if allowed implicid query call |
22,894 | public void updateApplicationTimeout ( TimeSpan span ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element scope = _getRootElement ( "scope" ) ; if ( span != null ) scope . setAttribute ( "applicationtimeout" , span . getDay ( ) + "," + span . getHour ( ) + "," + span . getMinute ( ) + "," + span . getSecond ( ) ) ; else scope . removeAttribute ( "applicationtimeout" ) ; } | updates request timeout value |
22,895 | public void updateSessionManagement ( Boolean sessionManagement ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element scope = _getRootElement ( "scope" ) ; scope . setAttribute ( "sessionmanagement" , Caster . toString ( sessionManagement , "" ) ) ; } | enable or desable session management |
22,896 | public void updateClientManagement ( Boolean clientManagement ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element scope = _getRootElement ( "scope" ) ; scope . setAttribute ( "clientmanagement" , Caster . toString ( clientManagement , "" ) ) ; } | enable or desable client management |
22,897 | public void updateClientCookies ( Boolean clientCookies ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element scope = _getRootElement ( "scope" ) ; scope . setAttribute ( "setclientcookies" , Caster . toString ( clientCookies , "" ) ) ; } | set if client cookies are enabled or not |
22,898 | public void updateMode ( Boolean developmode ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element mode = _getRootElement ( "mode" ) ; mode . setAttribute ( "develop" , Caster . toString ( developmode , "" ) ) ; } | set if it s develop mode or not |
22,899 | public void updateDomaincookies ( Boolean domainCookies ) throws SecurityException { checkWriteAccess ( ) ; boolean hasAccess = ConfigWebUtil . hasAccess ( config , SecurityManager . TYPE_SETTING ) ; if ( ! hasAccess ) throw new SecurityException ( "no access to update scope setting" ) ; Element scope = _getRootElement ( "scope" ) ; scope . setAttribute ( "setdomaincookies" , Caster . toString ( domainCookies , "" ) ) ; } | set if domain cookies are enabled or not |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.