idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
8,200
protected static synchronized void registerAllowedParentClass ( Class < ? extends ElementBase > clazz , Class < ? extends ElementBase > parentClass ) { allowedParentClasses . addCardinality ( clazz , parentClass , 1 ) ; }
A ElementBase subclass should call this in its static initializer block to register any subclasses that may act as a parent .
8,201
protected static synchronized void registerAllowedChildClass ( Class < ? extends ElementBase > clazz , Class < ? extends ElementBase > childClass , int maxOccurrences ) { allowedChildClasses . addCardinality ( clazz , childClass , maxOccurrences ) ; }
A ElementBase subclass should call this in its static initializer block to register any subclasses that may be a child .
8,202
public static boolean canAcceptChild ( Class < ? extends ElementBase > parentClass , Class < ? extends ElementBase > childClass ) { return allowedChildClasses . isRelated ( parentClass , childClass ) ; }
Returns true if childClass can be a child of the parentClass .
8,203
public static boolean canAcceptParent ( Class < ? extends ElementBase > childClass , Class < ? extends ElementBase > parentClass ) { return allowedParentClasses . isRelated ( childClass , parentClass ) ; }
Returns true if parentClass can be a parent of childClass .
8,204
protected void addChild ( ElementBase child , boolean doEvent ) { if ( ! child . canAcceptParent ( this ) ) { CWFException . raise ( child . rejectReason ) ; } if ( ! canAcceptChild ( child ) ) { CWFException . raise ( rejectReason ) ; } if ( doEvent ) { beforeAddChild ( child ) ; } if ( child . getParent ( ) != null ) { child . getParent ( ) . removeChild ( child , false ) ; } children . add ( child ) ; child . updateParent ( this ) ; if ( doEvent ) { afterAddChild ( child ) ; } }
Adds the specified child element . The validity of the operation is first tested and an exception thrown if the element is not a valid child for this parent .
8,205
public void removeChild ( ElementBase child , boolean destroy ) { if ( ! children . contains ( child ) ) { return ; } boolean isLocked = child . isLocked ( ) || child . getDefinition ( ) . isInternal ( ) ; if ( destroy ) { child . removeChildren ( ) ; if ( ! isLocked ) { child . destroy ( ) ; } } if ( ! isLocked ) { beforeRemoveChild ( child ) ; children . remove ( child ) ; child . updateParent ( null ) ; afterRemoveChild ( child ) ; } }
Removes the specified element as a child of this parent .
8,206
private void updateParent ( ElementBase newParent ) { ElementBase oldParent = this . parent ; if ( oldParent != newParent ) { beforeParentChanged ( newParent ) ; this . parent = newParent ; if ( oldParent != null ) { oldParent . updateState ( ) ; } if ( newParent != null ) { afterParentChanged ( oldParent ) ; newParent . updateState ( ) ; } } }
Changes the assigned parent firing parent changed events if appropriate .
8,207
public void removeChildren ( ) { for ( int i = children . size ( ) - 1 ; i >= 0 ; i -- ) { removeChild ( children . get ( i ) , true ) ; } }
Remove and destroy all children associated with this element .
8,208
public void setDefinition ( PluginDefinition definition ) { if ( this . definition != null ) { if ( this . definition == definition ) { return ; } CWFException . raise ( "Cannot modify plugin definition." ) ; } this . definition = definition ; if ( definition != null ) { for ( PropertyInfo propInfo : definition . getProperties ( ) ) { String dflt = propInfo . getDefault ( ) ; if ( dflt != null ) { try { propInfo . setPropertyValue ( this , dflt ) ; } catch ( Exception e ) { log . error ( "Error setting default value for property " + propInfo . getName ( ) , e ) ; } } } } }
Sets the plugin definition for this element .
8,209
public void setDesignMode ( boolean designMode ) { this . designMode = designMode ; for ( ElementBase child : children ) { child . setDesignMode ( designMode ) ; } updateState ( ) ; }
Sets design mode status for this component and all its children .
8,210
public void editProperties ( ) { try { PropertyGrid . create ( this , null ) ; } catch ( Exception e ) { DialogUtil . showError ( "Displaying property grid: \r\n" + e . toString ( ) ) ; } }
Invokes the property grid with this element as its target .
8,211
@ SuppressWarnings ( "unchecked" ) public < T extends ElementBase > T getChild ( Class < T > clazz , ElementBase last ) { int i = last == null ? - 1 : children . indexOf ( last ) ; for ( i ++ ; i < children . size ( ) ; i ++ ) { if ( clazz . isInstance ( children . get ( i ) ) ) { return ( T ) children . get ( i ) ; } } return null ; }
Locates and returns a child that is an instance of the specified class . If none is found returns null .
8,212
public < T extends ElementBase > Iterable < T > getChildren ( Class < T > clazz ) { return MiscUtil . iterableForType ( children , clazz ) ; }
Returns an iterable of this component s children restricted to the specified type .
8,213
public int getChildCount ( Class < ? extends ElementBase > clazz ) { if ( clazz == ElementBase . class ) { return getChildCount ( ) ; } int count = 0 ; for ( ElementBase child : children ) { if ( clazz . isInstance ( child ) ) { count ++ ; } } return count ; }
Returns the number of children .
8,214
@ SuppressWarnings ( "unchecked" ) public < T extends ElementBase > T findChildElement ( Class < T > clazz ) { for ( ElementBase child : getChildren ( ) ) { if ( clazz . isInstance ( child ) ) { return ( T ) child ; } } for ( ElementBase child : getChildren ( ) ) { T child2 = child . findChildElement ( clazz ) ; if ( child2 != null ) { return child2 ; } } return null ; }
Recurses the component subtree for a child belonging to the specified class .
8,215
public boolean hasAncestor ( ElementBase element ) { ElementBase child = this ; while ( child != null ) { if ( element . hasChild ( child ) ) { return true ; } child = child . getParent ( ) ; } return false ; }
Returns true if specified element is an ancestor of this element .
8,216
public void moveChild ( int from , int to ) { if ( from != to ) { ElementBase child = children . get ( from ) ; ElementBase ref = children . get ( to ) ; children . remove ( from ) ; to = children . indexOf ( ref ) ; children . add ( to , child ) ; afterMoveChild ( child , ref ) ; } }
Moves a child from one position to another under the same parent .
8,217
public void setIndex ( int index ) { ElementBase parent = getParent ( ) ; if ( parent == null ) { CWFException . raise ( "Element has no parent." ) ; } int currentIndex = parent . children . indexOf ( this ) ; if ( currentIndex < 0 || currentIndex == index ) { return ; } parent . moveChild ( currentIndex , index ) ; }
Sets this element s index to the specified value . This effectively changes the position of the element relative to its siblings .
8,218
protected void moveChild ( BaseUIComponent child , BaseUIComponent before ) { child . getParent ( ) . addChild ( child , before ) ; }
Moves a child to before another component .
8,219
public boolean canAcceptChild ( ) { if ( maxChildren == 0 ) { rejectReason = getDisplayName ( ) + " does not accept any children." ; } else if ( getChildCount ( ) >= maxChildren ) { rejectReason = "Maximum child count exceeded for " + getDisplayName ( ) + "." ; } else { rejectReason = null ; } return rejectReason == null ; }
Returns true if this element may accept a child . Updates the reject reason with the result .
8,220
public boolean canAcceptChild ( Class < ? extends ElementBase > childClass ) { if ( ! canAcceptChild ( ) ) { return false ; } Cardinality cardinality = allowedChildClasses . getCardinality ( getClass ( ) , childClass ) ; int max = cardinality . getMaxOccurrences ( ) ; if ( max == 0 ) { rejectReason = getDisplayName ( ) + " does not accept " + childClass . getSimpleName ( ) + " as a child." ; } else if ( max != Integer . MAX_VALUE && getChildCount ( cardinality . getTargetClass ( ) ) >= max ) { rejectReason = getDisplayName ( ) + " cannot accept more than " + max + " of " + cardinality . getTargetClass ( ) . getSimpleName ( ) + "." ; } return rejectReason == null ; }
Returns true if this element may accept a child of the specified class . Updates the reject reason with the result .
8,221
public boolean canAcceptParent ( Class < ? extends ElementBase > clazz ) { if ( ! canAcceptParent ( getClass ( ) , clazz ) ) { rejectReason = getDisplayName ( ) + " does not accept " + clazz . getSimpleName ( ) + " as a parent." ; } else { rejectReason = null ; } return rejectReason == null ; }
Returns true if this element may accept a parent of the specified class . Updates the reject reason with the result .
8,222
public boolean canAcceptParent ( ElementBase parent ) { if ( ! canAcceptParent ( ) ) { return false ; } if ( ! canAcceptParent ( getClass ( ) , parent . getClass ( ) ) ) { rejectReason = getDisplayName ( ) + " does not accept " + parent . getDisplayName ( ) + " as a parent." ; } else { rejectReason = null ; } return rejectReason == null ; }
Returns true if this element may accept the specified element as a parent . Updates the reject reason with the result .
8,223
public ElementBase getRoot ( ) { ElementBase root = this ; while ( root . getParent ( ) != null ) { root = root . getParent ( ) ; } return root ; }
Returns the UI element at the root of the component tree .
8,224
@ SuppressWarnings ( "unchecked" ) public < T extends ElementBase > T getAncestor ( Class < T > clazz ) { ElementBase parent = getParent ( ) ; while ( parent != null && ! clazz . isInstance ( parent ) ) { parent = parent . getParent ( ) ; } return ( T ) parent ; }
Returns the first ancestor corresponding to the specified class .
8,225
private void processResources ( boolean register ) { CareWebShell shell = CareWebUtil . getShell ( ) ; for ( IPluginResource resource : getDefinition ( ) . getResources ( ) ) { resource . register ( shell , this , register ) ; } }
Process all associated resources .
8,226
public void notifyParent ( String eventName , Object eventData , boolean recurse ) { ElementBase ele = parent ; while ( ele != null ) { recurse &= ele . parentListeners . notify ( this , eventName , eventData ) ; ele = recurse ? ele . parent : null ; } }
Allows a child element to notify its parent of an event of interest .
8,227
public void notifyChildren ( String eventName , Object eventData , boolean recurse ) { notifyChildren ( this , eventName , eventData , recurse ) ; }
Allows a parent element to notify its children of an event of interest .
8,228
private static IInfoPanel searchChildren ( ElementBase parent , ElementBase exclude , boolean activeOnly ) { IInfoPanel infoPanel = null ; if ( parent != null ) { for ( ElementBase child : parent . getChildren ( ) ) { if ( ( child != exclude ) && ( ( infoPanel = getInfoPanel ( child , activeOnly ) ) != null ) ) { break ; } } if ( infoPanel == null ) { for ( ElementBase child : parent . getChildren ( ) ) { if ( ( child != exclude ) && ( ( infoPanel = searchChildren ( child , null , activeOnly ) ) != null ) ) { break ; } } } } return infoPanel ; }
Search children of the specified parent for an occurrence of an active info panel . This is a recursive breadth - first search of the component tree .
8,229
private static IInfoPanel getInfoPanel ( ElementBase element , boolean activeOnly ) { if ( element instanceof ElementPlugin ) { ElementPlugin plugin = ( ElementPlugin ) element ; if ( ( ! activeOnly || plugin . isActivated ( ) ) && ( plugin . getDefinition ( ) . getId ( ) . equals ( "infoPanelPlugin" ) ) ) { plugin . load ( ) ; BaseComponent top = plugin . getOuterComponent ( ) . findByName ( "infoPanelRoot" ) ; return ( IInfoPanel ) FrameworkController . getController ( top ) ; } } return null ; }
Returns the info panel associated with the UI element if there is one .
8,230
public static void associateEvent ( BaseComponent component , String eventName , Action action ) { getActionListeners ( component , true ) . add ( new ActionListener ( eventName , action ) ) ; }
Associate a generic event with an action on this component s container .
8,231
private static List < ActionListener > getActionListeners ( BaseComponent component , boolean forceCreate ) { @ SuppressWarnings ( "unchecked" ) List < ActionListener > ActionListeners = ( List < ActionListener > ) component . getAttribute ( EVENT_LISTENER_ATTR ) ; if ( ActionListeners == null && forceCreate ) { ActionListeners = new ArrayList < > ( ) ; component . setAttribute ( EVENT_LISTENER_ATTR , ActionListeners ) ; } return ActionListeners ; }
Returns a list of events associated with a component .
8,232
public boolean validate ( XmlObject formObject , List < AuditError > errors , String formName ) { final List < String > formErrors = new ArrayList < > ( ) ; final boolean result = validateXml ( formObject , formErrors ) ; errors . addAll ( formErrors . stream ( ) . map ( validationError -> s2SErrorHandlerService . getError ( GRANTS_GOV_PREFIX + validationError , formName ) ) . collect ( Collectors . toList ( ) ) ) ; return result ; }
This method receives an XMLObject and validates it against its schema and returns the validation result . It also receives a list in which upon validation failure populates it with XPaths of the error nodes .
8,233
public Map < String , Long > resetRetryCounter ( ) { Map < String , Long > result = retryCounter . asMap ( ) ; retryCounter . clear ( ) ; return result ; }
Reset retry counter .
8,234
protected boolean _queueWithRetries ( Connection conn , IQueueMessage < ID , DATA > msg , int numRetries , int maxRetries ) { try { Date now = new Date ( ) ; msg . setNumRequeues ( 0 ) . setQueueTimestamp ( now ) . setTimestamp ( now ) ; return putToQueueStorage ( conn , msg ) ; } catch ( DuplicatedValueException dve ) { LOGGER . warn ( dve . getMessage ( ) , dve ) ; return true ; } catch ( DaoException de ) { if ( de . getCause ( ) instanceof DuplicateKeyException ) { LOGGER . warn ( de . getMessage ( ) , de ) ; return true ; } if ( de . getCause ( ) instanceof ConcurrencyFailureException ) { if ( numRetries > maxRetries ) { throw new QueueException ( de ) ; } else { incRetryCounter ( "_queueWithRetries" ) ; return _queueWithRetries ( conn , msg , numRetries + 1 , maxRetries ) ; } } throw de ; } catch ( Exception e ) { throw e instanceof QueueException ? ( QueueException ) e : new QueueException ( e ) ; } }
Queue a message retry if deadlock .
8,235
protected boolean _requeueWithRetries ( Connection conn , IQueueMessage < ID , DATA > msg , int numRetries , int maxRetries ) { try { jdbcHelper . startTransaction ( conn ) ; conn . setTransactionIsolation ( transactionIsolationLevel ) ; if ( ! isEphemeralDisabled ( ) ) { removeFromEphemeralStorage ( conn , msg ) ; } Date now = new Date ( ) ; msg . incNumRequeues ( ) . setQueueTimestamp ( now ) ; boolean result = putToQueueStorage ( conn , msg ) ; jdbcHelper . commitTransaction ( conn ) ; return result ; } catch ( DuplicatedValueException dve ) { jdbcHelper . rollbackTransaction ( conn ) ; LOGGER . warn ( dve . getMessage ( ) , dve ) ; return true ; } catch ( DaoException de ) { if ( de . getCause ( ) instanceof DuplicateKeyException ) { jdbcHelper . rollbackTransaction ( conn ) ; LOGGER . warn ( de . getMessage ( ) , de ) ; return true ; } if ( de . getCause ( ) instanceof ConcurrencyFailureException ) { jdbcHelper . rollbackTransaction ( conn ) ; if ( numRetries > maxRetries ) { throw new QueueException ( de ) ; } else { incRetryCounter ( "_requeueWithRetries" ) ; return _requeueSilentWithRetries ( conn , msg , numRetries + 1 , maxRetries ) ; } } throw de ; } catch ( Exception e ) { jdbcHelper . rollbackTransaction ( conn ) ; throw e instanceof QueueException ? ( QueueException ) e : new QueueException ( e ) ; } }
Re - queue a message retry if deadlock .
8,236
protected void _finishWithRetries ( Connection conn , IQueueMessage < ID , DATA > msg , int numRetries , int maxRetries ) { try { if ( ! isEphemeralDisabled ( ) ) { removeFromEphemeralStorage ( conn , msg ) ; } } catch ( DaoException de ) { if ( de . getCause ( ) instanceof ConcurrencyFailureException ) { if ( numRetries > maxRetries ) { throw new QueueException ( de ) ; } else { incRetryCounter ( "_finishWithRetries" ) ; _finishWithRetries ( conn , msg , numRetries + 1 , maxRetries ) ; } } throw de ; } catch ( Exception e ) { throw e instanceof QueueException ? ( QueueException ) e : new QueueException ( e ) ; } }
Perform finish action retry if deadlock .
8,237
protected IQueueMessage < ID , DATA > _takeWithRetries ( Connection conn , int numRetries , int maxRetries ) { try { jdbcHelper . startTransaction ( conn ) ; conn . setTransactionIsolation ( transactionIsolationLevel ) ; boolean result = true ; IQueueMessage < ID , DATA > msg = readFromQueueStorage ( conn ) ; if ( msg != null ) { result = result && removeFromQueueStorage ( conn , msg ) ; if ( ! isEphemeralDisabled ( ) ) { try { result = result && putToEphemeralStorage ( conn , msg ) ; } catch ( DuplicatedValueException dve ) { LOGGER . warn ( dve . getMessage ( ) , dve ) ; } catch ( DaoException de ) { if ( de . getCause ( ) instanceof DuplicatedValueException ) { LOGGER . warn ( de . getMessage ( ) , de ) ; } else { throw de ; } } } } if ( result ) { jdbcHelper . commitTransaction ( conn ) ; return msg ; } else { jdbcHelper . rollbackTransaction ( conn ) ; return null ; } } catch ( DaoException de ) { if ( de . getCause ( ) instanceof ConcurrencyFailureException ) { jdbcHelper . rollbackTransaction ( conn ) ; if ( numRetries > maxRetries ) { throw new QueueException ( de ) ; } else { incRetryCounter ( "_takeWithRetries" ) ; return _takeWithRetries ( conn , numRetries + 1 , maxRetries ) ; } } throw de ; } catch ( Exception e ) { jdbcHelper . rollbackTransaction ( conn ) ; throw e instanceof QueueException ? ( QueueException ) e : new QueueException ( e ) ; } }
Take a message from queue retry if deadlock .
8,238
private void setQuestionnareAnswerForResearchTrainingPlan ( ResearchTrainingPlan researchTrainingPlan ) { researchTrainingPlan . setHumanSubjectsIndefinite ( YesNoDataType . N_NO ) ; researchTrainingPlan . setVertebrateAnimalsIndefinite ( YesNoDataType . N_NO ) ; researchTrainingPlan . setHumanSubjectsIndefinite ( YesNoDataType . N_NO ) ; researchTrainingPlan . setClinicalTrial ( YesNoDataType . N_NO ) ; researchTrainingPlan . setPhase3ClinicalTrial ( YesNoDataType . N_NO ) ; for ( AnswerContract questionnaireAnswer : getPropDevQuestionAnswerService ( ) . getQuestionnaireAnswers ( pdDoc . getDevelopmentProposal ( ) . getProposalNumber ( ) , getNamespace ( ) , getFormName ( ) ) ) { String answer = questionnaireAnswer . getAnswer ( ) ; if ( answer != null ) { switch ( getQuestionAnswerService ( ) . findQuestionById ( questionnaireAnswer . getQuestionId ( ) ) . getQuestionSeqId ( ) ) { case HUMAN : researchTrainingPlan . setHumanSubjectsIndefinite ( answer . equals ( YnqConstant . YES . code ( ) ) ? YesNoDataType . Y_YES : YesNoDataType . N_NO ) ; break ; case VERT : researchTrainingPlan . setVertebrateAnimalsIndefinite ( answer . equals ( YnqConstant . YES . code ( ) ) ? YesNoDataType . Y_YES : YesNoDataType . N_NO ) ; break ; case CLINICAL : researchTrainingPlan . setClinicalTrial ( answer . equals ( YnqConstant . YES . code ( ) ) ? YesNoDataType . Y_YES : YesNoDataType . N_NO ) ; break ; case PHASE3CLINICAL : researchTrainingPlan . setPhase3ClinicalTrial ( answer . equals ( YnqConstant . YES . code ( ) ) ? YesNoDataType . Y_YES : YesNoDataType . N_NO ) ; break ; default : break ; } } } }
This method is used to set QuestionnareAnswer data to ResearchTrainingPlan XMLObject
8,239
private String transformKey ( String key , String src , String tgt ) { StringBuilder sb = new StringBuilder ( ) ; String [ ] srcTokens = src . split ( WILDCARD_DELIM_REGEX ) ; String [ ] tgtTokens = tgt . split ( WILDCARD_DELIM_REGEX ) ; int len = Math . max ( srcTokens . length , tgtTokens . length ) ; int pos = 0 ; int start = 0 ; for ( int i = 0 ; i <= len ; i ++ ) { String srcx = i >= srcTokens . length ? "" : srcTokens [ i ] ; String tgtx = i >= tgtTokens . length ? "" : tgtTokens [ i ] ; pos = i == len ? key . length ( ) : pos ; if ( "*" . equals ( srcx ) || "?" . equals ( srcx ) ) { start = pos ; } else { pos = key . indexOf ( srcx , pos ) ; if ( pos > start ) { sb . append ( key . substring ( start , pos ) ) ; } start = pos += srcx . length ( ) ; sb . append ( tgtx ) ; } } return sb . toString ( ) ; }
Uses the source and target wildcard masks to transform an input key .
8,240
protected void afterMoveChild ( ElementBase child , ElementBase before ) { ElementTreePane childpane = ( ElementTreePane ) child ; ElementTreePane beforepane = ( ElementTreePane ) before ; moveChild ( childpane . getNode ( ) , beforepane . getNode ( ) ) ; }
Only the node needs to be resequenced since pane sequencing is arbitrary .
8,241
public void setSelectionStyle ( ThemeUtil . ButtonStyle selectionStyle ) { if ( activePane != null ) { activePane . updateSelectionStyle ( this . selectionStyle , selectionStyle ) ; } this . selectionStyle = selectionStyle ; }
Sets the button style to use for selected nodes .
8,242
protected void afterRemoveChild ( ElementBase child ) { if ( child == activePane ) { setActivePane ( ( ElementTreePane ) getFirstChild ( ) ) ; } super . afterRemoveChild ( child ) ; }
Remove the associated tree node when a tree pane is removed .
8,243
public void activateChildren ( boolean activate ) { if ( activePane == null || ! activePane . isVisible ( ) ) { ElementBase active = getFirstVisibleChild ( ) ; setActivePane ( ( ElementTreePane ) active ) ; } if ( activePane != null ) { activePane . activate ( activate ) ; } }
Only the active pane should receive the activation request .
8,244
protected void setActivePane ( ElementTreePane pane ) { if ( pane == activePane ) { return ; } if ( activePane != null ) { activePane . makeActivePane ( false ) ; } activePane = pane ; if ( activePane != null ) { activePane . makeActivePane ( true ) ; } }
Activates the specified pane . Any previously active pane will be deactivated .
8,245
public AliasType get ( String key ) { key = key . toUpperCase ( ) ; AliasType type = super . get ( key ) ; if ( type == null ) { register ( type = new AliasType ( key ) ) ; } return type ; }
Returns the AliasType given the key creating and registering it if it does not already exist .
8,246
public void setApplicationContext ( ApplicationContext applicationContext ) throws BeansException { if ( StringUtils . isEmpty ( propertyFile ) ) { return ; } for ( String pf : propertyFile . split ( "\\," ) ) { loadAliases ( applicationContext , pf ) ; } if ( fileCount > 0 ) { log . info ( "Loaded " + entryCount + " aliases from " + fileCount + " files." ) ; } }
Loads aliases defined in an external property file if specified .
8,247
private void loadAliases ( ApplicationContext applicationContext , String propertyFile ) { if ( propertyFile . isEmpty ( ) ) { return ; } Resource [ ] resources ; try { resources = applicationContext . getResources ( propertyFile ) ; } catch ( IOException e ) { log . error ( "Failed to locate alias property file: " + propertyFile , e ) ; return ; } for ( Resource resource : resources ) { if ( ! resource . exists ( ) ) { log . info ( "Did not find alias property file: " + resource . getFilename ( ) ) ; continue ; } try ( InputStream is = resource . getInputStream ( ) ; ) { Properties props = new Properties ( ) ; props . load ( is ) ; for ( Entry < Object , Object > entry : props . entrySet ( ) ) { try { register ( ( String ) entry . getKey ( ) , ( String ) entry . getValue ( ) ) ; entryCount ++ ; } catch ( Exception e ) { log . error ( "Error registering alias for '" + entry . getKey ( ) + "'." , e ) ; } } fileCount ++ ; } catch ( IOException e ) { log . error ( "Failed to load alias property file: " + resource . getFilename ( ) , e ) ; } } }
Load aliases from a property file .
8,248
private void register ( String key , String alias ) { String [ ] pcs = key . split ( PREFIX_DELIM_REGEX , 2 ) ; if ( pcs . length != 2 ) { throw new IllegalArgumentException ( "Illegal key value: " + key ) ; } register ( pcs [ 0 ] , pcs [ 1 ] , alias ) ; }
Registers an alias for a key prefixed with an alias type .
8,249
public static < T1 extends Comparable < T1 > , T2 extends Comparable < T2 > > Comparator < Pair < T1 , T2 > > naturalOrder ( ) { return new Comparator < Pair < T1 , T2 > > ( ) { public int compare ( Pair < T1 , T2 > lhs , Pair < T1 , T2 > rhs ) { return compareTo ( lhs , rhs ) ; } } ; }
creates a natural order for pairs of comparable things
8,250
protected AttachedFileDataType [ ] getAppendixAttachedFileDataTypes ( ) { return pdDoc . getDevelopmentProposal ( ) . getNarratives ( ) . stream ( ) . filter ( narrative -> narrative . getNarrativeType ( ) . getCode ( ) != null && Integer . parseInt ( narrative . getNarrativeType ( ) . getCode ( ) ) == APPENDIX ) . map ( this :: getAttachedFileType ) . filter ( Objects :: nonNull ) . toArray ( AttachedFileDataType [ ] :: new ) ; }
This method is used to get List of appendix attachments from NarrativeAttachment
8,251
public Document nodeToDom ( org . w3c . dom . Node node ) throws S2SException { try { javax . xml . transform . TransformerFactory tf = javax . xml . transform . TransformerFactory . newInstance ( ) ; javax . xml . transform . Transformer xf = tf . newTransformer ( ) ; javax . xml . transform . dom . DOMResult dr = new javax . xml . transform . dom . DOMResult ( ) ; xf . transform ( new javax . xml . transform . dom . DOMSource ( node ) , dr ) ; return ( Document ) dr . getNode ( ) ; } catch ( javax . xml . transform . TransformerException ex ) { throw new S2SException ( ex . getMessage ( ) ) ; } }
This method convert node of form in to a Document
8,252
public Document stringToDom ( String xmlSource ) throws S2SException { try { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; return builder . parse ( new InputSource ( new StringReader ( xmlSource ) ) ) ; } catch ( SAXException | IOException | ParserConfigurationException ex ) { throw new S2SException ( ex . getMessage ( ) , ex ) ; } }
This method convert xml string in to a Document
8,253
public String docToString ( Document node ) throws S2SException { try { DOMSource domSource = new DOMSource ( node ) ; StringWriter writer = new StringWriter ( ) ; StreamResult result = new StreamResult ( writer ) ; TransformerFactory tf = TransformerFactory . newInstance ( ) ; Transformer transformer = tf . newTransformer ( ) ; transformer . transform ( domSource , result ) ; return writer . toString ( ) ; } catch ( Exception e ) { throw new S2SException ( e . getMessage ( ) , e ) ; } }
This method convert Document to a String
8,254
protected void addSubAwdAttachments ( BudgetSubAwardsContract budgetSubAwards ) { List < ? extends BudgetSubAwardAttachmentContract > subAwardAttachments = budgetSubAwards . getBudgetSubAwardAttachments ( ) ; for ( BudgetSubAwardAttachmentContract budgetSubAwardAttachment : subAwardAttachments ) { AttachmentData attachmentData = new AttachmentData ( ) ; attachmentData . setContent ( budgetSubAwardAttachment . getData ( ) ) ; attachmentData . setContentId ( budgetSubAwardAttachment . getName ( ) ) ; attachmentData . setContentType ( budgetSubAwardAttachment . getType ( ) ) ; attachmentData . setFileName ( budgetSubAwardAttachment . getName ( ) ) ; addAttachment ( attachmentData ) ; } }
Adding attachments to subaward
8,255
@ SuppressWarnings ( "unchecked" ) private List < BudgetSubAwardsContract > findBudgetSubawards ( String namespace , BudgetContract budget , boolean checkNull ) { List < BudgetSubAwardsContract > budgetSubAwardsList = new ArrayList < > ( ) ; for ( BudgetSubAwardsContract subAwards : budget . getBudgetSubAwards ( ) ) { if ( StringUtils . equals ( namespace , subAwards . getNamespace ( ) ) || ( checkNull && StringUtils . isBlank ( subAwards . getNamespace ( ) ) ) ) { budgetSubAwardsList . add ( subAwards ) ; } } return budgetSubAwardsList ; }
This method is to find the subaward budget BOs for the given namespace .
8,256
public static PerformanceMetrics createNew ( String action , String descriptor , String correlationId ) { return new PerformanceMetrics ( KEY_GEN . getAndIncrement ( ) , 0 , action , null , descriptor , correlationId ) ; }
Creates new instance of performance metrics . Generates new metrics key and assigns zero level .
8,257
public Action0 getStartAction ( ) { return new Action0 ( ) { public void call ( ) { if ( startTime == null ) { startTime = new Date ( ) . getTime ( ) ; } } } ; }
When called start action sets time stamp to identify start time of operation .
8,258
public static Path createTempFolder ( String prefix ) throws IOException { Path parent = Paths . get ( System . getProperty ( "java.io.tmpdir" ) ) ; if ( ! Files . isDirectory ( parent ) ) { throw new IOException ( "java.io.tmpdir points to a non-existing folder: " + parent ) ; } Path ret = null ; int i = 0 ; do { ret = parent . resolve ( Objects . requireNonNull ( prefix ) + Long . toHexString ( System . currentTimeMillis ( ) ) + "-" + Integer . toHexString ( RND . nextInt ( ) ) ) ; i ++ ; if ( i >= 100 ) { throw new IOException ( "Failed to create temporary folder." ) ; } } while ( ! ret . toFile ( ) . mkdirs ( ) ) ; return ret ; }
Creates a temporary folder .
8,259
public static void deleteRecursive ( Path start , boolean deleteStart ) throws IOException { Files . walkFileTree ( start , new SimpleFileVisitor < Path > ( ) { public FileVisitResult visitFile ( Path file , BasicFileAttributes attrs ) throws IOException { Files . delete ( file ) ; return FileVisitResult . CONTINUE ; } public FileVisitResult postVisitDirectory ( Path dir , IOException e ) throws IOException { if ( e == null ) { if ( deleteStart || ! Files . isSameFile ( dir , start ) ) { Files . delete ( dir ) ; } return FileVisitResult . CONTINUE ; } else { throw e ; } } } ) ; }
Deletes files and folders at the specified path .
8,260
public void afterInitialized ( BaseComponent comp ) { super . afterInitialized ( comp ) ; propertyGrid = PropertyGrid . create ( null , comp , true ) ; getPlugin ( ) . registerProperties ( this , "provider" , "group" ) ; }
Connects an embedded instance of the property grid to the plug - in s root component .
8,261
public void setProvider ( String beanId ) { provider = getAppContext ( ) . getBean ( beanId , ISettingsProvider . class ) ; providerBeanId = beanId ; init ( ) ; }
Sets the id of the bean that implements the ISettingsProvider interface .
8,262
private void init ( ) { if ( provider != null ) { propertyGrid . setTarget ( StringUtils . isEmpty ( groupId ) ? null : new Settings ( groupId , provider ) ) ; } }
Activates the property grid once the provider and group ids are set .
8,263
private void addCollectionProviderFixtureType ( Class < ? > clazz , List < FixtureType > listFixtureType , Set < Method > methods ) { for ( Method method : methods ) { if ( Collection . class . isAssignableFrom ( method . getReturnType ( ) ) ) { FixtureType fixtureType = new FixtureType ( ) ; if ( method . isAnnotationPresent ( FixtureCollection . class ) ) { FixtureCollection annotation = method . getAnnotation ( FixtureCollection . class ) ; if ( annotation . deprecated ( ) ) { fixtureType . setDeprecated ( annotation . deprecated ( ) ) ; } else { fixtureType . setBestpractice ( annotation . bestPractice ( ) ) ; } } Type genericReturnType = method . getGenericReturnType ( ) ; Class < ? > typeClass ; if ( ParameterizedType . class . isAssignableFrom ( genericReturnType . getClass ( ) ) ) { ParameterizedType parameterizedReturnType = ( ParameterizedType ) genericReturnType ; LOGGER . debug ( "Checking the Collection Generic type: {}" , parameterizedReturnType ) ; typeClass = ( Class < ? > ) parameterizedReturnType . getActualTypeArguments ( ) [ 0 ] ; } else { typeClass = Object . class ; } fixtureType . setClazz ( returnTypeToString ( clazz ) + "/" + method . getName ( ) ) ; List < MemberType > listMembreType = fixtureType . getMember ( ) ; if ( Modifier . isAbstract ( clazz . getModifiers ( ) ) ) { fixtureType . setCategory ( CAT_FIXTURES_ABSTRAITES ) ; } else { @ SuppressWarnings ( "unchecked" ) Set < Field > allFields = getAllFields ( typeClass , and ( or ( withModifier ( Modifier . PUBLIC ) , withModifier ( Modifier . PRIVATE ) ) , not ( withModifier ( Modifier . STATIC ) ) ) ) ; for ( Field field : allFields ) { MemberType membreType = new MemberType ( ) ; membreType . setName ( field . getName ( ) ) ; membreType . setType ( TypeMemberEnum . QUERY ) ; membreType . setReturntype ( returnTypeToString ( field . getType ( ) . getSimpleName ( ) ) ) ; listMembreType . add ( membreType ) ; } } listFixtureType . add ( fixtureType ) ; } else { LOGGER . warn ( "A method matching the CollectionIterpreter is not returning a Collection: {}" , method . toString ( ) ) ; } } }
Parsing des FixtureCollection .
8,264
public void unbind ( BaseUIComponent component ) { if ( componentBindings . remove ( component ) ) { keyEventListener . registerComponent ( component , false ) ; CommandUtil . updateShortcuts ( component , shortcutBindings , true ) ; setCommandTarget ( component , null ) ; } }
Unbind a component from this command .
8,265
private void shortcutChanged ( String shortcut , boolean unbind ) { Set < String > bindings = new HashSet < > ( ) ; bindings . add ( shortcut ) ; for ( BaseUIComponent component : componentBindings ) { CommandUtil . updateShortcuts ( component , bindings , unbind ) ; } }
Called when a shortcut is bound or unbound .
8,266
private void setCommandTarget ( BaseComponent component , BaseComponent commandTarget ) { if ( commandTarget == null ) { commandTarget = ( BaseComponent ) component . removeAttribute ( getTargetAttributeName ( ) ) ; if ( commandTarget != null && commandTarget . hasAttribute ( ATTR_DUMMY ) ) { commandTarget . detach ( ) ; } } else { component . setAttribute ( getTargetAttributeName ( ) , commandTarget ) ; } }
Sets or removes the command target for the specified component .
8,267
private BaseComponent getCommandTarget ( BaseComponent component ) { BaseComponent commandTarget = ( BaseComponent ) component . getAttribute ( getTargetAttributeName ( ) ) ; return commandTarget == null ? component : commandTarget ; }
Returns the command target associated with the specified component .
8,268
public static String getLocalizedId ( String id , Locale locale ) { String locstr = locale == null ? "" : ( "_" + locale . toString ( ) ) ; return id + locstr ; }
Adds locale information to a help module id .
8,269
public static String computeAttachmentHash ( byte [ ] attachment ) { byte [ ] rawDigest = MESSAGE_DIGESTER . digest ( attachment ) ; return Base64 . encode ( rawDigest ) ; }
Computes the hash of an binary attachment .
8,270
@ SuppressWarnings ( "unchecked" ) Map < String , Class < ? extends Service > > mapEventSources ( ) throws IOException { ClassLoader classLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; Set < ClassPath . ClassInfo > classes = ClassPath . from ( classLoader ) . getAllClasses ( ) ; ClassLoaderRepository repository = new ClassLoaderRepository ( classLoader ) ; LOGGER . info ( "Scanning classpath for EventHandlers...." ) ; Map < String , Class < ? extends Service > > collected = classes . parallelStream ( ) . map ( classInfo -> { try { return Optional . of ( repository . loadClass ( classInfo . getName ( ) ) ) ; } catch ( ClassNotFoundException e ) { LOGGER . trace ( "Class cannot be loaded: {}" , classInfo . getName ( ) , e ) ; return Optional . < JavaClass > empty ( ) ; } } ) . filter ( ( ( Predicate < Optional < JavaClass > > ) Optional :: isPresent ) . and ( javaClassOptional -> { return Arrays . stream ( javaClassOptional . get ( ) . getAnnotationEntries ( ) ) . anyMatch ( annotationEntry -> { return Type . getType ( annotationEntry . getAnnotationType ( ) ) . toString ( ) . equals ( EventSource . class . getCanonicalName ( ) ) ; } ) ; } ) . and ( javaClassOptional -> { try { return Arrays . stream ( javaClassOptional . get ( ) . getAllInterfaces ( ) ) . anyMatch ( iface -> { return iface . getClassName ( ) . equals ( Service . class . getCanonicalName ( ) ) ; } ) ; } catch ( ClassNotFoundException e ) { LOGGER . trace ( "Class annotations cannot be loaded: {}" , javaClassOptional . get ( ) . getClassName ( ) , e ) ; return false ; } } ) ) . map ( javaClassOptional -> { try { return ( Class < ? extends Service > ) classLoader . loadClass ( javaClassOptional . get ( ) . getClassName ( ) ) ; } catch ( ClassNotFoundException e ) { LOGGER . trace ( "Class cannot be loaded: {}" , javaClassOptional . get ( ) . getClassName ( ) , e ) ; return null ; } } ) . filter ( Objects :: nonNull ) . collect ( Collectors . toMap ( clazz -> clazz . getAnnotation ( EventSource . class ) . value ( ) , clazz -> clazz ) ) ; LOGGER . info ( "Found {} event handlers" , collected . size ( ) ) ; return collected ; }
Scans whole application classpath and finds events sources
8,271
public static String getClientId ( Connection connection ) { String clientId = null ; try { clientId = connection == null ? null : connection . getClientID ( ) ; } catch ( JMSException e ) { } return clientId ; }
Returns the client id from the connection .
8,272
public static String getMessageSelector ( String eventName , IPublisherInfo publisherInfo ) { StringBuilder sb = new StringBuilder ( "(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL" ) ; if ( publisherInfo != null ) { for ( String selector : publisherInfo . getAttributes ( ) . values ( ) ) { addRecipientSelector ( selector , sb ) ; } } sb . append ( ')' ) ; return sb . toString ( ) ; }
Creates a message selector which considers JMSType and recipients properties .
8,273
private static void addRecipientSelector ( String value , StringBuilder sb ) { if ( value != null ) { sb . append ( " OR Recipients LIKE '%," ) . append ( value ) . append ( ",%'" ) ; } }
Add a recipient selector for the given value .
8,274
private HttpHandler getAggregationHandler ( ) throws ServletException { DeploymentInfo deploymentInfo = Servlets . deployment ( ) . setClassLoader ( JashingServer . class . getClassLoader ( ) ) . setContextPath ( "/" ) . setDeploymentName ( "jashing" ) . addFilterUrlMapping ( "wro4j" , "/*" , DispatcherType . REQUEST ) . addFilter ( Servlets . filter ( "wro4j" , ConfigurableWroFilter . class , new InstanceFactory < ConfigurableWroFilter > ( ) { public InstanceHandle < ConfigurableWroFilter > createInstance ( ) throws InstantiationException { ConfigurableWroFilter filter = new ConfigurableWroFilter ( ) ; filter . setWroManagerFactory ( new WroManagerFactory ( ) ) ; return new ImmediateInstanceHandle < > ( filter ) ; } } ) ) ; DeploymentManager deployment = Servlets . defaultContainer ( ) . addDeployment ( deploymentInfo ) ; deployment . deploy ( ) ; return deployment . start ( ) ; }
Uses Wro4j Filter to pre - process resources Required for coffee scripts compilation and saas processing Wro4j uses Servlet API so we make fake Servlet Deployment here to emulate servlet - based environment
8,275
public static String [ ] loadLibFiles ( String fileSuffix , String ... libAbsoluteClassPaths ) { Set < String > failedDllPaths = new HashSet < String > ( ) ; for ( String libAbsoluteClassPath : libAbsoluteClassPaths ) { String libraryName = libAbsoluteClassPath . substring ( libAbsoluteClassPath . lastIndexOf ( "/" ) + 1 , libAbsoluteClassPath . lastIndexOf ( fileSuffix ) ) ; try { prepareLibFile ( true , libAbsoluteClassPath ) ; System . loadLibrary ( libraryName ) ; LOGGER . info ( "Success load library: " + libraryName ) ; } catch ( Exception e ) { LOGGER . info ( "Load library: " + libraryName + " failed!" , e ) ; failedDllPaths . add ( libAbsoluteClassPath ) ; } } return failedDllPaths . toArray ( new String [ failedDllPaths . size ( ) ] ) ; }
Load libraries which placed in class path .
8,276
public Cardinalities getCardinalities ( Class < ? extends ElementBase > sourceClass ) { Class < ? > clazz = sourceClass ; Cardinalities cardinalities = null ; while ( cardinalities == null && clazz != null ) { cardinalities = map . get ( clazz ) ; clazz = clazz == ElementBase . class ? null : clazz . getSuperclass ( ) ; } return cardinalities ; }
Returns the cardinalities associated with this class or a superclass .
8,277
private Cardinalities getOrCreateCardinalities ( Class < ? extends ElementBase > sourceClass ) { Cardinalities cardinalities = map . get ( sourceClass ) ; if ( cardinalities == null ) { map . put ( sourceClass , cardinalities = new Cardinalities ( ) ) ; } return cardinalities ; }
Returns cardinalities for the specified class creating it if necessary .
8,278
public void addCardinality ( Class < ? extends ElementBase > sourceClass , Class < ? extends ElementBase > targetClass , int maxOccurrences ) { Cardinality cardinality = new Cardinality ( sourceClass , targetClass , maxOccurrences ) ; getOrCreateCardinalities ( sourceClass ) . addCardinality ( cardinality ) ; }
Adds cardinality relationship between source and target classes .
8,279
public int getTotalCardinality ( Class < ? extends ElementBase > sourceClass ) { Cardinalities cardinalities = getCardinalities ( sourceClass ) ; return cardinalities == null ? 0 : cardinalities . total ; }
Returns the sum of cardinalities across all related classes .
8,280
public boolean isRelated ( Class < ? extends ElementBase > sourceClass , Class < ? extends ElementBase > targetClass ) { return getCardinality ( sourceClass , targetClass ) . maxOccurrences > 0 ; }
Returns true if targetClass or a superclass of targetClass is related to sourceClass .
8,281
public Cardinality getCardinality ( Class < ? extends ElementBase > sourceClass , Class < ? extends ElementBase > targetClass ) { Cardinalities cardinalities = getCardinalities ( sourceClass ) ; Cardinality cardinality = cardinalities == null ? null : cardinalities . getCardinality ( targetClass ) ; return cardinality == null ? new Cardinality ( sourceClass , targetClass , 0 ) : cardinality ; }
Returns the cardinality between two element classes .
8,282
public void setApplicationContext ( ApplicationContext appContext ) throws BeansException { if ( this . appContext != null ) { throw new ApplicationContextException ( "Attempt to reinitialize application context." ) ; } this . appContext = appContext ; }
ApplicationContextAware interface to allow container to inject itself . Sets the active application context .
8,283
public synchronized boolean unregisterObject ( Object object ) { int i = MiscUtil . indexOfInstance ( registeredObjects , object ) ; if ( i > - 1 ) { registeredObjects . remove ( i ) ; for ( IRegisterEvent onRegister : onRegisterList ) { onRegister . unregisterObject ( object ) ; } if ( object instanceof IRegisterEvent ) { onRegisterList . remove ( object ) ; } return true ; } return false ; }
Remove an object registration from the framework and any relevant subsystems .
8,284
public synchronized Object findObject ( Class < ? > clazz , Object previousInstance ) { int i = previousInstance == null ? - 1 : MiscUtil . indexOfInstance ( registeredObjects , previousInstance ) ; for ( i ++ ; i < registeredObjects . size ( ) ; i ++ ) { Object object = registeredObjects . get ( i ) ; if ( clazz . isInstance ( object ) ) { return object ; } } return null ; }
Finds a registered object belonging to the specified class .
8,285
public Object postProcessAfterInitialization ( Object bean , String beanName ) throws BeansException { registerObject ( bean ) ; return bean ; }
Automatically registers any container - managed bean with the framework .
8,286
public void afterInitialize ( boolean deserializing ) throws Exception { super . afterInitialize ( deserializing ) ; if ( linked ) { internalDeserialize ( false ) ; } initializing = false ; }
If this is a linked layout must deserialize from it .
8,287
private void internalDeserialize ( boolean forced ) { if ( ! forced && loaded ) { return ; } lockDescendants ( false ) ; removeChildren ( ) ; loaded = true ; try { if ( linked ) { checkForCircularReference ( ) ; } getLayout ( ) . materialize ( this ) ; if ( linked ) { lockDescendants ( true ) ; } } catch ( Exception e ) { CWFException . raise ( "Error loading layout." , e ) ; } }
Deserialize from the associated layout .
8,288
private void checkForCircularReference ( ) { ElementLayout layout = this ; while ( ( layout = layout . getAncestor ( ElementLayout . class ) ) != null ) { if ( layout . linked && layout . shared == shared && layout . layoutName . equals ( layoutName ) ) { CWFException . raise ( "Circular reference to layout " + layoutName ) ; } } }
Checks for a circular reference to the same linked layout throwing an exception if found .
8,289
private void lockDescendants ( Iterable < ElementBase > children , boolean lock ) { for ( ElementBase child : children ) { child . setLocked ( lock ) ; lockDescendants ( child . getChildren ( ) , lock ) ; } }
Sets the lock state for all descendants of this layout .
8,290
public void setLinked ( boolean linked ) { if ( linked != this . linked ) { this . linked = linked ; if ( ! initializing ) { internalDeserialize ( true ) ; getRoot ( ) . activate ( true ) ; } } }
Sets the linked state . A change in this state requires reloading of the associated layout .
8,291
public static BigDecimal getSelfConfigDecimal ( String configAbsoluteClassPath , IConfigKey key ) { OneProperties configs = otherConfigs . get ( configAbsoluteClassPath ) ; if ( configs == null ) { addSelfConfigs ( configAbsoluteClassPath , null ) ; configs = otherConfigs . get ( configAbsoluteClassPath ) ; if ( configs == null ) { return VOID_CONFIGS . getDecimalConfig ( key ) ; } } return configs . getDecimalConfig ( key ) ; }
Get self config decimal .
8,292
public static boolean isHavePathSelfConfig ( IConfigKeyWithPath key ) { String configAbsoluteClassPath = key . getConfigPath ( ) ; return isSelfConfig ( configAbsoluteClassPath , key ) ; }
Get self config boolean value
8,293
public static void modifySystemConfig ( IConfigKey key , String value ) throws IOException { systemConfigs . modifyConfig ( key , value ) ; }
Modify one system config .
8,294
private void hostSubscribe ( String eventName , boolean subscribe ) { if ( globalEventDispatcher != null ) { try { globalEventDispatcher . subscribeRemoteEvent ( eventName , subscribe ) ; } catch ( Throwable e ) { log . error ( "Error " + ( subscribe ? "subscribing to" : "unsubscribing from" ) + " remote event '" + eventName + "'" , e ) ; } } }
Registers or unregisters a subscription with the global event dispatcher if one is present .
8,295
public AbstractQueueFactory < T , ID , DATA > setDefaultObserver ( IQueueObserver < ID , DATA > defaultObserver ) { this . defaultObserver = defaultObserver ; return this ; }
Set default queue s event observer .
8,296
protected void initQueue ( T queue , QueueSpec spec ) throws Exception { queue . setObserver ( defaultObserver ) ; queue . init ( ) ; }
Initializes a newly created queue instance .
8,297
protected T createAndInitQueue ( QueueSpec spec ) throws Exception { T queue = createQueueInstance ( spec ) ; queue . setQueueName ( spec . name ) ; initQueue ( queue , spec ) ; return queue ; }
Creates & Initializes a new queue instance .
8,298
private BudgetYear1DataType getBudgetYear1DataType ( BudgetPeriodDto periodInfo ) { BudgetYear1DataType budgetYear = BudgetYear1DataType . Factory . newInstance ( ) ; 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 ( ) ) ; AttachedFileDataType attachedFileDataType = null ; for ( NarrativeContract narrative : pdDoc . getDevelopmentProposal ( ) . getNarratives ( ) ) { if ( narrative . getNarrativeType ( ) . getCode ( ) != null && Integer . parseInt ( narrative . getNarrativeType ( ) . getCode ( ) ) == BUDGET_JUSTIFICATION_ATTACHMENT ) { attachedFileDataType = getAttachedFileType ( narrative ) ; if ( attachedFileDataType != null ) { budgetYear . setBudgetJustificationAttachment ( attachedFileDataType ) ; break ; } } } return budgetYear ; }
This method gets BudgetYear1DataType details like BudgetPeriodStartDate BudgetPeriodEndDate BudgetPeriod KeyPersons OtherPersonnel TotalCompensation Equipment ParticipantTraineeSupportCosts Travel OtherDirectCosts DirectCosts IndirectCosts CognizantFederalAgency TotalCosts and BudgetJustificationAttachment based on BudgetPeriodInfo for the RRBudget .
8,299
private BudgetSummary getBudgetSummary ( BudgetSummaryDto budgetSummaryData ) { BudgetSummary budgetSummary = BudgetSummary . Factory . newInstance ( ) ; budgetSummary . setCumulativeTotalFundsRequestedSeniorKeyPerson ( BigDecimal . ZERO ) ; budgetSummary . setCumulativeTotalFundsRequestedPersonnel ( BigDecimal . ZERO ) ; budgetSummary . setCumulativeTotalFundsRequestedDirectCosts ( BigDecimal . ZERO ) ; if ( budgetSummaryData != null ) { if ( budgetSummaryData . getCumTotalFundsForSrPersonnel ( ) != null ) { budgetSummary . setCumulativeTotalFundsRequestedSeniorKeyPerson ( budgetSummaryData . getCumTotalFundsForSrPersonnel ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumTotalFundsForOtherPersonnel ( ) != null ) { budgetSummary . setCumulativeTotalFundsRequestedOtherPersonnel ( budgetSummaryData . getCumTotalFundsForOtherPersonnel ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumNumOtherPersonnel ( ) != null ) { budgetSummary . setCumulativeTotalNoOtherPersonnel ( budgetSummaryData . getCumNumOtherPersonnel ( ) . intValue ( ) ) ; } if ( budgetSummaryData . getCumTotalFundsForPersonnel ( ) != null ) { budgetSummary . setCumulativeTotalFundsRequestedPersonnel ( budgetSummaryData . getCumTotalFundsForPersonnel ( ) . bigDecimalValue ( ) ) ; } budgetSummary . setCumulativeEquipments ( getCumulativeEquipments ( budgetSummaryData ) ) ; budgetSummary . setCumulativeTravels ( getCumulativeTravels ( budgetSummaryData ) ) ; budgetSummary . setCumulativeTrainee ( getCumulativeTrainee ( budgetSummaryData ) ) ; budgetSummary . setCumulativeOtherDirect ( getCumulativeOtherDirect ( budgetSummaryData ) ) ; if ( budgetSummaryData . getCumTotalDirectCosts ( ) != null ) { budgetSummary . setCumulativeTotalFundsRequestedDirectCosts ( budgetSummaryData . getCumTotalDirectCosts ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumTotalIndirectCosts ( ) != null ) { budgetSummary . setCumulativeTotalFundsRequestedIndirectCost ( budgetSummaryData . getCumTotalIndirectCosts ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumTotalCosts ( ) != null ) { budgetSummary . setCumulativeTotalFundsRequestedDirectIndirectCosts ( budgetSummaryData . getCumTotalCosts ( ) . bigDecimalValue ( ) ) ; } if ( budgetSummaryData . getCumFee ( ) != null ) { budgetSummary . setCumulativeFee ( budgetSummaryData . getCumFee ( ) . bigDecimalValue ( ) ) ; } } return budgetSummary ; }
This method gets BudgetSummary details such as CumulativeTotalFundsRequestedSeniorKeyPerson CumulativeTotalFundsRequestedOtherPersonnel CumulativeTotalNoOtherPersonnel CumulativeTotalFundsRequestedPersonnel CumulativeEquipments CumulativeTravels CumulativeTrainee CumulativeOtherDirect CumulativeTotalFundsRequestedDirectCosts CumulativeTotalFundsRequestedIndirectCost CumulativeTotalFundsRequestedDirectIndirectCosts and CumulativeFee based on BudgetSummaryInfo for the RRBudget .