idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
16,600
public int [ ] getComponentOrder ( Container container ) { int components = container . getComponentCount ( ) ; int [ ] componentOrder = new int [ components ] ; int [ ] rgY = new int [ components ] ; for ( int i = 0 ; i < components ; i ++ ) { componentOrder [ i ] = i ; rgY [ i ] = container . getComponent ( i ) . getY ( ) ; } for ( int i = 0 ; i < components ; i ++ ) { for ( int j = i + 1 ; j < components ; j ++ ) { if ( rgY [ j ] < rgY [ i ] ) { int temp = rgY [ i ] ; rgY [ i ] = rgY [ j ] ; rgY [ j ] = temp ; temp = componentOrder [ i ] ; componentOrder [ i ] = componentOrder [ j ] ; componentOrder [ j ] = temp ; } } } return componentOrder ; }
Get the component order by how they are ordered vertically on the screen .
16,601
public void resetAll ( ) { currentLocationOnPage = 0 ; componentIndex = 0 ; currentComponent = this . getComponent ( componentIndex ) ; componentStartYLocation = 0 ; componentPageHeight = 0 ; currentPageIndex = 0 ; remainingComponentHeight = 0 ; if ( currentComponent != null ) remainingComponentHeight = currentComponent . getHeight ( ) ; remainingPageHeight = pageHeight ; }
Reset to the first page .
16,602
public boolean setCurrentYLocation ( int targetPageIndex , int targetLocationOnPage ) { this . resetAll ( ) ; boolean pageDone = false ; while ( pageDone == false ) { if ( currentComponent == null ) break ; componentPageHeight = this . calcComponentPageHeight ( ) ; if ( currentPageIndex > targetPageIndex ) break ; if ( currentPageIndex == targetPageIndex ) if ( currentLocationOnPage >= targetLocationOnPage ) break ; remainingComponentHeight = remainingComponentHeight + this . checkComponentHeight ( ) ; if ( remainingComponentHeight < remainingPageHeight ) { currentLocationOnPage = currentLocationOnPage + remainingComponentHeight ; remainingPageHeight = remainingPageHeight - remainingComponentHeight ; componentIndex ++ ; currentComponent = this . getComponent ( componentIndex ) ; componentStartYLocation = 0 ; if ( currentComponent != null ) remainingComponentHeight = currentComponent . getHeight ( ) ; } else { componentStartYLocation = componentStartYLocation + componentPageHeight ; if ( targetPageIndex == currentPageIndex ) pageDone = true ; currentPageIndex ++ ; currentLocationOnPage = 0 ; remainingComponentHeight = remainingComponentHeight - componentPageHeight ; remainingPageHeight = pageHeight ; } } return pageDone ; }
Set the current Y location and change the current component information to match .
16,603
public int getMaxComponentWidth ( ) { int maxWidth = 0 ; for ( int index = 0 ; ; index ++ ) { Component component = this . getComponent ( index ) ; if ( component == null ) break ; if ( component instanceof JTableHeader ) continue ; if ( component instanceof JPanel ) { for ( int i = 0 ; i < ( ( JPanel ) component ) . getComponentCount ( ) ; i ++ ) { Component childComponent = ( ( JPanel ) component ) . getComponent ( i ) ; int farthestWidth = childComponent . getX ( ) + ( ( JPanel ) component ) . getComponent ( i ) . getWidth ( ) ; maxWidth = Math . max ( maxWidth , Math . min ( component . getWidth ( ) , farthestWidth ) ) ; } } else maxWidth = Math . max ( maxWidth , component . getWidth ( ) ) ; } return maxWidth ; }
Get the widest component . To calculate the scale .
16,604
public Component getComponent ( int componentIndex ) { if ( componentList != null ) if ( componentIndex < componentList . length ) return componentList [ componentIndex ] ; return null ; }
Get the component at this index .
16,605
public int checkComponentHeight ( ) { int maxHeightToCheck = componentStartYLocation - currentLocationOnPage + pageHeight ; if ( currentComponent == null ) return 0 ; if ( currentComponent instanceof JTable ) { int beforeHeight = currentComponent . getHeight ( ) ; int rowHeight = ( ( JTable ) currentComponent ) . getRowHeight ( ) ; int rowCount = ( ( JTable ) currentComponent ) . getRowCount ( ) ; int maxRowCount = maxHeightToCheck / rowHeight ; for ( int i = rowCount - 1 ; i < rowCount ; i ++ ) { if ( i >= maxRowCount ) break ; rowCount = ( ( JTable ) currentComponent ) . getRowCount ( ) ; } int newComponentHeight = rowHeight * rowCount ; currentComponent . setSize ( currentComponent . getWidth ( ) , newComponentHeight ) ; return newComponentHeight - beforeHeight ; } return 0 ; }
Get the height of this component . Typically this is just the height of the component . Except for JTables where I need to query to this target height to make sure the component is at least this correct height .
16,606
public int calcComponentPageHeight ( ) { remainingComponentHeight = remainingComponentHeight + this . checkComponentHeight ( ) ; if ( remainingComponentHeight <= remainingPageHeight ) return remainingComponentHeight ; if ( currentComponent == null ) return 0 ; if ( ! ( currentComponent instanceof Container ) ) return 0 ; if ( currentComponent instanceof JTable ) { int rowHeight = ( ( JTable ) currentComponent ) . getRowHeight ( ) ; int currentComponentPageBreak = componentStartYLocation + remainingPageHeight ; int currentComponentPageRow = ( int ) ( currentComponentPageBreak / rowHeight ) ; return remainingPageHeight - ( currentComponentPageBreak - currentComponentPageRow * rowHeight ) ; } int lastComponentPageHeight = 0 ; int y = 0 ; int maxLowerBreak = ( int ) ( pageHeight * MAX_LOWER_BREAK ) ; Component component = null ; for ( y = remainingPageHeight ; y > remainingPageHeight - maxLowerBreak ; y -- ) { int x = 0 ; for ( x = 0 ; x < currentComponent . getWidth ( ) ; x ++ ) { component = ( ( Container ) currentComponent ) . getComponentAt ( x , componentStartYLocation + y ) ; if ( component != null ) if ( component != currentComponent ) if ( component . getY ( ) + component . getHeight ( ) - 1 != y ) break ; } if ( x == currentComponent . getWidth ( ) ) break ; if ( component != null ) lastComponentPageHeight = Math . max ( lastComponentPageHeight , component . getY ( ) - 1 ) ; } if ( y == remainingPageHeight - maxLowerBreak ) { if ( ( lastComponentPageHeight == 0 ) || ( lastComponentPageHeight < pageHeight - maxLowerBreak ) ) y = pageHeight ; else y = lastComponentPageHeight ; } return y ; }
Calculate the remaining height of this component on this page . This is used to calculate a smart page break that does not split a control between pages .
16,607
protected final QueryResult executeWorkFlow ( LogicalWorkflow workflow ) throws ConnectorException { checkIsSupported ( workflow ) ; ClusterName clusterName = ( ( Project ) workflow . getInitialSteps ( ) . get ( 0 ) ) . getClusterName ( ) ; return execute ( ( Project ) workflow . getInitialSteps ( ) . get ( 0 ) , connectionHandler . getConnection ( clusterName . getName ( ) ) ) ; }
This method execute a query with only a project .
16,608
protected final void asyncExecuteWorkFlow ( String queryId , LogicalWorkflow workflow , IResultHandler resultHandler ) throws ConnectorException { checkIsSupported ( workflow ) ; ClusterName clusterName = ( ( Project ) workflow . getInitialSteps ( ) . get ( 0 ) ) . getClusterName ( ) ; asyncExecute ( queryId , ( Project ) workflow . getInitialSteps ( ) . get ( 0 ) , connectionHandler . getConnection ( clusterName . getName ( ) ) , resultHandler ) ; }
Abstract method which must be implemented by the concrete database metadataEngine to execute a async workflow .
16,609
protected final void pagedExecuteWorkFlow ( String queryId , LogicalWorkflow workflow , IResultHandler resultHandler , int pageSize ) throws ConnectorException { checkIsSupported ( workflow ) ; ClusterName clusterName = ( ( Project ) workflow . getInitialSteps ( ) . get ( 0 ) ) . getClusterName ( ) ; pagedExecute ( queryId , ( Project ) workflow . getInitialSteps ( ) . get ( 0 ) , connectionHandler . getConnection ( clusterName . getName ( ) ) , resultHandler ) ; }
Abstract method which must be implemented by the concrete database metadataEngine to execute a async and paged workflow .
16,610
public Object set ( int index , Object element ) { if ( ( index < m_iStartIndex ) || ( index >= m_iStartIndex + m_iMaxSize ) ) { int iNewStart = index - m_iMaxSize / 2 ; if ( iNewStart < 0 ) iNewStart = 0 ; int iStart = 0 ; int iEnd = this . size ( ) - 1 ; int iIncrement = + 1 ; if ( iNewStart < m_iStartIndex ) { iStart = iEnd ; iEnd = 0 ; iIncrement = - 1 ; } for ( int i = iStart ; i * iIncrement <= iEnd ; i = i + iIncrement ) { Object obj = super . set ( i , null ) ; int iShiftedIndex = i + m_iStartIndex - iNewStart ; if ( ( iShiftedIndex >= 0 ) && ( iShiftedIndex < this . size ( ) ) ) super . set ( iShiftedIndex , obj ) ; else this . freeObject ( m_iStartIndex + i , obj ) ; } m_iStartIndex = iNewStart ; } if ( index >= m_iStartIndex + this . size ( ) ) { for ( int i = m_iStartIndex + this . size ( ) ; i <= index ; i ++ ) this . add ( null ) ; } index = index - m_iStartIndex ; return super . set ( index , element ) ; }
Set this element to this object . If this index is not in the current array shift the array and add it .
16,611
public void addState ( String name , Runnable enter ) { addState ( name , ( S ) new AdhocState ( name , enter , null , null ) ) ; }
Creates named state with functional interface .
16,612
public void addState ( String name , S state ) { AbstractState old = states . put ( name , new StateWrapper ( name , state ) ) ; if ( old != null ) { throw new IllegalArgumentException ( "state " + name + " exists already" ) ; } }
Creates named state
16,613
public void initSharedRecord ( Record record ) { FieldListener listener = null ; try { BaseField field = record . getSharedRecordTypeKey ( ) ; field . addListener ( listener = new InitOnceFieldHandler ( null ) ) ; field . setData ( new Integer ( 0 ) , true , DBConstants . INIT_MOVE ) ; field . setData ( new Integer ( 0 ) , true , DBConstants . INIT_MOVE ) ; if ( field != null ) if ( field . getDataClass ( ) == Integer . class ) { for ( int i = 1 ; ; i ++ ) { Integer intData = new Integer ( i ) ; field . setData ( intData ) ; record . addNew ( ) ; Record recShared = record . getTable ( ) . getCurrentTable ( ) . getRecord ( ) ; if ( recShared == null ) break ; if ( recShared == record ) break ; if ( recShared . getField ( field . getFieldName ( ) ) . getValue ( ) != i ) break ; this . disableAllListeners ( recShared ) ; } } } catch ( DBException ex ) { ex . printStackTrace ( ) ; } finally { if ( listener != null ) record . removeListener ( listener , true ) ; } }
InitSharedRecord Method .
16,614
public boolean validateContentSpec ( final ContentSpec contentSpec , final String username ) { boolean valid = preValidateContentSpec ( contentSpec ) ; if ( ! postValidateContentSpec ( contentSpec , username ) ) { valid = false ; } return valid ; }
Validates that a Content Specification is valid by checking the META data child levels and topics . This method is a wrapper to first call PreValidate and then PostValidate .
16,615
private boolean preValidateXML ( final KeyValueNode < String > keyValueNode , final String wrappedValue , final String format ) { Document doc = null ; String errorMsg = null ; try { String fixedXML = DocBookUtilities . escapeForXML ( wrappedValue ) ; if ( CommonConstants . DOCBOOK_50_TITLE . equalsIgnoreCase ( format ) ) { fixedXML = DocBookUtilities . addDocBook50Namespace ( fixedXML ) ; } doc = XMLUtilities . convertStringToDocument ( fixedXML ) ; } catch ( Exception e ) { errorMsg = e . getMessage ( ) ; } if ( doc == null ) { final String line = keyValueNode . getText ( ) ; if ( errorMsg != null ) { log . error ( String . format ( ProcessorConstants . ERROR_INVALID_METADATA_MSG , keyValueNode . getKey ( ) , errorMsg , line ) ) ; } else { log . error ( String . format ( ProcessorConstants . ERROR_INVALID_METADATA_NO_ERROR_MSG , keyValueNode . getKey ( ) , line ) ) ; } return false ; } return true ; }
Performs the pre validation on keyvalue nodes that may be used as XML to ensure it is at least valid XML .
16,616
private boolean doesPublicanCfgsContainValue ( final ContentSpec contentSpec , final String value ) { final Pattern pattern = Pattern . compile ( "^(.*\\n)?( |\\t)*" + value + ":.*" , java . util . regex . Pattern . DOTALL ) ; if ( ! isNullOrEmpty ( contentSpec . getPublicanCfg ( ) ) && pattern . matcher ( contentSpec . getPublicanCfg ( ) ) . matches ( ) ) { return true ; } else if ( ! contentSpec . getAllAdditionalPublicanCfgs ( ) . isEmpty ( ) ) { for ( final Entry < String , String > entry : contentSpec . getAllAdditionalPublicanCfgs ( ) . entrySet ( ) ) { if ( ! isNullOrEmpty ( entry . getValue ( ) ) && pattern . matcher ( entry . getValue ( ) ) . matches ( ) ) { return true ; } } } return false ; }
Check if the default or additional publican cfg files have a specified value
16,617
protected void checkForConflictingCondition ( final IOptionsNode node , final ContentSpec contentSpec ) { if ( ! isNullOrEmpty ( node . getConditionStatement ( ) ) ) { final String publicanCfg ; if ( ! contentSpec . getDefaultPublicanCfg ( ) . equals ( CommonConstants . CS_PUBLICAN_CFG_TITLE ) ) { final String name = contentSpec . getDefaultPublicanCfg ( ) ; final Matcher matcher = CSConstants . CUSTOM_PUBLICAN_CFG_PATTERN . matcher ( name ) ; final String fixedName = matcher . find ( ) ? matcher . group ( 1 ) : name ; publicanCfg = contentSpec . getAdditionalPublicanCfg ( fixedName ) ; } else { publicanCfg = contentSpec . getPublicanCfg ( ) ; } if ( ! isNullOrEmpty ( publicanCfg ) ) { if ( publicanCfg . contains ( "condition:" ) ) { log . warn ( String . format ( ProcessorConstants . WARN_CONDITION_IGNORED_MSG , node . getLineNumber ( ) , node . getText ( ) ) ) ; } } } }
Check if the condition on a node will conflict with a condition in the defined publican . cfg file .
16,618
protected boolean validateEntities ( final ContentSpec contentSpec ) { final String entities = contentSpec . getEntities ( ) ; if ( isNullOrEmpty ( entities ) ) return true ; boolean valid = true ; final String wrappedEntities = "<!DOCTYPE section [" + entities + "]><section></section>" ; Document doc = null ; try { doc = XMLUtilities . convertStringToDocument ( wrappedEntities ) ; } catch ( Exception e ) { final String line = CommonConstants . CS_ENTITIES_TITLE + " = [" + entities + "]" ; log . error ( String . format ( ProcessorConstants . ERROR_INVALID_ENTITIES_MSG , e . getMessage ( ) , line ) ) ; valid = false ; } if ( doc != null ) { final List < String > invalidEntities = new ArrayList < String > ( ) ; final NamedNodeMap entityNodes = doc . getDoctype ( ) . getEntities ( ) ; for ( int i = 0 ; i < entityNodes . getLength ( ) ; i ++ ) { final org . w3c . dom . Node entityNode = entityNodes . item ( i ) ; if ( ProcessorConstants . RESERVED_ENTITIES . contains ( entityNode . getNodeName ( ) ) ) { invalidEntities . add ( entityNode . getNodeName ( ) ) ; } } if ( ! invalidEntities . isEmpty ( ) ) { final StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < invalidEntities . size ( ) ; i ++ ) { if ( i != 0 ) { if ( i == invalidEntities . size ( ) - 1 ) { builder . append ( " and " ) ; } else { builder . append ( ", " ) ; } } builder . append ( invalidEntities . get ( i ) ) ; } final String line = CommonConstants . CS_ENTITIES_TITLE + " = [" + entities + "]" ; if ( invalidEntities . size ( ) == 1 ) { log . error ( String . format ( ProcessorConstants . ERROR_RESERVED_ENTITIES_SINGLE_DEFINED_MSG , builder . toString ( ) , line ) ) ; } else { log . error ( String . format ( ProcessorConstants . ERROR_RESERVED_ENTITIES_DEFINED_MSG , builder . toString ( ) , line ) ) ; } valid = false ; } } return valid ; }
Validates the custom entities to ensure that only the defaults are overridden and that the content is valid XML .
16,619
protected boolean postValidateXML ( final ContentSpec contentSpec , final KeyValueNode < String > keyValueNode , final String wrappedElement , String parentElement ) { String fixedWrappedElement = DocBookUtilities . escapeForXML ( wrappedElement ) ; final String docbookFileName ; final XMLValidator . ValidationMethod validationMethod ; final byte [ ] docbookSchema ; if ( contentSpec . getFormat ( ) . equalsIgnoreCase ( CommonConstants . DOCBOOK_50_TITLE ) ) { final BlobConstantWrapper docbookRng = blobConstantProvider . getBlobConstant ( serverEntities . getDocBook50RNGBlobConstantId ( ) ) ; docbookFileName = docbookRng . getName ( ) ; validationMethod = XMLValidator . ValidationMethod . RELAXNG ; docbookSchema = docbookRng . getValue ( ) ; if ( CommonConstants . CS_TITLE_TITLE . equalsIgnoreCase ( keyValueNode . getKey ( ) ) ) { fixedWrappedElement = DocBookUtilities . addDocBook50Namespace ( "<book><info>" + fixedWrappedElement + "</info></book>" ) ; } else { fixedWrappedElement = DocBookUtilities . addDocBook50Namespace ( "<book><info><title />" + fixedWrappedElement + "</info></book>" ) ; } parentElement = "book" ; } else { final BlobConstantWrapper rocbookDtd = blobConstantProvider . getBlobConstant ( serverEntities . getRocBook45DTDBlobConstantId ( ) ) ; docbookFileName = rocbookDtd . getName ( ) ; validationMethod = XMLValidator . ValidationMethod . DTD ; docbookSchema = rocbookDtd . getValue ( ) ; } final StringBuilder xmlEntities = new StringBuilder ( DocBookUtilities . DOCBOOK_ENTITIES_STRING ) ; xmlEntities . append ( "\n" ) . append ( CSConstants . DUMMY_CS_NAME_ENT_FILE ) ; if ( ! isNullOrEmpty ( contentSpec . getEntities ( ) ) ) { xmlEntities . append ( contentSpec . getEntities ( ) ) ; } final XMLValidator validator = new XMLValidator ( false ) ; if ( ! validator . validate ( validationMethod , fixedWrappedElement , docbookFileName , docbookSchema , xmlEntities . toString ( ) , parentElement ) ) { final String line = keyValueNode . getText ( ) ; log . error ( String . format ( ProcessorConstants . ERROR_INVALID_METADATA_MSG , keyValueNode . getKey ( ) , validator . getErrorText ( ) , line ) ) ; return false ; } return true ; }
Checks that the XML for a keyvalue node is valid DocBook XML .
16,620
protected boolean validateFiles ( final ContentSpec contentSpec ) { final FileList fileList = contentSpec . getFileList ( ) ; boolean valid = true ; if ( fileList != null && ! fileList . getValue ( ) . isEmpty ( ) ) { for ( final File file : fileList . getValue ( ) ) { FileWrapper fileWrapper = null ; try { fileWrapper = fileProvider . getFile ( file . getId ( ) , file . getRevision ( ) ) ; } catch ( NotFoundException e ) { log . debug ( "Could not find file for id " + file . getId ( ) ) ; } if ( fileWrapper == null ) { log . error ( String . format ( ProcessorConstants . ERROR_FILE_ID_NONEXIST_MSG , fileList . getLineNumber ( ) , file . getText ( ) ) ) ; valid = false ; } else if ( file . getTitle ( ) != null ) { if ( ! fileWrapper . getFilename ( ) . equals ( file . getTitle ( ) ) ) { final String errorMsg = String . format ( ProcessorConstants . ERROR_FILE_TITLE_NO_MATCH_MSG , fileList . getLineNumber ( ) , file . getTitle ( ) , fileWrapper . getFilename ( ) ) ; if ( processingOptions . isStrictTitles ( ) ) { log . error ( errorMsg ) ; valid = false ; } else { log . warn ( errorMsg ) ; file . setTitle ( fileWrapper . getFilename ( ) ) ; } } } else { file . setTitle ( fileWrapper . getFilename ( ) ) ; } } } return valid ; }
Checks to make sure that the files specified in a content spec are valid and exist .
16,621
public boolean preValidateRelationships ( final ContentSpec contentSpec ) { boolean error = false ; final Map < String , List < ITopicNode > > specTopicMap = ContentSpecUtilities . getIdTopicNodeMap ( contentSpec ) ; final Map < SpecNodeWithRelationships , List < Relationship > > relationships = contentSpec . getRelationships ( ) ; for ( final Entry < SpecNodeWithRelationships , List < Relationship > > relationshipEntry : relationships . entrySet ( ) ) { final SpecNodeWithRelationships specNode = relationshipEntry . getKey ( ) ; if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } for ( final Relationship relationship : relationshipEntry . getValue ( ) ) { if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } final String relatedId = relationship . getSecondaryRelationshipId ( ) ; if ( relationship instanceof TargetRelationship ) { final SpecNode node = ( ( TargetRelationship ) relationship ) . getSecondaryRelationship ( ) ; if ( node instanceof SpecTopic ) { final SpecTopic targetTopic = ( SpecTopic ) node ; if ( ! validateRelationshipToTopic ( relationship , specNode , relatedId , targetTopic , specTopicMap ) ) { error = true ; } } else if ( node instanceof Level ) { final Level targetLevel = ( Level ) node ; if ( ! validateRelationshipToLevel ( relationship , specNode , targetLevel ) ) { error = true ; } } } else if ( relationship instanceof TopicRelationship ) { final SpecTopic relatedTopic = ( ( TopicRelationship ) relationship ) . getSecondaryRelationship ( ) ; if ( ! validateRelationshipToTopic ( relationship , specNode , relatedId , relatedTopic , specTopicMap ) ) { error = true ; } } } } return ! error ; }
Validate a set of relationships created when parsing .
16,622
protected boolean validateFixedUrl ( final SpecNode specNode , final Set < String > processedFixedUrls ) { boolean valid = true ; if ( ! ProcessorConstants . VALID_FIXED_URL_PATTERN . matcher ( specNode . getFixedUrl ( ) ) . matches ( ) ) { log . error ( format ( ProcessorConstants . ERROR_FIXED_URL_NOT_VALID , specNode . getLineNumber ( ) , specNode . getText ( ) ) ) ; valid = false ; } else if ( processedFixedUrls . contains ( specNode . getFixedUrl ( ) ) ) { log . error ( format ( ProcessorConstants . ERROR_FIXED_URL_NOT_UNIQUE , specNode . getLineNumber ( ) , specNode . getFixedUrl ( ) , specNode . getText ( ) ) ) ; valid = false ; } return valid ; }
Checks to make sure that a user defined fixed url is valid
16,623
protected boolean preValidateCommonContent ( final CommonContent commonContent , final BookType bookType ) { boolean valid = true ; if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } if ( isNullOrEmpty ( commonContent . getTitle ( ) ) ) { log . error ( String . format ( ProcessorConstants . ERROR_COMMON_CONTENT_NO_TITLE_MSG , commonContent . getLineNumber ( ) , commonContent . getText ( ) ) ) ; valid = false ; } if ( ( bookType == BookType . BOOK || bookType == BookType . BOOK_DRAFT ) ) { final Level parent = commonContent . getParent ( ) ; final LevelType parentLevelType = parent . getLevelType ( ) ; if ( parent == null || parentLevelType == LevelType . BASE ) { log . error ( format ( ProcessorConstants . ERROR_COMMON_CONTENT_OUTSIDE_CHAPTER_MSG , commonContent . getLineNumber ( ) , commonContent . getText ( ) ) ) ; valid = false ; } if ( parent != null && parentLevelType == LevelType . PART ) { final List < Node > parentChildren = parent . getChildNodes ( ) ; final int index = parentChildren . indexOf ( commonContent ) ; for ( int i = 0 ; i < index ; i ++ ) { final Node node = parentChildren . get ( i ) ; if ( node instanceof Level && ( ( Level ) node ) . getLevelType ( ) != LevelType . INITIAL_CONTENT ) { log . error ( String . format ( ProcessorConstants . ERROR_COMMON_CONTENT_NOT_IN_PART_INTRO_MSG , commonContent . getLineNumber ( ) , commonContent . getText ( ) ) ) ; valid = false ; break ; } } } } if ( ! isNullOrEmpty ( commonContent . getFixedUrl ( ) ) ) { log . warn ( format ( ProcessorConstants . WARN_FIXED_URL_WILL_BE_IGNORED_MSG , commonContent . getLineNumber ( ) , commonContent . getText ( ) ) ) ; commonContent . setFixedUrl ( null ) ; } if ( ! ProcessorConstants . KNOWN_COMMON_CONTENT . contains ( commonContent . getFixedTitle ( ) ) ) { log . warn ( format ( ProcessorConstants . WARN_UNRECOGNISED_COMMON_CONTENT_MSG , commonContent . getLineNumber ( ) , commonContent . getText ( ) ) ) ; } return valid ; }
Validates a Common Content node for formatting issues .
16,624
private boolean validateExistingTopicTags ( final ITopicNode topicNode , final BaseTopicWrapper < ? > topic ) { if ( topicNode . getRevision ( ) != null ) { return true ; } boolean valid = true ; final List < String > tagNames = topicNode . getTags ( true ) ; if ( ! tagNames . isEmpty ( ) ) { final Set < TagWrapper > tags = new HashSet < TagWrapper > ( ) ; for ( final String tagName : tagNames ) { if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } TagWrapper tag = null ; try { tag = tagProvider . getTagByName ( tagName ) ; } catch ( NotFoundException e ) { } if ( tag != null ) { tags . add ( tag ) ; } } if ( topic . getTags ( ) != null ) { tags . addAll ( topic . getTags ( ) . getItems ( ) ) ; } final Map < Integer , List < TagWrapper > > mapping = EntityUtilities . getCategoryMappingFromTagList ( tags ) ; for ( final Entry < Integer , List < TagWrapper > > catEntry : mapping . entrySet ( ) ) { final CategoryWrapper cat = categoryProvider . getCategory ( catEntry . getKey ( ) ) ; final List < TagWrapper > catTags = catEntry . getValue ( ) ; if ( isShuttingDown . get ( ) ) { shutdown . set ( true ) ; return false ; } if ( cat . isMutuallyExclusive ( ) && catTags . size ( ) > 1 ) { log . error ( String . format ( ProcessorConstants . ERROR_TOPIC_TOO_MANY_CATS_MSG , topicNode . getLineNumber ( ) , cat . getName ( ) , topicNode . getText ( ) ) ) ; valid = false ; } } } return valid ; }
Checks that adding tags to existing topic won t cause problems
16,625
public boolean preValidateBugLinks ( final ContentSpec contentSpec ) { if ( ! contentSpec . isInjectBugLinks ( ) ) { return true ; } final BugLinkOptions bugOptions ; final BugLinkType type ; if ( contentSpec . getBugLinks ( ) . equals ( BugLinkType . JIRA ) ) { type = BugLinkType . JIRA ; bugOptions = contentSpec . getJIRABugLinkOptions ( ) ; } else { type = BugLinkType . BUGZILLA ; bugOptions = contentSpec . getBugzillaBugLinkOptions ( ) ; } final BaseBugLinkStrategy bugLinkStrategy = BugLinkStrategyFactory . getInstance ( ) . create ( type , bugOptions . getBaseUrl ( ) ) ; try { bugLinkStrategy . checkValidValues ( bugOptions ) ; } catch ( ValidationException e ) { final Throwable cause = ExceptionUtilities . getRootCause ( e ) ; log . error ( cause . getMessage ( ) ) ; return false ; } return true ; }
Validate the Bug Links MetaData for a Content Specification without doing any external calls .
16,626
public boolean postValidateBugLinks ( final ContentSpec contentSpec , boolean strict ) { if ( ! contentSpec . isInjectBugLinks ( ) ) { return true ; } try { final BugLinkOptions bugOptions ; final BugLinkType type ; if ( contentSpec . getBugLinks ( ) . equals ( BugLinkType . JIRA ) ) { type = BugLinkType . JIRA ; bugOptions = contentSpec . getJIRABugLinkOptions ( ) ; } else { type = BugLinkType . BUGZILLA ; bugOptions = contentSpec . getBugzillaBugLinkOptions ( ) ; } final BaseBugLinkStrategy bugLinkStrategy = BugLinkStrategyFactory . getInstance ( ) . create ( type , bugOptions . getBaseUrl ( ) ) ; try { bugLinkStrategy . checkValidValues ( bugOptions ) ; } catch ( ValidationException e ) { return false ; } try { bugLinkStrategy . validate ( bugOptions ) ; } catch ( ValidationException e ) { final Throwable cause = ExceptionUtilities . getRootCause ( e ) ; if ( strict ) { log . error ( cause . getMessage ( ) ) ; return false ; } else { log . warn ( cause . getMessage ( ) ) ; } } return true ; } catch ( Exception e ) { if ( e instanceof ConnectException || e instanceof MalformedURLException ) { if ( strict ) { log . error ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_CONNECT ) ; return false ; } else { log . warn ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_CONNECT ) ; } } else if ( e . getCause ( ) instanceof ConnectionException ) { if ( strict ) { log . error ( ProcessorConstants . ERROR_BUGZILLA_UNABLE_TO_CONNECT ) ; return false ; } else { log . warn ( ProcessorConstants . ERROR_BUGZILLA_UNABLE_TO_CONNECT ) ; } } else { if ( strict ) { log . error ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_VALIDATE ) ; log . error ( e . toString ( ) ) ; return false ; } else { log . warn ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_VALIDATE ) ; log . warn ( e . toString ( ) ) ; } } } return true ; }
Validate the Bug Links MetaData for a Content Specification .
16,627
public static List < Block > removeEmptyBlocks ( final Collection < Block > blocks ) { List < Block > cleanBlocks = Lists . newArrayListWithExpectedSize ( blocks . size ( ) ) ; for ( Block block : blocks ) { if ( block . content . isEmpty ( ) ) { continue ; } if ( isWhitespace ( block . content ) ) { continue ; } cleanBlocks . add ( block ) ; } return cleanBlocks ; }
Removes empty blocks from a collection of blocks .
16,628
private static Block block ( final String comment , final int nameStart ) { int attrIndex = comment . indexOf ( '{' ) ; if ( attrIndex != - 1 ) { return new Block ( comment . substring ( nameStart , attrIndex ) . trim ( ) , comment . substring ( attrIndex ) . trim ( ) ) ; } else { return new Block ( comment . substring ( nameStart ) . trim ( ) ) ; } }
Creates an empty block from a comment string .
16,629
public static < FT extends FarObject < NT > , NT > FT getFarObject ( NT nearObject , Class < FT > farType ) { return nearObject == null ? null : farType . cast ( getFarObject ( nearObject ) ) ; }
Returns the far object that corresponds to the given near object in a type safe way .
16,630
public static FarObject < ? > getFarObject ( Object nearObject ) { return nearObject == null ? null : getFacets ( nearObject ) . getFarObject ( ) ; }
Returns the far object that corresponds to the given near object .
16,631
public static WebApiClient getInstance ( Locale locale ) { if ( null == webApiClient ) { webApiClient = new WebApiClient ( locale ) ; } return webApiClient ; }
Returns instance of web API client for given locale . This method use default connection parameters from property configuration file .
16,632
public static WebApiClient getInstance ( Locale locale , String host , int port ) { if ( null == webApiClient ) { webApiClient = new WebApiClient ( locale , host , "" + port ) ; } return webApiClient ; }
Returns instance of web API client for given locale and connection properties .
16,633
public Correspondence match ( String sourceName , List < String > sourceNodes , String targetName , List < String > targetNodes ) { MatchMethods method = new MatchMethods ( httpClient , locale , serverPath ) ; Correspondence correspondace = null ; try { correspondace = method . match ( sourceName , sourceNodes , targetName , targetNodes ) ; } catch ( WebApiException ex ) { java . util . logging . Logger . getLogger ( WebApiClient . class . getName ( ) ) . log ( Level . SEVERE , null , ex ) ; } return correspondace ; }
Returns the correspondence between the source and the target contexts
16,634
private static Map < String , String > parseAttributes ( String attrString ) throws ParseException { AttributeString str = new AttributeString ( attrString ) ; Map < String , String > attributes = Maps . newLinkedHashMapWithExpectedSize ( 4 ) ; AttrState state = AttrState . NAME ; String currName = "" ; String currString = "" ; int currPos = 0 ; while ( ( currString = str . nextString ( ) ) != null ) { switch ( state ) { case NAME : if ( str . ch == '=' ) { currName = currString ; state = AttrState . VALUE ; } else { attributes . put ( String . format ( "$%d" , currPos ++ ) , currString ) ; } break ; case VALUE : attributes . put ( currName . toLowerCase ( ) , currString ) ; state = AttrState . NAME ; break ; } } return attributes ; }
Parse attributes in a shortcode .
16,635
private static String scanForName ( int pos , final char [ ] chars ) { StringBuilder buf = new StringBuilder ( ) ; while ( pos < chars . length ) { char ch = chars [ pos ++ ] ; switch ( ch ) { case ' ' : case ']' : return buf . toString ( ) ; case '[' : case '<' : case '>' : case '&' : case '/' : return "" ; default : if ( ch < 0x20 || Character . isWhitespace ( ch ) ) { return "" ; } else { buf . append ( ch ) ; } } } return "" ; }
Scans for a valid shortcode name .
16,636
public static String fixDisplayURL ( String strURL , boolean bHelp , boolean bNoNav , boolean bLanguage , PropertyOwner propertyOwner ) { if ( ( strURL == null ) || ( strURL . length ( ) == 0 ) ) return strURL ; Map < String , Object > properties = UrlUtil . parseArgs ( null , strURL ) ; if ( bHelp ) properties . put ( Params . HELP , Constants . BLANK ) ; if ( bNoNav ) { properties . put ( Params . MENUBARS , "No" ) ; properties . put ( Params . NAVMENUS , "No" ) ; properties . put ( Params . LOGOS , "No" ) ; properties . put ( Params . TRAILERS , "No" ) ; } if ( bLanguage ) { String strLanguage = null ; if ( propertyOwner != null ) strLanguage = propertyOwner . getProperty ( "helplanguage" ) ; if ( ( strLanguage == null ) || ( strLanguage . length ( ) == 0 ) ) if ( propertyOwner != null ) strLanguage = propertyOwner . getProperty ( Params . LANGUAGE ) ; if ( ( strLanguage != null ) && ( strLanguage . length ( ) > 0 ) ) properties . put ( Params . LANGUAGE , strLanguage ) ; } return UrlUtil . propertiesToUrl ( properties ) ; }
Get this URL minus the nav bars
16,637
public boolean matches ( ESigItem item ) { if ( selected != null && item . isSelected ( ) != selected ) { return false ; } if ( eSigType != null && ! item . getESigType ( ) . equals ( eSigType ) ) { return false ; } if ( session != null && ! item . getSession ( ) . equals ( session ) ) { return false ; } if ( ids != null && ! ids . contains ( item . getId ( ) ) ) { return false ; } return true ; }
Returns true if the item matches the selection filter .
16,638
public void scanTableItems ( ) { m_vDisplays = new Vector < String > ( ) ; m_vValues = new Vector < String > ( ) ; String strField = null ; Convert converter = this . getScreenField ( ) . getConverter ( ) ; Object data = converter . getData ( ) ; BaseField field = ( BaseField ) converter . getField ( ) ; boolean bModifiedState = false ; boolean [ ] states = null ; if ( field != null ) { bModifiedState = field . isModified ( ) ; states = field . setEnableListeners ( false ) ; } for ( int index = 0 ; index < SPopupBox . MAX_POPUP_ITEMS ; index ++ ) { String strDisplay = converter . convertIndexToDisStr ( index ) ; boolean bModified = false ; if ( field != null ) bModified = field . isModified ( ) ; converter . convertIndexToField ( index , DBConstants . DONT_DISPLAY , DBConstants . READ_MOVE ) ; if ( field != null ) field . setModified ( bModified ) ; if ( converter . getField ( ) != null ) strField = converter . getField ( ) . getString ( ) ; else strField = Integer . toString ( index ) ; if ( index > 0 ) if ( ( strDisplay == null ) || ( strDisplay . length ( ) == 0 ) ) break ; m_vDisplays . add ( strDisplay ) ; m_vValues . add ( strField ) ; } converter . setData ( data , DBConstants . DONT_DISPLAY , DBConstants . READ_MOVE ) ; if ( field != null ) { field . setModified ( bModifiedState ) ; field . setEnableListeners ( states ) ; } }
Scan through the items and cache the values and display strings .
16,639
public String getSFieldProperty ( String strFieldName ) { String strValue = super . getSFieldProperty ( strFieldName ) ; Convert converter = this . getScreenField ( ) . getConverter ( ) ; String strConverter = converter . toString ( ) ; if ( ( ( strValue != null ) && ( strValue . equals ( strConverter ) ) ) || ( ( strValue == null ) && ( strConverter == null ) ) ) { if ( converter . getField ( ) != null ) return converter . getField ( ) . toString ( ) ; } for ( int index = 0 ; index < SPopupBox . MAX_POPUP_ITEMS ; index ++ ) { String strDisplay = converter . convertIndexToDisStr ( index ) ; if ( ( ( strValue != null ) && ( strValue . equals ( strDisplay ) ) ) || ( ( strValue == null ) && ( strDisplay == null ) ) ) { if ( converter . convertIndexToField ( index , DBConstants . DISPLAY , DBConstants . SCREEN_MOVE ) == DBConstants . NORMAL_RETURN ) return converter . getField ( ) . toString ( ) ; } if ( index > 0 ) if ( ( strDisplay == null ) || ( strDisplay . length ( ) == 0 ) ) break ; } return strValue ; }
Get this control s value as it was submitted by the HTML post operation .
16,640
public static Object unmarshall ( HttpResponse response ) throws JAXBException , IOException { String xml = EntityUtils . toString ( response . getEntity ( ) ) ; Unmarshaller unmarshaller = ctx . createUnmarshaller ( ) ; return unmarshaller . unmarshal ( new StringReader ( xml ) ) ; }
Unmarshalls the input stream into an object from org . yestech . episodic . objectmodel .
16,641
public static String join ( String [ ] strings ) { StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < strings . length ; i ++ ) { builder . append ( strings [ i ] ) ; if ( i + 1 < strings . length ) builder . append ( "," ) ; } return builder . toString ( ) ; }
A simple method for joining an array of strings to a comma seperated string .
16,642
public void removeIt ( ) { if ( m_queryRecord != null ) if ( this . getOwner ( ) != null ) m_queryRecord . removeRecord ( this . getOwner ( ) ) ; m_queryRecord = null ; }
Remove this record from the query record .
16,643
public List < Class < ? > > directSuperclasses ( Class < ? > c ) { if ( c . isPrimitive ( ) ) { return primitiveSuperclasses ( c ) ; } else if ( c . isArray ( ) ) { return arrayDirectSuperclasses ( 0 , c ) ; } else { Class < ? > [ ] interfaces = c . getInterfaces ( ) ; Class < ? > superclass = c . getSuperclass ( ) ; List < Class < ? > > classes = new LinkedList < Class < ? > > ( ) ; classes . addAll ( Arrays . asList ( interfaces ) ) ; if ( superclass == null ) { if ( interfaces . length == 0 && c != Object . class ) classes . add ( Object . class ) ; } else { classes . add ( superclass ) ; } return classes ; } }
Get the direct superclasses of a class . Interfaces followed by the superclasses . Interfaces with no super interfaces extend Object .
16,644
public Object getValue ( String name ) { if ( arguments == null ) { throw new IllegalStateException ( "setArgs not called" ) ; } Object ob = options . get ( name ) ; if ( ob != null ) { return ob ; } return arguments . get ( name ) ; }
Returns named option or argument value
16,645
public void command ( String ... args ) { try { setArgs ( args ) ; } catch ( CmdArgsException ex ) { ex . printStackTrace ( ) ; Logger logger = Logger . getLogger ( CmdArgs . class . getName ( ) ) ; logger . log ( Level . SEVERE , Arrays . toString ( args ) ) ; logger . log ( Level . SEVERE , ex . getMessage ( ) , ex ) ; logger . log ( Level . SEVERE , ex . usage ( ) ) ; System . exit ( - 1 ) ; } }
Initializes options and arguments . Reports error and exits on error . Called usually from main method .
16,646
public final < T > T getArgument ( String name ) { if ( arguments == null ) { throw new IllegalStateException ( "setArgs not called" ) ; } return ( T ) arguments . get ( name ) ; }
Returns named argument value
16,647
public final < T > T getOption ( String name ) { if ( arguments == null ) { throw new IllegalStateException ( "setArgs not called" ) ; } Object value = options . get ( name ) ; if ( value == null ) { Option opt = map . get ( name ) ; if ( opt == null ) { throw new IllegalArgumentException ( "option " + name + " not found" ) ; } if ( opt . defValue != null ) { return ( T ) opt . defValue ; } if ( ! opt . mandatory ) { return null ; } throw new IllegalArgumentException ( name + " not found" ) ; } return ( T ) value ; }
Return named option value .
16,648
public final < T > void addArgument ( Class < T > cls , String name ) { if ( map . containsKey ( name ) ) { throw new IllegalArgumentException ( name + " is already added as option" ) ; } if ( hasArrayArgument ) { throw new IllegalArgumentException ( "no argument allowed after array argument" ) ; } types . add ( cls ) ; names . add ( name ) ; if ( cls . isArray ( ) ) { hasArrayArgument = true ; } }
Add typed argument
16,649
public final < T > void addOption ( String name , String description ) { addOption ( String . class , name , description , null ) ; }
Add a mandatory string option
16,650
public String getUsage ( ) { Set < Option > set = new HashSet < > ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "usage: " ) ; boolean n1 = false ; for ( Entry < String , List < Option > > e : groups . entrySet ( ) ) { if ( n1 ) { sb . append ( "|" ) ; } n1 = true ; sb . append ( "[" ) ; boolean n2 = false ; for ( Option opt : e . getValue ( ) ) { if ( n2 ) { sb . append ( " " ) ; } n2 = true ; append ( sb , opt ) ; set . add ( opt ) ; } sb . append ( "]" ) ; } for ( Option opt : map . values ( ) ) { if ( ! set . contains ( opt ) ) { sb . append ( " " ) ; append ( sb , opt ) ; } } for ( int ii = 0 ; ii < names . size ( ) ; ii ++ ) { sb . append ( " <" ) . append ( names . get ( ii ) ) . append ( ">" ) ; if ( types . get ( ii ) . isArray ( ) ) { sb . append ( "..." ) ; } } return sb . toString ( ) ; }
Returns usage string .
16,651
public Object intercept ( Object obj , Method method , Object [ ] args , MethodProxy proxy ) throws Throwable { if ( method . getName ( ) . equals ( "annotationType" ) ) { return annotationType ; } else if ( method . getName ( ) . equals ( "toString" ) ) { return toString ( ) ; } else if ( method . getName ( ) . equals ( "equals" ) ) { return annotationEquals ( args [ 0 ] ) ; } else if ( method . getName ( ) . equals ( "hashCode" ) ) { return proxy . hashCode ( ) ; } else { return attributeData . get ( method . getName ( ) ) ; } }
Intercept all methods calls .
16,652
private boolean annotationEquals ( Object object ) { if ( object == null || ! ( object instanceof Annotation ) || ! annotationType . equals ( ( ( Annotation ) object ) . annotationType ( ) ) ) { return false ; } for ( Map . Entry < String , Method > entry : attributes . entrySet ( ) ) { String methodName = entry . getKey ( ) ; Method method = entry . getValue ( ) ; Object otherValue ; try { otherValue = method . invoke ( object ) ; Object value = attributeData . get ( methodName ) ; if ( ! attributeEquals ( value , otherValue ) ) { return false ; } } catch ( Exception e ) { return false ; } } return true ; }
Returns true if the specified object represents an annotation that is logically equivalent to this one .
16,653
private boolean attributeEquals ( Object value , Object otherValue ) { if ( value == null && otherValue == null ) { return true ; } else if ( value == null || otherValue == null ) { return false ; } else { if ( value . getClass ( ) . isArray ( ) ) { return Arrays . equals ( ( Object [ ] ) value , ( Object [ ] ) otherValue ) ; } else { return value . equals ( otherValue ) ; } } }
Returns true if two attributes are equal .
16,654
public synchronized void sendNotification ( Supplier < String > textSupplier , Supplier < U > userDataSupplier , LongSupplier timestampSupplier ) { if ( ! map . isEmpty ( ) ) { sendNotification ( textSupplier . get ( ) , userDataSupplier . get ( ) , timestampSupplier . getAsLong ( ) ) ; } }
Send notification . supplier is called only if there are listeners
16,655
public synchronized void sendNotification ( String text , U userData , long timestamp ) { map . allValues ( ) . forEach ( ( ListenerWrapper w ) -> executor . execute ( ( ) -> w . sendNotification ( text , userData , timestamp ) ) ) ; }
Send notification .
16,656
public void logoutAllSessions ( final Timestamp logoutTimestamp ) { final PersistenceManager pm = isisJdoSupport . getJdoPersistenceManager ( ) ; final Properties properties = pm . getPersistenceManagerFactory ( ) . getProperties ( ) ; if ( isTrue ( properties . get ( DN_BULK_UPDATES_KEY ) ) ) { final javax . jdo . Query jdoQuery = pm . newNamedQuery ( SessionLogEntry . class , "logoutAllActiveSessions" ) ; final Map argumentsByParameterName = ImmutableMap . of ( "logoutTimestamp" , logoutTimestamp , "causedBy2" , SessionLogEntry . CausedBy2 . RESTART ) ; try { final Long numRows = ( Long ) jdoQuery . executeWithMap ( argumentsByParameterName ) ; } finally { jdoQuery . closeAll ( ) ; } } else { final List < SessionLogEntry > activeEntries = repositoryService . allMatches ( new QueryDefault < > ( SessionLogEntry . class , "listAllActiveSessions" ) ) ; for ( SessionLogEntry activeEntry : activeEntries ) { activeEntry . setCausedBy2 ( SessionLogEntry . CausedBy2 . RESTART ) ; activeEntry . setLogoutTimestamp ( logoutTimestamp ) ; } } }
region > logoutAllSessions
16,657
public SessionLogEntry findBySessionId ( final String sessionId ) { return repositoryService . firstMatch ( new QueryDefault < > ( SessionLogEntry . class , "findBySessionId" , "sessionId" , sessionId ) ) ; }
region > findBySessionId
16,658
public List < SessionLogEntry > findByUserAndStrictlyBefore ( final String user , final Timestamp from ) { return repositoryService . allMatches ( new QueryDefault < > ( SessionLogEntry . class , "findByUserAndTimestampStrictlyBefore" , "user" , user , "from" , from ) ) ; }
region > findByUserAndStrictlyBefore
16,659
@ XmlElement ( name = "maxPaginationLinks" , defaultValue = "7" ) @ JsonProperty ( value = "maxPaginationLinks" , required = true ) @ ApiModelProperty ( value = "The maximum number of pagination links." , required = true , example = "7" ) public int getMaxPaginationLinks ( ) { return maxPaginationLinks ; }
Returns the maximum number of pagination links .
16,660
@ XmlElement ( name = "firstPageLink" ) @ JsonProperty ( value = "firstPageLink" ) @ ApiModelProperty ( value = "The first pagination link." , position = 1 ) public PageRequestLinkDto getFirstPageLink ( ) { return firstPageLink ; }
Returns the first pagination link .
16,661
@ XmlElement ( name = "previousPageLink" ) @ JsonProperty ( value = "previousPageLink" ) @ ApiModelProperty ( value = "The previous pagination link." , position = 2 ) public PageRequestLinkDto getPreviousPageLink ( ) { return previousPageLink ; }
Returns the previous pagination link .
16,662
@ XmlElementWrapper ( name = "links" ) @ XmlElement ( name = "link" ) @ JsonProperty ( value = "links" ) @ ApiModelProperty ( value = "The pagination links." , position = 3 ) public List < PageRequestLinkDto > getLinks ( ) { return links ; }
Returns the pagination links .
16,663
@ JsonProperty ( value = "links" ) public void setLinks ( List < PageRequestLinkDto > links ) { if ( links == null ) { this . links = new ArrayList < > ( ) ; } else { this . links = links ; } }
Sets the pagination links .
16,664
@ XmlElement ( name = "nextPageLink" ) @ JsonProperty ( value = "nextPageLink" ) @ ApiModelProperty ( value = "The next pagination link." , position = 4 ) public PageRequestLinkDto getNextPageLink ( ) { return nextPageLink ; }
Returns the next pagination link .
16,665
@ XmlElement ( name = "lastPageLink" ) @ JsonProperty ( value = "lastPageLink" ) @ ApiModelProperty ( value = "The last pagination link." , position = 5 ) public PageRequestLinkDto getLastPageLink ( ) { return lastPageLink ; }
Returns the last pagination link .
16,666
private List < EditableAcraReport > retrieveUnsyncedElements ( ) throws IOException , ServiceException { final ListFeed listFeed = client . getFeed ( listFeedUrl , ListFeed . class ) ; final List < EditableAcraReport > reports = new ArrayList < EditableAcraReport > ( ) ; for ( final ListEntry listEntry : listFeed . getEntries ( ) ) { try { reports . add ( new EditableAcraReport ( listEntry ) ) ; } catch ( final MalformedSpreadsheetLineException e ) { LOGGER . error ( e . getMessage ( ) ) ; } } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "found {} reports to sync" , CollectionUtils . size ( reports ) ) ; if ( LOGGER . isTraceEnabled ( ) ) { for ( final EditableAcraReport report : reports ) { LOGGER . trace ( "reportId={} stacktraceMd5={}" , report . getId ( ) , report . getStacktraceMD5 ( ) ) ; } } } return reports ; }
Gets unsynchronized Acra reports from the Google spreadsheet .
16,667
public void startSynchronization ( ) throws IOException , ServiceException , AuthenticationException , NotFoundException , RedmineException , ParseException { final List < EditableAcraReport > listReports = retrieveUnsyncedElements ( ) ; for ( final EditableAcraReport report : listReports ) { final Issue issue = getIssueForStack ( report . getStacktraceMD5 ( ) ) ; try { if ( null == issue ) { LOGGER . debug ( "Got a new bugreport: reportId={}" , report . getId ( ) ) ; for ( final AcraReportHandler handler : reportHandlers ) { handler . onNewReport ( report ) ; } } else if ( ChiliprojectUtils . isSynchronized ( report , issue ) ) { LOGGER . debug ( "Got a bugreport already synchronized: reportId={}" , report . getId ( ) ) ; for ( final AcraReportHandler handler : reportHandlers ) { handler . onKnownIssueAlreadySynchronized ( report , issue ) ; } } else { LOGGER . debug ( "Got a new bugreport with a stacktrace similar to an existing ticket: reportId={}" , report . getId ( ) ) ; for ( final AcraReportHandler handler : reportHandlers ) { handler . onKnownIssueNotSynchronized ( report , issue ) ; } } } catch ( final SynchronizationException e ) { report . mergeSyncStatus ( SyncStatus . FAILURE ) ; LOGGER . error ( "Unable to synchronize ACRA report " + report . getId ( ) , e ) ; } } try { for ( final AcraReportHandler handler : reportHandlers ) { handler . onFinishReceivingNewReports ( ) ; } } catch ( final SynchronizationException e ) { for ( final EditableAcraReport report : listReports ) { report . mergeSyncStatus ( SyncStatus . FAILURE ) ; } LOGGER . error ( "Unable to finalize ACRA report synchronization" ) ; } for ( final EditableAcraReport report : listReports ) { if ( SyncStatus . SUCCESS . equals ( report . getStatus ( ) ) ) { report . commitStacktraceMD5 ( ) ; } } }
Starts the synchronization between Acra reports Google spreadsheet and Chiliproject bugtracker .
16,668
private Issue getIssueForStack ( final String pStacktraceMD5 ) throws IOException , AuthenticationException , NotFoundException , RedmineException { final Map < String , String > parameters = new HashMap < String , String > ( ) ; parameters . put ( "project_id" , String . valueOf ( config . CHILIPROJECT_PROJECT_ID ) ) ; parameters . put ( String . format ( "cf_%d" , config . CHILIPROJECT_STACKTRACE_MD5_CF_ID ) , pStacktraceMD5 ) ; final List < Issue > results = redmineClient . getIssues ( parameters ) ; Issue issue = null ; if ( CollectionUtils . size ( results ) > 1 ) { issue = handleMultipleIssuesForSameStacktrace ( results ) ; } else if ( CollectionUtils . size ( results ) == 1 ) { issue = results . get ( 0 ) ; } return issue ; }
Search for the issue related to the given MD5 stacktrace hash .
16,669
public Set < V > get ( Object key ) { Set < V > set = map . get ( key ) ; return set != null ? set : Collections . EMPTY_SET ; }
Returns mapped set . Returns empty set if no mapping exists .
16,670
public static Typeface createFromAsset ( AssetManager mgr , String path ) { Typeface typeface = TYPEFACES . get ( path ) ; if ( typeface != null ) { return typeface ; } else { typeface = Typeface . createFromAsset ( mgr , path ) ; TYPEFACES . put ( path , typeface ) ; return typeface ; } }
Create a new typeface from the specified font data .
16,671
@ SuppressWarnings ( "PMD.CollapsibleIfStatements" ) private < V extends FileAttributeView > V addIsLinkIfPossible ( Class < V > type , V fav ) { if ( BasicFileAttributeView . class . isAssignableFrom ( type ) ) { if ( ( ! v ( ( ) -> BasicFileAttributeView . class . cast ( fav ) . readAttributes ( ) ) . isSymbolicLink ( ) ) ) { if ( ! ( fav instanceof LinkInfoSettable ) ) { throw new UnsupportedOperationException ( "the attribute view need to implement LinkInfoSettable in order to make SymLinks work" ) ; } ( ( LinkInfoSettable ) ( fav ) ) . setLink ( ) ; } } return fav ; }
if the the FAV is actually a BasicFileAttributeView then there is an isLink method if this is not already set and FAV implements LinkInfoSettable use it to add this link info
16,672
public Object unmarshalThisMessage ( String strXMLBody ) { try { Reader inStream = new StringReader ( strXMLBody ) ; Object msg = this . unmarshalRootElement ( inStream ) ; inStream . close ( ) ; return msg ; } catch ( Throwable ex ) { ex . printStackTrace ( ) ; } return null ; }
UnmarshalThisMessage Method .
16,673
public Object unmarshalRootElement ( Reader inStream ) throws UnmarshalException { try { String strSOAPPackage = this . getSOAPPackage ( ) ; if ( strSOAPPackage != null ) { Unmarshaller u = JaxbContexts . getJAXBContexts ( ) . getUnmarshaller ( strSOAPPackage ) ; Object obj = null ; synchronized ( u ) { obj = u . unmarshal ( inStream ) ; } return obj ; } } catch ( JAXBException ex ) { ex . printStackTrace ( ) ; } return null ; }
UnmarshalRootElement Method .
16,674
public void updateMessageProcessInfo ( String elementIn , String elementOut , String elementFault , boolean bIsSafe , String address ) { MessageInfo recMessageInfo = this . getMessageInfo ( elementIn ) ; if ( recMessageInfo != null ) { MessageProcessInfo recMessageProcessInfo = ( MessageProcessInfo ) this . getRecord ( MessageProcessInfo . MESSAGE_PROCESS_INFO_FILE ) ; FileListener listener = new SubFileFilter ( recMessageInfo ) ; recMessageProcessInfo . addListener ( listener ) ; recMessageProcessInfo . setKeyArea ( MessageProcessInfo . MESSAGE_INFO_ID_KEY ) ; recMessageProcessInfo . close ( ) ; try { while ( recMessageProcessInfo . hasNext ( ) ) { recMessageProcessInfo . next ( ) ; if ( ! MessageType . MESSAGE_OUT . equalsIgnoreCase ( ( ( ReferenceField ) recMessageProcessInfo . getField ( MessageProcessInfo . MESSAGE_TYPE_ID ) ) . getReference ( ) . getField ( MessageType . CODE ) . toString ( ) ) ) continue ; boolean safe = CreateWSDL . SAFE_DEFAULT ; String safeValue = ( ( PropertiesField ) recMessageProcessInfo . getField ( MessageProcessInfo . PROPERTIES ) ) . getProperty ( MessageProcessInfo . SAFE ) ; if ( safeValue != null ) safe = Boolean . parseBoolean ( safeValue ) ; if ( safeValue != null ) if ( safe != bIsSafe ) continue ; Record recMessageProcessInfo2 = ( ( ReferenceField ) recMessageProcessInfo . getField ( MessageProcessInfo . REPLY_MESSAGE_PROCESS_INFO_ID ) ) . getReference ( ) ; if ( recMessageProcessInfo2 != null ) if ( ( recMessageProcessInfo2 . getEditMode ( ) == DBConstants . EDIT_IN_PROGRESS ) || ( recMessageProcessInfo2 . getEditMode ( ) == DBConstants . EDIT_CURRENT ) ) { Record recMessageInfo2 = ( ( ReferenceField ) recMessageProcessInfo2 . getField ( MessageProcessInfo . MESSAGE_INFO_ID ) ) . getReference ( ) ; if ( recMessageInfo2 != null ) { if ( elementOut != null ) if ( elementOut . equalsIgnoreCase ( recMessageInfo2 . getField ( MessageInfo . CODE ) . getString ( ) ) ) { Map < String , Object > map = null ; if ( address != null ) { map = new Hashtable < String , Object > ( ) ; String site = this . getSiteFromAddress ( address , null ) ; map . put ( TrxMessageHeader . DESTINATION_PARAM , site ) ; map . put ( TrxMessageHeader . DESTINATION_MESSAGE_PARAM , this . getPathFromAddress ( address , site ) ) ; } this . updateMessageDetail ( recMessageProcessInfo , map ) ; } } } } } catch ( DBException e ) { e . printStackTrace ( ) ; } finally { recMessageProcessInfo . removeListener ( listener , true ) ; } } }
UpdateMessageProcessInfo Method .
16,675
public MessageInfo getMessageInfo ( String element ) { MessageInfo recMessageInfo = ( MessageInfo ) this . getRecord ( MessageInfo . MESSAGE_INFO_FILE ) ; recMessageInfo . setKeyArea ( MessageInfo . CODE_KEY ) ; recMessageInfo . getField ( MessageInfo . CODE ) . setString ( element ) ; try { if ( recMessageInfo . seek ( null ) ) { return recMessageInfo ; } } catch ( DBException e ) { e . printStackTrace ( ) ; } return null ; }
GetMessageInfo Method .
16,676
public String addAddressToTarget ( String address ) { if ( address != null ) { MessageDetailTarget messageDetailTarget = ( MessageDetailTarget ) this . getMainRecord ( ) ; String site = messageDetailTarget . getProperty ( TrxMessageHeader . DESTINATION_PARAM ) ; site = this . getSiteFromAddress ( address , site ) ; if ( ! messageDetailTarget . setProperty ( TrxMessageHeader . DESTINATION_PARAM , site ) ) address = null ; messageDetailTarget . setProperty ( TrxMessageHeader . DESTINATION_MESSAGE_PARAM , this . getPathFromAddress ( address , site ) ) ; String wsdlPath = messageDetailTarget . getProperty ( TrxMessageHeader . WSDL_PATH ) ; wsdlPath = this . getPathFromAddress ( wsdlPath , site ) ; if ( wsdlPath != null ) messageDetailTarget . setProperty ( TrxMessageHeader . WSDL_PATH , wsdlPath ) ; } return address ; }
AddAddressToTarget Method .
16,677
public void updateMessageDetail ( MessageProcessInfo recMessageProcessInfo , Map < String , Object > map ) { MessageDetail recMessageDetail = ( MessageDetail ) this . getRecord ( MessageDetail . MESSAGE_DETAIL_FILE ) ; MessageTransport recMessageTransport = ( MessageTransport ) this . getRecord ( MessageTransport . MESSAGE_TRANSPORT_FILE ) ; try { recMessageDetail . addNew ( ) ; recMessageDetail . getField ( MessageDetail . MESSAGE_PROCESS_INFO_ID ) . moveFieldToThis ( ( BaseField ) recMessageProcessInfo . getCounterField ( ) ) ; recMessageDetail . getField ( MessageDetail . MESSAGE_TRANSPORT_ID ) . moveFieldToThis ( ( BaseField ) recMessageTransport . getCounterField ( ) ) ; if ( recMessageDetail . seek ( null ) ) recMessageDetail . edit ( ) ; else recMessageDetail . addNew ( ) ; recMessageDetail . getField ( MessageDetail . MESSAGE_PROCESS_INFO_ID ) . moveFieldToThis ( ( BaseField ) recMessageProcessInfo . getCounterField ( ) ) ; recMessageDetail . getField ( MessageDetail . MESSAGE_TRANSPORT_ID ) . moveFieldToThis ( ( BaseField ) recMessageTransport . getCounterField ( ) ) ; String site = ( map == null ) ? null : ( String ) map . get ( TrxMessageHeader . DESTINATION_PARAM ) ; ( ( PropertiesField ) recMessageDetail . getField ( MessageDetail . PROPERTIES ) ) . setProperty ( TrxMessageHeader . DESTINATION_PARAM , site ) ; String wspath = ( map == null ) ? null : ( String ) map . get ( TrxMessageHeader . DESTINATION_MESSAGE_PARAM ) ; ( ( PropertiesField ) recMessageDetail . getField ( MessageDetail . PROPERTIES ) ) . setProperty ( TrxMessageHeader . DESTINATION_MESSAGE_PARAM , wspath ) ; if ( recMessageDetail . getEditMode ( ) == DBConstants . EDIT_ADD ) recMessageDetail . add ( ) ; else recMessageDetail . set ( ) ; } catch ( DBException e ) { e . printStackTrace ( ) ; } }
UpdateMessageDetail Method .
16,678
public String getSiteFromAddress ( String url , String site ) { int iStart = url . indexOf ( "//" ) + 2 ; iStart = url . indexOf ( '/' , iStart ) ; if ( iStart == - 1 ) iStart = url . length ( ) ; if ( ( site != null ) && ( site . length ( ) > 0 ) ) if ( ! url . equalsIgnoreCase ( site ) ) return site ; return url . substring ( 0 , iStart ) ; }
GetSiteFromAddress Method .
16,679
@ SuppressWarnings ( "unchecked" ) public static < V > V get ( String key ) { return ( V ) share . get ( ) . get ( key ) ; }
Get the specific key value
16,680
public static void set ( String key , Object value ) { share . get ( ) . put ( key , value ) ; }
Set the specific key value
16,681
@ SuppressWarnings ( "unchecked" ) public static < V > V remove ( String key ) { return ( V ) share . get ( ) . remove ( key ) ; }
Remove the specific key
16,682
public Record getNextRecord ( PrintWriter out , int iPrintOptions , boolean bFirstTime , boolean bHeadingFootingExists ) throws DBException { Object [ ] rgobjEnabled = null ; boolean bAfterRequery = ! this . getMainRecord ( ) . isOpen ( ) ; if ( ! this . getMainRecord ( ) . isOpen ( ) ) this . getMainRecord ( ) . open ( ) ; if ( bHeadingFootingExists ) rgobjEnabled = this . getMainRecord ( ) . setEnableNonFilter ( null , false , false , false , false , true ) ; Record record = this . getNextGridRecord ( bFirstTime ) ; if ( bHeadingFootingExists ) { boolean bBreak = this . printHeadingFootingData ( out , iPrintOptions | HtmlConstants . FOOTING_SCREEN | HtmlConstants . DETAIL_SCREEN ) ; this . getMainRecord ( ) . setEnableNonFilter ( rgobjEnabled , ( record != null ) , bBreak , bFirstTime | bAfterRequery , ( record == null ) , true ) ; } return record ; }
Get the next record . This is the special method for a report . It handles breaks by disabling all listeners except filter listeners then reenabling and calling the listeners after the footing has been printed so totals etc will be in the next break .
16,683
private static Class < ? > box ( Class < ? > clazz ) { if ( clazz == int . class ) { return Integer . class ; } else if ( clazz == float . class ) { return Float . class ; } else if ( clazz == long . class ) { return Long . class ; } else if ( clazz == double . class ) { return double . class ; } else if ( clazz == boolean . class ) { return Boolean . class ; } else if ( clazz == char . class ) { return Character . class ; } else if ( clazz == byte . class ) { return Byte . class ; } return clazz ; }
returns the boxed type of the primitive class or the class itself if there is no wrapper for the given type .
16,684
static String getNativeDataTypeName ( int nativeDataTypeCode ) throws OdaException { DataTypeMapping typeMapping = getManifest ( ) . getDataSetType ( null ) . getDataTypeMapping ( nativeDataTypeCode ) ; if ( typeMapping != null ) return typeMapping . getNativeType ( ) ; return "Non-defined" ; }
Returns the native data type name of the specified code as defined in this data source extension s manifest .
16,685
private String toAlias ( String propertyName ) { String result = propertyAliasType . get ( propertyName ) ; return result == null ? propertyName : result ; }
Returns alias for name if it exists or the original name if not .
16,686
private Property newProperty ( String propertyName , String instanceName , String entity ) { return new Property ( toAlias ( propertyName ) , instanceName , entity ) ; }
Returns an instance of the specified property observing property aliases .
16,687
public static ECPoint compressPoint ( ECPoint uncompressed ) { return CURVE . getCurve ( ) . decodePoint ( uncompressed . getEncoded ( true ) ) ; }
Utility for compressing an elliptic curve point . Returns the same point if it s already compressed . See the ECKey class docs for a discussion of point compression .
16,688
public static ECPoint decompressPoint ( ECPoint compressed ) { return CURVE . getCurve ( ) . decodePoint ( compressed . getEncoded ( false ) ) ; }
Utility for decompressing an elliptic curve point . Returns the same point if it s already compressed . See the ECKey class docs for a discussion of point compression .
16,689
public static ECKey fromPrivate ( BigInteger privKey ) { return new ECKey ( privKey , CURVE . getG ( ) . multiply ( privKey ) ) ; }
Creates an ECKey given the private key only .
16,690
public static byte [ ] pubBytesWithoutFormat ( ECPoint pubPoint ) { final byte [ ] pubBytes = pubPoint . getEncoded ( false ) ; return Arrays . copyOfRange ( pubBytes , 1 , pubBytes . length ) ; }
Compute the encoded X Y coordinates of a public point .
16,691
public static ECKey fromNodeId ( byte [ ] nodeId ) { check ( nodeId . length == 64 , "Expected a 64 byte node id" ) ; byte [ ] pubBytes = new byte [ 65 ] ; System . arraycopy ( nodeId , 0 , pubBytes , 1 , nodeId . length ) ; pubBytes [ 0 ] = 0x04 ; return ECKey . fromPublicOnly ( pubBytes ) ; }
Recover the public key from an encoded node id .
16,692
public ECDSASignature doSign ( byte [ ] input ) { if ( input . length != 32 ) { throw new IllegalArgumentException ( "Expected 32 byte input to ECDSA signature, not " + input . length ) ; } if ( privKey == null ) throw new MissingPrivateKeyException ( ) ; if ( privKey instanceof BCECPrivateKey ) { ECDSASigner signer = new ECDSASigner ( new HMacDSAKCalculator ( new SHA256Digest ( ) ) ) ; ECPrivateKeyParameters privKeyParams = new ECPrivateKeyParameters ( ( ( BCECPrivateKey ) privKey ) . getD ( ) , CURVE ) ; signer . init ( true , privKeyParams ) ; BigInteger [ ] components = signer . generateSignature ( input ) ; return new ECDSASignature ( components [ 0 ] , components [ 1 ] ) . toCanonicalised ( ) ; } else { try { final Signature ecSig = ECSignatureFactory . getRawInstance ( provider ) ; ecSig . initSign ( privKey ) ; ecSig . update ( input ) ; final byte [ ] derSignature = ecSig . sign ( ) ; return ECDSASignature . decodeFromDER ( derSignature ) . toCanonicalised ( ) ; } catch ( SignatureException | InvalidKeyException ex ) { throw new RuntimeException ( "ECKey signing error" , ex ) ; } } }
Signs the given hash and returns the R and S components as BigIntegers and put them in ECDSASignature
16,693
public static byte [ ] signatureToKeyBytes ( byte [ ] messageHash , String signatureBase64 ) throws SignatureException { byte [ ] signatureEncoded ; try { signatureEncoded = Base64 . decode ( signatureBase64 ) ; } catch ( RuntimeException e ) { throw new SignatureException ( "Could not decode base64" , e ) ; } if ( signatureEncoded . length < 65 ) throw new SignatureException ( "Signature truncated, expected 65 bytes and got " + signatureEncoded . length ) ; return signatureToKeyBytes ( messageHash , ECDSASignature . fromComponents ( Arrays . copyOfRange ( signatureEncoded , 1 , 33 ) , Arrays . copyOfRange ( signatureEncoded , 33 , 65 ) , ( byte ) ( signatureEncoded [ 0 ] & 0xFF ) ) ) ; }
Given a piece of text and a message signature encoded in base64 returns an ECKey containing the public key that was used to sign it . This can then be compared to the expected public key to determine if the signature was correct .
16,694
public static boolean isPubKeyCanonical ( byte [ ] pubkey ) { if ( pubkey [ 0 ] == 0x04 ) { if ( pubkey . length != 65 ) return false ; } else if ( pubkey [ 0 ] == 0x02 || pubkey [ 0 ] == 0x03 ) { if ( pubkey . length != 33 ) return false ; } else return false ; return true ; }
Returns true if the given pubkey is canonical i . e . the correct length taking into account compression .
16,695
public byte [ ] getPrivKeyBytes ( ) { if ( privKey == null ) { return null ; } else if ( privKey instanceof BCECPrivateKey ) { return bigIntegerToBytes ( ( ( BCECPrivateKey ) privKey ) . getD ( ) , 32 ) ; } else { return null ; } }
Returns a 32 byte array containing the private key or null if the key is encrypted or public only
16,696
public void setGridTable ( int iKeyArea ) { String keyAreaName = null ; if ( iKeyArea != - 1 ) keyAreaName = this . getOwner ( ) . getRecord ( ) . getKeyArea ( iKeyArea ) . getKeyName ( ) ; this . setGridTable ( keyAreaName , null , - 1 ) ; }
Default call ; gridTable = mainRecord index = next .
16,697
public void setGridTable ( String keyAreaName , Rec gridTable , int index ) { if ( index == - 1 ) index = m_iNextArrayIndex ; m_iNextArrayIndex = Math . max ( m_iNextArrayIndex , index + 1 ) ; if ( gridTable == null ) if ( m_gridScreen != null ) gridTable = m_gridScreen . getMainRecord ( ) ; if ( gridTable != null ) if ( m_gridScreen != null ) if ( gridTable != m_gridScreen . getMainRecord ( ) ) { if ( m_gridScreen . getMainRecord ( ) instanceof QueryRecord ) { int keyIndex = ( ( QueryRecord ) m_gridScreen . getMainRecord ( ) ) . setGridFile ( ( Record ) gridTable , keyAreaName ) ; keyAreaName = gridTable . getKeyArea ( keyIndex ) . getKeyName ( ) ; } } m_iKeyAreaArray [ index ] = keyAreaName ; }
Set an index to a key area .
16,698
public int setupGridOrder ( ) { int iErrorCode = DBConstants . NORMAL_RETURN ; boolean bOrder = DBConstants . ASCENDING ; int iKeyOrder = ( int ) ( ( NumberField ) this . getOwner ( ) ) . getValue ( ) ; if ( iKeyOrder == 0 ) return DBConstants . KEY_NOT_FOUND ; if ( iKeyOrder < 0 ) { bOrder = DBConstants . DESCENDING ; iKeyOrder = - iKeyOrder ; } iKeyOrder -- ; if ( iKeyOrder < m_iNextArrayIndex ) { if ( m_recGrid == null ) m_recGrid = ( Record ) m_gridScreen . getMainRecord ( ) ; for ( int i = 0 ; i < m_recGrid . getKeyAreaCount ( ) ; i ++ ) { if ( m_recGrid . getKeyArea ( i ) . getKeyName ( ) . equals ( m_iKeyAreaArray [ iKeyOrder ] ) ) iKeyOrder = i ; } } else { if ( m_gridScreen != null ) { int iColumn = iKeyOrder + 1 + m_gridScreen . getNavCount ( ) ; ScreenComponent sField = m_gridScreen . getSField ( iColumn ) ; if ( sField . getConverter ( ) != null ) if ( sField . getConverter ( ) . getField ( ) != null ) { Record record = ( Record ) m_gridScreen . getMainRecord ( ) ; iKeyOrder = - 1 ; for ( int iKeyArea = 0 ; iKeyArea < record . getKeyAreaCount ( ) ; iKeyArea ++ ) { KeyArea keyArea = record . getKeyArea ( iKeyArea ) ; if ( keyArea . getField ( 0 ) == sField . getConverter ( ) . getField ( ) ) { iKeyOrder = iKeyArea ; break ; } } if ( iKeyOrder == - 1 ) if ( m_bCreateSortOrder ) { BaseField field = ( BaseField ) sField . getConverter ( ) . getField ( ) ; KeyArea keyArea = new KeyArea ( record , DBConstants . NOT_UNIQUE , field . getFieldName ( ) + "tempKey" ) ; new KeyField ( keyArea , field , DBConstants . ASCENDING ) ; iKeyOrder = record . getKeyAreaCount ( ) - 1 ; } } } } if ( iKeyOrder < 0 ) return DBConstants . KEY_NOT_FOUND ; KeyArea keyArea = null ; if ( m_recGrid == null ) m_recGrid = ( Record ) m_gridScreen . getMainRecord ( ) ; keyArea = m_recGrid . setKeyArea ( iKeyOrder ) ; if ( keyArea == null ) iErrorCode = DBConstants . KEY_NOT_FOUND ; else { for ( int i = 0 ; i < keyArea . getKeyFields ( ) ; i ++ ) { KeyField keyField = keyArea . getKeyField ( i ) ; keyField . setKeyOrder ( bOrder ) ; } } return iErrorCode ; }
Set the grid order to the value in this field .
16,699
public int fieldChanged ( boolean bDisplayOption , int iMoveMode ) { int iErrorCode = this . setupGridOrder ( ) ; if ( iErrorCode != DBConstants . NORMAL_RETURN ) return iErrorCode ; return super . fieldChanged ( bDisplayOption , iMoveMode ) ; }
The Field has Changed . Change the key order to match this field s value .