idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
8,300
private CumulativeTravels getCumulativeTravels ( BudgetSummaryDto budgetSummaryData ) { CumulativeTravels cumulativeTravels = CumulativeTravels . Factory . newInstance ( ) ; if ( budgetSummaryData . getCumDomesticTravel ( ) != null ) { cumulativeTravels . setCumulativeDomesticTravelCosts ( budgetSummaryData . getCumDomesticTravel ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumForeignTravel ( ) != null ) { cumulativeTravels . setCumulativeForeignTravelCosts ( budgetSummaryData . getCumForeignTravel ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumTravel ( ) != null ) { cumulativeTravels . setCumulativeTotalFundsRequestedTravel ( budgetSummaryData . getCumTravel ( ) . bigDecimalValue ( ) ) ; } return cumulativeTravels ; }
This method gets CumulativeTravels details CumulativeTotalFundsRequestedTravel CumulativeDomesticTravelCosts and CumulativeForeignTravelCosts based on BudgetSummaryInfo for the RRBudget .
8,301
private OtherPersonnel getOtherPersonnel ( BudgetPeriodDto periodInfo ) { OtherPersonnel otherPersonnel = OtherPersonnel . Factory . newInstance ( ) ; int OtherpersonalCount = 0 ; List < OtherPersonnelDataType > otherPersonnelList = new ArrayList < > ( ) ; OtherPersonnelDataType otherPersonnelDataTypeArray [ ] = new OtherPersonnelDataType [ 1 ] ; if ( periodInfo != null ) { for ( OtherPersonnelDto otherPersonnelInfo : periodInfo . getOtherPersonnel ( ) ) { if ( OTHERPERSONNEL_POSTDOC . equals ( otherPersonnelInfo . getPersonnelType ( ) ) ) { otherPersonnel . setPostDocAssociates ( getPostDocAssociates ( otherPersonnelInfo ) ) ; } else if ( OTHERPERSONNEL_GRADUATE . equals ( otherPersonnelInfo . getPersonnelType ( ) ) ) { otherPersonnel . setGraduateStudents ( getGraduateStudents ( otherPersonnelInfo ) ) ; } else if ( OTHERPERSONNEL_UNDERGRADUATE . equals ( otherPersonnelInfo . getPersonnelType ( ) ) ) { otherPersonnel . setUndergraduateStudents ( getUndergraduateStudents ( otherPersonnelInfo ) ) ; } else if ( OTHERPERSONNEL_SECRETARIAL . equals ( otherPersonnelInfo . getPersonnelType ( ) ) ) { otherPersonnel . setSecretarialClerical ( getSecretarialClerical ( otherPersonnelInfo ) ) ; } else if ( OtherpersonalCount < OTHERPERSONNEL_MAX_ALLOWED ) { OtherPersonnelDataType otherPersonnelDataType = OtherPersonnelDataType . Factory . newInstance ( ) ; otherPersonnelDataType . setNumberOfPersonnel ( otherPersonnelInfo . getNumberPersonnel ( ) ) ; otherPersonnelDataType . setProjectRole ( otherPersonnelInfo . getRole ( ) ) ; otherPersonnelDataType . setCompensation ( getSectBCompensationDataType ( otherPersonnelInfo . getCompensation ( ) ) ) ; otherPersonnelList . add ( otherPersonnelDataType ) ; OtherpersonalCount ++ ; } } otherPersonnelDataTypeArray = otherPersonnelList . toArray ( otherPersonnelDataTypeArray ) ; otherPersonnel . setOtherArray ( otherPersonnelDataTypeArray ) ; if ( periodInfo . getOtherPersonnelTotalNumber ( ) != null ) { otherPersonnel . setOtherPersonnelTotalNumber ( periodInfo . getOtherPersonnelTotalNumber ( ) . intValue ( ) ) ; } if ( periodInfo . getTotalOtherPersonnelFunds ( ) != null ) { otherPersonnel . setTotalOtherPersonnelFund ( periodInfo . getTotalOtherPersonnelFunds ( ) . bigDecimalValue ( ) ) ; } } return otherPersonnel ; }
This method gets OtherPersonnel informations like PostDocAssociates GraduateStudents UndergraduateStudents SecretarialClerical based on PersonnelType and also gets NumberOfPersonnel ProjectRole Compensation OtherPersonnelTotalNumber and TotalOtherPersonnelFund based on BudgetPeriodInfo for the RRBudget .
8,302
private Equipment getEquipment ( BudgetPeriodDto periodInfo ) { Equipment equipment = Equipment . Factory . newInstance ( ) ; NarrativeContract extraEquipmentNarr = null ; if ( periodInfo != null && periodInfo . getEquipment ( ) != null && periodInfo . getEquipment ( ) . size ( ) > 0 ) { List < EquipmentList > equipmentArrayList = new ArrayList < > ( ) ; ScaleTwoDecimal totalFund = ScaleTwoDecimal . ZERO ; for ( CostDto costInfo : periodInfo . getEquipment ( ) . get ( 0 ) . getEquipmentList ( ) ) { EquipmentList equipmentList = EquipmentList . Factory . newInstance ( ) ; equipmentList . setEquipmentItem ( costInfo . getDescription ( ) ) ; if ( costInfo . getCost ( ) != null ) { equipmentList . setFundsRequested ( costInfo . getCost ( ) . bigDecimalValue ( ) ) ; } totalFund = totalFund . add ( costInfo . getCost ( ) ) ; equipmentArrayList . add ( equipmentList ) ; } List < CostDto > extraEquipmentArrayList = new ArrayList < > ( ) ; ScaleTwoDecimal totalExtraEquipFund = ScaleTwoDecimal . ZERO ; for ( CostDto costInfo : periodInfo . getEquipment ( ) . get ( 0 ) . getExtraEquipmentList ( ) ) { extraEquipmentArrayList . add ( costInfo ) ; totalExtraEquipFund = totalExtraEquipFund . add ( costInfo . getCost ( ) ) ; } EquipmentList [ ] equipmentArray = new EquipmentList [ 0 ] ; equipmentArray = equipmentArrayList . toArray ( equipmentArray ) ; equipment . setEquipmentListArray ( equipmentArray ) ; TotalFundForAttachedEquipment totalFundForAttachedEquipment = TotalFundForAttachedEquipment . Factory . newInstance ( ) ; totalFundForAttachedEquipment . setTotalFundForAttachedEquipmentExist ( YesNoDataType . YES ) ; totalFundForAttachedEquipment . setBigDecimalValue ( periodInfo . getEquipment ( ) . get ( 0 ) . getTotalExtraFund ( ) . bigDecimalValue ( ) ) ; totalFund = totalFund . add ( totalExtraEquipFund ) ; equipment . setTotalFundForAttachedEquipment ( totalFundForAttachedEquipment ) ; equipment . setTotalFund ( totalFund . bigDecimalValue ( ) ) ; extraEquipmentNarr = saveAdditionalEquipments ( periodInfo , extraEquipmentArrayList ) ; } if ( extraEquipmentNarr != null ) { AdditionalEquipmentsAttachment equipmentAttachment = AdditionalEquipmentsAttachment . Factory . newInstance ( ) ; FileLocation fileLocation = FileLocation . Factory . newInstance ( ) ; equipmentAttachment . setFileLocation ( fileLocation ) ; String contentId = createContentId ( extraEquipmentNarr ) ; fileLocation . setHref ( contentId ) ; equipmentAttachment . setFileLocation ( fileLocation ) ; equipmentAttachment . setFileName ( extraEquipmentNarr . getNarrativeAttachment ( ) . getName ( ) ) ; equipmentAttachment . setMimeType ( InfastructureConstants . CONTENT_TYPE_OCTET_STREAM ) ; equipmentAttachment . setHashValue ( getHashValue ( extraEquipmentNarr . getNarrativeAttachment ( ) . getData ( ) ) ) ; AttachmentData attachmentData = new AttachmentData ( ) ; attachmentData . setContent ( extraEquipmentNarr . getNarrativeAttachment ( ) . getData ( ) ) ; attachmentData . setContentId ( contentId ) ; attachmentData . setContentType ( InfastructureConstants . CONTENT_TYPE_OCTET_STREAM ) ; attachmentData . setFileName ( extraEquipmentNarr . getNarrativeAttachment ( ) . getName ( ) ) ; addAttachment ( attachmentData ) ; equipmentAttachment . setTotalFundForAttachedEquipmentExist ( YesNoDataType . YES ) ; equipment . setAdditionalEquipmentsAttachment ( equipmentAttachment ) ; } return equipment ; }
This method gets Equipment details such as EquipmentItem FundsRequested TotalFundForAttachedEquipment TotalFund and AdditionalEquipmentsAttachment based on BudgetPeriodInfo for the RRBudget .
8,303
private Travel getTravel ( BudgetPeriodDto periodInfo ) { Travel travel = Travel . Factory . newInstance ( ) ; if ( periodInfo != null ) { if ( periodInfo . getDomesticTravelCost ( ) != null ) { travel . setDomesticTravelCost ( periodInfo . getDomesticTravelCost ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getForeignTravelCost ( ) != null ) { travel . setForeignTravelCost ( periodInfo . getForeignTravelCost ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getTotalTravelCost ( ) != null ) { travel . setTotalTravelCost ( periodInfo . getTotalTravelCost ( ) . bigDecimalValue ( ) ) ; } } return travel ; }
This method gets Travel cost information including DomesticTravelCost ForeignTravelCost and TotalTravelCost in the BudgetYearDataType based on BudgetPeriodInfo for the RRBudget .
8,304
private ParticipantTraineeSupportCosts getParticipantTraineeSupportCosts ( BudgetPeriodDto periodInfo ) { ParticipantTraineeSupportCosts traineeSupportCosts = ParticipantTraineeSupportCosts . Factory . newInstance ( ) ; if ( periodInfo != null ) { traineeSupportCosts . setTuitionFeeHealthInsurance ( periodInfo . getPartTuition ( ) . bigDecimalValue ( ) ) ; traineeSupportCosts . setStipends ( periodInfo . getpartStipendCost ( ) . bigDecimalValue ( ) ) ; traineeSupportCosts . setTravel ( periodInfo . getpartTravelCost ( ) . bigDecimalValue ( ) ) ; traineeSupportCosts . setSubsistence ( periodInfo . getPartSubsistence ( ) . bigDecimalValue ( ) ) ; traineeSupportCosts . setOther ( getOtherPTSupportCosts ( periodInfo ) ) ; traineeSupportCosts . setParticipantTraineeNumber ( periodInfo . getparticipantCount ( ) ) ; traineeSupportCosts . setTotalCost ( traineeSupportCosts . getTuitionFeeHealthInsurance ( ) . add ( traineeSupportCosts . getStipends ( ) . add ( traineeSupportCosts . getTravel ( ) . add ( traineeSupportCosts . getSubsistence ( ) . add ( traineeSupportCosts . getOther ( ) . getCost ( ) ) ) ) ) ) ; } return traineeSupportCosts ; }
This method gets ParticipantTraineeSupportCosts details in BudgetYearDataType such as TuitionFeeHealthInsurance Stipends Subsistence Travel Other ParticipantTraineeNumber and TotalCost based on the BudgetPeriodInfo for the RRBudget .
8,305
public static Window showXML ( Document document , BaseUIComponent parent ) { Map < String , Object > args = Collections . singletonMap ( "document" , document ) ; boolean modal = parent == null ; Window dialog = PopupDialog . show ( XMLConstants . VIEW_DIALOG , args , modal , modal , modal , null ) ; if ( parent != null ) { dialog . setParent ( parent ) ; } return dialog ; }
Show the dialog loading the specified document .
8,306
public static Window showCWF ( BaseComponent root , String ... excludedProperties ) { Window window = showXML ( CWF2XML . toDocument ( root , excludedProperties ) ) ; window . setTitle ( "CWF Markup" ) ; return window ; }
Display the CWF markup for the component tree rooted at root .
8,307
public static void setAttribute ( String key , Object value ) { assertInitialized ( ) ; getAppFramework ( ) . setAttribute ( key , value ) ; }
Stores an arbitrary named attribute in the attribute cache .
8,308
public void afterInitialized ( BaseComponent comp ) { super . afterInitialized ( comp ) ; PluginContainer container = comp . getAncestor ( PluginContainer . class , true ) ; plugin = ( ElementPlugin ) ElementUI . getAssociatedElement ( container ) ; }
Wire controller from toolbar components first then from plugin .
8,309
public void attachController ( BaseComponent comp , IAutoWired controller ) { plugin . tryRegisterListener ( controller , true ) ; comp . wireController ( controller ) ; }
Attaches a controller to the specified component and registers any recognized listeners to the plugin .
8,310
protected IAbortable removeThread ( IAbortable thread ) { super . removeThread ( thread ) ; if ( ! hasActiveThreads ( ) ) { showBusy ( null ) ; } return thread ; }
Remove a thread from the active list . Clears the busy state if this was the last active thread .
8,311
public static void bindActionListeners ( IActionTarget target , List < ActionListener > actionListeners ) { if ( actionListeners != null ) { for ( ActionListener actionListener : actionListeners ) { actionListener . bind ( target ) ; } } }
Binds the action listeners to the specified target .
8,312
public static void unbindActionListeners ( IActionTarget target , List < ActionListener > actionListeners ) { if ( actionListeners != null ) { for ( ActionListener listener : actionListeners ) { listener . unbind ( target ) ; } } }
Unbinds all action listeners from the specified target .
8,313
public void eventCallback ( String eventName , Object eventData ) { for ( IActionTarget target : new ArrayList < > ( targets ) ) { try { target . doAction ( action ) ; } catch ( Throwable t ) { } } }
This is the callback for the generic event that is monitored by this listener . It will result in the invocation of the doAction method of each bound action target .
8,314
private void bind ( IActionTarget target ) { if ( targets . isEmpty ( ) ) { getEventManager ( ) . subscribe ( eventName , this ) ; } targets . add ( target ) ; }
Binds the specified action target to this event listener .
8,315
private void unbind ( IActionTarget target ) { if ( targets . remove ( target ) && targets . isEmpty ( ) ) { getEventManager ( ) . unsubscribe ( eventName , this ) ; } }
Unbinds the specified action target from this event listener .
8,316
private synchronized LinkedHashSet < IMessageCallback > getCallbacks ( String channel , boolean autoCreate , boolean clone ) { LinkedHashSet < IMessageCallback > result = callbacks . get ( channel ) ; if ( result == null && autoCreate ) { callbacks . put ( channel , result = new LinkedHashSet < > ( ) ) ; } return result == null ? null : clone ? new LinkedHashSet < > ( result ) : result ; }
Return the callbacks associated with the specified channel .
8,317
public void onMessage ( String channel , Message message ) { if ( MessageUtil . isMessageExcluded ( message , RecipientType . CONSUMER , nodeId ) ) { return ; } if ( updateDelivered ( message ) ) { LinkedHashSet < IMessageCallback > callbacks = getCallbacks ( channel , false , true ) ; if ( callbacks != null ) { dispatchMessages ( channel , message , callbacks ) ; } } }
Callback entry point for all registered consumers .
8,318
private boolean updateDelivered ( Message message ) { if ( consumers . size ( ) <= 1 ) { return true ; } String pubid = ( String ) message . getMetadata ( "cwf.pub.event" ) ; return deliveredMessageCache . putIfAbsent ( pubid , "" ) == null ; }
Updates the delivered message cache . This avoids delivering the same message transported by different messaging frameworks . If we have only one consumer registered we don t need to worry about this .
8,319
protected void dispatchMessages ( String channel , Message message , Set < IMessageCallback > callbacks ) { for ( IMessageCallback callback : callbacks ) { try { callback . onMessage ( channel , message ) ; } catch ( Exception e ) { } } }
Dispatch message to callback . Override to address special threading considerations .
8,320
private void updateStyle ( ) { CaptionStyle cs = captionStyle == null ? CaptionStyle . HIDDEN : captionStyle ; String background = null ; switch ( cs ) { case FRAME : break ; case TITLE : break ; case LEFT : background = getGradValue ( color1 , color2 ) ; break ; case RIGHT : background = getGradValue ( color2 , color1 ) ; break ; case CENTER : background = getGradValue ( color1 , color2 , color1 ) ; break ; } panel . addClass ( "sharedForms-captioned sharedForms-captioned-caption-" + cs . name ( ) . toLowerCase ( ) ) ; String css = "##{id}-titlebar " ; if ( cs == CaptionStyle . HIDDEN ) { css += "{display:none}" ; } else { css += "{background: " + background + "}" ; } panel . setCss ( css ) ; }
Update styles by current caption style setting .
8,321
static List < TaskGroupInformation > getPath ( TaskGroupFactoryMakerService imf , TaskSystemInformation def , String locale ) throws TaskSystemException { Set < TaskGroupInformation > specs = imf . list ( locale ) ; Map < String , List < TaskGroupInformation > > byInput = byInput ( specs ) ; return getPathSpecifications ( def . getInputType ( ) . getIdentifier ( ) , def . getOutputType ( ) . getIdentifier ( ) , byInput ) ; }
Finds a path for the given specifications
8,322
public void addToolbarComponent ( BaseComponent component , String action ) { BaseComponent ref = toolbar . getFirstChild ( ) ; if ( component instanceof Toolbar ) { BaseComponent child ; while ( ( child = component . getFirstChild ( ) ) != null ) { toolbar . addChild ( child , ref ) ; } } else { toolbar . addChild ( component , ref ) ; ActionUtil . addAction ( component , action ) ; } }
Adds a component to the toolbar .
8,323
protected String extractAttribute ( String name , String line ) { int i = line . indexOf ( name + "=\"" ) ; i = i == - 1 ? i : i + name . length ( ) + 2 ; int j = i == - 1 ? - 1 : line . indexOf ( "\"" , i ) ; return j == - 1 ? null : line . substring ( i , j ) ; }
Extracts the value of the named attribute .
8,324
protected void write ( OutputStream outputStream , String data , boolean terminate , int level ) { try { if ( data != null ) { if ( level > 0 ) { outputStream . write ( StringUtils . repeat ( " " , level ) . getBytes ( CS_UTF8 ) ) ; } outputStream . write ( data . getBytes ( CS_UTF8 ) ) ; if ( terminate ) { outputStream . write ( "\n" . getBytes ( ) ) ; } } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Write data to the output stream with the specified formatting .
8,325
public synchronized void closeAll ( ) { for ( Window window : windows ) { try { window . removeEventListener ( "close" , this ) ; window . destroy ( ) ; } catch ( Throwable e ) { } } windows . clear ( ) ; resetPosition ( ) ; }
Close all open popups .
8,326
@ SuppressWarnings ( "deprecation" ) public void eventCallback ( String eventName , Object eventData ) { try { PopupData popupData = null ; if ( eventData instanceof PopupData ) { popupData = ( PopupData ) eventData ; } else { popupData = new PopupData ( eventData . toString ( ) ) ; } if ( popupData . isEmpty ( ) ) { return ; } Page currentPage = ExecutionContext . getPage ( ) ; Window window = getPopupWindow ( ) ; window . setTitle ( popupData . getTitle ( ) ) ; window . setParent ( currentPage ) ; String pos = getPosition ( ) ; window . addStyle ( "left" , pos ) ; window . addStyle ( "top" , pos ) ; window . addEventListener ( "close" , this ) ; Label label = window . findByName ( "messagetext" , Label . class ) ; label . setLabel ( popupData . getMessage ( ) ) ; window . setMode ( Mode . POPUP ) ; } catch ( Exception e ) { } }
Popup event handler - display popup dialog upon receipt .
8,327
private synchronized Window getPopupWindow ( ) throws Exception { if ( popupDefinition == null ) { popupDefinition = PageParser . getInstance ( ) . parse ( RESOURCE_PREFIX + "popupWindow.fsp" ) ; } Window window = ( Window ) popupDefinition . materialize ( null ) ; windows . add ( window ) ; return window ; }
Return a popup window instance .
8,328
@ SuppressWarnings ( "unchecked" ) public Object postProcessAfterInitialization ( Object bean , String beanName ) throws BeansException { if ( clazz . isInstance ( bean ) ) { register ( ( V ) bean ) ; } return bean ; }
If the managed bean is of the desired type add it to the registry .
8,329
@ SuppressWarnings ( "unchecked" ) public void postProcessBeforeDestruction ( Object bean , String beanName ) throws BeansException { if ( clazz . isInstance ( bean ) ) { unregister ( ( V ) bean ) ; } }
If the managed bean is of the desired type remove it from the registry .
8,330
public void loadChoices ( Iterable < String > choices ) { clear ( ) ; if ( choices != null ) { for ( String choice : choices ) { addChoice ( choice , false ) ; } } checkSelection ( true ) ; }
Load choices from a list .
8,331
public Dateitem addChoice ( DateRange range , boolean isCustom ) { Dateitem item ; if ( isCustom ) { item = findMatchingItem ( range ) ; if ( item != null ) { return item ; } } item = new Dateitem ( ) ; item . setLabel ( range . getLabel ( ) ) ; item . setData ( range ) ; addChild ( item , isCustom ? null : customItem ) ; if ( range . isDefault ( ) ) { setSelectedItem ( item ) ; } return item ; }
Adds a date range to the choice list .
8,332
public Dateitem findMatchingItem ( DateRange range ) { for ( BaseComponent item : getChildren ( ) ) { if ( range . equals ( item . getData ( ) ) ) { return ( Dateitem ) item ; } } return null ; }
Searches for a comboitem that has a date range equivalent to the specified range .
8,333
public Dateitem findMatchingItem ( String label ) { for ( BaseComponent child : getChildren ( ) ) { Dateitem item = ( Dateitem ) child ; if ( label . equalsIgnoreCase ( item . getLabel ( ) ) ) { return item ; } } return null ; }
Searches for a comboitem that has a label that matches the specified value . The search is case insensitive .
8,334
private void checkSelection ( boolean suppressEvent ) { Dateitem selectedItem = getSelectedItem ( ) ; if ( selectedItem == null ) { selectedItem = lastSelectedItem ; setSelectedItem ( selectedItem ) ; } else if ( selectedItem != customItem && lastSelectedItem != selectedItem ) { lastSelectedItem = selectedItem ; if ( ! suppressEvent ) { EventUtil . send ( new Event ( ON_SELECT_RANGE , this ) ) ; } } updateSelection ( ) ; }
Check the current selection . If nothing is selected display a prompt message in gray text . Also remembers the last selection made .
8,335
private void updateSelection ( ) { Dateitem selectedItem = getSelectedItem ( ) ; if ( selectedItem == null ) { addStyle ( "color" , "gray" ) ; } else { addStyle ( "color" , "inherit" ) ; } setFocus ( false ) ; }
Updates the visual appearance of the current selection .
8,336
@ EventHandler ( "change" ) private void onChange ( ChangeEvent event ) { if ( event . getRelatedTarget ( ) == customItem ) { event . stopPropagation ( ) ; DateRangeDialog . show ( ( range ) -> { setSelectedItem ( range == null ? lastSelectedItem : addChoice ( range , true ) ) ; checkSelection ( false ) ; } ) ; } }
Change event handler .
8,337
private String getAttribute ( BeanDefinition beanDefinition , String attributeName ) { String value = null ; while ( beanDefinition != null ) { value = ( String ) beanDefinition . getAttribute ( attributeName ) ; if ( value != null ) { break ; } beanDefinition = beanDefinition . getOriginatingBeanDefinition ( ) ; } return value ; }
Searches this bean definition and all originating bean definitions until it finds the requested attribute .
8,338
public static String getValue ( String propertyName , String instanceName ) { return getPropertyService ( ) . getValue ( propertyName , instanceName ) ; }
Returns a property value as a string .
8,339
public static List < String > getValues ( String propertyName , String instanceName ) { return getPropertyService ( ) . getValues ( propertyName , instanceName ) ; }
Returns a property value as a string list .
8,340
public static void saveValue ( String propertyName , String instanceName , boolean asGlobal , String value ) { getPropertyService ( ) . saveValue ( propertyName , instanceName , asGlobal , value ) ; }
Saves a string value to the underlying property store .
8,341
public static void saveValues ( String propertyName , String instanceName , boolean asGlobal , List < String > value ) { getPropertyService ( ) . saveValues ( propertyName , instanceName , asGlobal , value ) ; }
Saves a value list to the underlying property store .
8,342
public static List < String > getInstances ( String propertyName , boolean asGlobal ) { return getPropertyService ( ) . getInstances ( propertyName , asGlobal ) ; }
Returns a list of all instance id s associated with the specified property name .
8,343
private void sendRequest ( String methodName , Object ... params ) { sendRequest ( new InvocationRequest ( methodName , params ) , true ) ; }
Send a request to the remote viewer to request execution of the specified method .
8,344
private void sendRequest ( InvocationRequest helpRequest , boolean startRemoteViewer ) { this . helpRequest = helpRequest ; if ( helpRequest != null ) { if ( remoteViewerActive ( ) ) { remoteQueue . sendRequest ( helpRequest ) ; this . helpRequest = null ; } else if ( startRemoteViewer ) { startRemoteViewer ( ) ; } else { this . helpRequest = null ; } } }
Sends a request to the remote viewer .
8,345
public void setRemoteQueue ( InvocationRequestQueue remoteQueue ) { this . remoteQueue = remoteQueue ; InvocationRequest deferredRequest = helpRequest ; sendRequest ( loadRequest , false ) ; sendRequest ( deferredRequest , false ) ; }
Sets the remote queue associated with the proxy .
8,346
public static Class < ? extends IHelpSet > register ( Class < ? extends IHelpSet > clazz , String formats ) { for ( String type : formats . split ( "\\," ) ) { instance . map . put ( type , clazz ) ; } return clazz ; }
Register an implementation for one or more help formats .
8,347
public static IHelpSet create ( HelpModule module ) { try { Class < ? extends IHelpSet > clazz = instance . map . get ( module . getFormat ( ) ) ; if ( clazz == null ) { throw new Exception ( "Unsupported help format: " + module . getFormat ( ) ) ; } Constructor < ? extends IHelpSet > ctor = clazz . getConstructor ( HelpModule . class ) ; return ctor . newInstance ( module ) ; } catch ( Exception e ) { log . error ( "Error creating help set for " + module . getUrl ( ) , e ) ; throw MiscUtil . toUnchecked ( e ) ; } }
Creates a help set .
8,348
public BaseRedisQueue < ID , DATA > setRedisHashName ( String redisHashName ) { _redisHashName = redisHashName ; this . redisHashName = _redisHashName . getBytes ( QueueUtils . UTF8 ) ; return this ; }
Name of the Redis hash to store queue messages .
8,349
public BaseRedisQueue < ID , DATA > setRedisListName ( String redisListName ) { _redisListName = redisListName ; this . redisListName = _redisListName . getBytes ( QueueUtils . UTF8 ) ; return this ; }
Name of the Redis list to store queue message ids .
8,350
public BaseRedisQueue < ID , DATA > setRedisSortedSetName ( String redisSortedSetName ) { _redisSortedSetName = redisSortedSetName ; this . redisSortedSetName = _redisSortedSetName . getBytes ( QueueUtils . UTF8 ) ; return this ; }
Name of the Redis sorted - set to store ephemeral message ids .
8,351
public void addEntry ( String placeholder , String ... params ) { ConfigEntry entry = entries . get ( placeholder ) ; String line = entry . template ; for ( int i = 0 ; i < params . length ; i ++ ) { line = line . replace ( "{" + i + "}" , StringUtils . defaultString ( params [ i ] ) ) ; } entry . buffer . add ( line ) ; }
Adds an entry to the config file .
8,352
protected void createFile ( File stagingDirectory ) throws MojoExecutionException { File targetDirectory = newSubdirectory ( stagingDirectory , "META-INF" ) ; File newEntry = new File ( targetDirectory , filename ) ; try ( FileOutputStream out = new FileOutputStream ( newEntry ) ; PrintStream ps = new PrintStream ( out ) ; ) { Iterator < ConfigEntry > iter = entries . values ( ) . iterator ( ) ; ConfigEntry entry = null ; for ( int i = 0 ; i < buffer . size ( ) ; i ++ ) { if ( entry == null && iter . hasNext ( ) ) { entry = iter . next ( ) ; } if ( entry != null && entry . placeholder == i ) { for ( String line : entry . buffer ) { ps . println ( line ) ; } entry = null ; continue ; } ps . println ( buffer . get ( i ) ) ; } } catch ( Exception e ) { throw new MojoExecutionException ( "Unexpected error while creating configuration file." , e ) ; } }
Create the xml configuration descriptor .
8,353
private File newSubdirectory ( File parentDirectory , String path ) { File dir = new File ( parentDirectory , path ) ; if ( ! dir . exists ( ) ) { dir . mkdirs ( ) ; } return dir ; }
Creates a new subdirectory under the specified parent directory .
8,354
public void destroy ( ) { shell . unregisterPlugin ( this ) ; executeAction ( PluginAction . UNLOAD , false ) ; CommandUtil . dissociateAll ( container ) ; if ( pluginEventListeners1 != null ) { pluginEventListeners1 . clear ( ) ; pluginEventListeners1 = null ; } if ( pluginEventListeners2 != null ) { executeAction ( PluginAction . UNSUBSCRIBE , false ) ; pluginEventListeners2 . clear ( ) ; pluginEventListeners2 = null ; } if ( registeredProperties != null ) { registeredProperties . clear ( ) ; registeredProperties = null ; } if ( registeredBeans != null ) { registeredBeans . clear ( ) ; registeredBeans = null ; } if ( registeredComponents != null ) { for ( BaseComponent component : registeredComponents ) { component . destroy ( ) ; } registeredComponents . clear ( ) ; registeredComponents = null ; } super . destroy ( ) ; }
Release contained resources .
8,355
public Object getPropertyValue ( PropertyInfo propInfo ) throws Exception { Object obj = registeredProperties == null ? null : registeredProperties . get ( propInfo . getId ( ) ) ; if ( obj instanceof PropertyProxy ) { Object value = ( ( PropertyProxy ) obj ) . getValue ( ) ; return value instanceof String ? propInfo . getPropertyType ( ) . getSerializer ( ) . deserialize ( ( String ) value ) : value ; } else { return obj == null ? null : propInfo . getPropertyValue ( obj , obj == this ) ; } }
Returns the value for a registered property .
8,356
public void setPropertyValue ( PropertyInfo propInfo , Object value ) throws Exception { String propId = propInfo . getId ( ) ; Object obj = registeredProperties == null ? null : registeredProperties . get ( propId ) ; if ( obj == null ) { obj = new PropertyProxy ( propInfo , value ) ; registerProperties ( obj , propId ) ; } else if ( obj instanceof PropertyProxy ) { ( ( PropertyProxy ) obj ) . setValue ( value ) ; } else { propInfo . setPropertyValue ( obj , value , obj == this ) ; } }
Sets a value for a registered property .
8,357
protected void updateVisibility ( boolean visible , boolean activated ) { super . updateVisibility ( visible , activated ) ; if ( registeredComponents != null ) { for ( BaseUIComponent component : registeredComponents ) { if ( ! visible ) { component . setAttribute ( Constants . ATTR_VISIBLE , component . isVisible ( ) ) ; component . setVisible ( false ) ; } else { component . setVisible ( ( Boolean ) component . getAttribute ( Constants . ATTR_VISIBLE ) ) ; } } } if ( visible ) { checkBusy ( ) ; } }
Sets the visibility of the contained resource and any registered components .
8,358
public void setDefinition ( PluginDefinition definition ) { super . setDefinition ( definition ) ; if ( definition != null ) { container . addClass ( "cwf-plugin-" + definition . getId ( ) ) ; shell . registerPlugin ( this ) ; } }
Sets the plugin definition the container will use to instantiate the plugin . If there is a status bean associated with the plugin it is registered with the container at this time . If there are style sheet resources associated with the plugin they will be added to the container at this time .
8,359
public void setBusy ( String message ) { busyMessage = message = StrUtil . formatMessage ( message ) ; if ( busyDisabled ) { busyPending = true ; } else if ( message != null ) { disableActions ( true ) ; ClientUtil . busy ( container , message ) ; busyPending = ! isVisible ( ) ; } else { disableActions ( false ) ; ClientUtil . busy ( container , null ) ; busyPending = false ; } }
If message is not null disables the plugin and displays the busy message . If message is null removes any previous message and returns the plugin to its previous state .
8,360
private void executeAction ( PluginAction action , boolean async , Object data ) { if ( hasListeners ( ) || action == PluginAction . LOAD ) { PluginEvent event = new PluginEvent ( this , action , data ) ; if ( async ) { EventUtil . post ( event ) ; } else { onAction ( event ) ; } } }
Notify all plugin callbacks of the specified action .
8,361
@ EventHandler ( "action" ) private void onAction ( PluginEvent event ) { PluginException exception = null ; PluginAction action = event . getAction ( ) ; boolean debug = log . isDebugEnabled ( ) ; if ( pluginEventListeners1 != null ) { for ( IPluginEvent listener : new ArrayList < > ( pluginEventListeners1 ) ) { try { if ( debug ) { log . debug ( "Invoking IPluginEvent.on" + WordUtils . capitalizeFully ( action . name ( ) ) + " for listener " + listener ) ; } switch ( action ) { case LOAD : listener . onLoad ( this ) ; continue ; case UNLOAD : listener . onUnload ( ) ; continue ; case ACTIVATE : listener . onActivate ( ) ; continue ; case INACTIVATE : listener . onInactivate ( ) ; continue ; } } catch ( Throwable e ) { exception = createChainedException ( action . name ( ) , e , exception ) ; } } } if ( pluginEventListeners2 != null ) { for ( IPluginEventListener listener : new ArrayList < > ( pluginEventListeners2 ) ) { try { if ( debug ) { log . debug ( "Delivering " + action . name ( ) + " event to IPluginEventListener listener " + listener ) ; } listener . onPluginEvent ( event ) ; } catch ( Throwable e ) { exception = createChainedException ( action . name ( ) , e , exception ) ; } } } if ( action == PluginAction . LOAD ) { doAfterLoad ( ) ; } if ( exception != null ) { throw exception ; } }
Notify listeners of plugin events .
8,362
@ EventHandler ( "command" ) private void onCommand ( CommandEvent event ) { if ( isEnabled ( ) ) { for ( BaseComponent child : container . getChildren ( ) ) { EventUtil . send ( event , child ) ; if ( event . isStopped ( ) ) { break ; } } } }
Forward command events to first level children of the container .
8,363
private PluginException createChainedException ( String action , Throwable newException , PluginException previousException ) { String msg = action + " event generated an error." ; log . error ( msg , newException ) ; PluginException wrapper = new PluginException ( msg , previousException == null ? newException : previousException , null ) ; wrapper . setStackTrace ( newException . getStackTrace ( ) ) ; return wrapper ; }
Creates a chained exception .
8,364
public void load ( ) { PluginDefinition definition = getDefinition ( ) ; if ( ! initialized && definition != null ) { BaseComponent top ; try { initialized = true ; top = container . getFirstChild ( ) ; if ( top == null ) { top = PageUtil . createPage ( definition . getUrl ( ) , container ) . get ( 0 ) ; } } catch ( Throwable e ) { container . destroyChildren ( ) ; throw createChainedException ( "Initialize" , e , null ) ; } if ( pluginControllers != null ) { for ( Object controller : pluginControllers ) { top . wireController ( controller ) ; } } findListeners ( container ) ; executeAction ( PluginAction . LOAD , true ) ; } }
Initializes a plugin if not already done . This loads the plugin s principal cwf page attaches any event listeners and sends a load event to subscribers .
8,365
public void addToolbarComponent ( BaseComponent component ) { if ( tbarContainer == null ) { tbarContainer = new ToolbarContainer ( ) ; shell . addToolbarComponent ( tbarContainer ) ; registerComponent ( tbarContainer ) ; } tbarContainer . addChild ( component ) ; }
Adds the specified component to the toolbar container . The component is registered to this container and will visible only when the container is active .
8,366
public void registerId ( String id , BaseComponent component ) { if ( ! StringUtils . isEmpty ( id ) && ! container . hasAttribute ( id ) ) { container . setAttribute ( id , component ) ; } }
Allows auto - wire to work even if component is not a child of the container .
8,367
public void registerListener ( IPluginEvent listener ) { if ( pluginEventListeners1 == null ) { pluginEventListeners1 = new ArrayList < > ( ) ; } if ( ! pluginEventListeners1 . contains ( listener ) ) { pluginEventListeners1 . add ( listener ) ; } }
Registers a listener for the IPluginEvent callback event . If the listener has already been registered the request is ignored .
8,368
public void registerListener ( IPluginEventListener listener ) { if ( pluginEventListeners2 == null ) { pluginEventListeners2 = new ArrayList < > ( ) ; } if ( ! pluginEventListeners2 . contains ( listener ) ) { pluginEventListeners2 . add ( listener ) ; listener . onPluginEvent ( new PluginEvent ( this , PluginAction . SUBSCRIBE ) ) ; } }
Registers a listener for the IPluginEventListener callback event . If the listener has already been registered the request is ignored .
8,369
public void unregisterListener ( IPluginEventListener listener ) { if ( pluginEventListeners2 != null && pluginEventListeners2 . contains ( listener ) ) { pluginEventListeners2 . remove ( listener ) ; listener . onPluginEvent ( new PluginEvent ( this , PluginAction . UNSUBSCRIBE ) ) ; } }
Unregisters a listener for the IPluginEvent callback event .
8,370
public boolean tryRegisterListener ( Object object , boolean register ) { boolean success = false ; if ( object instanceof IPluginEvent ) { if ( register ) { registerListener ( ( IPluginEvent ) object ) ; } else { unregisterListener ( ( IPluginEvent ) object ) ; } success = true ; } if ( object instanceof IPluginEventListener ) { if ( register ) { registerListener ( ( IPluginEventListener ) object ) ; } else { unregisterListener ( ( IPluginEventListener ) object ) ; } success = true ; } return success ; }
Attempts to register or unregister an object as an event listener .
8,371
public void tryRegisterController ( Object object ) { if ( object instanceof IPluginController ) { if ( pluginControllers == null ) { pluginControllers = new ArrayList < > ( ) ; } pluginControllers . add ( ( IPluginController ) object ) ; } }
Registers an object as a controller if it implements the IPluginController interface .
8,372
public void registerProperties ( Object instance , String ... propertyNames ) { for ( String propertyName : propertyNames ) { registerProperty ( instance , propertyName , true ) ; } }
Registers one or more named properties to the container . Using this a plugin can expose properties for serialization and deserialization .
8,373
public void registerProperty ( Object instance , String propertyName , boolean override ) { if ( registeredProperties == null ) { registeredProperties = new HashMap < > ( ) ; } if ( instance == null ) { registeredProperties . remove ( propertyName ) ; } else { Object oldInstance = registeredProperties . get ( propertyName ) ; PropertyProxy proxy = oldInstance instanceof PropertyProxy ? ( PropertyProxy ) oldInstance : null ; if ( ! override && oldInstance != null && proxy == null ) { return ; } registeredProperties . put ( propertyName , instance ) ; if ( proxy != null ) { try { proxy . getPropertyInfo ( ) . setPropertyValue ( instance , proxy . getValue ( ) ) ; } catch ( Exception e ) { throw createChainedException ( "Register Property" , e , null ) ; } } } }
Registers a named property to the container . Using this a plugin can expose a property for serialization and deserialization .
8,374
public void registerBean ( String beanId , boolean isRequired ) { if ( beanId == null || beanId . isEmpty ( ) ) { return ; } Object bean = SpringUtil . getBean ( beanId ) ; if ( bean == null && isRequired ) { throw new PluginException ( "Required bean resouce not found: " + beanId ) ; } Object oldBean = getAssociatedBean ( beanId ) ; if ( bean == oldBean ) { return ; } if ( registeredBeans == null ) { registeredBeans = new HashMap < > ( ) ; } tryRegisterListener ( oldBean , false ) ; if ( bean == null ) { registeredBeans . remove ( beanId ) ; } else { registeredBeans . put ( beanId , bean ) ; tryRegisterListener ( bean , true ) ; tryRegisterController ( bean ) ; } }
Registers a helper bean with this container .
8,375
public void setPropertyValue ( PropertyInfo propInfo , Object value ) { setPropertyValue ( propInfo . getId ( ) , value ) ; }
Overridden to set property value in proxy s property cache .
8,376
public ElementBase realize ( ElementBase parent ) { if ( ! deleted && real == null ) { real = getDefinition ( ) . createElement ( parent , null , false ) ; } else if ( deleted && real != null ) { real . remove ( true ) ; real = null ; } return real ; }
Realizes the creation or destruction of the proxied object . In other words if this is a deletion operation and the proxied object exists the proxied object is removed from its parent . If this is not a deletion and the proxied object does not exist a new object is instantiated as a child to the specified parent .
8,377
private void syncProperties ( boolean fromReal ) { PluginDefinition def = getDefinition ( ) ; for ( PropertyInfo propInfo : def . getProperties ( ) ) { if ( fromReal ) { syncProperty ( propInfo , real , this ) ; } else { syncProperty ( propInfo , this , real ) ; } } }
Synchronizes property values between the proxy and its object .
8,378
public String execute ( @ SuppressWarnings ( "rawtypes" ) Map parameters , String body , RenderContext renderContext ) throws MacroException { try { return body ; } catch ( Exception e ) { return getErrorView ( "greenpepper.info.macroid" , e . getMessage ( ) ) ; } }
Confluence 2 and 3
8,379
public String execute ( Map < String , String > parameters , String body , ConversionContext context ) throws MacroExecutionException { try { String xhtmlRendered = gpUtil . getWikiStyleRenderer ( ) . convertWikiToXHtml ( context . getPageContext ( ) , body ) ; LOGGER . trace ( "rendering : \n - source \n {} \n - output \n {}" , body , xhtmlRendered ) ; return xhtmlRendered ; } catch ( Exception e ) { return getErrorView ( "greenpepper.info.macroid" , e . getMessage ( ) ) ; } }
Confluence 4 +
8,380
private void saveLastFetchedId ( byte [ ] lastFetchedId ) { if ( lastFetchedId != null ) { rocksDbWrapper . put ( cfNameMetadata , writeOptions , keyLastFetchedId , lastFetchedId ) ; } }
Saves last - fetched - id .
8,381
public static HelpViewBase createView ( HelpViewer viewer , HelpViewType viewType ) { Class < ? extends HelpViewBase > viewClass = viewType == null ? null : getViewClass ( viewType ) ; if ( viewClass == null ) { return null ; } try { return viewClass . getConstructor ( HelpViewer . class , HelpViewType . class ) . newInstance ( viewer , viewType ) ; } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } }
Creates a new tab for the specified view type .
8,382
private static Class < ? extends HelpViewBase > getViewClass ( HelpViewType viewType ) { switch ( viewType ) { case TOC : return HelpViewContents . class ; case KEYWORD : return HelpViewIndex . class ; case INDEX : return HelpViewIndex . class ; case SEARCH : return HelpViewSearch . class ; case HISTORY : return HelpViewHistory . class ; case GLOSSARY : return HelpViewIndex . class ; default : return null ; } }
Returns the help view class that services the specified view type . For unsupported view types returns null .
8,383
private static int computeCapacity ( final int expectedSize ) { if ( expectedSize == 0 ) { return 1 ; } final int capacity = ( int ) InternalFastMath . ceil ( expectedSize / LOAD_FACTOR ) ; final int powerOfTwo = Integer . highestOneBit ( capacity ) ; if ( powerOfTwo == capacity ) { return capacity ; } return nextPowerOfTwo ( capacity ) ; }
Compute the capacity needed for a given size .
8,384
public boolean contains ( final long key ) { final int hash = hashOf ( key ) ; int index = hash & mask ; if ( contains ( key , index ) ) { return true ; } if ( states [ index ] == FREE ) { return false ; } int j = index ; for ( int perturb = perturb ( hash ) ; states [ index ] != FREE ; perturb >>= PERTURB_SHIFT ) { j = probe ( perturb , j ) ; index = j & mask ; if ( contains ( key , index ) ) { return true ; } } return false ; }
Check if a value is associated with a key .
8,385
private static int findInsertionIndex ( final long [ ] keys , final byte [ ] states , final long key , final int mask ) { final int hash = hashOf ( key ) ; int index = hash & mask ; if ( states [ index ] == FREE ) { return index ; } else if ( states [ index ] == FULL && keys [ index ] == key ) { return changeIndexSign ( index ) ; } int perturb = perturb ( hash ) ; int j = index ; if ( states [ index ] == FULL ) { while ( true ) { j = probe ( perturb , j ) ; index = j & mask ; perturb >>= PERTURB_SHIFT ; if ( states [ index ] != FULL || keys [ index ] == key ) { break ; } } } if ( states [ index ] == FREE ) { return index ; } else if ( states [ index ] == FULL ) { return changeIndexSign ( index ) ; } final int firstRemoved = index ; while ( true ) { j = probe ( perturb , j ) ; index = j & mask ; if ( states [ index ] == FREE ) { return firstRemoved ; } else if ( states [ index ] == FULL && keys [ index ] == key ) { return changeIndexSign ( index ) ; } perturb >>= PERTURB_SHIFT ; } }
Find the index at which a key should be inserted
8,386
public void clear ( ) { final int capacity = keys . length ; Arrays . fill ( keys , 0 ) ; Arrays . fill ( values , 0 ) ; Arrays . fill ( states , FREE ) ; size = 0 ; mask = capacity - 1 ; count = 0 ; }
Removes all entries from the hash map .
8,387
private static void swap ( long [ ] values , int [ ] index , int i , int j ) { if ( i != j ) { swap ( values , i , j ) ; swap ( index , i , j ) ; numSwaps ++ ; } }
Swaps the elements at positions i and j in both the values and index array which must be the same length .
8,388
public static IntTuple getArgmax ( float [ ] [ ] array , float delta ) { float maxValue = Float . NEGATIVE_INFINITY ; int maxX = - 1 ; int maxY = - 1 ; float numMax = 1 ; for ( int x = 0 ; x < array . length ; x ++ ) { for ( int y = 0 ; y < array [ x ] . length ; y ++ ) { float diff = Primitives . compare ( array [ x ] [ y ] , maxValue , delta ) ; if ( diff == 0 && Prng . nextFloat ( ) < 1.0 / numMax ) { maxValue = array [ x ] [ y ] ; maxX = x ; maxY = y ; numMax ++ ; } else if ( diff > 0 ) { maxValue = array [ x ] [ y ] ; maxX = x ; maxY = y ; numMax = 1 ; } } } return new IntTuple ( maxX , maxY ) ; }
Gets the argmax breaking ties randomly .
8,389
public static int count ( float [ ] array , float val ) { int count = 0 ; for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == val ) { count ++ ; } } return count ; }
Gets the number of times a given value occurs in an array .
8,390
public static Collection < OrderedPair > sampleOrderedPairs ( int minI , int maxI , int minJ , int maxJ , double prop ) { int numI = maxI - minI ; int numJ = maxJ - minJ ; long maxPairs = numI * numJ ; Collection < OrderedPair > samples ; if ( maxPairs < 400000000 || prop > 0.1 ) { samples = new ArrayList < OrderedPair > ( ) ; for ( int i = minI ; i < maxI ; i ++ ) { for ( int j = minJ ; j < maxJ ; j ++ ) { if ( prop >= 1.0 || Prng . nextDouble ( ) < prop ) { samples . add ( new OrderedPair ( i , j ) ) ; } } } } else { samples = new HashSet < OrderedPair > ( ) ; double numSamples = maxPairs * prop ; while ( samples . size ( ) < numSamples ) { int i = Prng . nextInt ( numI ) + minI ; int j = Prng . nextInt ( numJ ) + minJ ; samples . add ( new OrderedPair ( i , j ) ) ; } } return samples ; }
Sample with replacement ordered pairs of integers .
8,391
public static Collection < UnorderedPair > sampleUnorderedPairs ( int minI , int maxI , int minJ , int maxJ , double prop ) { int numI = maxI - minI ; int numJ = maxJ - minJ ; long maxPairs = PairSampler . countUnorderedPairs ( minI , maxI , minJ , maxJ ) ; Collection < UnorderedPair > samples ; if ( maxPairs < 400000000 || prop > 0.1 ) { samples = new ArrayList < UnorderedPair > ( ) ; int min = Math . min ( minI , minJ ) ; int max = Math . max ( maxI , maxJ ) ; for ( int i = min ; i < max ; i ++ ) { for ( int j = i ; j < max ; j ++ ) { if ( ( minI <= i && i < maxI && minJ <= j && j < maxJ ) || ( minJ <= i && i < maxJ && minI <= j && j < maxI ) ) { if ( prop >= 1.0 || Prng . nextDouble ( ) < prop ) { samples . add ( new UnorderedPair ( i , j ) ) ; } } } } } else { samples = new HashSet < UnorderedPair > ( ) ; double numSamples = maxPairs * prop ; while ( samples . size ( ) < numSamples ) { int i = Prng . nextInt ( numI ) + minI ; int j = Prng . nextInt ( numJ ) + minJ ; if ( i <= j ) { samples . add ( new UnorderedPair ( i , j ) ) ; } } } return samples ; }
Sample with replacement unordered pairs of integers .
8,392
public void setActive ( boolean active ) { refreshListener . setActive ( active ) ; addListener . setActive ( active ) ; removeListener . setActive ( active ) ; eventManager . fireRemoteEvent ( active ? addListener . eventName : removeListener . eventName , self ) ; if ( active ) { refresh ( ) ; } }
Sets the active state .
8,393
public void init ( ) { if ( manifests == null ) { manifests = new ArrayList < > ( ) ; try { primaryManifest = addToList ( applicationContext . getResource ( MANIFEST_PATH ) ) ; Resource [ ] resources = applicationContext . getResources ( "classpath*:/" + MANIFEST_PATH ) ; for ( Resource resource : resources ) { Manifest manifest = addToList ( resource ) ; if ( primaryManifest == null ) { primaryManifest = manifest ; } } } catch ( Exception e ) { log . error ( "Error enumerating manifests." , e ) ; } } }
Initialize the manifest list if not already done . This is done by iterating over the class path to locate all manifest files .
8,394
public Manifest findByPath ( String path ) { for ( Manifest manifest : this ) { String mpath = ( ( ManifestEx ) manifest ) . path ; if ( path . startsWith ( mpath ) ) { return manifest ; } } return null ; }
Returns a manifest based on the input path .
8,395
private Manifest addToList ( Resource resource ) { try { if ( resource != null && resource . exists ( ) ) { Manifest manifest = new ManifestEx ( resource ) ; manifests . add ( manifest ) ; return manifest ; } } catch ( Exception e ) { log . debug ( "Exception occurred reading manifest: " + resource ) ; } return null ; }
Adds the manifest referenced by the specified resource to the list .
8,396
protected void putToQueue ( IQueueMessage < ID , DATA > msg ) throws QueueException . QueueIsFull { if ( ! queue . offer ( msg ) ) { throw new QueueException . QueueIsFull ( getBoundary ( ) ) ; } }
Puts a message to the queue buffer .
8,397
protected String getType ( String script ) { int i = script . indexOf ( ':' ) ; return i < 0 ? "" : script . substring ( 0 , i ) ; }
Extracts the action type prefix .
8,398
public void setApplicationContext ( ApplicationContext applicationContext ) throws BeansException { propertyProvider = new PropertyProvider ( applicationContext ) ; conversionService = DefaultConversionService . getSharedInstance ( ) ; wireParams ( this ) ; afterInitialized ( ) ; }
Inject all annotated class members .
8,399
void initConfigs ( String propertiesAbsoluteClassPath ) { this . propertiesAbsoluteClassPath = propertiesAbsoluteClassPath ; this . propertiesFilePath = ResourceUtil . getAbsolutePath ( propertiesAbsoluteClassPath ) ; loadConfigs ( ) ; }
Init properties file path . Will reload configs every time .