idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
16,700 | public int setString ( String string , boolean bDisplayOption , int moveMode ) { boolean bNewState = ! this . getNextConverter ( ) . getState ( ) ; return this . getNextConverter ( ) . setState ( bNewState , bDisplayOption , moveMode ) ; } | Convert and move string to this field . Toggle the field value . Override this method to convert the String to the actual Physical Data Type . |
16,701 | private static < X > Predicate < X > isCandidate ( final Iterable < List < X > > remainingInputs ) { return new Predicate < X > ( ) { Predicate < List < X > > headIs ( final X c ) { return new Predicate < List < X > > ( ) { public boolean apply ( List < X > input ) { return ! input . isEmpty ( ) && c . equals ( input . get ( 0 ) ) ; } } ; } Predicate < List < X > > tailContains ( final X c ) { return new Predicate < List < X > > ( ) { public boolean apply ( List < X > input ) { return input . indexOf ( c ) > 0 ; } } ; } public boolean apply ( final X c ) { return any ( remainingInputs , headIs ( c ) ) && all ( remainingInputs , not ( tailContains ( c ) ) ) ; } } ; } | To be a candidate for the next place in the linearization you must be the head of at least one list and in the tail of none of the lists . |
16,702 | public void join ( SelectableBySelector ch1 , SelectableBySelector ch2 ) throws IOException { join ( ch1 . getSelector ( ) , ch2 . getSelector ( ) , ( ByteChannel ) ch1 , ( ByteChannel ) ch2 ) ; } | Join channel pair to this virtual circuit |
16,703 | public List < BroadCategory > getBroadCategories ( ) { ClientResource resource = new ClientResource ( Route . BROAD_CATEGORY . url ( ) ) ; try { Representation repr = resource . get ( ) ; return mapper . readValue ( repr . getText ( ) , new TypeReference < List < BroadCategory > > ( ) { } ) ; } catch ( IOException ex ) { LEX4JLogger . log ( Level . WARNING , "Could not retrieve broad categories correctly!" ) ; return null ; } } | Returns the broad categories |
16,704 | public List < Category > getLEXCategories ( ) { ClientResource resource = new ClientResource ( Route . LEX_CATEGORY . url ( ) ) ; try { Representation repr = resource . get ( ) ; return mapper . readValue ( repr . getText ( ) , new TypeReference < List < Category > > ( ) { } ) ; } catch ( IOException ex ) { LEX4JLogger . log ( Level . WARNING , "Could not retrieve LEX categories correctly!" ) ; return null ; } } | Returns the LEX categories |
16,705 | public List < TypeCategory > getLEXTypes ( ) { ClientResource resource = new ClientResource ( Route . LEX_TYPE . url ( ) ) ; try { Representation repr = resource . get ( ) ; return mapper . readValue ( repr . getText ( ) , new TypeReference < List < TypeCategory > > ( ) { } ) ; } catch ( IOException ex ) { LEX4JLogger . log ( Level . WARNING , "Could not retrieve LEX types correctly!" ) ; return null ; } } | Returns the LEX types |
16,706 | public List < GroupCategory > getLotGroups ( ) { ClientResource resource = new ClientResource ( Route . LOTGROUP . url ( ) ) ; try { Representation repr = resource . get ( ) ; return mapper . readValue ( repr . getText ( ) , new TypeReference < List < GroupCategory > > ( ) { } ) ; } catch ( IOException ex ) { LEX4JLogger . log ( Level . WARNING , "Could not retrieve lot groups correctly!" ) ; return null ; } } | Returns the lot groups |
16,707 | public CategoryOverview getCategories ( ) { ClientResource resource = new ClientResource ( Route . ALL_CATEGORY . url ( ) ) ; try { Representation repr = resource . get ( ) ; return mapper . readValue ( repr . getText ( ) , CategoryOverview . class ) ; } catch ( IOException ex ) { LEX4JLogger . log ( Level . WARNING , "Could not retrieve the categories correctly!" ) ; return null ; } } | Returns all the categories |
16,708 | public void write ( char [ ] cbuf , int off , int len ) throws IOException { for ( int count = 0 ; count < len ; ++ off , ++ count ) { char c = cbuf [ off ] ; switch ( state ) { case TEXT : if ( c == '$' ) { state = State . VARIABLE_MARK ; } else { targetWriter . write ( c ) ; } break ; case VARIABLE_MARK : if ( c == '{' ) { state = State . VARIABLE ; variableBuilder . setLength ( 0 ) ; } else { targetWriter . write ( '$' ) ; targetWriter . write ( c ) ; state = State . TEXT ; } break ; case VARIABLE : if ( c == '}' ) { String variable = variables . get ( variableBuilder . toString ( ) ) ; if ( variable == null ) { targetWriter . write ( "${" ) ; targetWriter . write ( variableBuilder . toString ( ) ) ; targetWriter . write ( '}' ) ; } else { targetWriter . write ( variable ) ; } state = State . TEXT ; } else { variableBuilder . append ( c ) ; } break ; default : throw new IllegalStateException ( ) ; } } } | Inject values into given variables stream and write the result to target writer . |
16,709 | public String getButtonDesc ( ) { if ( this . getDisplayFieldDesc ( this ) == false ) return null ; if ( this . getSeparateFieldDesc ( ) ) return null ; if ( this . getConverter ( ) != null ) return this . getConverter ( ) . getFieldDesc ( ) ; return null ; } | Get the button description . |
16,710 | public String getButtonCommand ( ) { String strCommand = m_strCommand ; if ( strCommand == null ) strCommand = this . getButtonDesc ( ) ; if ( ( strCommand == null ) || ( strCommand . equals ( Constants . BLANK ) ) ) strCommand = m_strImageButton ; return strCommand ; } | Get the best guess for the command name . This is usually used to get the command to perform for a canned button . |
16,711 | public int getMaxLength ( ) { String string ; int maxLength = 1 ; for ( int index = 0 ; index < 10 ; index ++ ) { string = this . getNextConverter ( ) . convertIndexToDisStr ( index ) ; if ( index > 0 ) if ( string . length ( ) == 0 ) break ; if ( string . length ( ) > ( short ) maxLength ) maxLength = string . length ( ) ; } return maxLength ; } | Get the maximum length of this field . Survey the first 10 items in the display list and return the longest length . |
16,712 | public int setString ( String fieldPtr , boolean bDisplayOption , int moveMode ) { int index = ( ( NumberField ) this . getNextConverter ( ) ) . convertStringToIndex ( fieldPtr ) ; return this . getNextConverter ( ) . setValue ( index , bDisplayOption , moveMode ) ; } | Convert and move string to this field . Convert this string to an index and set the index value . Override this method to convert the String to the actual Physical Data Type . |
16,713 | public void setFullFileName ( String fullFileName ) { fullFileName = StringSupport . replaceAll ( fullFileName , "\\" , "/" ) ; fullFileName = StringSupport . replaceAll ( fullFileName , "//" , "/" ) ; int lastFileSeparator = fullFileName . lastIndexOf ( '/' ) ; if ( lastFileSeparator != - 1 ) { path = fullFileName . substring ( 0 , lastFileSeparator ) ; } else { path = "" ; } setFileName ( fullFileName . substring ( lastFileSeparator + 1 , fullFileName . length ( ) ) ) ; } | Sets the file name including path and extension |
16,714 | public String getMessage ( Task task ) { String strError = null ; switch ( m_iErrorCode ) { case DBConstants . NORMAL_RETURN : strError = "Normal return" ; break ; case DBConstants . END_OF_FILE : strError = "End of file" ; break ; case DBConstants . KEY_NOT_FOUND : strError = "Key not found" ; break ; case DBConstants . DUPLICATE_KEY : strError = "Duplicate key" ; break ; case DBConstants . FILE_NOT_OPEN : strError = "File not open" ; break ; case DBConstants . FILE_ALREADY_OPEN : strError = "File already open" ; break ; case DBConstants . FILE_TABLE_FULL : strError = "File table full" ; break ; case DBConstants . FILE_INCONSISTENCY : strError = "File inconsistency" ; break ; case DBConstants . INVALID_RECORD : strError = "Invalid record" ; break ; case DBConstants . FILE_NOT_FOUND : strError = "File not found" ; break ; case DBConstants . INVALID_KEY : strError = "Invalid Key" ; break ; case DBConstants . FILE_ALREADY_EXISTS : strError = "File Already Exists" ; break ; case DBConstants . NULL_FIELD : strError = "Null field" ; break ; case DBConstants . READ_NOT_NEW : strError = "Read not new" ; break ; case DBConstants . NO_ACTIVE_QUERY : strError = "No active query" ; break ; case DBConstants . RECORD_NOT_LOCKED : strError = "Record not locked" ; break ; case DBConstants . RETRY_ERROR : strError = "Retry error" ; break ; case DBConstants . ERROR_READ_ONLY : strError = "Can't update read only file" ; break ; case DBConstants . ERROR_APPEND_ONLY : strError = "Can't update append only file" ; break ; case DBConstants . RECORD_LOCKED : strError = "Record locked" ; break ; case DBConstants . BROKEN_PIPE : strError = "Broken Pipe" ; break ; case DBConstants . DUPLICATE_COUNTER : strError = "Duplicate counter" ; break ; case DBConstants . DB_NOT_FOUND : strError = "Database not found" ; break ; case DBConstants . NEXT_ERROR_CODE : case DBConstants . ERROR_RETURN : case DBConstants . ERROR_STRING : default : strError = super . getMessage ( ) ; if ( ( strError == null ) || ( strError . length ( ) == 0 ) || ( strError . startsWith ( "null" ) ) ) if ( task != null ) { strError = task . getLastError ( m_iErrorCode ) ; if ( ( strError != null ) && ( strError . length ( ) > 0 ) ) break ; } break ; } return strError ; } | Return the error message . |
16,715 | public static DatabaseException toDatabaseException ( Exception ex ) { if ( ex instanceof DatabaseException ) return ( DatabaseException ) ex ; int iErrorCode = DBConstants . ERROR_STRING ; if ( ex instanceof DBException ) iErrorCode = ( ( DBException ) ex ) . getErrorCode ( ) ; String strMessage = ex . getMessage ( ) ; if ( strMessage != null ) if ( strMessage . startsWith ( DBEXCEPTION_TEXT ) ) { int iNextPos = strMessage . indexOf ( ' ' , DBEXCEPTION_TEXT . length ( ) ) ; if ( iNextPos != - 1 ) { iErrorCode = Integer . parseInt ( strMessage . substring ( DBEXCEPTION_TEXT . length ( ) , iNextPos ) ) ; if ( iNextPos + 1 < strMessage . length ( ) ) strMessage = strMessage . substring ( iNextPos + 1 ) ; } } return new DatabaseException ( iErrorCode , strMessage ) ; } | Convert a normal Exception to a DBException . |
16,716 | public Record getSubRecord ( ) { if ( m_recDependent == null ) m_recDependent = this . createSubRecord ( ) ; if ( m_recDependent != null ) { if ( m_recDependent . getListener ( SubFileFilter . class . getName ( ) ) == null ) m_recDependent . addListener ( new SubFileFilter ( this . getOwner ( ) ) ) ; } return m_recDependent ; } | Get the sub - record . |
16,717 | public Record createSubRecord ( ) { Record record = ( Record ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( m_strSubFile ) ; if ( record != null ) { RecordOwner recordOwner = Record . findRecordOwner ( this . getOwner ( ) ) ; record . init ( recordOwner ) ; if ( recordOwner != null ) recordOwner . removeRecord ( record ) ; this . getOwner ( ) . addListener ( new FreeOnFreeHandler ( record ) ) ; } return record ; } | Create the sub - record . Override this method to create a sub - record . |
16,718 | public void addTocError ( final BaseTopicWrapper < ? > topic , final ErrorType errorType , final String error ) { addItem ( topic , error , ErrorLevel . ERROR , errorType ) ; } | Add a error for a topic that was included in the TOC |
16,719 | public boolean isMainMenu ( ) { boolean bIsMainMenu = false ; if ( m_strMenu != null ) { if ( this . getTask ( ) != null ) if ( HtmlConstants . MAIN_MENU_KEY . equalsIgnoreCase ( this . getTask ( ) . getProperty ( DBParams . MENU ) ) ) bIsMainMenu = true ; if ( m_strMenu . equalsIgnoreCase ( HtmlConstants . MAIN_MENU_KEY ) ) bIsMainMenu = true ; else if ( ( ( this . getProperty ( DBParams . HOME ) == null ) || ( this . getProperty ( DBParams . HOME ) . length ( ) == 0 ) ) && ( DBConstants . ANON_USER_ID . equals ( this . getProperty ( DBParams . USER_ID ) ) ) ) bIsMainMenu = true ; } return bIsMainMenu ; } | Is this the user s main menu? |
16,720 | public String getMenuLink ( Record recMenu ) { String strRecordClass = recMenu . getClass ( ) . getName ( ) ; String strLink = HtmlConstants . SERVLET_LINK ; strLink = Utility . addURLParam ( strLink , DBParams . RECORD , strRecordClass ) ; strLink = Utility . addURLParam ( strLink , DBParams . COMMAND , MenuConstants . FORM ) ; if ( ( recMenu . getEditMode ( ) == Constants . EDIT_IN_PROGRESS ) || ( recMenu . getEditMode ( ) == Constants . EDIT_CURRENT ) ) { try { String strBookmark = recMenu . getHandle ( DBConstants . OBJECT_ID_HANDLE ) . toString ( ) ; strLink = Utility . addURLParam ( strLink , DBConstants . STRING_OBJECT_ID_HANDLE , strBookmark ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; } } return strLink ; } | Get menu link . |
16,721 | public Object getRemoteSession ( ) { Object remoteSession = super . getRemoteSession ( ) ; if ( remoteSession == null ) if ( this . getMessageSource ( ) instanceof Record ) { Record record = ( Record ) this . getMessageSource ( ) ; BaseTable table = record . getTable ( ) . getCurrentTable ( ) ; if ( DBParams . CLIENT . equals ( table . getSourceType ( ) ) ) remoteSession = ( RemoteSession ) table . getRemoteTableType ( org . jbundle . model . Remote . class ) ; } return remoteSession ; } | Try to figure out the remote session that this filter belongs to . In this case the remotesession should be the RecordOwner . |
16,722 | public boolean isSendRemoteMessage ( BaseMessage message ) { if ( message instanceof RecordMessage ) { RecordMessageHeader recMessageHeader = ( RecordMessageHeader ) message . getMessageHeader ( ) ; int iChangeType = recMessageHeader . getRecordMessageType ( ) ; if ( m_iDatabaseType == recMessageHeader . getDatabaseType ( ) ) if ( DBParams . CLIENT . equals ( recMessageHeader . getSourceType ( ) ) ) { if ( ! ( this instanceof GridRecordMessageFilter ) ) if ( ( iChangeType == DBConstants . AFTER_UPDATE_TYPE ) || ( iChangeType == DBConstants . AFTER_ADD_TYPE ) || ( iChangeType == DBConstants . AFTER_DELETE_TYPE ) ) return false ; if ( this instanceof GridRecordMessageFilter ) if ( iChangeType == DBConstants . AFTER_REQUERY_TYPE ) return false ; } } return super . isSendRemoteMessage ( message ) ; } | Do I send this message to the remote server? |
16,723 | public boolean isSameFilter ( BaseMessageFilter filter ) { if ( filter . getClass ( ) . equals ( this . getClass ( ) ) ) { if ( this . get ( DB_NAME ) != null ) if ( this . get ( DB_NAME ) . equals ( filter . get ( DB_NAME ) ) ) if ( this . get ( TABLE_NAME ) != null ) if ( this . get ( TABLE_NAME ) . equals ( filter . get ( TABLE_NAME ) ) ) { return true ; } if ( filter . isFilterMatch ( this ) ) ; } return false ; } | Are these filters functionally the same? |
16,724 | public < T > Set < Class < ? extends T > > findAnotatedClasses ( String scanPath , Class < ? extends Annotation > annotationClass , Class < T > ofType ) throws IOException { Set < Class < ? extends T > > classes = new HashSet < Class < ? extends T > > ( ) ; if ( scanPath . contains ( "." ) ) { scanPath = scanPath . replace ( '.' , '/' ) ; } String [ ] scanPaths = scanPath . split ( "," ) ; String includeRegExp = buildIncludeRegExp ( scanPaths ) ; Set < URL > urls = resolverUrls ( scanPaths ) ; Map < String , Set < String > > annotationIndex = scanForAnnotatedClasses ( urls ) ; Set < String > classNames = annotationIndex . get ( annotationClass . getName ( ) ) ; if ( classNames != null ) { for ( String className : classNames ) { addClass ( classes , includeRegExp , className , ofType , annotationClass ) ; } } return classes ; } | Scan classpath for packages matching scanPath for classes annotated with the supplied annotationClass that extends or implements the supplied ofType . |
16,725 | @ SuppressWarnings ( "unchecked" ) private < T > void addClass ( Set < Class < ? extends T > > classes , String includeRegExp , String className , Class < T > ofType , Class < ? extends Annotation > annotationClass ) { if ( className . matches ( includeRegExp ) ) { try { Class < ? > matchingClass = Class . forName ( className ) ; matchingClass . asSubclass ( ofType ) ; classes . add ( ( Class < T > ) matchingClass ) ; } catch ( ClassNotFoundException cnfe ) { throw new IllegalStateException ( "Scannotation found a class that does not exist " + className + " !" , cnfe ) ; } catch ( ClassCastException cce ) { throw new IllegalStateException ( "Class " + className + " is annoted with @" + annotationClass + " but does not extend or implement " + ofType ) ; } } } | Created and adds the event to the eventsFound set if its package matches the includeRegExp . |
16,726 | private Set < URL > resolverUrls ( String [ ] scanPaths ) { Set < URL > urls = new HashSet < URL > ( ) ; for ( String path : scanPaths ) { URL [ ] urlsFromPath = ClasspathUrlFinder . findResourceBases ( path . trim ( ) ) ; urls . addAll ( Arrays . asList ( urlsFromPath ) ) ; } return urls ; } | Returns the URLs which has classes from scanPaths . |
16,727 | private String buildIncludeRegExp ( String [ ] scanPaths ) { String includeRegExp = "" ; for ( String path : scanPaths ) { includeRegExp += path . trim ( ) . replace ( "/" , "\\." ) + ".*|" ; } if ( scanPaths . length > 0 ) { includeRegExp = includeRegExp . substring ( 0 , includeRegExp . length ( ) - 1 ) ; } return includeRegExp ; } | Returns a regular expression of acceptable package names . |
16,728 | private Map < String , Set < String > > scanForAnnotatedClasses ( Set < URL > urls ) throws IOException { AnnotationDB db = new AnnotationDB ( ) ; db . setScanClassAnnotations ( true ) ; db . setScanFieldAnnotations ( false ) ; db . setScanMethodAnnotations ( false ) ; db . setScanParameterAnnotations ( false ) ; db . scanArchives ( urls . toArray ( new URL [ urls . size ( ) ] ) ) ; return db . getAnnotationIndex ( ) ; } | Scans for classes in URLs . |
16,729 | private void registerConverterInstance ( Class < ? > valueType , Converter converter ) { if ( converters . put ( valueType , converter ) == null ) { log . debug ( "Register converter |%s| for value type |%s|." , converter . getClass ( ) , valueType ) ; } else { log . warn ( "Override converter |%s| for value type |%s|." , converter . getClass ( ) , valueType ) ; } } | Utility method to bind converter instance to concrete value type . |
16,730 | public void init ( BaseField field , Field sourceField , Object sourceString , boolean bInitIfSourceNull , boolean bOnlyInitIfDestNull ) { super . init ( field ) ; m_objSource = sourceString ; m_fldSource = ( BaseField ) sourceField ; m_bInitIfSourceNull = bInitIfSourceNull ; m_bOnlyInitIfDestNull = bOnlyInitIfDestNull ; m_bScreenMove = false ; m_bInitMove = true ; m_bReadMove = false ; } | Constructor . Only responds to init moves . |
16,731 | public int fieldChanged ( boolean bDisplayOption , int iMoveMode ) { if ( m_fldSource != null ) { if ( ( ( m_bInitIfSourceNull == true ) || ( ! m_fldSource . isNull ( ) ) ) && ( ( m_bOnlyInitIfDestNull == false ) || ( m_bOnlyInitIfDestNull == true ) && ( this . getOwner ( ) . isNull ( ) ) ) ) { boolean bModified = this . getOwner ( ) . isModified ( ) ; int iErrorCode = this . getOwner ( ) . moveFieldToThis ( m_fldSource , bDisplayOption , iMoveMode ) ; this . getOwner ( ) . setModified ( bModified ) ; return iErrorCode ; } else return super . fieldChanged ( bDisplayOption , iMoveMode ) ; } else { if ( m_objSource instanceof String ) return this . getOwner ( ) . setString ( m_objSource . toString ( ) , bDisplayOption , iMoveMode ) ; else return this . getOwner ( ) . setData ( m_objSource , bDisplayOption , iMoveMode ) ; } } | The Field has Changed . Move the source field or string to this listener s owner . |
16,732 | public void init ( BaseApplet baseApplet , RemoteSession remoteSession , String strDescription , String objID , String strRecordName ) { m_baseApplet = baseApplet ; m_remoteSession = remoteSession ; m_strDescription = strDescription ; m_objID = objID ; m_strRecordName = strRecordName ; } | Constructs a new instance of SampleData with the passed in arguments . |
16,733 | public FieldList makeRecord ( ) { FieldList record = null ; try { Map < String , Object > properties = new Hashtable < String , Object > ( ) ; properties . put ( "description" , m_strDescription ) ; if ( m_objID != null ) properties . put ( "id" , m_objID ) ; String strSubRecordName = this . getSubRecordClassName ( ) ; if ( strSubRecordName != null ) properties . put ( "record" , strSubRecordName ) ; m_remoteSession . doRemoteAction ( "requery" , properties ) ; RemoteTable remoteTable = m_remoteSession . getRemoteTable ( strSubRecordName ) ; record = remoteTable . makeFieldList ( null ) ; new org . jbundle . thin . base . db . client . RemoteFieldTable ( record , remoteTable , m_baseApplet ) ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } return record ; } | Returns the field list . |
16,734 | public String getSubRecordClassName ( ) { for ( int i = 0 ; i < m_rgstrRecordHierarchy . length - 1 ; i ++ ) { if ( m_rgstrRecordHierarchy [ i ] . equalsIgnoreCase ( m_strRecordName ) ) return m_rgstrRecordHierarchy [ i + 1 ] ; } return null ; } | Get the next logical sub - record class given this record s class . |
16,735 | public String soundex ( String s ) { String sound = "01230120022455012623010202" ; char code [ ] = { '0' , '0' , '0' , '0' } ; if ( ( s == null ) || ( s . length ( ) == 0 ) ) return null ; code [ 0 ] = Character . toUpperCase ( s . charAt ( 0 ) ) ; if ( ! Character . isLetter ( code [ 0 ] ) ) return null ; int iSrc = 0 ; int iDest = 1 ; char ch ; while ( iSrc < s . length ( ) ) { if ( iDest >= 4 ) break ; iSrc ++ ; if ( ! Character . isLetter ( s . charAt ( iSrc ) ) ) continue ; ch = sound . charAt ( Character . toUpperCase ( s . charAt ( iSrc ) ) - 'A' ) ; if ( ( ch == '0' ) || ( ch == code [ iDest - 1 ] ) ) continue ; code [ iDest ++ ] = ch ; } return new String ( code ) ; } | Convert this four character string to a soundex string . |
16,736 | @ Around ( "execution(* *(..)) && @annotation(TimerJ)" ) public Object around ( ProceedingJoinPoint point ) throws Throwable { String methodName = MethodSignature . class . cast ( point . getSignature ( ) ) . getMethod ( ) . getName ( ) ; String methodArgs = point . getArgs ( ) . toString ( ) ; MetricRegistry metricRegistry = Metrics . getRegistry ( ) ; Timer timer ; String metricName = "Starting method " + methodName + "at " + System . nanoTime ( ) ; synchronized ( this ) { if ( metricRegistry . getTimers ( ) . containsKey ( methodName ) ) { timer = metricRegistry . getTimers ( ) . get ( metricName ) ; } else { timer = metricRegistry . register ( metricName , new Timer ( ) ) ; } } Timer . Context before = timer . time ( ) ; Object result = point . proceed ( ) ; long timeAfter = before . stop ( ) ; logger . debug ( "Method " + methodName + " with args " + methodArgs + " executed in " + timeAfter + " ns" ) ; return result ; } | Function that register metrics . |
16,737 | public static Integer getContentSpecID ( final String contentSpecString ) { final Matcher matcher = CS_ID_PATTERN . matcher ( contentSpecString ) ; if ( matcher . find ( ) ) { return Integer . parseInt ( matcher . group ( "ID" ) ) ; } return null ; } | Get the ID of a Content Specification object . |
16,738 | public static String replaceChecksum ( final String contentSpecString , final String checksum ) { Matcher matcher = CS_CHECKSUM_PATTERN . matcher ( contentSpecString ) ; if ( matcher . find ( ) ) { return matcher . replaceFirst ( "CHECKSUM=" + checksum + "\n" ) ; } return contentSpecString ; } | Replaces the checksum of a Content Spec with a new checksum value |
16,739 | public static List < CSNodeWrapper > getAllNodes ( final ContentSpecWrapper contentSpec ) { final List < CSNodeWrapper > nodes = new LinkedList < CSNodeWrapper > ( ) ; if ( contentSpec . getChildren ( ) != null ) { final List < CSNodeWrapper > childrenNodes = contentSpec . getChildren ( ) . getItems ( ) ; for ( final CSNodeWrapper childNode : childrenNodes ) { nodes . add ( childNode ) ; nodes . addAll ( getAllChildrenNodes ( childNode ) ) ; } } return nodes ; } | Recursively find all of a Content Specs child nodes . |
16,740 | public static List < CSNodeWrapper > getAllChildrenNodes ( final CSNodeWrapper csNode ) { final List < CSNodeWrapper > nodes = new LinkedList < CSNodeWrapper > ( ) ; if ( csNode . getChildren ( ) != null ) { final List < CSNodeWrapper > childrenNodes = csNode . getChildren ( ) . getItems ( ) ; for ( final CSNodeWrapper childNode : childrenNodes ) { nodes . add ( childNode ) ; nodes . addAll ( getAllChildrenNodes ( childNode ) ) ; } } return nodes ; } | Recursively find all of a Content Spec Nodes children . |
16,741 | public static boolean isSpecTopicMetaData ( final String key ) { return key . equalsIgnoreCase ( CommonConstants . CS_LEGAL_NOTICE_TITLE ) || key . equalsIgnoreCase ( CommonConstants . CS_REV_HISTORY_TITLE ) || key . equalsIgnoreCase ( CommonConstants . CS_FEEDBACK_TITLE ) || key . equalsIgnoreCase ( CommonConstants . CS_AUTHOR_GROUP_TITLE ) || key . equalsIgnoreCase ( CommonConstants . CS_ABSTRACT_TITLE ) || key . equalsIgnoreCase ( CommonConstants . CS_ABSTRACT_ALTERNATE_TITLE ) ; } | Check to see if a Meta Data line is a Spec Topic Meta Data based on the key value . |
16,742 | public static String escapeTitle ( final String title ) { if ( title == null ) { return null ; } else { return title . replace ( "[" , "\\[" ) . replace ( "]" , "\\]" ) ; } } | Escapes a title so that it can be used in a Content Specification . |
16,743 | public static List < Entity > getContentSpecEntities ( final ContentSpec contentSpec ) { final DocBookVersion docBookVersion = getDocBookVersion ( contentSpec ) ; final String escapedTitle = DocBookUtilities . escapeTitle ( contentSpec . getTitle ( ) ) ; final String entitiesString = ContentSpecUtilities . generateEntitiesForContentSpec ( contentSpec , docBookVersion , escapedTitle , contentSpec . getTitle ( ) , contentSpec . getProduct ( ) ) ; return XMLUtilities . parseEntitiesFromString ( entitiesString ) ; } | Gets the entities that are allowed to be used in a Content Specification . |
16,744 | public static String getLevelPrefix ( final Level level ) { switch ( level . getLevelType ( ) ) { case APPENDIX : return "appe-" ; case SECTION : return "sect-" ; case PROCESS : return "proc-" ; case CHAPTER : return "chap-" ; case PART : return "part-" ; case PREFACE : return "pref-" ; default : return "" ; } } | Get the prefix to use for level container fixed urls . |
16,745 | public static Set < String > getFixedURLs ( final ContentSpec contentSpec ) { final Set < String > fixedUrls = new HashSet < String > ( ) ; for ( final Node childNode : contentSpec . getNodes ( ) ) { if ( childNode instanceof SpecNode ) { final SpecNode specNode = ( ( SpecNode ) childNode ) ; if ( ! isNullOrEmpty ( specNode . getFixedUrl ( ) ) ) { fixedUrls . add ( specNode . getFixedUrl ( ) ) ; } } if ( childNode instanceof Level ) { fixedUrls . addAll ( getFixedURLs ( ( Level ) childNode ) ) ; } } fixedUrls . addAll ( getFixedURLs ( contentSpec . getBaseLevel ( ) ) ) ; return fixedUrls ; } | Gets all the fixed urls from a content specification |
16,746 | public static Set < String > getFixedURLs ( final Level level ) { final Set < String > fixedUrls = new HashSet < String > ( ) ; for ( final Node childNode : level . getChildNodes ( ) ) { if ( childNode instanceof SpecNode ) { final SpecNode specNode = ( ( SpecNode ) childNode ) ; if ( ! isNullOrEmpty ( specNode . getFixedUrl ( ) ) ) { fixedUrls . add ( specNode . getFixedUrl ( ) ) ; } } if ( childNode instanceof Level ) { fixedUrls . addAll ( getFixedURLs ( ( Level ) childNode ) ) ; } } return fixedUrls ; } | Gets all the fixed urls from a content specification level . |
16,747 | public static String getTopicTitleWithConditions ( final ITopicNode specTopic , final BaseTopicWrapper < ? > topic ) { final String condition = specTopic . getConditionStatement ( true ) ; if ( condition != null && topic . getTitle ( ) != null && topic . getTitle ( ) . contains ( "condition" ) ) { try { final Document doc = XMLUtilities . convertStringToDocument ( "<title>" + topic . getTitle ( ) + "</title>" ) ; DocBookUtilities . processConditions ( condition , doc ) ; return XMLUtilities . convertNodeToString ( doc , false ) ; } catch ( Exception e ) { log . debug ( e . getMessage ( ) ) ; } return topic . getTitle ( ) ; } else { return topic . getTitle ( ) ; } } | Gets a Topics title with conditional statements applied |
16,748 | public boolean updateAttribute ( Attribute attribute ) throws IllegalStateException { if ( this . terminated ) { throw new IllegalStateException ( "Cannot send solutions to the World Model once the connection has been destroyed." ) ; } if ( this . canSend ) { return this . wmi . updateAttribute ( attribute ) ; } return this . attributeBuffer . offer ( attribute ) ; } | Sends a single attribute value update to the world model or buffers it to be sent later if the World Model is not connected . |
16,749 | public boolean updateAttributes ( Collection < Attribute > attributes ) throws IllegalStateException { if ( this . terminated ) { throw new IllegalStateException ( "Cannot send solutions to the World Model once the connection has been destroyed." ) ; } if ( this . canSend ) { return this . wmi . updateAttributes ( attributes ) ; } for ( Attribute a : attributes ) { if ( ! this . attributeBuffer . offer ( a ) ) { return false ; } } return true ; } | Sends a collection of updated Attribute values to the world model or buffers them to be sent later if the World Model is not connected . |
16,750 | public boolean expire ( final String identifier , final long timestamp , final String ... attributes ) { if ( attributes == null || attributes . length == 0 ) { return this . wmi . expireId ( identifier , timestamp ) ; } boolean retVal = true ; for ( String attribute : attributes ) { retVal = retVal && this . wmi . expireAttribute ( identifier , attribute , timestamp ) ; } return retVal ; } | Expires an Identifier or one or more attributes of that Identifier . If Attributes are specified then they will be expired instead of the Identifier . |
16,751 | public boolean expire ( final String identifier , final String ... attributes ) { return this . expire ( identifier , System . currentTimeMillis ( ) , attributes ) ; } | Expires an Identifier or one or more attributes of that Identifier . If Attributes are specified then they will be expired instead of the Identifier . The expiration time will be the current local time . |
16,752 | private void sendBufferedValues ( ) { ArrayList < Attribute > attributesToSend = new ArrayList < Attribute > ( ) ; int num = 0 ; while ( ! this . attributeBuffer . isEmpty ( ) ) { num += this . attributeBuffer . drainTo ( attributesToSend ) ; } if ( num > 0 ) { this . wmi . updateAttributes ( attributesToSend ) ; log . info ( "Sent {} buffered attribute updates." , Integer . valueOf ( num ) ) ; } } | Sends any buffered Attribute values to the world model . |
16,753 | public void execute ( String name , Reader sqlCode , PrintWriter out ) throws Exception { runScript ( name , sqlCode , out ) ; } | Executes any SQL script file |
16,754 | protected void execute ( String sqlStatement , PrintWriter out , boolean acceptFailure ) throws Exception { try ( Connection conn = dataSource . getConnection ( ) ) { try ( Statement stmt = conn . createStatement ( ) ) { boolean success = execute ( stmt , sqlStatement , out , acceptFailure ) ; while ( success ) { int rowCount = stmt . getUpdateCount ( ) ; if ( rowCount > 0 ) { if ( options . debug ) { out . println ( "Rows affected: " + rowCount ) ; out . flush ( ) ; } if ( stmt . getMoreResults ( ) ) { continue ; } } else if ( rowCount == 0 ) { if ( options . debug ) { out . println ( "No rows affected or statement was DDL command" ) ; out . flush ( ) ; } boolean moreResults ; try { moreResults = stmt . getMoreResults ( ) ; } catch ( SQLException sqle ) { if ( sqle . getSQLState ( ) . startsWith ( "24" ) ) { break ; } else { throw sqle ; } } if ( moreResults ) { continue ; } } else { ResultSet rs = stmt . getResultSet ( ) ; if ( null != rs ) { rs . close ( ) ; if ( stmt . getMoreResults ( ) ) { continue ; } } } break ; } } } catch ( SQLException sqle ) { out . println ( "Failed to execute statement: \n" + sqlStatement ) ; out . println ( "\n\nDescription of failure: \n" + Database . squeeze ( sqle ) ) ; out . flush ( ) ; throw sqle ; } catch ( Exception e ) { out . println ( "Failed to execute statement: \n" + sqlStatement ) ; out . println ( "\n\nDescription of failure: \n" + e . getMessage ( ) ) ; out . flush ( ) ; throw e ; } } | Executes an SQL statement . |
16,755 | public FilterReply decide ( final ILoggingEvent event ) { final Marker marker = event . getMarker ( ) ; if ( marker == this . marker ) { return FilterReply . NEUTRAL ; } else { return FilterReply . DENY ; } } | Filter the logging event according to the provided marker |
16,756 | public boolean connect ( long timeout ) { if ( this . wmi . connect ( timeout ) ) { this . wmi . setStayConnected ( true ) ; return true ; } return false ; } | Connects to the world model at the configured host and port . |
16,757 | public synchronized Response getSnapshot ( final String idRegex , final long start , final long end , String ... attributes ) { SnapshotRequestMessage req = new SnapshotRequestMessage ( ) ; req . setIdRegex ( idRegex ) ; req . setBeginTimestamp ( start ) ; req . setEndTimestamp ( end ) ; if ( attributes != null ) { req . setAttributeRegexes ( attributes ) ; } Response resp = new Response ( this , 0 ) ; try { while ( ! this . isReady ) { log . debug ( "Trying to wait until connection is ready." ) ; synchronized ( this ) { try { this . wait ( ) ; } catch ( InterruptedException ie ) { } } } long reqId = this . wmi . sendMessage ( req ) ; resp . setTicketNumber ( reqId ) ; this . outstandingSnapshots . put ( Long . valueOf ( reqId ) , resp ) ; WorldState ws = new WorldState ( ) ; this . outstandingStates . put ( Long . valueOf ( reqId ) , ws ) ; log . info ( "Binding Tix #{} to {}" , Long . valueOf ( reqId ) , resp ) ; return resp ; } catch ( Exception e ) { log . error ( "Unable to send " + req + "." , e ) ; resp . setError ( e ) ; return resp ; } } | Sends a snapshot request to the world model for the specified Identifier regular expression and Attribute regular expressions between the start and end timestamps . |
16,758 | public synchronized StepResponse getRangeRequest ( final String idRegex , final long start , final long end , String ... attributes ) { RangeRequestMessage req = new RangeRequestMessage ( ) ; req . setIdRegex ( idRegex ) ; req . setBeginTimestamp ( start ) ; req . setEndTimestamp ( end ) ; if ( attributes != null ) { req . setAttributeRegexes ( attributes ) ; } StepResponse resp = new StepResponse ( this , 0 ) ; try { while ( ! this . isReady ) { log . debug ( "Trying to wait until connection is ready." ) ; synchronized ( this ) { try { this . wait ( ) ; } catch ( InterruptedException ie ) { } } } long reqId = this . wmi . sendMessage ( req ) ; resp . setTicketNumber ( reqId ) ; this . outstandingSteps . put ( Long . valueOf ( reqId ) , resp ) ; log . info ( "Binding Tix #{} to {}" , Long . valueOf ( reqId ) , resp ) ; return resp ; } catch ( Exception e ) { resp . setError ( e ) ; return resp ; } } | Sends a range request to the world model for the specified Identifier regular expression Attribute regular expressions between the start and end times . |
16,759 | public String [ ] searchId ( final String idRegex ) { synchronized ( this . idSearchResponses ) { if ( ! this . wmi . searchIdRegex ( idRegex ) ) { log . warn ( "Attempted to search for a null Identifier regex. Not sending." ) ; return new String [ ] { } ; } do { log . debug ( "Waiting for response." ) ; try { return this . idSearchResponses . take ( ) ; } catch ( InterruptedException ie ) { } } while ( this . idSearchResponses . isEmpty ( ) ) ; log . error ( "Unable to retrieve matching Identifier values for {}." , idRegex ) ; return new String [ ] { } ; } } | Searches for any Identifier values that match the provided regular expression . |
16,760 | void connectionInterrupted ( ClientWorldModelInterface worldModel ) { this . isReady = false ; for ( Iterator < Long > iter = this . outstandingSnapshots . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Long tix = iter . next ( ) ; Response resp = this . outstandingSnapshots . remove ( tix ) ; resp . setError ( new RuntimeException ( "Connection to " + worldModel . toString ( ) + " was closed." ) ) ; iter . remove ( ) ; } this . outstandingStates . clear ( ) ; for ( Iterator < Long > iter = this . outstandingSteps . keySet ( ) . iterator ( ) ; iter . hasNext ( ) ; ) { Long tix = iter . next ( ) ; StepResponse resp = this . outstandingSteps . remove ( tix ) ; if ( resp == null ) { log . error ( "No step response found for {}" , tix ) ; } else { resp . setError ( new RuntimeException ( "Connection to " + worldModel . toString ( ) + " was closed." ) ) ; } iter . remove ( ) ; } } | Completes any outstanding requests with errors . |
16,761 | @ RuleSetup ( RequirementLevel . OPTIONAL ) public void setContentDefinition ( final URL contentDef ) { assertStateBefore ( State . INITIALIZED ) ; this . contentDef = contentDef ; } | Sets the locator pointing to the content definition . |
16,762 | public Node loadContent ( URL contentDefinition ) throws RepositoryException { LOG . info ( "Loading Content" ) ; final Session session = repository . getAdminSession ( ) ; final XMLContentLoader loader = new XMLContentLoader ( ) ; return loader . loadContent ( session , contentDefinition ) ; } | Loads content from an external content definition into the underlying repository . |
16,763 | public TemporaryFileBuilder fromClasspathResource ( final String pathToResource ) { final Class < ? > callerClass = getCallerClass ( ) ; this . content = getResolver ( ) . resolve ( pathToResource , callerClass ) ; return this ; } | Defines the classpath resource from where the content of the file should be retrieved |
16,764 | public ZipFileBuilder asZip ( ) { final ZipFileBuilder zfb = new ZipFileBuilder ( folder , filename ) ; if ( this . content != null ) { zfb . addResource ( getContenFileName ( ) , this . content ) ; } return zfb ; } | Indicates the content for the file should be zipped . If only one content reference is provided the zip will only contain this file . |
16,765 | private String getContenFileName ( ) { final String file = this . content . getPath ( ) ; if ( file . indexOf ( '/' ) != - 1 ) { return file . substring ( file . lastIndexOf ( '/' ) ) ; } return file ; } | Extracts the name of the resource from the url itself . The filename from the path - part of the URL is extracted . |
16,766 | public Object processMessage ( Object message ) { Utility . getLogger ( ) . info ( "processMessage called in service message" ) ; BaseMessage msgReplyInternal = null ; try { BaseMessage messageIn = new TreeMessage ( null , null ) ; new ServiceTrxMessageIn ( messageIn , message ) ; msgReplyInternal = this . processIncomingMessage ( messageIn , null ) ; Utility . getLogger ( ) . info ( "msgReplyInternal: " + msgReplyInternal ) ; int iErrorCode = this . convertToExternal ( msgReplyInternal , null ) ; Utility . getLogger ( ) . info ( "externalMessageReply: " + msgReplyInternal ) ; Object msg = null ; if ( iErrorCode == DBConstants . NORMAL_RETURN ) { msg = msgReplyInternal . getExternalMessage ( ) . getRawData ( ) ; String strTrxID = ( String ) msgReplyInternal . getMessageHeader ( ) . get ( TrxMessageHeader . LOG_TRX_ID ) ; this . logMessage ( strTrxID , msgReplyInternal , MessageInfoTypeModel . REPLY , MessageTypeModel . MESSAGE_OUT , MessageStatusModel . SENTOK , null , null ) ; } return msg ; } catch ( Throwable ex ) { ex . printStackTrace ( ) ; String strError = "Error in processing or replying to a message" ; Utility . getLogger ( ) . warning ( strError ) ; if ( msgReplyInternal != null ) { String strTrxID = ( String ) msgReplyInternal . getMessageHeader ( ) . get ( TrxMessageHeader . LOG_TRX_ID ) ; this . logMessage ( strTrxID , msgReplyInternal , MessageInfoTypeModel . REPLY , MessageTypeModel . MESSAGE_OUT , MessageStatusModel . ERROR , strError , null ) ; } return null ; } } | This is the application code for handling the message .. Once the message is received the application can retrieve the soap part the attachment part if there are any or any other information from the message . |
16,767 | public String getDatabaseName ( ) { if ( m_vRecordList != null ) if ( this . getRecordlistAt ( 0 ) != null ) return this . getRecordlistAt ( 0 ) . getDatabaseName ( ) ; return DBConstants . BLANK ; } | Get the Database Name . Always override this method . |
16,768 | public int getDatabaseType ( ) { if ( m_vRecordList != null ) if ( this . getRecordlistAt ( 0 ) != null ) return this . getRecordlistAt ( 0 ) . getDatabaseType ( ) & DBConstants . TABLE_MASK ; return super . getDatabaseType ( ) ; } | Get the database type . Always override this method . |
16,769 | public void free ( ) { super . free ( ) ; while ( m_LinkageList . size ( ) > 0 ) { TableLink tableLink = ( TableLink ) m_LinkageList . elementAt ( 0 ) ; tableLink . free ( ) ; } m_LinkageList . removeAllElements ( ) ; m_LinkageList = null ; m_vRecordList . free ( ) ; m_vRecordList = null ; } | Free the query record . |
16,770 | public String addSelectParams ( String seekSign , int areaDesc , boolean bAddOnlyMods , boolean bIncludeFileName , boolean bUseCurrentValues , Vector < BaseField > vParamList , boolean bForceUniqueKey , boolean bIncludeTempFields ) { String sFilter = super . addSelectParams ( seekSign , areaDesc , bAddOnlyMods , bIncludeFileName , bUseCurrentValues , vParamList , bForceUniqueKey , bIncludeTempFields ) ; if ( sFilter . length ( ) > 0 ) return sFilter ; for ( int iIndex = 0 ; iIndex < this . getRecordlistCount ( ) ; iIndex ++ ) { Record stmtTable = this . getRecordlistAt ( iIndex ) ; if ( stmtTable != null ) sFilter += stmtTable . addSelectParams ( seekSign , areaDesc , bAddOnlyMods , bIncludeFileName , bUseCurrentValues , vParamList , bForceUniqueKey , bIncludeTempFields ) ; } return sFilter ; } | Add to this SQL Key Filter . |
16,771 | public int getFieldCount ( ) { int iFieldCount = 0 ; for ( int i = 0 ; i < this . getRecordlistCount ( ) ; i ++ ) { iFieldCount += this . getRecordlistAt ( i ) . getFieldCount ( ) ; } return iFieldCount ; } | Number of Fields in this record . |
16,772 | public Record getRecord ( String sFileName ) { Record pQueryCore = null ; Record pStmtTable = null ; pQueryCore = super . getRecord ( sFileName ) ; if ( pQueryCore != null ) return pQueryCore ; for ( int i = 0 ; i < this . getRecordlistCount ( ) ; i ++ ) { pStmtTable = this . getRecordlistAt ( i ) ; pQueryCore = pStmtTable . getRecord ( sFileName ) ; if ( pQueryCore != null ) return pQueryCore ; } return null ; } | Get this table in the query . |
16,773 | public Record moveTableQuery ( int iRelPosition ) throws DBException { BaseTable table = null ; Record record = null ; Record recordLeft = null ; boolean bFirstTime = true ; for ( Enumeration < TableLink > e = m_LinkageList . elements ( ) ; e . hasMoreElements ( ) ; ) { TableLink tableLink = e . nextElement ( ) ; table = tableLink . getLeftRecord ( ) . getTable ( ) ; if ( bFirstTime ) { recordLeft = record = ( Record ) table . move ( iRelPosition ) ; if ( record == null ) break ; } table = tableLink . getRightRecord ( ) . getTable ( ) ; record = table . getRecord ( ) ; record . addNew ( ) ; tableLink . moveDataRight ( ) ; boolean bFound = record . seek ( "=" ) ; if ( ! bFound ) { if ( tableLink . getJoinType ( ) == DBConstants . LEFT_OUTER ) record . initRecord ( DBConstants . DISPLAY ) ; else { if ( ( iRelPosition > 0 ) || ( iRelPosition == DBConstants . FIRST_RECORD ) ) return this . moveTableQuery ( + 1 ) ; return this . moveTableQuery ( - 1 ) ; } } bFirstTime = false ; } if ( recordLeft != null ) { if ( ( this . handleLocalCriteria ( null , false , null ) == false ) || ( this . handleRemoteCriteria ( null , false , null ) == false ) ) { if ( ( iRelPosition > 0 ) || ( iRelPosition == DBConstants . FIRST_RECORD ) ) return this . moveTableQuery ( + 1 ) ; return this . moveTableQuery ( - 1 ) ; } this . setEditMode ( recordLeft . getEditMode ( ) ) ; } else this . setEditMode ( DBConstants . END_OF_FILE ) ; return recordLeft ; } | Special logic to move a QueryRecord using the tables . The method also retrives any linked record . |
16,774 | public void openTableQuery ( ) throws DBException { Record record = null ; boolean bFirstTime = true ; for ( Enumeration < TableLink > e = m_LinkageList . elements ( ) ; e . hasMoreElements ( ) ; ) { TableLink tableLink = e . nextElement ( ) ; record = tableLink . getLeftRecord ( ) ; if ( bFirstTime ) { if ( ! record . isOpen ( ) ) record . open ( ) ; } record = tableLink . getRightRecord ( ) ; if ( ! record . isOpen ( ) ) record . open ( ) ; bFirstTime = false ; } } | Special logic to open a QueryRecord using the tables . |
16,775 | public void checkLinkedFields ( ) { if ( this . isManualQuery ( ) ) { for ( Enumeration < TableLink > e = m_LinkageList . elements ( ) ; e . hasMoreElements ( ) ; ) { TableLink tableLink = e . nextElement ( ) ; for ( int i = 0 ; i < 3 ; i ++ ) { if ( tableLink . getLeftField ( i ) != null ) tableLink . getLeftField ( i ) . setSelected ( true ) ; if ( tableLink . getRightField ( i ) != null ) tableLink . getRightField ( i ) . setSelected ( true ) ; } } } } | Make sure all the linked fields are selected . |
16,776 | public boolean isComplexQuery ( ) { for ( int i = 0 ; i < this . getRecordlistCount ( ) ; i ++ ) { if ( this . getRecordlistAt ( i ) . getTable ( ) instanceof org . jbundle . base . db . shared . MultiTable ) return true ; } return false ; } | Is one of the sub - queries a multi - table . |
16,777 | public static List < Class < ? > > makeArrayClasses ( List < Class < ? > > classes , int dims ) { Iterator < Class < ? > > i = classes . iterator ( ) ; LinkedList < Class < ? > > arrayClasses = new LinkedList < Class < ? > > ( ) ; while ( i . hasNext ( ) ) arrayClasses . add ( makeArrayClass ( i . next ( ) , dims ) ) ; return arrayClasses ; } | this compensates for the lack of map |
16,778 | public void addListeners ( ) { super . addListeners ( ) ; try { this . doRemoteAction ( DBConstants . BLANK , null ) ; } catch ( Exception ex ) { } Record recMenus = this . getMainRecord ( ) ; recMenus . setOpenMode ( DBConstants . OPEN_NORMAL ) ; recMenus . addListener ( new FileListener ( null ) { public void doValidRecord ( boolean bDisplayOption ) { Record recMenus = this . getOwner ( ) ; XMLPropertiesField field = ( XMLPropertiesField ) recMenus . getField ( Menus . PARAMS ) ; Map < String , Object > properties = field . getProperties ( ) ; String strURL = null ; strURL = Utility . propertiesToURL ( strURL , properties ) ; if ( strURL != null ) if ( strURL . length ( ) > 0 ) if ( strURL . charAt ( 0 ) == '?' ) strURL = strURL . substring ( 1 ) ; field . setString ( strURL ) ; super . doValidRecord ( bDisplayOption ) ; } } ) ; } | Add behaviors to this session . |
16,779 | public void setupSubMenus ( String strMenu ) { Record recMenu = this . getMainRecord ( ) ; try { String strCommandNoCommas = Utility . replace ( strMenu , "," , null ) ; boolean bIsNumeric = Utility . isNumeric ( strCommandNoCommas ) ; if ( bIsNumeric ) { recMenu . setKeyArea ( Menus . ID_KEY ) ; recMenu . getField ( Menus . ID ) . setString ( strCommandNoCommas ) ; bIsNumeric = recMenu . seek ( "=" ) ; } if ( ! bIsNumeric ) { recMenu . setKeyArea ( Menus . CODE_KEY ) ; recMenu . getField ( Menus . CODE ) . setString ( strMenu ) ; if ( ! recMenu . seek ( "=" ) ) { recMenu . getField ( Menus . CODE ) . setString ( HtmlConstants . MAIN_MENU_KEY ) ; recMenu . seek ( "=" ) ; } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } String strParentID = recMenu . getField ( Menus . ID ) . toString ( ) ; BaseListener listener = recMenu . getListener ( StringSubFileFilter . class . getName ( ) ) ; if ( listener != null ) { recMenu . removeListener ( listener , true ) ; } recMenu . setKeyArea ( Menus . PARENT_FOLDER_ID_KEY ) ; recMenu . addListener ( new StringSubFileFilter ( strParentID , recMenu . getField ( Menus . PARENT_FOLDER_ID ) , null , null , null , null ) ) ; } | SetupSubMenus Method . |
16,780 | public PSBrokerBuilder typeToSubscriberMapping ( ConcurrentMap < Class < ? > , List < SubscriberParent > > mapping ) { broker . mapping = mapping ; return this ; } | The map that should be used internally that maps types to a list of subscribers . |
16,781 | public void init ( BaseDatabase database , Record record ) { super . init ( database , record ) ; if ( ( ( QueryRecord ) record ) . getBaseRecord ( ) != null ) m_tableNext = ( ( QueryRecord ) record ) . getBaseRecord ( ) . getTable ( ) ; } | QueryTable Constructor . |
16,782 | protected < Type > void addIfNotNull ( final Array < Type > array , final Type object ) { if ( object != null ) { array . add ( object ) ; } } | Simple array utility . |
16,783 | private static Iterator < ? > seek ( ELContext context , Object base , Object property ) { if ( base instanceof Iterable < ? > ) { context . setPropertyResolved ( true ) ; int index = toIndex ( context , property ) ; if ( index >= 0 ) { Iterator < ? > result = ( ( Iterable < ? > ) base ) . iterator ( ) ; for ( int i = 0 ; i < index && result . hasNext ( ) ; i ++ ) { result . next ( ) ; } if ( result . hasNext ( ) ) { return result ; } throw new PropertyNotFoundException ( String . valueOf ( property ) ) ; } } return null ; } | Establishes an Iterator and advances it to the specified index . If this operation succeeds the context will be set as having been resolved . |
16,784 | public Grounding generateOWLGrounding ( Service service ) throws DynamicGroundingBuildingException { JavaGrounding javaGrounding = service . getOntology ( ) . createJavaGrounding ( null ) ; JavaAtomicGrounding javaAtomicGrounding = service . getOntology ( ) . createJavaAtomicGrounding ( null ) ; AtomicProcess atomicProcess = service . getProcess ( ) . castTo ( AtomicProcess . class ) ; URI javaTransformatorURI = null ; try { javaTransformatorURI = new URI ( javaTransformatorURL ) ; } catch ( URISyntaxException ex ) { throw new DynamicGroundingBuildingException ( "cannot load needed ontology on " + javaTransformatorURL ) ; } javaAtomicGrounding . setOutput ( null , method ( ) . getReturnType ( ) . getName ( ) , atomicProcess . getOutput ( ) ) ; javaAtomicGrounding . getOutput ( ) . addProperty ( javaTransformatorURI , service . getKB ( ) . createDataValue ( javaTransformatorClass ) ) ; OWLIndividualList < Input > inputs = atomicProcess . getInputs ( ) ; Class < ? > [ ] methodParameterTypes = method ( ) . getParameterTypes ( ) ; if ( inputs . size ( ) != methodParameterTypes . length ) { throw new DynamicGroundingBuildingException ( "the method (" + ") and the service have different number of input parameters" ) ; } for ( int i = 0 ; i < inputs . size ( ) ; i ++ ) { javaAtomicGrounding . addInputParameter ( null , methodParameterTypes [ i ] . getName ( ) , i , inputs . get ( i ) ) ; } for ( Iterator < Input > it = inputs . iterator ( ) ; it . hasNext ( ) ; ) { javaAtomicGrounding . getInputParamter ( it . next ( ) ) . addProperty ( javaTransformatorURI , service . getKB ( ) . createDataValue ( javaTransformatorClass ) ) ; } javaAtomicGrounding . setClazz ( clas . getName ( ) ) ; javaAtomicGrounding . setMethod ( methodName ) ; javaAtomicGrounding . setProcess ( atomicProcess ) ; javaGrounding . addGrounding ( javaAtomicGrounding ) ; javaGrounding . setService ( service ) ; service . addGrounding ( javaGrounding ) ; return javaGrounding ; } | It automatically creates Output and Inputs assigning them a Java Transformator class |
16,785 | private void addLogicalStep ( LogicalStep lStep ) throws ExecutionException { if ( lStep instanceof Project ) { project = ( Project ) lStep ; } else if ( lStep instanceof Filter ) { decideTypeFilterToAdd ( ( Filter ) lStep ) ; } else if ( lStep instanceof FunctionFilter ) { functionFilters . add ( ( FunctionFilter ) lStep ) ; } else if ( lStep instanceof Select ) { select = ( Select ) lStep ; } else if ( lStep instanceof Limit ) { limit = ( Limit ) lStep ; } else if ( lStep instanceof GroupBy ) { groupBy = ( GroupBy ) lStep ; } else if ( lStep instanceof Window ) { window = ( Window ) lStep ; } else if ( lStep instanceof OrderBy ) { orderBy = ( OrderBy ) lStep ; } else if ( lStep instanceof Disjunction ) { switchDisjunctionList ( ( Disjunction ) lStep ) ; } else { String message = "LogicalStep [" + lStep . getClass ( ) . getCanonicalName ( ) + " not supported" ; logger . error ( message ) ; throw new ExecutionException ( message ) ; } } | This method add the correct logical step . |
16,786 | private void decideTypeFilterToAdd ( Filter filter ) { Filter step = filter ; if ( Operator . MATCH == step . getRelation ( ) . getOperator ( ) || step . getRelation ( ) . getRightTerm ( ) instanceof FunctionSelector ) { if ( matchList . isEmpty ( ) ) { matchList = new ArrayList < > ( ) ; } matchList . add ( filter ) ; } else { if ( filterList . isEmpty ( ) ) { filterList = new ArrayList < > ( ) ; } filterList . add ( filter ) ; } } | Add filter in the correct list . |
16,787 | public void free ( ) { if ( m_receiver != null ) m_receiver . free ( ) ; m_receiver = null ; if ( m_sender != null ) m_sender . free ( ) ; m_sender = null ; if ( m_manager != null ) m_manager . removeMessageQueue ( this ) ; m_manager = null ; m_strQueueName = null ; m_strQueueType = null ; } | Free all the resources belonging to this object . |
16,788 | public BaseMessageReceiver getMessageReceiver ( ) { if ( m_receiver == null ) { m_receiver = this . createMessageReceiver ( ) ; if ( m_receiver != null ) new Thread ( m_receiver , "MessageReceiver" ) . start ( ) ; } return m_receiver ; } | Get the message receiver . Create it if it doesn t exist . |
16,789 | public static String [ ] getDatastoreName ( String pathManifest ) throws InitializationException { String [ ] datastoreName = { "" } ; try { Document document = getDocument ( pathManifest ) ; Object result = getResult ( document , "//DataStores/DataStoreName/text()" ) ; datastoreName = new String [ ( ( NodeList ) result ) . getLength ( ) ] ; for ( int i = 0 ; i < ( ( NodeList ) result ) . getLength ( ) ; i ++ ) { datastoreName [ i ] = ( ( NodeList ) result ) . item ( i ) . getNodeValue ( ) ; } } catch ( SAXException | XPathExpressionException | IOException | ParserConfigurationException e ) { String msg = "Impossible to read DataStoreName in Manifest with the connector configuration." + e . getCause ( ) ; LOGGER . error ( msg ) ; throw new InitializationException ( msg , e ) ; } return datastoreName ; } | Recovered the datastoreName form Manifest . |
16,790 | public static String getConectorName ( String pathManifest ) throws InitializationException { String connectionName = "" ; try { Document document = getDocument ( pathManifest ) ; Object result = getResult ( document , "//ConnectorName/text()" ) ; connectionName = ( ( NodeList ) result ) . item ( 0 ) . getNodeValue ( ) ; } catch ( SAXException | XPathExpressionException | IOException | ParserConfigurationException e ) { String msg = "Impossible to read DataStoreName in Manifest with the connector configuration." + e . getCause ( ) ; LOGGER . error ( msg ) ; throw new InitializationException ( msg , e ) ; } return connectionName ; } | Recovered the ConecrtorName form Manifest . |
16,791 | private static Object getResult ( Document document , String node ) throws XPathExpressionException { XPath xpath = XPathFactory . newInstance ( ) . newXPath ( ) ; Object result ; XPathExpression expr = null ; expr = xpath . compile ( node ) ; result = expr . evaluate ( document , XPathConstants . NODESET ) ; return result ; } | Get the node value . |
16,792 | private static Document getDocument ( String pathManifest ) throws SAXException , IOException , ParserConfigurationException { InputStream inputStream = ManifestUtil . class . getClassLoader ( ) . getResourceAsStream ( pathManifest ) ; return DocumentBuilderFactory . newInstance ( ) . newDocumentBuilder ( ) . parse ( inputStream ) ; } | Create the documento . |
16,793 | public String getHyperlink ( ) { String strMailTo = this . getString ( ) ; if ( strMailTo != null ) if ( strMailTo . length ( ) > 0 ) strMailTo = DBParams . FAX + ":" + strMailTo ; return strMailTo ; } | Get the faxto HTML Hyperlink . |
16,794 | public static String join ( Iterable < ? > objects , char separator ) { return join ( objects , Character . toString ( separator ) ) ; } | Join collection of objects converted to string using specified char separator . Returns null if given objects array is null and empty if empty . |
16,795 | public static List < String > split ( String string , String separator ) { final int separatorLength = separator . length ( ) ; final List < String > list = new ArrayList < String > ( ) ; int fromIndex = 0 ; for ( ; ; ) { int endIndex = string . indexOf ( separator , fromIndex ) ; if ( endIndex == - 1 ) { break ; } if ( fromIndex < endIndex ) { list . add ( string . substring ( fromIndex , endIndex ) . trim ( ) ) ; } fromIndex = endIndex + separatorLength ; } if ( fromIndex < string . length ( ) ) { list . add ( string . substring ( fromIndex ) . trim ( ) ) ; } return list ; } | Splits string using specified string separator and returns trimmed values . Returns null if string argument is null and empty list if is empty . |
16,796 | public static boolean isNumeric ( String string ) { if ( string == null || string . isEmpty ( ) ) return false ; State state = State . SIGN ; for ( int i = 0 ; i < string . length ( ) ; ++ i ) { char c = string . charAt ( i ) ; switch ( state ) { case SIGN : if ( c == '-' || c == '+' ) { state = State . INTEGER ; break ; } if ( c == DECIMAL_SEPARATOR ) { state = State . FRACTIONAL ; break ; } if ( Character . isDigit ( c ) ) { state = State . INTEGER ; break ; } return false ; case INTEGER : if ( Character . isDigit ( c ) ) { break ; } if ( c == GROUPING_SEPARATOR ) { break ; } if ( c == DECIMAL_SEPARATOR ) { state = State . FRACTIONAL ; break ; } if ( c == 'e' || c == 'E' ) { state = State . EXPONENT_SIGN ; break ; } if ( isNumericSuffix ( c ) ) { state = State . END ; break ; } return false ; case FRACTIONAL : if ( c == 'e' || c == 'E' ) { state = State . EXPONENT_SIGN ; break ; } if ( isNumericSuffix ( c ) ) { state = State . END ; break ; } if ( Character . isDigit ( c ) ) { break ; } return false ; case EXPONENT_SIGN : if ( c == '-' || c == '+' ) { state = State . EXPONENT ; break ; } if ( Character . isDigit ( c ) ) { break ; } return false ; case EXPONENT : if ( isNumericSuffix ( c ) ) { state = State . END ; break ; } if ( Character . isDigit ( c ) ) { break ; } return false ; case END : return false ; default : throw new IllegalStateException ( ) ; } } return true ; } | Test if string is a numeric value . Returns false if string argument is null or empty . |
16,797 | public static boolean isInteger ( String string ) { if ( string == null || string . isEmpty ( ) ) return false ; int startIndex = string . charAt ( 0 ) == '-' ? 1 : string . charAt ( 0 ) == '+' ? 1 : 0 ; for ( int i = startIndex , l = string . length ( ) ; i < l ; i ++ ) { if ( string . charAt ( i ) == GROUPING_SEPARATOR ) continue ; if ( ! Character . isDigit ( string . charAt ( i ) ) ) { return false ; } } return true ; } | Test if string is an integer numeric value . Returns false if string is null or empty . |
16,798 | public static String escapeXML ( String text ) { StringWriter writer = new StringWriter ( ) ; try { escapeXML ( text , writer ) ; } catch ( IOException e ) { throw new BugError ( "IO failure while attempting to write to string." ) ; } return writer . toString ( ) ; } | Escape text for reserved XML characters . Replace quotes apostrophe ampersand left and right angular brackets with entities . Return the newly created escaped string ; if text argument is null or empty returns an empty string . |
16,799 | public static String escapeRegExp ( String string ) { if ( string == null ) { return null ; } return string . replaceAll ( REGEXP_PATTERN , REPLACE_ARG_REX ) ; } | Escape string for regular expression reserved characters . Return null if string argument is null and empty if empty . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.