idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
8,600 | public void update ( ) { boolean shouldShow = shouldShow ( ) ; if ( visible != shouldShow ) { visible = shouldShow ; BaseUIComponent target = element . getMaskTarget ( ) ; if ( visible ) { Menupopup contextMenu = ElementUI . getDesignContextMenu ( target ) ; String displayName = element . getDisplayName ( ) ; target . addMask ( displayName , contextMenu ) ; } else { target . removeMask ( ) ; } } } | Show or hide the design mode mask . |
8,601 | protected URL toURL ( String filename ) { try { return new File ( filename ) . toURI ( ) . toURL ( ) ; } catch ( MalformedURLException e ) { throw new IllegalArgumentException ( e ) ; } } | Returns a file URL pointing to the given file |
8,602 | public float putAndGet ( final int key , final float value ) { int index = findInsertionIndex ( key ) ; float previous = missingEntries ; boolean newMapping = true ; if ( index < 0 ) { index = changeIndexSign ( index ) ; previous = values [ index ] ; newMapping = false ; } keys [ index ] = key ; states [ index ] = FULL ; values [ index ] = value ; if ( newMapping ) { ++ size ; if ( shouldGrowTable ( ) ) { growTable ( ) ; } ++ count ; } return previous ; } | Put a value associated with a key in the map . |
8,603 | private void growTable ( ) { final int oldLength = states . length ; final int [ ] oldKeys = keys ; final float [ ] oldValues = values ; final byte [ ] oldStates = states ; final int newLength = RESIZE_MULTIPLIER * oldLength ; final int [ ] newKeys = new int [ newLength ] ; final float [ ] newValues = new float [ newLength ] ; final byte [ ] newStates = new byte [ newLength ] ; final int newMask = newLength - 1 ; for ( int i = 0 ; i < oldLength ; ++ i ) { if ( oldStates [ i ] == FULL ) { final int key = oldKeys [ i ] ; final int index = findInsertionIndex ( newKeys , newStates , key , newMask ) ; newKeys [ index ] = key ; newValues [ index ] = oldValues [ i ] ; newStates [ index ] = FULL ; } } mask = newMask ; keys = newKeys ; values = newValues ; states = newStates ; } | Grow the tables . |
8,604 | public static < T > T newObject ( Class < T > clazz ) { return getFactory ( clazz ) . newObject ( clazz ) ; } | Creates a new instance of an object of this domain . |
8,605 | public static < T > T fetchObject ( Class < T > clazz , String id ) { return getFactory ( clazz ) . fetchObject ( clazz , id ) ; } | Fetches an object identified by its unique id from the underlying data store . |
8,606 | public static < T > List < T > fetchObjects ( Class < T > clazz , String [ ] ids ) { return getFactory ( clazz ) . fetchObjects ( clazz , ids ) ; } | Fetches multiple domain objects as specified by an array of identifier values . |
8,607 | @ SuppressWarnings ( "unchecked" ) public static < T > IDomainFactory < T > getFactory ( Class < T > clazz ) { for ( IDomainFactory < ? > factory : instance ) { String alias = factory . getAlias ( clazz ) ; if ( alias != null ) { return ( IDomainFactory < T > ) factory ; } } throw new IllegalArgumentException ( "Domain class has no registered factory: " + clazz . getName ( ) ) ; } | Returns a domain factory for the specified class . |
8,608 | public static int compare ( float a , float b , float delta ) { if ( equals ( a , b , delta ) ) { return 0 ; } return Float . compare ( a , b ) ; } | Compares two float values up to some delta . |
8,609 | public static short countCommon ( short [ ] indices1 , short [ ] indices2 ) { short numCommonIndices = 0 ; int i = 0 ; int j = 0 ; while ( i < indices1 . length && j < indices2 . length ) { if ( indices1 [ i ] < indices2 [ j ] ) { i ++ ; } else if ( indices2 [ j ] < indices1 [ i ] ) { j ++ ; } else { numCommonIndices ++ ; i ++ ; j ++ ; } } for ( ; i < indices1 . length ; i ++ ) { numCommonIndices ++ ; } for ( ; j < indices2 . length ; j ++ ) { numCommonIndices ++ ; } return numCommonIndices ; } | Counts the number of indices that appear in both arrays . |
8,610 | public boolean isSponsorInHierarchy ( DevelopmentProposalContract sponsorable , String sponsorHierarchy , String level1 ) { return sponsorHierarchyService . isSponsorInHierarchy ( sponsorable . getSponsor ( ) . getSponsorCode ( ) , sponsorHierarchy , 1 , level1 ) ; } | This method tests whether a document s sponsor is in a given sponsor hierarchy . |
8,611 | public Map < String , String > getSubmissionType ( ProposalDevelopmentDocumentContract pdDoc ) { Map < String , String > submissionInfo = new HashMap < > ( ) ; S2sOpportunityContract opportunity = pdDoc . getDevelopmentProposal ( ) . getS2sOpportunity ( ) ; if ( opportunity != null ) { if ( opportunity . getS2sSubmissionType ( ) != null ) { String submissionTypeCode = opportunity . getS2sSubmissionType ( ) . getCode ( ) ; String submissionTypeDescription = opportunity . getS2sSubmissionType ( ) . getDescription ( ) ; submissionInfo . put ( SUBMISSION_TYPE_CODE , submissionTypeCode ) ; submissionInfo . put ( SUBMISSION_TYPE_DESCRIPTION , submissionTypeDescription ) ; } if ( opportunity . getS2sRevisionType ( ) != null ) { String revisionCode = opportunity . getS2sRevisionType ( ) . getCode ( ) ; submissionInfo . put ( KEY_REVISION_CODE , revisionCode ) ; } if ( opportunity . getRevisionOtherDescription ( ) != null ) { submissionInfo . put ( KEY_REVISION_OTHER_DESCRIPTION , opportunity . getRevisionOtherDescription ( ) ) ; } } return submissionInfo ; } | This method creates and returns Map of submission details like submission type description and Revision code |
8,612 | private RRBudgetDocument getRRBudget ( ) { deleteAutoGenNarratives ( ) ; RRBudgetDocument rrBudgetDocument = RRBudgetDocument . Factory . newInstance ( ) ; RRBudget rrBudget = RRBudget . Factory . newInstance ( ) ; rrBudget . setFormVersion ( FormVersion . v1_1 . getVersion ( ) ) ; if ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) != null ) { rrBudget . setDUNSID ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getDunsNumber ( ) ) ; rrBudget . setOrganizationName ( pdDoc . getDevelopmentProposal ( ) . getApplicantOrganization ( ) . getOrganization ( ) . getOrganizationName ( ) ) ; } rrBudget . setBudgetType ( BudgetTypeDataType . PROJECT ) ; rrBudget . setBudgetYear1 ( BudgetYear1DataType . Factory . newInstance ( ) ) ; List < BudgetPeriodDto > budgetperiodList ; BudgetSummaryDto budgetSummary = null ; try { validateBudgetForForm ( pdDoc ) ; budgetperiodList = s2sBudgetCalculatorService . getBudgetPeriods ( pdDoc ) ; budgetSummary = s2sBudgetCalculatorService . getBudgetInfo ( pdDoc , budgetperiodList ) ; } catch ( S2SException e ) { LOG . error ( e . getMessage ( ) , e ) ; return rrBudgetDocument ; } for ( BudgetPeriodDto budgetPeriodData : budgetperiodList ) { if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P1 . getNum ( ) ) { rrBudget . setBudgetYear1 ( getBudgetYear1DataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P2 . getNum ( ) ) { rrBudget . setBudgetYear2 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P3 . getNum ( ) ) { rrBudget . setBudgetYear3 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P4 . getNum ( ) ) { rrBudget . setBudgetYear4 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } else if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P5 . getNum ( ) ) { rrBudget . setBudgetYear5 ( getBudgetYearDataType ( budgetPeriodData ) ) ; } } for ( BudgetPeriodDto budgetPeriodData : budgetperiodList ) { if ( budgetPeriodData . getBudgetPeriod ( ) == BudgetPeriodNum . P1 . getNum ( ) ) { rrBudget . setBudgetYear1 ( getBudgetJustificationAttachment ( rrBudget . getBudgetYear1 ( ) ) ) ; } } rrBudget . setBudgetSummary ( getBudgetSummary ( budgetSummary ) ) ; rrBudgetDocument . setRRBudget ( rrBudget ) ; return rrBudgetDocument ; } | This method returns RRBudgetDocument object based on proposal development document which contains the informations such as DUNSID OrganizationName BudgetType BudgetYear and BudgetSummary . |
8,613 | private BudgetYear1DataType getBudgetYear1DataType ( BudgetPeriodDto periodInfo ) { BudgetYear1DataType budgetYear = BudgetYear1DataType . Factory . newInstance ( ) ; if ( periodInfo != null ) { budgetYear . setBudgetPeriodStartDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getStartDate ( ) ) ) ; budgetYear . setBudgetPeriodEndDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getEndDate ( ) ) ) ; BudgetPeriod . Enum budgetPeriod = BudgetPeriod . Enum . forInt ( periodInfo . getBudgetPeriod ( ) ) ; budgetYear . setBudgetPeriod ( budgetPeriod ) ; budgetYear . setKeyPersons ( getKeyPersons ( periodInfo ) ) ; budgetYear . setOtherPersonnel ( getOtherPersonnel ( periodInfo ) ) ; if ( periodInfo . getTotalCompensation ( ) != null ) { budgetYear . setTotalCompensation ( periodInfo . getTotalCompensation ( ) . bigDecimalValue ( ) ) ; } budgetYear . setEquipment ( getEquipment ( periodInfo ) ) ; budgetYear . setTravel ( getTravel ( periodInfo ) ) ; budgetYear . setParticipantTraineeSupportCosts ( getParticipantTraineeSupportCosts ( periodInfo ) ) ; budgetYear . setOtherDirectCosts ( getOtherDirectCosts ( periodInfo ) ) ; budgetYear . setDirectCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ) ; IndirectCosts indirectCosts = getIndirectCosts ( periodInfo ) ; if ( indirectCosts != null ) { budgetYear . setIndirectCosts ( indirectCosts ) ; budgetYear . setTotalCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) . add ( indirectCosts . getTotalIndirectCosts ( ) ) ) ; } else { budgetYear . setTotalCosts ( periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ) ; } budgetYear . setCognizantFederalAgency ( periodInfo . getCognizantFedAgency ( ) ) ; } return budgetYear ; } | This method gets BudgetYear1DataType details like BudgetPeriodStartDate BudgetPeriodEndDate BudgetPeriod KeyPersons OtherPersonnel TotalCompensation Equipment ParticipantTraineeSupportCosts Travel OtherDirectCosts DirectCosts IndirectCosts CognizantFederalAgency TotalCosts |
8,614 | private CumulativeEquipments getCumulativeEquipments ( BudgetSummaryDto budgetSummaryData ) { CumulativeEquipments cumulativeEquipments = CumulativeEquipments . Factory . newInstance ( ) ; if ( budgetSummaryData != null && budgetSummaryData . getCumEquipmentFunds ( ) != null ) { cumulativeEquipments . setCumulativeTotalFundsRequestedEquipment ( budgetSummaryData . getCumEquipmentFunds ( ) . bigDecimalValue ( ) ) ; } return cumulativeEquipments ; } | This method gets CumulativeEquipments information CumulativeTotalFundsRequestedEquipment based on BudgetSummaryInfo for the form RRBudget . |
8,615 | private CumulativeOtherDirect getCumulativeOtherDirect ( BudgetSummaryDto budgetSummaryData ) { CumulativeOtherDirect cumulativeOtherDirect = CumulativeOtherDirect . Factory . newInstance ( ) ; cumulativeOtherDirect . setCumulativeTotalFundsRequestedOtherDirectCosts ( BigDecimal . ZERO ) ; if ( budgetSummaryData != null && budgetSummaryData . getOtherDirectCosts ( ) != null ) { for ( OtherDirectCostInfoDto cumOtherDirect : budgetSummaryData . getOtherDirectCosts ( ) ) { cumulativeOtherDirect . setCumulativeTotalFundsRequestedOtherDirectCosts ( cumOtherDirect . gettotalOtherDirect ( ) . bigDecimalValue ( ) ) ; if ( cumOtherDirect . getmaterials ( ) != null ) { cumulativeOtherDirect . setCumulativeMaterialAndSupplies ( cumOtherDirect . getmaterials ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getpublications ( ) != null ) { cumulativeOtherDirect . setCumulativePublicationCosts ( cumOtherDirect . getpublications ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getConsultants ( ) != null ) { cumulativeOtherDirect . setCumulativeConsultantServices ( cumOtherDirect . getConsultants ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getcomputer ( ) != null ) { cumulativeOtherDirect . setCumulativeADPComputerServices ( cumOtherDirect . getcomputer ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getsubAwards ( ) != null ) { cumulativeOtherDirect . setCumulativeSubawardConsortiumContractualCosts ( cumOtherDirect . getsubAwards ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getEquipRental ( ) != null ) { cumulativeOtherDirect . setCumulativeEquipmentFacilityRentalFees ( cumOtherDirect . getEquipRental ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getAlterations ( ) != null ) { cumulativeOtherDirect . setCumulativeAlterationsAndRenovations ( cumOtherDirect . getAlterations ( ) . bigDecimalValue ( ) ) ; } if ( cumOtherDirect . getOtherCosts ( ) . size ( ) > 0 ) { cumulativeOtherDirect . setCumulativeOther1DirectCost ( new BigDecimal ( cumOtherDirect . getOtherCosts ( ) . get ( 0 ) . get ( CostConstants . KEY_COST ) ) ) ; } } } return cumulativeOtherDirect ; } | This method gets CumulativeOtherDirectCost details CumulativeMaterialAndSupplies CumulativePublicationCosts CumulativeConsultantServices CumulativeADPComputerServices CumulativeSubawardConsortiumContractualCosts CumulativeEquipmentFacilityRentalFees CumulativeAlterationsAndRenovations and CumulativeOther1DirectCost based on BudgetSummaryInfo for the RRBudget . |
8,616 | private OtherDirectCosts getOtherDirectCosts ( BudgetPeriodDto periodInfo ) { OtherDirectCosts otherDirectCosts = OtherDirectCosts . Factory . newInstance ( ) ; if ( periodInfo != null && periodInfo . getOtherDirectCosts ( ) . size ( ) > 0 ) { if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getpublications ( ) != null ) { otherDirectCosts . setPublicationCosts ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getpublications ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getmaterials ( ) != null ) { otherDirectCosts . setMaterialsSupplies ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getmaterials ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getConsultants ( ) != null ) { otherDirectCosts . setConsultantServices ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getConsultants ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getcomputer ( ) != null ) { otherDirectCosts . setADPComputerServices ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getcomputer ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getsubAwards ( ) != null ) { otherDirectCosts . setSubawardConsortiumContractualCosts ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getsubAwards ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getAlterations ( ) != null ) { otherDirectCosts . setAlterationsRenovations ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getAlterations ( ) . bigDecimalValue ( ) ) ; } if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getEquipRental ( ) != null ) { otherDirectCosts . setEquipmentRentalFee ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . getEquipRental ( ) . bigDecimalValue ( ) ) ; } otherDirectCosts . setOthers ( getOthersForOtherDirectCosts ( periodInfo ) ) ; if ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . gettotalOtherDirect ( ) != null ) { otherDirectCosts . setTotalOtherDirectCost ( periodInfo . getOtherDirectCosts ( ) . get ( 0 ) . gettotalOtherDirect ( ) . bigDecimalValue ( ) ) ; } } return otherDirectCosts ; } | This method gets OtherDirectCosts details such as PublicationCosts MaterialsSupplies ConsultantServices ADPComputerServices SubawardConsortiumContractualCosts EquipmentRentalFee AlterationsRenovations and TotalOtherDirectCost in BudgetYearDataType based on BudgetPeriodInfo for the RRBudget . |
8,617 | private Others getOthersForOtherDirectCosts ( BudgetPeriodDto periodInfo ) { Others others = Others . Factory . newInstance ( ) ; if ( periodInfo != null && periodInfo . getOtherDirectCosts ( ) != null ) { Others . Other otherArray [ ] = new Others . Other [ periodInfo . getOtherDirectCosts ( ) . size ( ) ] ; int Otherscount = 0 ; for ( OtherDirectCostInfoDto otherDirectCostInfo : periodInfo . getOtherDirectCosts ( ) ) { Others . Other other = Others . Other . Factory . newInstance ( ) ; if ( otherDirectCostInfo . getOtherCosts ( ) != null && otherDirectCostInfo . getOtherCosts ( ) . size ( ) > 0 ) { other . setCost ( new BigDecimal ( otherDirectCostInfo . getOtherCosts ( ) . get ( 0 ) . get ( CostConstants . KEY_COST ) ) ) ; } other . setDescription ( OTHERCOST_DESCRIPTION ) ; otherArray [ Otherscount ] = other ; Otherscount ++ ; } others . setOtherArray ( otherArray ) ; } return others ; } | This method is to get Other type description and total cost OtherDirectCosts details in BudgetYearDataType based on BudgetPeriodInfo for the RRBudget . |
8,618 | public static void status ( String statusText ) { try { getEventManager ( ) . fireLocalEvent ( STATUS_EVENT , statusText == null ? "" : statusText ) ; } catch ( Throwable e ) { log . error ( e ) ; } } | Fires a generic event of type STATUS to update any object that subscribes to it . |
8,619 | public static void ping ( String responseEvent , List < PingFilter > filters , Recipient ... recipients ) { IEventManager eventManager = getEventManager ( ) ; IGlobalEventDispatcher ged = ( ( ILocalEventDispatcher ) eventManager ) . getGlobalEventDispatcher ( ) ; if ( ged != null ) { ged . Ping ( responseEvent , filters , recipients ) ; } } | Fires a ping request to specified or all recipients . |
8,620 | public static String getChannelName ( String eventName ) { return eventName == null ? null : EVENT_PREFIX + eventName . split ( "\\." , 2 ) [ 0 ] ; } | Returns the messaging channel name from the event name . |
8,621 | public static String getEventName ( String channelName ) { int i = channelName . indexOf ( EVENT_PREFIX ) ; return i < 0 ? channelName : channelName . substring ( i + EVENT_PREFIX . length ( ) ) ; } | Returns the event name from the channel name . |
8,622 | public void refresh ( ) { String url = mockupTypes . getUrl ( mockupType ) ; if ( mockupId == null || url == null ) { iframe . setSrc ( null ) ; return ; } iframe . setSrc ( String . format ( url , mockupId , System . currentTimeMillis ( ) ) ) ; } | Refreshes the iframe content . |
8,623 | public String getPath ( ) { if ( path == null ) { HelpModule module = HelpModule . getModule ( id ) ; path = module == null ? "" : module . getTitle ( ) ; } return path ; } | Returns the path that determines where the associated menu item will appear under the help submenu . If this value has not been explicitly set and a help module has been specified its value will be determined from the help module . |
8,624 | public String getAction ( ) { if ( action == null ) { HelpModule module = HelpModule . getModule ( id ) ; action = module == null ? "" : "groovy:" + CareWebUtil . class . getName ( ) + ".showHelpTopic(\"" + id + "\",\"" + ( topic == null ? "" : topic ) + "\",\"" + module . getTitle ( ) + "\");" ; } return action ; } | Returns the action that will be invoked when the associated menu item is clicked . For externally derived help content this value must be explicitly set . Otherwise it will be determined automatically from the specified help module . |
8,625 | public static ApplicationContext createAppContext ( Page page ) { XmlWebApplicationContext appContext = new FrameworkAppContext ( ) ; new AppContextInitializer ( page ) . initialize ( appContext ) ; appContext . refresh ( ) ; return appContext ; } | Creates an application context as a child of the root application context and associates it with the specified page . In this way any objects managed by the root application context are available to the framework context . |
8,626 | public static void destroyAppContext ( Page page ) { XmlWebApplicationContext appContext = getAppContext ( page ) ; if ( appContext != null ) { appContext . close ( ) ; } } | Destroys the application context associated with the specified page . |
8,627 | public ApplicationContext getChildAppContext ( ) { ApplicationContext appContext = getAppContext ( ExecutionContext . getPage ( ) ) ; return appContext == null ? getRootAppContext ( ) : appContext ; } | Returns the application context for the current scope . If no page exists or no application context is associated with the page looks for an application context registered to the current thread . Failing that returns the root application context . |
8,628 | public static XmlWebApplicationContext getAppContext ( Page page ) { return page == null ? null : ( XmlWebApplicationContext ) page . getAttribute ( APP_CONTEXT_ATTRIB ) ; } | Returns the application context associated with the given page . |
8,629 | private String firstUpper ( String value ) { return value == null ? null : value . substring ( 0 , 1 ) . toUpperCase ( ) + value . substring ( 1 ) ; } | Convert first character of a string to upper case . |
8,630 | public Object getPropertyValue ( Object instance , boolean forceDirect ) { try { if ( instance == null ) { return dflt == null || ! isSerializable ( ) ? null : getPropertyType ( ) . getSerializer ( ) . deserialize ( dflt ) ; } if ( ! forceDirect && instance instanceof IPropertyAccessor ) { return ( ( IPropertyAccessor ) instance ) . getPropertyValue ( this ) ; } Method method = PropertyUtil . findGetter ( getter , instance , null ) ; return method == null ? null : method . invoke ( instance ) ; } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } } | Returns the property value for a specified object instance . |
8,631 | public void setPropertyValue ( Object instance , Object value , boolean forceDirect ) { try { if ( ! forceDirect && instance instanceof IPropertyAccessor ) { ( ( IPropertyAccessor ) instance ) . setPropertyValue ( this , value ) ; return ; } Method method = null ; try { method = PropertyUtil . findSetter ( setter , instance , value == null ? null : value . getClass ( ) ) ; } catch ( Exception e ) { if ( value != null ) { PropertySerializer < ? > serializer = getPropertyType ( ) . getSerializer ( ) ; value = value instanceof String ? serializer . deserialize ( ( String ) value ) : serializer . serialize ( value ) ; method = PropertyUtil . findSetter ( setter , instance , value . getClass ( ) ) ; } else { throw e ; } } if ( method != null ) { method . invoke ( instance , value ) ; } } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } } | Sets the property value for a specified object instance . |
8,632 | public Integer getConfigValueInt ( String key , Integer dflt ) { try { return Integer . parseInt ( getConfigValue ( key ) ) ; } catch ( Exception e ) { return dflt ; } } | This is a convenience method for returning a named configuration value that is expected to be an integer . |
8,633 | public Double getConfigValueDouble ( String key , Double dflt ) { try { return Double . parseDouble ( getConfigValue ( key ) ) ; } catch ( Exception e ) { return dflt ; } } | This is a convenience method for returning a named configuration value that is expected to be a double floating point number . |
8,634 | public Boolean getConfigValueBoolean ( String key , Boolean dflt ) { try { String value = getConfigValue ( key ) ; return value == null ? dflt : Boolean . parseBoolean ( value ) ; } catch ( Exception e ) { return dflt ; } } | This is a convenience method for returning a named configuration value that is expected to be a Boolean value . |
8,635 | public String [ ] getConfigValueArray ( String key , String delimiter ) { return StringUtils . split ( getConfigValue ( key ) , delimiter ) ; } | This is a convenience method for returning a named configuration value that is expected to be a list of array elements . |
8,636 | public boolean include ( T result ) { return getDateRange ( ) . inRange ( DateUtil . stripTime ( dateTypeExtractor . getDateByType ( result , dateType ) ) , true , true ) ; } | Filter result based on selected date range . |
8,637 | public static void appendResponse ( StringBuilder buffer , String response ) { if ( response != null && ! response . isEmpty ( ) ) { if ( buffer . length ( ) > 0 ) { buffer . append ( "\r\n" ) ; } buffer . append ( response ) ; } } | Accumulate response values in string buffer . |
8,638 | public void ccowJoin ( ) { if ( ccowIsActive ( ) ) { return ; } if ( ccowContextManager == null && ccowEnabled ) { ccowContextManager = new CCOWContextManager ( ) ; ccowContextManager . subscribe ( this ) ; ccowContextManager . run ( "CareWebFramework#" , "" , true , "*" ) ; } if ( ccowContextManager != null ) { if ( ! ccowContextManager . isActive ( ) ) { ccowContextManager . resume ( ) ; } init ( response -> { if ( response . rejected ( ) ) { ccowContextManager . suspend ( ) ; } updateCCOWStatus ( ) ; } ) ; } } | Joins the CCOW common context if available . |
8,639 | public void init ( IManagedContext < ? > item , ISurveyCallback callback ) { contextItems . clear ( ) ; if ( ccowIsActive ( ) ) { contextItems . addItems ( ccowContextManager . getCCOWContext ( ) ) ; } if ( item != null ) { initItem ( item , callback ) ; } else { SurveyResponse response = new SurveyResponse ( ) ; initItem ( managedContexts . iterator ( ) , response , callback ) ; } } | Initializes one or all managed contexts to their default state . |
8,640 | private void initItem ( IManagedContext < ? > item , ISurveyCallback callback ) { try { localChangeBegin ( item ) ; if ( hasSubject ( item . getContextName ( ) ) ) { item . setContextItems ( contextItems ) ; } else { item . init ( ) ; } localChangeEnd ( item , callback ) ; } catch ( ContextException e ) { log . error ( "Error initializing context." , e ) ; execCallback ( callback , new SurveyResponse ( e . toString ( ) ) ) ; } } | Initializes the managed context . |
8,641 | private boolean hasSubject ( String subject ) { boolean result = false ; String s = subject + "." ; int c = s . length ( ) ; for ( String propName : contextItems . getItemNames ( ) ) { result = s . equalsIgnoreCase ( propName . substring ( 0 , c ) ) ; if ( result ) { break ; } } return result ; } | Returns true if the CCOW context contains context settings pertaining to the named subject . |
8,642 | private void commitContexts ( boolean accept , boolean all ) { Stack < IManagedContext < ? > > stack = commitStack ; commitStack = new Stack < > ( ) ; for ( IManagedContext < ? > managedContext : stack ) { if ( managedContext . isPending ( ) ) { managedContext . commit ( accept ) ; } } while ( ! stack . isEmpty ( ) ) { stack . pop ( ) . notifySubscribers ( accept , all ) ; } } | Commit or cancel all pending context changes . |
8,643 | public void setCCOWEnabled ( boolean ccowEnabled ) { this . ccowEnabled = ccowEnabled ; if ( ! ccowEnabled && ccowContextManager != null ) { ccowContextManager . suspend ( ) ; ccowContextManager = null ; } updateCCOWStatus ( ) ; } | Enables or disables CCOW support . |
8,644 | public ContextItems getMarshaledContext ( ) { ContextItems marshaledContext = new ContextItems ( ) ; for ( IManagedContext < ? > managedContext : managedContexts ) { marshaledContext . addItems ( managedContext . getContextItems ( false ) ) ; } return marshaledContext ; } | Returns the marshaled context representing the state of all shared contexts . |
8,645 | private CCOWStatus getCCOWStatus ( ) { if ( ccowContextManager == null ) { return ccowEnabled ? CCOWStatus . NONE : CCOWStatus . DISABLED ; } else if ( ccowTransaction ) { return CCOWStatus . CHANGING ; } else { switch ( ccowContextManager . getState ( ) ) { case csParticipating : return CCOWStatus . JOINED ; case csSuspended : return CCOWStatus . BROKEN ; default : return CCOWStatus . NONE ; } } } | Returns the current status of the CCOW common context . Return values correspond to possible states of the standard CCOW status icon . |
8,646 | private void updateCCOWStatus ( ) { if ( ccowEnabled && eventManager != null ) { eventManager . fireLocalEvent ( "CCOW" , Integer . toString ( getCCOWStatus ( ) . ordinal ( ) ) ) ; } } | Notifies subscribers of a change in the CCOW status via a generic event . |
8,647 | public void registerObject ( Object object ) { if ( object instanceof IManagedContext ) { managedContexts . add ( ( IManagedContext < ? > ) object ) ; } } | Register an object with the context manager if it implements the IManagedContext interface . |
8,648 | public void unregisterObject ( Object object ) { if ( object instanceof IContextEvent ) { for ( IManagedContext < ? > managedContext : managedContexts ) { managedContext . removeSubscriber ( ( IContextEvent ) object ) ; } } if ( object instanceof IManagedContext ) { managedContexts . remove ( object ) ; } } | Unregister an object from the context manager . |
8,649 | private void localChangeEnd ( IManagedContext < ? > managedContext , boolean silent , boolean deferCommit , ISurveyCallback callback ) throws ContextException { if ( pendingStack . isEmpty ( ) || pendingStack . peek ( ) != managedContext ) { throw new ContextException ( "Illegal context change nesting." ) ; } if ( ! managedContext . isPending ( ) ) { pendingStack . pop ( ) ; return ; } commitStack . push ( managedContext ) ; managedContext . surveySubscribers ( silent , response -> { boolean accept = ! response . rejected ( ) ; if ( ! accept && log . isDebugEnabled ( ) ) { log . debug ( "Survey of managed context " + managedContext . getContextName ( ) + " returned '" + response + "'." ) ; } pendingStack . remove ( managedContext ) ; if ( ! deferCommit && ( ! accept || pendingStack . isEmpty ( ) ) ) { commitContexts ( accept , accept ) ; } execCallback ( callback , response ) ; } ) ; } | Commits a pending context change . |
8,650 | private void resetItem ( IManagedContext < ? > item , boolean silent , ISurveyCallback callback ) { try { localChangeBegin ( item ) ; item . reset ( ) ; localChangeEnd ( item , silent , true , callback ) ; } catch ( ContextException e ) { execCallback ( callback , e ) ; } } | Resets the managed context . |
8,651 | public void ccowPending ( CCOWContextManager sender , ContextItems contextItems ) { ccowTransaction = true ; updateCCOWStatus ( ) ; setMarshaledContext ( contextItems , false , response -> { if ( response . rejected ( ) ) { sender . setSurveyResponse ( response . toString ( ) ) ; } ccowTransaction = false ; updateCCOWStatus ( ) ; } ) ; } | Callback to handle a polling request from the CCOW context manager . |
8,652 | private void initTopicTree ( ) { try { Object data = view . getViewData ( ) ; if ( ! ( data instanceof TopicTree ) ) { return ; } TopicTree topicTree = ( TopicTree ) data ; HelpTopicNode baseNode ; if ( helpViewType == HelpViewType . TOC ) { HelpTopic topic = new HelpTopic ( null , hs . getName ( ) , hs . getName ( ) ) ; baseNode = new HelpTopicNode ( topic ) ; rootNode . addChild ( baseNode ) ; } else { baseNode = rootNode ; } initTopicTree ( baseNode , topicTree . getRoot ( ) ) ; } catch ( IOException e ) { return ; } } | Initialize the topic tree . |
8,653 | private void parseResources ( Element element , BeanDefinitionBuilder builder , ManagedList < AbstractBeanDefinition > resourceList ) { NodeList resources = element . getChildNodes ( ) ; for ( int i = 0 ; i < resources . getLength ( ) ; i ++ ) { Node node = resources . item ( i ) ; if ( ! ( node instanceof Element ) ) { continue ; } Element resource = ( Element ) resources . item ( i ) ; Class < ? extends IPluginResource > resourceClass = null ; switch ( getResourceType ( getNodeName ( resource ) ) ) { case button : resourceClass = PluginResourceButton . class ; break ; case help : resourceClass = PluginResourceHelp . class ; break ; case menu : resourceClass = PluginResourceMenu . class ; break ; case property : resourceClass = PluginResourcePropertyGroup . class ; break ; case css : resourceClass = PluginResourceCSS . class ; break ; case bean : resourceClass = PluginResourceBean . class ; break ; case command : resourceClass = PluginResourceCommand . class ; break ; case action : resourceClass = PluginResourceAction . class ; break ; } if ( resourceClass != null ) { BeanDefinitionBuilder resourceBuilder = BeanDefinitionBuilder . genericBeanDefinition ( resourceClass ) ; addProperties ( resource , resourceBuilder ) ; resourceList . add ( resourceBuilder . getBeanDefinition ( ) ) ; } } } | Parse the resource list . |
8,654 | private void parseAuthorities ( Element element , BeanDefinitionBuilder builder , ManagedList < AbstractBeanDefinition > authorityList ) { NodeList authorities = element . getChildNodes ( ) ; for ( int i = 0 ; i < authorities . getLength ( ) ; i ++ ) { Node node = authorities . item ( i ) ; if ( ! ( node instanceof Element ) ) { continue ; } Element authority = ( Element ) node ; BeanDefinitionBuilder authorityBuilder = BeanDefinitionBuilder . genericBeanDefinition ( PluginDefinition . Authority . class ) ; addProperties ( authority , authorityBuilder ) ; authorityList . add ( authorityBuilder . getBeanDefinition ( ) ) ; } } | Parse the authority list . |
8,655 | private void parseProperties ( Element element , BeanDefinitionBuilder builder , ManagedList < AbstractBeanDefinition > propertyList ) { NodeList properties = element . getChildNodes ( ) ; for ( int i = 0 ; i < properties . getLength ( ) ; i ++ ) { Node node = properties . item ( i ) ; if ( ! ( node instanceof Element ) ) { continue ; } Element property = ( Element ) node ; BeanDefinitionBuilder propertyBuilder = BeanDefinitionBuilder . genericBeanDefinition ( PropertyInfo . class ) ; addProperties ( property , propertyBuilder ) ; parseConfig ( property , propertyBuilder ) ; propertyList . add ( propertyBuilder . getBeanDefinition ( ) ) ; } } | Parse the property list . |
8,656 | private void parseConfig ( Element property , BeanDefinitionBuilder propertyBuilder ) { Element config = ( Element ) getTagChildren ( "config" , property ) . item ( 0 ) ; if ( config != null ) { Properties properties = new Properties ( ) ; NodeList entries = getTagChildren ( "entry" , config ) ; for ( int i = 0 ; i < entries . getLength ( ) ; i ++ ) { Element entry = ( Element ) entries . item ( i ) ; String key = entry . getAttribute ( "key" ) ; String value = entry . getTextContent ( ) . trim ( ) ; properties . put ( key , value ) ; } propertyBuilder . addPropertyValue ( "config" , properties ) ; } } | Parses out configuration settings for current property descriptor . |
8,657 | private ResourceType getResourceType ( String resourceTag ) { if ( resourceTag == null || ! resourceTag . endsWith ( "-resource" ) ) { return ResourceType . unknown ; } try { return ResourceType . valueOf ( resourceTag . substring ( 0 , resourceTag . length ( ) - 9 ) ) ; } catch ( Exception e ) { return ResourceType . unknown ; } } | Returns the ResourceType enum value corresponding to the resource tag . |
8,658 | public Fixture getFixture ( String name , String ... params ) throws Throwable { Type < ? > type = loadType ( name ) ; Object target = type . newInstanceUsingCoercion ( params ) ; return new DefaultFixture ( target ) ; } | Creates a new instance of a fixture class using a set of parameters . |
8,659 | protected int readWord ( InputStream inputStream ) throws IOException { byte [ ] bytes = new byte [ 2 ] ; boolean success = inputStream . read ( bytes ) == 2 ; return ! success ? - 1 : readWord ( bytes , 0 ) ; } | Reads a two - byte integer from the input stream . |
8,660 | protected int readWord ( byte [ ] data , int offset ) { int low = data [ offset ] & 0xff ; int high = data [ offset + 1 ] & 0xff ; return high << 8 | low ; } | Reads a two - byte integer from a byte array at the specified offset . |
8,661 | protected String getString ( byte [ ] data , int offset ) { if ( offset < 0 ) { return "" ; } int i = offset ; while ( data [ i ++ ] != 0x00 ) { ; } return getString ( data , offset , i - offset - 1 ) ; } | Returns a string value from a zero - terminated byte array at the specified offset . |
8,662 | protected String getString ( byte [ ] data , int offset , int length ) { return new String ( data , offset , length , CS_WIN1252 ) ; } | Returns a string value from the byte array . |
8,663 | protected byte [ ] loadBinaryFile ( String file ) throws IOException { try ( InputStream is = resource . getInputStream ( file ) ) { return IOUtils . toByteArray ( is ) ; } } | Loads the entire contents of a binary file into a byte array . |
8,664 | public static < T > IQueryResult < T > abortResult ( String reason ) { return packageResult ( null , CompletionStatus . ABORTED , reason == null ? null : Collections . singletonMap ( "reason" , ( Object ) reason ) ) ; } | Returns a query result for an aborted operation . |
8,665 | public static < T > IQueryResult < T > errorResult ( Throwable exception ) { return packageResult ( null , CompletionStatus . ERROR , exception == null ? null : Collections . singletonMap ( "exception" , ( Object ) exception ) ) ; } | Returns a query result for an error . |
8,666 | public List < T > filter ( List < T > results ) { if ( filters . isEmpty ( ) || results == null ) { return results ; } List < T > include = new ArrayList < > ( ) ; for ( T result : results ) { if ( include ( result ) ) { include . add ( result ) ; } } return results . size ( ) == include . size ( ) ? results : include ; } | Filters a list of results based on the member filters . |
8,667 | protected void updateVisibility ( boolean visible , boolean activated ) { tab . setVisible ( visible ) ; tab . setSelected ( visible && activated ) ; } | Sets the visibility and selection state of the tab . |
8,668 | private void init ( ) { add ( "text" , PropertySerializer . STRING , PropertyEditorText . class ) ; add ( "color" , PropertySerializer . STRING , PropertyEditorColor . class ) ; add ( "choice" , PropertySerializer . STRING , PropertyEditorChoiceList . class ) ; add ( "action" , PropertySerializer . STRING , PropertyEditorAction . class ) ; add ( "icon" , PropertySerializer . STRING , PropertyEditorIcon . class ) ; add ( "integer" , PropertySerializer . INTEGER , PropertyEditorInteger . class ) ; add ( "double" , PropertySerializer . DOUBLE , PropertyEditorDouble . class ) ; add ( "boolean" , PropertySerializer . BOOLEAN , PropertyEditorBoolean . class ) ; add ( "date" , PropertySerializer . DATE , PropertyEditorDate . class ) ; } | Add built - in property types . |
8,669 | private void computeInputParatemeter ( final EntryPoint entryPoint , final String [ ] parameterNames , final Set < Class < ? > > consolidatedTypeBlacklist , final Set < String > consolidatedNameBlacklist , MethodParameter methodParameter ) { if ( consolidatedTypeBlacklist . contains ( methodParameter . getParameterType ( ) ) ) { LOGGER . debug ( "Ignoring parameter type [{}]. It is on the blacklist." , methodParameter . getParameterType ( ) ) ; return ; } if ( ExternalEntryPointHelper . isSimpleRequestParameter ( methodParameter . getParameterType ( ) ) ) { final String parameterRealName = parameterNames [ methodParameter . getParameterIndex ( ) ] ; LOGGER . debug ( "Parameter Real Name [{}]" , parameterRealName ) ; if ( consolidatedNameBlacklist . contains ( parameterRealName ) ) { LOGGER . debug ( "Ignoring parameter name [{}]. It is on the blacklist." , parameterRealName ) ; return ; } final EntryPointParameter entryPointParameter = new EntryPointParameter ( ) ; entryPointParameter . setName ( parameterRealName ) ; entryPointParameter . setType ( methodParameter . getParameterType ( ) ) ; if ( methodParameter . hasParameterAnnotation ( RequestParam . class ) ) { final RequestParam requestParam = methodParameter . getParameterAnnotation ( RequestParam . class ) ; final String definedName = StringUtils . trimToEmpty ( requestParam . value ( ) ) ; if ( consolidatedNameBlacklist . contains ( definedName ) ) { LOGGER . debug ( "Ignoring parameter @RequestParam defined name [{}]. It is on the blacklist." , definedName ) ; return ; } entryPointParameter . setName ( StringUtils . isNotBlank ( definedName ) ? definedName : entryPointParameter . getName ( ) ) ; entryPointParameter . setRequired ( requestParam . required ( ) ) ; entryPointParameter . setDefaultValue ( StringUtils . equals ( ValueConstants . DEFAULT_NONE , requestParam . defaultValue ( ) ) ? "" : requestParam . defaultValue ( ) ) ; } entryPoint . getParameters ( ) . add ( entryPointParameter ) ; } else if ( ! methodParameter . getParameterType ( ) . isArray ( ) ) { entryPoint . getParameters ( ) . addAll ( ExternalEntryPointHelper . getInternalEntryPointParametersRecursively ( methodParameter . getParameterType ( ) , consolidatedTypeBlacklist , consolidatedNameBlacklist , maxDeepLevel ) ) ; } } | Checks whether or not the supplied parameter should be part of the response or not . It adds to the entry point if necessary . |
8,670 | public static Method findSetter ( String methodName , Object instance , Class < ? > valueClass ) throws NoSuchMethodException { return findMethod ( methodName , instance , valueClass , true ) ; } | Returns the requested setter method from an object instance . |
8,671 | public static Method findGetter ( String methodName , Object instance , Class < ? > valueClass ) throws NoSuchMethodException { return findMethod ( methodName , instance , valueClass , false ) ; } | Returns the requested getter method from an object instance . |
8,672 | private static Method findMethod ( String methodName , Object instance , Class < ? > valueClass , boolean setter ) throws NoSuchMethodException { if ( methodName == null ) { return null ; } int paramCount = setter ? 1 : 0 ; for ( Method method : instance . getClass ( ) . getMethods ( ) ) { if ( method . getName ( ) . equals ( methodName ) && method . getParameterTypes ( ) . length == paramCount ) { Class < ? > targetClass = setter ? method . getParameterTypes ( ) [ 0 ] : method . getReturnType ( ) ; if ( valueClass == null || TypeUtils . isAssignable ( targetClass , valueClass ) ) { return method ; } } } throw new NoSuchMethodException ( "Compatible method not found: " + methodName ) ; } | Returns the requested method from an object instance . |
8,673 | protected ScaleTwoDecimal getTotalCost ( BudgetModularContract budgetModular ) { ScaleTwoDecimal totalCost = ScaleTwoDecimal . ZERO ; if ( budgetModular . getTotalDirectCost ( ) != null ) { totalCost = budgetModular . getTotalDirectCost ( ) ; } for ( BudgetModularIdcContract budgetModularIdc : budgetModular . getBudgetModularIdcs ( ) ) { if ( budgetModularIdc . getFundsRequested ( ) != null ) { totalCost = totalCost . add ( budgetModularIdc . getFundsRequested ( ) ) ; } } return totalCost ; } | This method is used to get total cost as sum of totalDirectCost and total sum of fundRequested . |
8,674 | protected String getCognizantFederalAgency ( RolodexContract rolodex ) { StringBuilder agency = new StringBuilder ( ) ; if ( rolodex . getOrganization ( ) != null ) { agency . append ( rolodex . getOrganization ( ) ) ; } agency . append ( COMMA_SEPERATOR ) ; if ( rolodex . getFirstName ( ) != null ) { agency . append ( rolodex . getFirstName ( ) ) ; } agency . append ( EMPTY_STRING ) ; if ( rolodex . getLastName ( ) != null ) { agency . append ( rolodex . getLastName ( ) ) ; } agency . append ( EMPTY_STRING ) ; if ( rolodex . getPhoneNumber ( ) != null ) { agency . append ( rolodex . getPhoneNumber ( ) ) ; } return agency . toString ( ) ; } | This method is used to get rolodex Organization FirstName LastName and PhoneNumber as a single string |
8,675 | public boolean transform ( IResource resource ) throws Exception { String path = resource . getSourcePath ( ) ; if ( path . startsWith ( "META-INF/" ) ) { return false ; } if ( hsFile == null && loader . isHelpSetFile ( path ) ) { hsFile = getResourceBase ( ) + resource . getTargetPath ( ) ; } return super . transform ( resource ) ; } | Excludes resources under the META - INF folder and checks the resource against the help set pattern saving a path reference if it matches . |
8,676 | public VCSConfiguration loadConfiguration ( Gson gson ) { try { URL resource = ResourceUtils . getResourceAsURL ( VCS_CONFIG_JSON ) ; if ( null == resource ) { throw new IncorrectConfigurationException ( "Unable to find VCS configuration" ) ; } return gson . fromJson ( Resources . asCharSource ( resource , Charsets . UTF_8 ) . openStream ( ) , VCSConfiguration . class ) ; } catch ( IOException e ) { throw new IncorrectConfigurationException ( "Unable to read VCS configuration" , e ) ; } } | Loads VCS configuration |
8,677 | protected IQueueMessage < ID , DATA > takeFromQueue ( ) { KafkaMessage kMsg = kafkaClient . consumeMessage ( consumerGroupId , true , topicName , 1000 , TimeUnit . MILLISECONDS ) ; return kMsg != null ? deserialize ( kMsg . content ( ) ) : null ; } | Takes a message from Kafka queue . |
8,678 | public ParticipantListener createSessionListener ( String sessionId , ISessionUpdate callback ) { return SessionService . create ( self , sessionId , eventManager , callback ) ; } | Creates a session listener . |
8,679 | public void createSession ( String sessionId ) { boolean newSession = sessionId == null ; sessionId = newSession ? newSessionId ( ) : sessionId ; SessionController controller = sessions . get ( sessionId ) ; if ( controller == null ) { controller = SessionController . create ( sessionId , newSession ) ; sessions . put ( sessionId , controller ) ; } } | Creates a new session with the specified session id . |
8,680 | public void setActive ( boolean active ) { if ( this . active != active ) { this . active = active ; inviteListener . setActive ( active ) ; acceptListener . setActive ( active ) ; participants . clear ( ) ; participants . add ( self ) ; participantListener . setActive ( active ) ; } } | Sets the listening state of the service . When set to false the service stops listening to all events . |
8,681 | public void invite ( String sessionId , Collection < IPublisherInfo > invitees , boolean cancel ) { if ( invitees == null || invitees . isEmpty ( ) ) { return ; } List < Recipient > recipients = new ArrayList < > ( ) ; for ( IPublisherInfo invitee : invitees ) { recipients . add ( new Recipient ( RecipientType . SESSION , invitee . getSessionId ( ) ) ) ; } String eventData = sessionId + ( cancel ? "" : "^" + self . getUserName ( ) ) ; Recipient [ ] recips = new Recipient [ recipients . size ( ) ] ; eventManager . fireRemoteEvent ( EVENT_INVITE , eventData , recipients . toArray ( recips ) ) ; } | Sends an invitation request to the specified invitees . |
8,682 | public static void store ( String absolutePath , Properties configs ) throws IOException { OutputStream outStream = null ; try { outStream = new FileOutputStream ( new File ( absolutePath ) ) ; configs . store ( outStream , null ) ; } finally { try { if ( outStream != null ) { outStream . close ( ) ; } } catch ( IOException ignore ) { } } } | Write into properties file . |
8,683 | public void registerObject ( Object object ) { if ( object instanceof ICareWebStartup ) { startupRoutines . add ( ( ICareWebStartup ) object ) ; } } | Register a startup routine . |
8,684 | public void execute ( ) { List < ICareWebStartup > temp = new ArrayList < > ( startupRoutines ) ; for ( ICareWebStartup startupRoutine : temp ) { try { if ( startupRoutine . execute ( ) ) { unregisterObject ( startupRoutine ) ; } } catch ( Throwable t ) { log . error ( "Error executing startup routine." , t ) ; unregisterObject ( startupRoutine ) ; } } } | Execute registered startup routines . |
8,685 | public void setStretch ( boolean stretch ) { this . stretch = stretch ; image . setWidth ( stretch ? "100%" : null ) ; image . setHeight ( stretch ? "100%" : null ) ; } | Sets whether or not to stretch the image to fill its parent . |
8,686 | public static < T > T getBean ( Class < T > clazz ) { ApplicationContext appContext = getAppContext ( ) ; try { return appContext == null ? null : appContext . getBean ( clazz ) ; } catch ( Exception e ) { return null ; } } | Return the bean of the specified class . |
8,687 | public static String getProperty ( String name ) { if ( propertyProvider == null ) { initPropertyProvider ( ) ; } return propertyProvider . getProperty ( name ) ; } | Returns a property value from the application context . |
8,688 | public static Resource getResource ( String location ) { Resource resource = resolver . getResource ( location ) ; return resource . exists ( ) ? resource : null ; } | Returns the resource at the specified location . Supports classpath references . |
8,689 | public static Resource [ ] getResources ( String locationPattern ) { try { return resolver . getResources ( locationPattern ) ; } catch ( IOException e ) { throw MiscUtil . toUnchecked ( e ) ; } } | Returns an array of resources matching the location pattern . |
8,690 | protected static void setShell ( CareWebShell shell ) { if ( getShell ( ) != null ) { throw new RuntimeException ( "A CareWeb shell instance has already been registered." ) ; } ExecutionContext . getPage ( ) . setAttribute ( Constants . SHELL_INSTANCE , shell ) ; } | Sets the active instance of the CareWeb shell . An exception is raised if an active instance has already been set . |
8,691 | public static void showMessage ( String message , String caption ) { getShell ( ) . getMessageWindow ( ) . showMessage ( message , caption ) ; } | Sends an informational message for display by desktop . |
8,692 | public static void showHelpTopic ( String module , String topic , String label ) { getShell ( ) . getHelpViewer ( ) ; HelpUtil . show ( module , topic , label ) ; } | Shows help topic in help viewer . |
8,693 | public static String getUrlMapping ( String url , Map < String , String > urlMappings ) { if ( urlMappings != null ) { for ( String pattern : urlMappings . keySet ( ) ) { if ( urlMatcher . match ( pattern , url ) ) { return urlMappings . get ( pattern ) ; } } } return null ; } | Returns the target of a url pattern mapping . |
8,694 | public static String generateRandomPassword ( int minLength , int maxLength , String [ ] constraints ) { if ( constraints == null || constraints . length == 0 || minLength <= 0 || maxLength < minLength ) { throw new IllegalArgumentException ( ) ; } int pwdLength = RandomUtils . nextInt ( maxLength - minLength + 1 ) + minLength ; int [ ] min = new int [ constraints . length ] ; String [ ] chars = new String [ constraints . length ] ; char [ ] pwd = new char [ pwdLength ] ; int totalRequired = 0 ; for ( int i = 0 ; i < constraints . length ; i ++ ) { String [ ] pcs = constraints [ i ] . split ( "\\," , 2 ) ; min [ i ] = Integer . parseInt ( pcs [ 0 ] ) ; chars [ i ] = pcs [ 1 ] ; totalRequired += min [ i ] ; } if ( totalRequired > maxLength ) { throw new IllegalArgumentException ( "Maximum length and constraints in conflict." ) ; } int grp = 0 ; while ( pwdLength -- > 0 ) { if ( min [ grp ] <= 0 ) { grp = totalRequired > 0 ? grp + 1 : RandomUtils . nextInt ( constraints . length ) ; } int i = RandomUtils . nextInt ( pwd . length ) ; while ( pwd [ i ] != 0 ) { i = ++ i % pwd . length ; } pwd [ i ] = chars [ grp ] . charAt ( RandomUtils . nextInt ( chars [ grp ] . length ( ) ) ) ; min [ grp ] -- ; totalRequired -- ; } return new String ( pwd ) ; } | Generates a random password within the specified parameters . |
8,695 | public String [ ] getMessageWithParams ( ) { String [ ] messageWithParams = new String [ getParams ( ) . length + 1 ] ; messageWithParams [ 0 ] = errorMessage ; System . arraycopy ( params , 0 , messageWithParams , 1 , messageWithParams . length - 1 ) ; return messageWithParams ; } | This method returns the message as the first element followed by all params . |
8,696 | public boolean validateName ( String name ) { return name != null && ! name . isEmpty ( ) && StringUtils . isAlphanumericSpace ( name . replace ( '_' , ' ' ) ) ; } | Validates a layout name . |
8,697 | public boolean layoutExists ( LayoutIdentifier layout ) { return getLayouts ( layout . shared ) . contains ( layout . name ) ; } | Returns true if the specified layout exists . |
8,698 | public void saveLayout ( LayoutIdentifier layout , String content ) { propertyService . saveValue ( getPropertyName ( layout . shared ) , layout . name , layout . shared , content ) ; } | Saves a layout with the specified name and content . |
8,699 | public void renameLayout ( LayoutIdentifier layout , String newName ) { String text = getLayoutContent ( layout ) ; saveLayout ( new LayoutIdentifier ( newName , layout . shared ) , text ) ; deleteLayout ( layout ) ; } | Rename a layout . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.