idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
8,500
private static InputStream getResourceAsStream ( String path ) throws IOException { if ( StringUtils . isEmpty ( path ) ) { return null ; } // first try to load as file File file = new File ( path ) ; if ( file . exists ( ) && file . isFile ( ) ) { return new FileInputStream ( file ) ; } // if not a file fallback to classloader resource return CertificateLoader . class . getResourceAsStream ( path ) ; }
Tries to load the given resource as file or if no file exists as classpath resource .
101
19
8,501
private static String getFilenameInfo ( String path ) { if ( StringUtils . isEmpty ( path ) ) { return null ; } try { return new File ( path ) . getCanonicalPath ( ) ; } catch ( IOException ex ) { return new File ( path ) . getAbsolutePath ( ) ; } }
Generate filename info for given path for error messages .
69
11
8,502
public static boolean isSslKeyManagerEnabled ( HttpClientConfig config ) { return StringUtils . isNotEmpty ( config . getSslContextType ( ) ) && StringUtils . isNotEmpty ( config . getKeyManagerType ( ) ) && StringUtils . isNotEmpty ( config . getKeyStoreType ( ) ) && StringUtils . isNotEmpty ( config . getKeyStorePath ( ) ) ; }
Checks whether a SSL key store is configured .
92
10
8,503
public static boolean isSslTrustStoreEnbaled ( HttpClientConfig config ) { return StringUtils . isNotEmpty ( config . getSslContextType ( ) ) && StringUtils . isNotEmpty ( config . getTrustManagerType ( ) ) && StringUtils . isNotEmpty ( config . getTrustStoreType ( ) ) && StringUtils . isNotEmpty ( config . getTrustStorePath ( ) ) ; }
Checks whether a SSL trust store is configured .
94
10
8,504
public static SSLContext createDefaultSSlContext ( ) throws SSLInitializationException { try { final SSLContext sslcontext = SSLContext . getInstance ( SSL_CONTEXT_TYPE_DEFAULT ) ; sslcontext . init ( null , null , null ) ; return sslcontext ; } catch ( NoSuchAlgorithmException ex ) { throw new SSLInitializationException ( ex . getMessage ( ) , ex ) ; } catch ( KeyManagementException ex ) { throw new SSLInitializationException ( ex . getMessage ( ) , ex ) ; } }
Creates default SSL context .
117
6
8,505
private static void swap ( byte [ ] array , int i , int j ) { if ( i != j ) { byte valAtI = array [ i ] ; array [ i ] = array [ j ] ; array [ j ] = valAtI ; numSwaps ++ ; } }
Swaps the elements at positions i and j .
60
10
8,506
public String getUrl ( String mockupType ) { return mockupType == null ? null : mockupTypes . getProperty ( mockupType ) ; }
Returns the url given the mockup type .
33
9
8,507
@ Override public Iterator < String > iterator ( ) { List < String > list = new ArrayList <> ( mockupTypes . stringPropertyNames ( ) ) ; Collections . sort ( list , String . CASE_INSENSITIVE_ORDER ) ; return list . iterator ( ) ; }
Returns an alphabetically sorted iterator of recognized mockup framework types .
63
13
8,508
public int lookupIndex ( short value ) { for ( int i = 0 ; i < elements . length ; i ++ ) { if ( elements [ i ] == value ) { return i ; } } return - 1 ; }
Gets the index of the first element in this list with the specified value or - 1 if it is not present .
46
24
8,509
public static short [ ] ensureCapacity ( short [ ] elements , int size ) { if ( size > elements . length ) { short [ ] tmp = new short [ size * 2 ] ; System . arraycopy ( elements , 0 , tmp , 0 , elements . length ) ; elements = tmp ; } return elements ; }
Ensure that the array has space to contain the specified number of elements .
67
15
8,510
private PluginDefinition pluginById ( String id ) { PluginDefinition def = pluginRegistry . get ( id ) ; if ( def == null ) { throw new PluginException ( EXC_UNKNOWN_PLUGIN , null , null , id ) ; } return def ; }
Lookup a plugin definition by its id . Raises a runtime exception if the plugin is not found .
57
21
8,511
public ElementMenuItem registerMenu ( String path , String action ) { ElementMenuItem menu = getElement ( path , getDesktop ( ) . getMenubar ( ) , ElementMenuItem . class ) ; menu . setAction ( action ) ; return menu ; }
Register a menu .
55
4
8,512
public void registerLayout ( String path , String resource ) throws Exception { Layout layout = LayoutParser . parseResource ( resource ) ; ElementUI parent = parentFromPath ( path ) ; if ( parent != null ) { layout . materialize ( parent ) ; } }
Registers a layout at the specified path .
54
9
8,513
private ElementUI parentFromPath ( String path ) throws Exception { if ( TOOLBAR_PATH . equalsIgnoreCase ( path ) ) { return getDesktop ( ) . getToolbar ( ) ; } String [ ] pieces = path . split ( delim , 2 ) ; ElementTabPane tabPane = pieces . length == 0 ? null : findTabPane ( pieces [ 0 ] ) ; ElementUI parent = pieces . length < 2 ? null : getPathResolver ( ) . resolvePath ( tabPane , pieces [ 1 ] ) ; return parent == null ? tabPane : parent ; }
Returns the parent UI element based on the provided path .
129
11
8,514
private ElementTabPane findTabPane ( String name ) throws Exception { ElementTabView tabView = getTabView ( ) ; ElementTabPane tabPane = null ; while ( ( tabPane = tabView . getChild ( ElementTabPane . class , tabPane ) ) != null ) { if ( name . equalsIgnoreCase ( tabPane . getLabel ( ) ) ) { return tabPane ; } } tabPane = new ElementTabPane ( ) ; tabPane . setParent ( tabView ) ; tabPane . setLabel ( name ) ; return tabPane ; }
Locate the tab with the corresponding label or create one if not found .
133
15
8,515
private String getDefaultPluginId ( ) { if ( defaultPluginId == null ) { try { defaultPluginId = PropertyUtil . getValue ( "CAREWEB.INITIAL.SECTION" , null ) ; if ( defaultPluginId == null ) { defaultPluginId = "" ; } } catch ( Exception e ) { defaultPluginId = "" ; } } return defaultPluginId ; }
Returns the default plugin id as a user preference .
84
10
8,516
public void setResources ( Resource [ ] resources ) throws IOException { clear ( ) ; for ( Resource resource : resources ) { addResource ( resource ) ; } }
Initializes the properties from a multiple resources .
34
9
8,517
@ Override public void afterInitialized ( BaseComponent comp ) { super . afterInitialized ( comp ) ; createLabel ( "default" ) ; getEventManager ( ) . subscribe ( EventUtil . STATUS_EVENT , this ) ; }
Creates the default pane .
51
6
8,518
private Label getLabel ( String pane ) { Label lbl = root . findByName ( pane , Label . class ) ; return lbl == null ? createLabel ( pane ) : lbl ; }
Returns the label associated with the named pane or creates a new one if necessary .
42
16
8,519
private Label createLabel ( String label ) { Pane pane = new Pane ( ) ; root . addChild ( pane ) ; Label lbl = new Label ( ) ; lbl . setName ( label ) ; pane . addChild ( lbl ) ; adjustPanes ( ) ; return lbl ; }
Create a new status pane and associated label .
65
9
8,520
public synchronized int addSubscriber ( String eventName , IGenericEvent < T > subscriber ) { List < IGenericEvent < T >> subscribers = getSubscribers ( eventName , true ) ; subscribers . add ( subscriber ) ; return subscribers . size ( ) ; }
Adds a subscriber to the specified event .
57
8
8,521
public synchronized int removeSubscriber ( String eventName , IGenericEvent < T > subscriber ) { List < IGenericEvent < T >> subscribers = getSubscribers ( eventName , false ) ; if ( subscribers != null ) { subscribers . remove ( subscriber ) ; if ( subscribers . isEmpty ( ) ) { subscriptions . remove ( eventName ) ; } return subscribers . size ( ) ; } return - 1 ; }
Removes a subscriber from the specified event .
88
9
8,522
public boolean hasSubscribers ( String eventName , boolean exact ) { while ( ! StringUtils . isEmpty ( eventName ) ) { if ( hasSubscribers ( eventName ) ) { return true ; } else if ( exact ) { return false ; } else { eventName = stripLevel ( eventName ) ; } } return false ; }
Returns true If the event has subscribers .
74
8
8,523
public synchronized Iterable < IGenericEvent < T > > getSubscribers ( String eventName ) { List < IGenericEvent < T >> subscribers = getSubscribers ( eventName , false ) ; return subscribers == null ? null : new ArrayList <> ( subscribers ) ; }
Returns a thread - safe iterable for the subscriber list .
60
12
8,524
public void invokeCallbacks ( String eventName , T eventData ) { String name = eventName ; while ( ! StringUtils . isEmpty ( name ) ) { Iterable < IGenericEvent < T >> subscribers = getSubscribers ( name ) ; if ( subscribers != null ) { for ( IGenericEvent < T > subscriber : subscribers ) { try { if ( log . isDebugEnabled ( ) ) { log . debug ( String . format ( "Firing local Event[name=%s,data=%s]" , eventName , eventData ) ) ; } subscriber . eventCallback ( eventName , eventData ) ; } catch ( Throwable e ) { log . error ( "Error during local event callback." , e ) ; } } } name = stripLevel ( name ) ; } }
Invokes callbacks on all subscribers of this and parent events .
169
13
8,525
private List < IGenericEvent < T > > getSubscribers ( String eventName , boolean canCreate ) { List < IGenericEvent < T >> subscribers = subscriptions . get ( eventName ) ; if ( subscribers == null && canCreate ) { subscribers = new LinkedList <> ( ) ; subscriptions . put ( eventName , subscribers ) ; } return subscribers ; }
Gets the list of subscribers associated with an event .
78
11
8,526
private String stripLevel ( String eventName ) { int i = eventName . lastIndexOf ( ' ' ) ; return i > 1 ? eventName . substring ( 0 , i ) : "" ; }
Strips the lowest hierarchical level from the event type .
43
12
8,527
public void start ( ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Executing ThreadEx [target=" + target . getClass ( ) . getName ( ) + "]" ) ; } ThreadUtil . startThread ( this . thread ) ; }
Starts the background thread .
60
6
8,528
protected void done ( ) { try { page . getEventQueue ( ) . queue ( event ) ; } catch ( Exception e ) { log . error ( e ) ; } }
Invoked by the background thread when it has completed the target operation even if aborted . This schedules a notification on the desktop s event thread where the requester is notified of the completion .
37
37
8,529
public void setAttribute ( String name , Object value ) { synchronized ( attribute ) { attribute . put ( name , value ) ; } }
Sets the named attribute to the specified value .
28
10
8,530
public void revertImplementation ( Page page ) { Integer previousImplementedVersion = getPreviousImplementedVersion ( page ) ; if ( previousImplementedVersion != null ) { saveImplementedVersion ( page , previousImplementedVersion ) ; savePreviousImplementedVersion ( page , null ) ; } }
Sets the implemented version to the previous implemented version .
67
11
8,531
public Integer getPreviousImplementedVersion ( Page page ) { ContentEntityObject entityObject = getContentEntityManager ( ) . getById ( page . getId ( ) ) ; String value = getContentPropertyManager ( ) . getStringProperty ( entityObject , PREVIOUS_IMPLEMENTED_VERSION ) ; return value == null ? null : Integer . valueOf ( value ) ; }
Retrieves the previous implemented version of the specification .
82
11
8,532
public void savePreviousImplementedVersion ( Page page , Integer version ) { String value = version != null ? String . valueOf ( version ) : null ; ContentEntityObject entityObject = getContentEntityManager ( ) . getById ( page . getId ( ) ) ; getContentPropertyManager ( ) . setStringProperty ( entityObject , PREVIOUS_IMPLEMENTED_VERSION , value ) ; }
Saves the sprecified version as the Previous implemented version
86
12
8,533
public boolean canBeImplemented ( Page page ) { Integer implementedVersion = getImplementedVersion ( page ) ; return implementedVersion == null || page . getVersion ( ) != implementedVersion ; }
Verifies if the specification can be Implemented .
42
11
8,534
public Integer getImplementedVersion ( Page page ) { ContentEntityObject entityObject = getContentEntityManager ( ) . getById ( page . getId ( ) ) ; String value = getContentPropertyManager ( ) . getStringProperty ( entityObject , IMPLEMENTED_VERSION ) ; return value == null ? null : Integer . valueOf ( value ) ; }
Retrieves the implemented version of the specification .
77
10
8,535
public void saveImplementedVersion ( Page page , Integer version ) { Integer previousImplementedVersion = getImplementedVersion ( page ) ; if ( previousImplementedVersion != null && version != null && previousImplementedVersion == version ) return ; if ( previousImplementedVersion != null ) savePreviousImplementedVersion ( page , previousImplementedVersion ) ; String value = version != null ? String . valueOf ( version ) : null ; ContentEntityObject entityObject = getContentEntityManager ( ) . getById ( page . getId ( ) ) ; getContentPropertyManager ( ) . setStringProperty ( entityObject , IMPLEMENTED_VERSION , value ) ; }
Saves the sprecified version as the Iimplemented version
147
14
8,536
public boolean isImplementationDue ( Page page ) { int version = page . getVersion ( ) ; Integer implementedVersion = getImplementedVersion ( page ) ; if ( implementedVersion != null ) version = page . getVersion ( ) == implementedVersion ? implementedVersion : implementedVersion + 1 ; Date date = getPageManager ( ) . getPageByVersion ( page , version ) . getLastModificationDate ( ) ; Period period = Period . fromTo ( date , new Date ( System . currentTimeMillis ( ) ) ) ; return period . daysCount ( ) > CRITICAL_PERIOD ; }
Verifies if the Specification has stayed to long in the WORKING state .
129
16
8,537
public boolean getExecuteChildren ( Page page ) { ContentEntityObject entityObject = getContentEntityManager ( ) . getById ( page . getId ( ) ) ; String value = getContentPropertyManager ( ) . getStringProperty ( entityObject , EXECUTE_CHILDREN ) ; return value == null ? false : Boolean . valueOf ( value ) ; }
Retrieves from the page propeties the Execute childs boolean . If none registered false is returned .
78
22
8,538
public static Document toDocument ( BaseComponent root , String ... excludedProperties ) { try { CWF2XML instance = new CWF2XML ( excludedProperties ) ; instance . toXML ( root , instance . doc ) ; return instance . doc ; } catch ( ParserConfigurationException e ) { return null ; } }
Returns an XML document that mirrors the CWF component tree starting at the specified root .
71
17
8,539
public static String toXML ( BaseComponent root , String ... excludedProperties ) { return XMLUtil . toString ( toDocument ( root , excludedProperties ) ) ; }
Returns an XML - formatted string that mirrors the CWF component tree starting at the specified root .
38
19
8,540
private void toXML ( BaseComponent root , Node parent ) { TreeMap < String , String > properties = new TreeMap <> ( String . CASE_INSENSITIVE_ORDER ) ; Class < ? > clazz = root . getClass ( ) ; ComponentDefinition def = root . getDefinition ( ) ; String cmpname = def . getTag ( ) ; if ( def . getComponentClass ( ) != clazz ) { properties . put ( "impl" , clazz . getName ( ) ) ; } Node child = doc . createElement ( cmpname ) ; parent . appendChild ( child ) ; for ( PropertyDescriptor propDx : PropertyUtils . getPropertyDescriptors ( root ) ) { Method getter = propDx . getReadMethod ( ) ; Method setter = propDx . getWriteMethod ( ) ; String name = propDx . getName ( ) ; if ( getter != null && setter != null && ! isExcluded ( name , cmpname , null ) && ! setter . isAnnotationPresent ( Deprecated . class ) && ( getter . getReturnType ( ) == String . class || getter . getReturnType ( ) . isPrimitive ( ) ) ) { try { Object raw = getter . invoke ( root ) ; String value = raw == null ? null : raw . toString ( ) ; if ( StringUtils . isEmpty ( value ) || ( "id" . equals ( name ) && value . startsWith ( "z_" ) ) || isExcluded ( name , cmpname , value ) ) { continue ; } properties . put ( name , value . toString ( ) ) ; } catch ( Exception e ) { } } } for ( Entry < String , String > entry : properties . entrySet ( ) ) { Attr attr = doc . createAttribute ( entry . getKey ( ) ) ; child . getAttributes ( ) . setNamedItem ( attr ) ; attr . setValue ( entry . getValue ( ) ) ; } properties = null ; for ( BaseComponent cmp : root . getChildren ( ) ) { toXML ( cmp , child ) ; } }
Adds the root component to the XML document at the current level along with all bean properties that return String or primitive types . Then recurses over all of the root component s children .
470
36
8,541
private boolean isExcluded ( String name , String cmpname , String value ) { return exclude . contains ( excludeKey ( name , null , value ) ) || exclude . contains ( excludeKey ( name , cmpname , value ) ) ; }
Returns true if the property is to be excluded .
52
10
8,542
private String excludeKey ( String name , String cmpname , String value ) { StringBuilder sb = new StringBuilder ( cmpname == null ? "" : cmpname + "." ) ; sb . append ( name ) . append ( value == null ? "" : "=" + value ) ; return sb . toString ( ) ; }
Returns the exclusion lookup key for the property .
74
9
8,543
protected void putToRingBuffer ( IQueueMessage < ID , DATA > msg ) throws QueueException . QueueIsFull { if ( msg == null ) { throw new NullPointerException ( "Supplied queue message is null!" ) ; } LOCK_PUT . lock ( ) ; try { if ( ! ringBuffer . tryPublishEvent ( ( event , _seq ) -> { event . set ( msg ) ; knownPublishedSeq = _seq > knownPublishedSeq ? _seq : knownPublishedSeq ; } ) ) { throw new QueueException . QueueIsFull ( getRingSize ( ) ) ; } } finally { LOCK_PUT . unlock ( ) ; } }
Put a message to the ring buffer .
147
8
8,544
protected IQueueMessage < ID , DATA > takeFromRingBuffer ( ) { LOCK_TAKE . lock ( ) ; try { long l = consumedSeq . get ( ) + 1 ; if ( l <= knownPublishedSeq ) { try { Event < ID , DATA > eventHolder = ringBuffer . get ( l ) ; try { return eventHolder . get ( ) ; } finally { eventHolder . set ( null ) ; } } finally { consumedSeq . incrementAndGet ( ) ; } } else { knownPublishedSeq = ringBuffer . getCursor ( ) ; } return null ; } finally { LOCK_TAKE . unlock ( ) ; } }
Takes a message from the ring buffer .
145
9
8,545
protected void setHumanSubjectInvolvedAndVertebrateAnimalUsed ( OtherResearchTrainingPlan researchTrainingPlan ) { researchTrainingPlan . setHumanSubjectsInvolved ( YesNoDataType . N_NO ) ; researchTrainingPlan . setVertebrateAnimalsUsed ( YesNoDataType . N_NO ) ; for ( ProposalSpecialReviewContract propSpecialReview : pdDoc . getDevelopmentProposal ( ) . getPropSpecialReviews ( ) ) { switch ( Integer . parseInt ( propSpecialReview . getSpecialReviewType ( ) . getCode ( ) ) ) { case 1 : researchTrainingPlan . setHumanSubjectsInvolved ( YesNoDataType . Y_YES ) ; break ; case 2 : researchTrainingPlan . setVertebrateAnimalsUsed ( YesNoDataType . Y_YES ) ; break ; default : break ; } } }
This method is used to set HumanSubjectInvoved and VertebrateAnimalUsed XMLObject Data .
182
20
8,546
public List < Pair < A , B > > getEntries ( ) { List < Pair < A , B > > l = new ArrayList <> ( size ( ) ) ; for ( Map . Entry < A , B > x : map1 . entrySet ( ) ) l . ( new Pair <> ( x . getKey ( ) , x . getValue ( ) ) ) ; return l ; }
Returns a new List with all the entries in this bimap
86
13
8,547
public static void show ( DialogControl < ? > control ) { DialogResponse < ? > response = control . getLastResponse ( ) ; if ( response != null ) { control . callback ( response ) ; return ; } Window root = null ; try { Map < String , Object > args = Collections . singletonMap ( "control" , control ) ; root = ( Window ) PageUtil . createPage ( DialogConstants . RESOURCE_PREFIX + "promptDialog.fsp" , ExecutionContext . getPage ( ) , args ) . get ( 0 ) ; root . modal ( null ) ; } catch ( Exception e ) { log . error ( "Error Displaying Dialog" , e ) ; if ( root != null ) { root . destroy ( ) ; } throw MiscUtil . toUnchecked ( e ) ; } }
Display the prompt dialog .
182
5
8,548
public static SecurityContext getSecurityContext ( ) { Session session = ExecutionContext . getSession ( ) ; @ SuppressWarnings ( "resource" ) WebSocketSession ws = session == null ? null : session . getSocket ( ) ; return ws == null ? null : ( SecurityContext ) ws . getAttributes ( ) . get ( HttpSessionSecurityContextRepository . SPRING_SECURITY_CONTEXT_KEY ) ; }
Returns the security context from the execution context .
95
9
8,549
@ Override public void logout ( boolean force , String target , String message ) { log . trace ( "Logging Out" ) ; IContextManager contextManager = ContextManager . getInstance ( ) ; if ( contextManager == null ) { logout ( target , message ) ; } else { contextManager . reset ( force , ( response ) - > { if ( force || ! response . rejected ( ) ) { logout ( target , message ) ; } } ) ; }
Logout out the current page instance .
100
8
8,550
protected Boolean hasPersonnelBudget ( KeyPersonDto keyPerson , int period ) { List < ? extends BudgetLineItemContract > budgetLineItemList = new ArrayList <> ( ) ; ProposalDevelopmentBudgetExtContract budget = s2SCommonBudgetService . getBudget ( pdDoc . getDevelopmentProposal ( ) ) ; budgetLineItemList = budget . getBudgetPeriods ( ) . get ( period - 1 ) . getBudgetLineItems ( ) ; for ( BudgetLineItemContract budgetLineItem : budgetLineItemList ) { for ( BudgetPersonnelDetailsContract budgetPersonnelDetails : budgetLineItem . getBudgetPersonnelDetailsList ( ) ) { if ( budgetPersonnelDetails . getPersonId ( ) . equals ( keyPerson . getPersonId ( ) ) ) { return true ; } else if ( keyPerson . getRolodexId ( ) != null && budgetPersonnelDetails . getPersonId ( ) . equals ( keyPerson . getRolodexId ( ) . toString ( ) ) ) { return true ; } } } return false ; }
This method check whether the key person has a personnel budget
238
11
8,551
public static < T > List < DialogResponse < T > > toResponseList ( T [ ] responses , T [ ] exclusions , T dflt ) { List < DialogResponse < T >> list = new ArrayList <> ( ) ; boolean forceDefault = dflt == null && responses . length == 1 ; for ( T response : responses ) { DialogResponse < T > rsp = new DialogResponse <> ( response , response . toString ( ) , exclusions != null && ArrayUtils . contains ( exclusions , response ) , forceDefault || response . equals ( dflt ) ) ; list . add ( rsp ) ; } return list ; }
Returns list of response objects created from a string of vertical bar delimited captions .
142
17
8,552
private boolean isResponseType ( String text , String label ) { return label . equals ( text ) || StrUtil . formatMessage ( label ) . equals ( text ) ; }
Returns true if the text corresponds to a specific response type .
37
12
8,553
public double get ( long i ) { if ( i < 0 || i >= idxAfterLast ) { return missingEntries ; } return elements [ SafeCast . safeLongToInt ( i ) ] ; }
Gets the i th entry in the vector .
44
10
8,554
public String getName ( ) { return getName ( hasGivenNames ( ) ? Collections . singletonList ( givenNames . get ( 0 ) ) : Collections . < String > emptyList ( ) ) ; }
Will return a standard Firstname Lastname representation of the person with middle names omitted .
44
17
8,555
@ Override public Resource [ ] getResources ( String pattern ) { Resource [ ] resources = cache . get ( pattern ) ; return resources == null ? internalGet ( pattern ) : resources ; }
Returns an array of resources corresponding to the specified pattern . If the pattern has not yet been cached the resources will be enumerated by the application context and stored in the cache .
40
35
8,556
private synchronized Resource [ ] internalGet ( String pattern ) { Resource [ ] resources = cache . get ( pattern ) ; if ( resources != null ) { return resources ; } try { resources = resolver . getResources ( pattern ) ; } catch ( IOException e ) { throw MiscUtil . toUnchecked ( e ) ; } if ( resources == null ) { resources = new Resource [ 0 ] ; } else { Arrays . sort ( resources , resourceComparator ) ; } cache . put ( pattern , resources ) ; return resources ; }
Use application context to enumerate resources . This call is thread safe .
113
14
8,557
private void setQuestionnaireAnswers ( CoverSheet coverSheet , ProjectNarrative projectNarrative ) { List < ? extends AnswerContract > answers = getPropDevQuestionAnswerService ( ) . getQuestionnaireAnswers ( pdDoc . getDevelopmentProposal ( ) . getProposalNumber ( ) , getNamespace ( ) , getFormName ( ) ) ; for ( AnswerContract answer : answers ) { Integer seqId = getQuestionAnswerService ( ) . findQuestionById ( answer . getQuestionId ( ) ) . getQuestionSeqId ( ) ; switch ( seqId ) { case PRELIMINARY : YesNoNotApplicableDataType . Enum yesNoNotApplicableDataType = YesNoNotApplicableDataType . N_NO ; if ( QUESTIONNAIRE_ANSWER_YES . equals ( answer . getAnswer ( ) ) ) { yesNoNotApplicableDataType = YesNoNotApplicableDataType . Y_YES ; } else if ( QUESTIONNAIRE_ANSWER_NO . equals ( answer . getAnswer ( ) ) ) { yesNoNotApplicableDataType = YesNoNotApplicableDataType . N_NO ; } else if ( QUESTIONNAIRE_ANSWER_X . equals ( answer . getAnswer ( ) ) ) { yesNoNotApplicableDataType = YesNoNotApplicableDataType . NA_NOT_APPLICABLE ; } coverSheet . setCheckFullApp ( yesNoNotApplicableDataType ) ; break ; case MERIT_REVIEW : if ( QUESTIONNAIRE_ANSWER_YES . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckMeritReview ( YesNoNotApplicableDataType . Y_YES ) ; } else if ( QUESTIONNAIRE_ANSWER_NO . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckMeritReview ( YesNoNotApplicableDataType . N_NO ) ; } else if ( QUESTIONNAIRE_ANSWER_X . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckMeritReview ( YesNoNotApplicableDataType . NA_NOT_APPLICABLE ) ; } break ; case MENTORING : if ( QUESTIONNAIRE_ANSWER_YES . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckMentoring ( YesNoNotApplicableDataType . Y_YES ) ; } else if ( QUESTIONNAIRE_ANSWER_NO . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckMentoring ( YesNoNotApplicableDataType . N_NO ) ; } break ; case PRIOR_SUPPORT : // Does narrative include info regarding prior support? if ( QUESTIONNAIRE_ANSWER_YES . equals ( answer . getAnswer ( ) ) ) projectNarrative . setCheckPriorSupport ( YesNoNotApplicableDataType . Y_YES ) ; if ( QUESTIONNAIRE_ANSWER_NO . equals ( answer . getAnswer ( ) ) ) projectNarrative . setCheckPriorSupport ( YesNoNotApplicableDataType . N_NO ) ; if ( QUESTIONNAIRE_ANSWER_X . equals ( answer . getAnswer ( ) ) ) projectNarrative . setCheckPriorSupport ( YesNoNotApplicableDataType . NA_NOT_APPLICABLE ) ; break ; case HR_QUESTION : /* * HR Info that is mandatory for renwals from academic * institutions. */ if ( QUESTIONNAIRE_ANSWER_NO . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckHRInfo ( YesNoNotApplicableDataType . N_NO ) ; } break ; case HR_REQUIRED_INFO : /* * HR Info that is mandatory for renwals from academic * institutions. */ if ( QUESTIONNAIRE_ANSWER_YES . equals ( answer . getAnswer ( ) ) ) { projectNarrative . setCheckHRInfo ( YesNoNotApplicableDataType . Y_YES ) ; } break ; default : break ; } } }
Setting the Coversheet and ProjectNarrative details according the Questionnaire Answers .
882
16
8,558
@ JsonProperty private Map < String , Object > getMetadata ( ) { if ( metadata == null ) { metadata = new HashMap <> ( ) ; } return metadata ; }
Returns the metadata map creating it if not already so .
39
11
8,559
public void setMetadata ( String key , Object value ) { if ( value != null ) { getMetadata ( ) . put ( key , value ) ; } }
Sets a metadata value .
35
6
8,560
@ Override public List < ProposalPersonContract > getNKeyPersons ( List < ? extends ProposalPersonContract > proposalPersons , int n ) { ProposalPersonContract proposalPerson , previousProposalPerson ; int size = proposalPersons . size ( ) ; for ( int i = size - 1 ; i > 0 ; i -- ) { proposalPerson = proposalPersons . get ( i ) ; previousProposalPerson = proposalPersons . get ( i - 1 ) ; if ( proposalPerson . getPersonId ( ) != null && previousProposalPerson . getPersonId ( ) != null && proposalPerson . getPersonId ( ) . equals ( previousProposalPerson . getPersonId ( ) ) ) { proposalPersons . remove ( i ) ; } else if ( proposalPerson . getRolodexId ( ) != null && previousProposalPerson . getRolodexId ( ) != null && proposalPerson . getRolodexId ( ) . equals ( previousProposalPerson . getRolodexId ( ) ) ) { proposalPersons . remove ( i ) ; } } size = proposalPersons . size ( ) ; List < ProposalPersonContract > firstNPersons = new ArrayList <> ( ) ; // Make sure we don't exceed the size of the list. if ( size > n ) { size = n ; } // remove extras for ( int i = 0 ; i < size ; i ++ ) { firstNPersons . add ( proposalPersons . get ( i ) ) ; } return firstNPersons ; }
This method limits the number of key persons to n returns list of key persons .
334
16
8,561
@ Override public ProposalPersonContract getPrincipalInvestigator ( ProposalDevelopmentDocumentContract pdDoc ) { ProposalPersonContract proposalPerson = null ; if ( pdDoc != null ) { for ( ProposalPersonContract person : pdDoc . getDevelopmentProposal ( ) . getProposalPersons ( ) ) { if ( person . isPrincipalInvestigator ( ) ) { proposalPerson = person ; } } } return proposalPerson ; }
This method is to get PrincipalInvestigator from person list
96
11
8,562
@ Override public List < ProposalPersonContract > getCoInvestigators ( ProposalDevelopmentDocumentContract pdDoc ) { List < ProposalPersonContract > investigators = new ArrayList <> ( ) ; if ( pdDoc != null ) { for ( ProposalPersonContract person : pdDoc . getDevelopmentProposal ( ) . getProposalPersons ( ) ) { //multi-pis are still considered co-i within S2S. if ( person . isCoInvestigator ( ) || person . isMultiplePi ( ) ) { investigators . add ( person ) ; } } } return investigators ; }
Finds all the Investigators associated with the provided pdDoc .
129
13
8,563
@ Override public List < ProposalPersonContract > getKeyPersons ( ProposalDevelopmentDocumentContract pdDoc ) { List < ProposalPersonContract > keyPersons = new ArrayList <> ( ) ; if ( pdDoc != null ) { for ( ProposalPersonContract person : pdDoc . getDevelopmentProposal ( ) . getProposalPersons ( ) ) { if ( person . isKeyPerson ( ) ) { keyPersons . add ( person ) ; } } } return keyPersons ; }
Finds all the key Person associated with the provided pdDoc .
111
14
8,564
public static Window show ( String dialog , Map < String , Object > args , boolean closable , boolean sizable , boolean show , IEventListener closeListener ) { Window parent = new Window ( ) ; // Temporary parent in case materialize fails, so can cleanup. Page currentPage = ExecutionContext . getPage ( ) ; parent . setParent ( currentPage ) ; Window window = null ; try { PageUtil . createPage ( dialog , parent , args ) ; window = parent . getChild ( Window . class ) ; if ( window != null ) { // If any top component is a window, discard temp parent window . setParent ( null ) ; BaseComponent child ; while ( ( child = parent . getFirstChild ( ) ) != null ) { child . setParent ( window ) ; } parent . destroy ( ) ; window . setParent ( currentPage ) ; } else { // Otherwise, use the temp parent as the window window = parent ; } window . setClosable ( closable ) ; window . setSizable ( sizable ) ; if ( show ) { window . modal ( closeListener ) ; } } catch ( Exception e ) { if ( window != null ) { window . destroy ( ) ; window = null ; } if ( parent != null ) { parent . destroy ( ) ; } DialogUtil . showError ( e ) ; log . error ( "Error materializing page" , e ) ; } return window ; }
Can be used to popup any page definition as a modal dialog .
302
14
8,565
private String loadfromFromFile ( String queryName ) throws IllegalStateException { try ( final InputStream is = getClass ( ) . getResourceAsStream ( scriptsFolder + queryName + ".sql" ) ; ) { String sql = StringUtils . join ( IOUtils . readLines ( is , StandardCharsets . UTF_8 ) , IOUtils . LINE_SEPARATOR ) ; // Look for tokens final String [ ] tokens = StringUtils . substringsBetween ( sql , "${" , "}" ) ; if ( tokens != null && tokens . length > 0 ) { final Map < String , String > values = Arrays . stream ( tokens ) . collect ( Collectors . toMap ( Function . identity ( ) , this :: load , ( o , n ) -> o ) ) ; sql = StrSubstitutor . replace ( sql , values ) ; } return sql ; } catch ( Exception e ) { throw new IllegalStateException ( "Could not load query " + scriptsFolder + queryName , e ) ; } }
Loads the query from the informed path and adds to cache
223
12
8,566
synchronized void open ( ) throws IOException { if ( opened ) { return ; } opened = true ; CompletableFuture < Void > future = new CompletableFuture <> ( ) ; OnRegistration onRegistration = new OnRegistration ( future ) ; try { registrationId = face . registerPrefix ( prefix , this , ( OnRegisterFailed ) onRegistration , onRegistration ) ; // assumes face.processEvents is driven concurrently elsewhere future . get ( 10 , TimeUnit . SECONDS ) ; announcementService . announceEntrance ( publisherId ) ; } catch ( IOException | SecurityException | InterruptedException | ExecutionException | TimeoutException e ) { throw new IOException ( "Failed to register NDN prefix; pub-sub IO will be impossible" , e ) ; } }
Open the publisher registering prefixes and announcing group entry . If the publisher is already open this method immediately returns
167
21
8,567
private boolean initPropertyService ( ) { if ( propertyService == null && appContext . containsBean ( "propertyService" ) ) { propertyService = appContext . getBean ( "propertyService" , IPropertyService . class ) ; } return propertyService != null ; }
Initializes the property service .
59
6
8,568
public static < T > Stream < T > of ( Iterable < T > iterable ) { checkNotNull ( iterable ) ; return new StreamImpl < T > ( iterable ) ; }
Creates a stream from an iterable .
41
9
8,569
@ SafeVarargs public static < T > Stream < T > of ( T ... items ) { checkNotNull ( items ) ; return new StreamImpl < T > ( Arrays . asList ( items ) ) ; }
Creates a stream from items .
46
7
8,570
public static Layout parseResource ( String resource ) { int i = resource . indexOf ( ":" ) ; if ( i > 0 ) { String loaderId = resource . substring ( 0 , i ) ; ILayoutLoader layoutLoader = LayoutLoaderRegistry . getInstance ( ) . get ( loaderId ) ; if ( layoutLoader != null ) { String name = resource . substring ( i + 1 ) ; return layoutLoader . loadLayout ( name ) ; } } InputStream strm = ExecutionContext . getSession ( ) . getServletContext ( ) . getResourceAsStream ( resource ) ; if ( strm == null ) { throw new CWFException ( "Unable to locate layout resource: " + resource ) ; } return parseStream ( strm ) ; }
Loads a layout from the specified resource using a registered layout loader or failing that using the default loadFromUrl method .
164
24
8,571
public static Layout parseText ( String xml ) { try { return parseDocument ( XMLUtil . parseXMLFromString ( xml ) ) ; } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } }
Parse the layout from XML content .
51
8
8,572
public static Layout parseStream ( InputStream stream ) { try ( InputStream is = stream ) { return parseDocument ( XMLUtil . parseXMLFromStream ( is ) ) ; } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } }
Parse layout from an input stream .
59
8
8,573
public static Layout parseDocument ( Document document ) { return new Layout ( instance . parseChildren ( document , null , Tag . LAYOUT ) ) ; }
Parse the layout from an XML document .
32
9
8,574
private LayoutElement parseElement ( Element node , LayoutElement parent ) { LayoutElement layoutElement = newLayoutElement ( node , parent , null ) ; parseChildren ( node , layoutElement , Tag . ELEMENT , Tag . TRIGGER ) ; return layoutElement ; }
Parse a layout element node .
55
7
8,575
private String getRequiredAttribute ( Element node , String name ) { String value = node . getAttribute ( name ) ; if ( value . isEmpty ( ) ) { throw new IllegalArgumentException ( "Missing " + name + " attribute on node: " + node . getTagName ( ) ) ; } return value ; }
Returns the value of the named attribute from a DOM node throwing an exception if not found .
68
18
8,576
private void parseTrigger ( Element node , LayoutElement parent ) { LayoutTrigger trigger = new LayoutTrigger ( ) ; parent . getTriggers ( ) . add ( trigger ) ; parseChildren ( node , trigger , Tag . CONDITION , Tag . ACTION ) ; }
Parse a trigger node .
56
6
8,577
private void parseCondition ( Element node , LayoutTrigger parent ) { new LayoutTriggerCondition ( parent , getDefinition ( null , node ) ) ; }
Parse a trigger condition node .
30
7
8,578
private void parseAction ( Element node , LayoutTrigger parent ) { new LayoutTriggerAction ( parent , getDefinition ( null , node ) ) ; }
Parse a trigger action node .
30
7
8,579
private Tag getTag ( Element node , Tag ... tags ) { String name = node . getTagName ( ) ; String error = null ; try { Tag tag = Tag . valueOf ( name . toUpperCase ( ) ) ; int i = ArrayUtils . indexOf ( tags , tag ) ; if ( i < 0 ) { error = "Tag '%s' is not valid at this location" ; } else { if ( ! tag . allowMultiple ) { tags [ i ] = null ; } return tag ; } } catch ( IllegalArgumentException e ) { error = "Unrecognized tag '%s' in layout" ; } throw new IllegalArgumentException ( getInvalidTagError ( error , name , tags ) ) ; }
Return and validate the tag type throwing an exception if the tag is unknown or among the allowable types .
158
20
8,580
private LayoutRoot parseUI ( ElementBase root ) { LayoutRoot ele = new LayoutRoot ( ) ; if ( root instanceof ElementDesktop ) { copyAttributes ( root , ele ) ; } parseChildren ( root , ele ) ; return ele ; }
Parse the layout from the UI element tree .
51
10
8,581
private void copyAttributes ( ElementBase src , LayoutElement dest ) { for ( PropertyInfo propInfo : src . getDefinition ( ) . getProperties ( ) ) { Object value = propInfo . isSerializable ( ) ? propInfo . getPropertyValue ( src ) : null ; String val = value == null ? null : propInfo . getPropertyType ( ) . getSerializer ( ) . serialize ( value ) ; if ( ! ObjectUtils . equals ( value , propInfo . getDefault ( ) ) ) { dest . getAttributes ( ) . put ( propInfo . getId ( ) , val ) ; } } }
Copy attributes from a UI element to layout element .
133
10
8,582
public static String readContent ( File file ) throws IOException { Reader input = null ; try { input = new FileReader ( file ) ; return readContent ( input ) ; } finally { closeQuietly ( input ) ; } }
Returns the content of a file as a String .
49
10
8,583
public static void log ( Marker marker , PerformanceMetrics metrics ) { if ( log . isDebugEnabled ( ) ) { log . debug ( marker , getEndMetrics ( metrics ) ) ; } }
Log line of measured performance of single operation specifying by performance metrics parameter .
43
14
8,584
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 .
103
8
8,585
@ Override 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
55
9
8,586
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 .
125
11
8,587
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 .
221
5
8,588
public static < T > T newObject ( Class < T > clazz ) { return getFactory ( clazz ) . newObject ( clazz ) ; }
Creates a new instance of an object of this domain .
33
12
8,589
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 .
38
16
8,590
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 .
47
15
8,591
@ 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 .
109
9
8,592
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 .
42
10
8,593
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 ++ ; // Equal indices. 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 .
162
12
8,594
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 .
71
15
8,595
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
282
16
8,596
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 ) ; // Set default values for mandatory fields 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 .
791
34
8,597
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
497
60
8,598
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 .
118
30
8,599
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 .
578
81