idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
8,700
public void cloneLayout ( LayoutIdentifier layout , LayoutIdentifier layout2 ) { String text = getLayoutContent ( layout ) ; saveLayout ( layout2 , text ) ; }
Clone a layout .
8,701
public String getLayoutContent ( LayoutIdentifier layout ) { return propertyService . getValue ( getPropertyName ( layout . shared ) , layout . name ) ; }
Returns the layout content .
8,702
public String getLayoutContentByAppId ( String appId ) { String value = propertyService . getValue ( PROPERTY_LAYOUT_ASSOCIATION , appId ) ; return value == null ? null : getLayoutContent ( new LayoutIdentifier ( value , true ) ) ; }
Load the layout associated with the specified application id .
8,703
public List < String > getLayouts ( boolean shared ) { List < String > layouts = propertyService . getInstances ( getPropertyName ( shared ) , shared ) ; Collections . sort ( layouts , String . CASE_INSENSITIVE_ORDER ) ; return layouts ; }
Returns a list of saved layouts .
8,704
public CWFAuthenticationDetails buildDetails ( HttpServletRequest request ) { log . trace ( "Building details" ) ; CWFAuthenticationDetails details = new CWFAuthenticationDetails ( request ) ; return details ; }
Returns an instance of a CWFAuthenticationDetails object .
8,705
protected void init ( String classifier , String moduleBase ) throws MojoExecutionException { this . classifier = classifier ; this . moduleBase = moduleBase ; stagingDirectory = new File ( buildDirectory , classifier + "-staging" ) ; configTemplate = new ConfigTemplate ( classifier + "-spring.xml" ) ; exclusionFilter = exclusions == null || exclusions . isEmpty ( ) ? null : new WildcardFileFilter ( exclusions ) ; archiveConfig . setAddMavenDescriptor ( false ) ; }
Subclasses must call this method early in their execute method .
8,706
protected String getModuleVersion ( ) { StringBuilder sb = new StringBuilder ( ) ; int pcs = 0 ; for ( String pc : projectVersion . split ( "\\." ) ) { if ( pcs ++ > 3 ) { break ; } else { appendVersionPiece ( sb , pc ) ; } } appendVersionPiece ( sb , buildNumber ) ; return sb . toString ( ) ; }
Form a version string from the project version and build number .
8,707
public File newStagingFile ( String entryName , long modTime ) { File file = new File ( stagingDirectory , entryName ) ; if ( modTime != 0 ) { file . setLastModified ( modTime ) ; } file . getParentFile ( ) . mkdirs ( ) ; return file ; }
Creates a new file in the staging directory . Ensures that all folders in the path are also created .
8,708
public void throwMojoException ( String msg , Throwable e ) throws MojoExecutionException { if ( failOnError ) { throw new MojoExecutionException ( msg , e ) ; } else { getLog ( ) . error ( msg , e ) ; } }
If failOnError is enabled throws a MojoExecutionException . Otherwise logs the exception and resumes execution .
8,709
protected void assembleArchive ( ) throws Exception { getLog ( ) . info ( "Assembling " + classifier + " archive" ) ; if ( resources != null && ! resources . isEmpty ( ) ) { getLog ( ) . info ( "Copying additional resources." ) ; new ResourceProcessor ( this , moduleBase , resources ) . transform ( ) ; } if ( configTemplate != null ) { getLog ( ) . info ( "Creating config file." ) ; configTemplate . addEntry ( "info" , pluginDescriptor . getName ( ) , pluginDescriptor . getVersion ( ) , new Date ( ) . toString ( ) ) ; configTemplate . createFile ( stagingDirectory ) ; } try { File archive = createArchive ( ) ; if ( "war" . equalsIgnoreCase ( mavenProject . getPackaging ( ) ) && this . warInclusion ) { webappLibDirectory . mkdirs ( ) ; File webappLibArchive = new File ( this . webappLibDirectory , archive . getName ( ) ) ; Files . copy ( archive , webappLibArchive ) ; } } catch ( Exception e ) { throw new RuntimeException ( "Exception occurred assembling archive." , e ) ; } }
Assembles the archive file . Optionally copies to the war application directory if the packaging type is war .
8,710
private File createArchive ( ) throws Exception { getLog ( ) . info ( "Creating archive." ) ; Artifact artifact = mavenProject . getArtifact ( ) ; String clsfr = noclassifier ? "" : ( "-" + classifier ) ; String archiveName = artifact . getArtifactId ( ) + "-" + artifact . getVersion ( ) + clsfr + ".jar" ; File jarFile = new File ( mavenProject . getBuild ( ) . getDirectory ( ) , archiveName ) ; MavenArchiver archiver = new MavenArchiver ( ) ; jarArchiver . addDirectory ( stagingDirectory ) ; archiver . setArchiver ( jarArchiver ) ; archiver . setOutputFile ( jarFile ) ; archiver . createArchive ( mavenSession , mavenProject , archiveConfig ) ; if ( noclassifier ) { artifact . setFile ( jarFile ) ; } else { projectHelper . attachArtifact ( mavenProject , jarFile , classifier ) ; } FileUtils . deleteDirectory ( stagingDirectory ) ; return jarFile ; }
Creates the archive from data in the staging directory .
8,711
public static void startThread ( Thread thread ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Starting background thread: " + thread ) ; } ExecutorService executor = getTaskExecutor ( ) ; if ( executor != null ) { executor . execute ( thread ) ; } else { thread . start ( ) ; } }
Starts a thread . If an executor service is available that is used . Otherwise the thread s start method is called .
8,712
protected static SessionService create ( IPublisherInfo self , String sessionId , IEventManager eventManager , ISessionUpdate callback ) { String sendEvent = StrUtil . formatMessage ( EVENT_SEND , sessionId ) ; String joinEvent = StrUtil . formatMessage ( EVENT_JOIN , sessionId ) ; String leaveEvent = StrUtil . formatMessage ( EVENT_LEAVE , sessionId ) ; return new SessionService ( self , sendEvent , joinEvent , leaveEvent , eventManager , callback ) ; }
Creates a service handler for a chat session .
8,713
public ChatMessage sendMessage ( String text ) { if ( text != null && ! text . isEmpty ( ) ) { ChatMessage message = new ChatMessage ( self , text ) ; eventManager . fireRemoteEvent ( sendEvent , message ) ; return message ; } return null ; }
Sends a message to a chat session .
8,714
public int compareTo ( HelpSearchHit hit ) { int result = - NumUtil . compare ( confidence , hit . confidence ) ; return result != 0 ? result : topic . compareTo ( hit . topic ) ; }
Used to sort hits by confidence level .
8,715
protected static byte toUnsignedByte ( int intVal ) { byte byteVal ; if ( intVal > 127 ) { int temp = intVal - 256 ; byteVal = ( byte ) temp ; } else { byteVal = ( byte ) intVal ; } return byteVal ; }
convert int to unsigned byte
8,716
public static KeyStore getKeyStore ( String keystoreLocation , String keystoreType ) throws NoSuchAlgorithmException , CertificateException , IOException , KeyStoreException { KeyStore keystore = KeyStore . getInstance ( keystoreType ) ; InputStream is = CipherUtil . class . getResourceAsStream ( keystoreLocation ) ; if ( is == null ) { is = new FileInputStream ( keystoreLocation ) ; } keystore . load ( is , null ) ; return keystore ; }
Returns a key store instance of the specified type from the specified resource .
8,717
public static boolean verify ( PublicKey key , String base64Signature , String content , String timestamp , int duration ) throws Exception { if ( key == null || base64Signature == null || content == null || timestamp == null ) { return false ; } try { if ( timestamp != null && duration > 0 ) { validateTime ( timestamp , duration ) ; } Signature signature = Signature . getInstance ( SIGN_ALGORITHM ) ; signature . initVerify ( key ) ; signature . update ( content . getBytes ( ) ) ; byte [ ] signatureBytes = Base64 . decodeBase64 ( base64Signature ) ; return signature . verify ( signatureBytes ) ; } catch ( Exception e ) { log . error ( "Authentication Exception:verifySignature" , e ) ; throw e ; } }
Verifies a digitally signed payload .
8,718
public static String sign ( PrivateKey key , String content ) throws Exception { Signature signature = Signature . getInstance ( SIGN_ALGORITHM ) ; signature . initSign ( key ) ; signature . update ( content . getBytes ( ) ) ; return Base64 . encodeBase64String ( signature . sign ( ) ) ; }
Returns the digital signature for the specified content .
8,719
public static void validateTime ( String timestamp , int duration ) throws Exception { Date date = getTimestampFormatter ( ) . parse ( timestamp ) ; long sign_time = date . getTime ( ) ; long now_time = System . currentTimeMillis ( ) ; long diff = now_time - sign_time ; long min_diff = diff / ( 60 * 1000 ) ; if ( min_diff >= duration ) { throw new GeneralSecurityException ( "Authorization token has expired." ) ; } }
Validates the timestamp and insures that it falls within the specified duration .
8,720
public static String getTimestamp ( Date time ) { return getTimestampFormatter ( ) . format ( time == null ? new Date ( ) : time ) ; }
Converts a time to timestamp format .
8,721
public static String encrypt ( Key key , String content ) throws Exception { try { Cipher cipher = Cipher . getInstance ( CRYPTO_ALGORITHM ) ; cipher . init ( Cipher . ENCRYPT_MODE , key ) ; return Base64 . encodeBase64String ( cipher . doFinal ( content . getBytes ( ) ) ) ; } catch ( Exception e ) { log . error ( "Error while encrypting" , e ) ; throw e ; } }
Encrypts the content with the specified key using the default algorithm .
8,722
public static String decrypt ( Key key , String content ) throws Exception { try { Cipher cipher = Cipher . getInstance ( CRYPTO_ALGORITHM ) ; cipher . init ( Cipher . DECRYPT_MODE , key ) ; return new String ( cipher . doFinal ( Base64 . decodeBase64 ( content ) ) ) ; } catch ( Exception e ) { log . error ( "Error while decrypting" , e ) ; throw e ; } }
Decrypts the content with the specified key using the default algorithm .
8,723
public String getManifestAttribute ( String attributeName ) { if ( attributeName != null ) { Map < Object , Object > mf = getManifestAttributes ( ) ; for ( Object att : mf . keySet ( ) ) { if ( attributeName . equals ( att . toString ( ) ) ) { return mf . get ( att ) . toString ( ) ; } } } return null ; }
Retrieves a value for a specific manifest attribute . Or null if not found
8,724
public Map < Object , Object > getManifestAttributes ( ) { Map < Object , Object > manifestAttributes = null ; manifestAttributes = getExplodedWarManifestAttributes ( ) ; if ( manifestAttributes == null ) { manifestAttributes = getPackagedWarManifestAttributes ( ) ; } if ( manifestAttributes == null ) { manifestAttributes = getClassPathManifestAttributes ( ) ; } if ( manifestAttributes == null ) { manifestAttributes = new HashMap < > ( ) ; } return manifestAttributes ; }
Reads the manifest entries for this application . Returns empty if anything fails . First tries from Exploded WAR second Packaged WAR third from classpath . if not found returns an empty map
8,725
private Map < Object , Object > getExplodedWarManifestAttributes ( ) { Map < Object , Object > manifestAttributes = null ; FileInputStream fis = null ; try { if ( servletContext != null ) { final String appServerHome = servletContext . getRealPath ( "" ) ; final File manifestFile = new File ( appServerHome , MANIFEST ) ; LOGGER . debug ( "Using Manifest file:{}" , manifestFile . getPath ( ) ) ; fis = new FileInputStream ( manifestFile ) ; Manifest mf = new Manifest ( fis ) ; manifestAttributes = mf . getMainAttributes ( ) ; } } catch ( Exception e ) { LOGGER . warn ( "Unable to read the manifest file from the servlet context." ) ; LOGGER . debug ( "Unable to read the manifest file" , e ) ; } finally { IOUtils . closeQuietly ( fis ) ; } return manifestAttributes ; }
reads the manifest from a exploded WAR
8,726
private Map < Object , Object > getPackagedWarManifestAttributes ( ) { Map < Object , Object > manifestAttributes = null ; try { LOGGER . debug ( "Using Manifest file:{}" , servletContext . getResource ( MANIFEST ) . getPath ( ) ) ; Manifest manifest = new Manifest ( servletContext . getResourceAsStream ( MANIFEST ) ) ; manifestAttributes = manifest . getMainAttributes ( ) ; } catch ( Exception e ) { LOGGER . warn ( "Unable to read the manifest from the packaged war" ) ; LOGGER . debug ( "Unable to read the manifest from the packaged" , e ) ; } return manifestAttributes ; }
Retrieve the Manifest from a packaged war
8,727
public CountryContract getCountryFromCode ( String countryCode ) { if ( StringUtils . isBlank ( countryCode ) ) return null ; CountryContract country = getKcCountryService ( ) . getCountryByAlternateCode ( countryCode ) ; if ( country == null ) { country = getKcCountryService ( ) . getCountry ( countryCode ) ; } return country ; }
This method is to get a Country object from the country code
8,728
public StateContract getStateFromName ( String countryAlternateCode , String stateName ) { CountryContract country = getCountryFromCode ( countryAlternateCode ) ; return getKcStateService ( ) . getState ( country . getCode ( ) , stateName ) ; }
This method is to get a State object from the state name
8,729
public static boolean isSegmented ( Name name , byte marker ) { return name . size ( ) > 0 && name . get ( - 1 ) . getValue ( ) . buf ( ) . get ( 0 ) == marker ; }
Determine if a name is segmented i . e . if it ends with the correct marker type .
8,730
public static long parseSegment ( Name name , byte marker ) throws EncodingException { if ( name . size ( ) == 0 ) { throw new EncodingException ( "No components to parse." ) ; } return name . get ( - 1 ) . toNumberWithMarker ( marker ) ; }
Retrieve the segment number from the last component of a name .
8,731
public static Name removeSegment ( Name name , byte marker ) { return isSegmented ( name , marker ) ? name . getPrefix ( - 1 ) : new Name ( name ) ; }
Remove a segment component from the end of a name
8,732
public static List < Data > segment ( Data template , InputStream bytes ) throws IOException { return segment ( template , bytes , DEFAULT_SEGMENT_SIZE ) ; }
Segment a stream of bytes into a list of Data packets ; this must read all the bytes first in order to determine the end segment for FinalBlockId .
8,733
public static byte [ ] readAll ( InputStream bytes ) throws IOException { ByteArrayOutputStream builder = new ByteArrayOutputStream ( ) ; int read = bytes . read ( ) ; while ( read != - 1 ) { builder . write ( read ) ; read = bytes . read ( ) ; } builder . flush ( ) ; bytes . close ( ) ; return builder . toByteArray ( ) ; }
Read all of the bytes in an input stream .
8,734
protected void init ( Object target , PropertyInfo propInfo , PropertyGrid propGrid ) { propInfo . getConfig ( ) . setProperty ( "readonly" , Boolean . toString ( ! SecurityUtil . hasDebugRole ( ) ) ) ; super . init ( target , propInfo , propGrid ) ; List < IAction > actions = new ArrayList < > ( ActionRegistry . getRegisteredActions ( ActionScope . BOTH ) ) ; Collections . sort ( actions , ActionUtil . comparator ) ; for ( IAction action : actions ) { appendItem ( action . toString ( ) , action . getId ( ) ) ; } }
Initialize the list from the action registry .
8,735
public CountryCodeDataType . Enum getCountryCodeDataType ( String countryCode ) { CountryCodeDataType . Enum countryCodeDataType = null ; CountryContract country = s2SLocationService . getCountryFromCode ( countryCode ) ; if ( country != null ) { StringBuilder countryDetail = new StringBuilder ( ) ; countryDetail . append ( country . getAlternateCode ( ) ) ; countryDetail . append ( ": " ) ; countryDetail . append ( country . getName ( ) . toUpperCase ( ) ) ; countryCodeDataType = CountryCodeDataType . Enum . forString ( countryDetail . toString ( ) ) ; } return countryCodeDataType ; }
Create a CountryCodeDataType . Enum as defined in UniversalCodes 2 . 0 from the given country code .
8,736
public StateCodeDataType . Enum getStateCodeDataType ( String countryAlternateCode , String stateName ) { StateCodeDataType . Enum stateCodeDataType = null ; StateContract state = s2SLocationService . getStateFromName ( countryAlternateCode , stateName ) ; if ( state != null ) { StringBuilder stateDetail = new StringBuilder ( ) ; stateDetail . append ( state . getCode ( ) ) ; stateDetail . append ( ": " ) ; String stateNameCapital = WordUtils . capitalizeFully ( state . getName ( ) ) ; stateNameCapital = stateNameCapital . replace ( " Of " , " of " ) ; stateNameCapital = stateNameCapital . replace ( " The " , " the " ) ; stateNameCapital = stateNameCapital . replace ( " And " , " and " ) ; stateDetail . append ( stateNameCapital ) ; stateCodeDataType = StateCodeDataType . Enum . forString ( stateDetail . toString ( ) ) ; } return stateCodeDataType ; }
Create a StateCodeDataType . Enum as defined in UniversalCodes 2 . 0 from the given name of the state .
8,737
public AddressDataType getAddressDataType ( RolodexContract rolodex ) { AddressDataType addressDataType = AddressDataType . Factory . newInstance ( ) ; if ( rolodex != null ) { String street1 = rolodex . getAddressLine1 ( ) ; addressDataType . setStreet1 ( street1 ) ; String street2 = rolodex . getAddressLine2 ( ) ; if ( street2 != null && ! street2 . equals ( "" ) ) { addressDataType . setStreet2 ( street2 ) ; } String city = rolodex . getCity ( ) ; addressDataType . setCity ( city ) ; String county = rolodex . getCounty ( ) ; if ( county != null && ! county . equals ( "" ) ) { addressDataType . setCounty ( county ) ; } String postalCode = rolodex . getPostalCode ( ) ; if ( postalCode != null && ! postalCode . equals ( "" ) ) { addressDataType . setZipPostalCode ( postalCode ) ; } String country = rolodex . getCountryCode ( ) ; CountryCodeDataType . Enum countryCodeDataType = getCountryCodeDataType ( country ) ; addressDataType . setCountry ( countryCodeDataType ) ; String state = rolodex . getState ( ) ; if ( state != null && ! state . equals ( "" ) ) { if ( countryCodeDataType != null ) { if ( countryCodeDataType . equals ( CountryCodeDataType . USA_UNITED_STATES ) ) { addressDataType . setState ( getStateCodeDataType ( country , state ) ) ; } else { addressDataType . setProvince ( state ) ; } } } } return addressDataType ; }
Create AddressDataType from rolodex entry
8,738
public HumanNameDataType getHumanNameDataType ( ProposalPersonContract person ) { HumanNameDataType humanName = HumanNameDataType . Factory . newInstance ( ) ; if ( person != null ) { humanName . setFirstName ( person . getFirstName ( ) ) ; humanName . setLastName ( person . getLastName ( ) ) ; String middleName = person . getMiddleName ( ) ; if ( middleName != null && ! middleName . equals ( "" ) ) { humanName . setMiddleName ( middleName ) ; } } return humanName ; }
Create HumanNameDataType from ProposalPerson object
8,739
public HumanNameDataType getHumanNameDataType ( RolodexContract rolodex ) { HumanNameDataType humanName = HumanNameDataType . Factory . newInstance ( ) ; if ( rolodex != null ) { humanName . setFirstName ( rolodex . getFirstName ( ) ) ; humanName . setLastName ( rolodex . getLastName ( ) ) ; String middleName = rolodex . getMiddleName ( ) ; if ( middleName != null && ! middleName . equals ( "" ) ) { humanName . setMiddleName ( middleName ) ; } } return humanName ; }
Create a HumanNameDataType from Rolodex object
8,740
public ContactPersonDataType getContactPersonDataType ( ProposalPersonContract person ) { ContactPersonDataType contactPerson = ContactPersonDataType . Factory . newInstance ( ) ; if ( person != null ) { contactPerson . setName ( ( getHumanNameDataType ( person ) ) ) ; String phone = person . getOfficePhone ( ) ; if ( phone != null && ! phone . equals ( "" ) ) { contactPerson . setPhone ( phone ) ; } String email = person . getEmailAddress ( ) ; if ( email != null && ! email . equals ( "" ) ) { contactPerson . setEmail ( email ) ; } String title = person . getPrimaryTitle ( ) ; if ( title != null && ! title . equals ( "" ) ) { contactPerson . setTitle ( title ) ; } String fax = person . getFaxNumber ( ) ; if ( StringUtils . isNotEmpty ( fax ) ) { contactPerson . setFax ( fax ) ; } contactPerson . setAddress ( getAddressDataType ( person ) ) ; } return contactPerson ; }
Create ContactPersonDataType from ProposalPerson object
8,741
public Map < String , URL > nextImageSet ( ) { return buildImageSet ( dirs . get ( random . nextInt ( dirs . size ( ) ) ) ) ; }
Returns a random image set found as a subdirectory of the base directory .
8,742
public static Object getController ( BaseComponent comp , boolean recurse ) { return recurse ? comp . findAttribute ( Constants . ATTR_COMPOSER ) : comp . getAttribute ( Constants . ATTR_COMPOSER ) ; }
Returns the controller associated with the specified component if any .
8,743
@ SuppressWarnings ( "unchecked" ) public static < T > T getController ( BaseComponent comp , Class < T > type ) { while ( comp != null ) { Object controller = getController ( comp ) ; if ( type . isInstance ( controller ) ) { return ( T ) controller ; } comp = comp . getParent ( ) ; } return null ; }
Locates and returns a controller of the given type by searching up the component tree starting at the specified component .
8,744
public void afterInitialized ( BaseComponent comp ) { root = ( BaseUIComponent ) comp ; this . comp = root ; comp . setAttribute ( Constants . ATTR_COMPOSER , this ) ; comp . addEventListener ( ThreadEx . ON_THREAD_COMPLETE , threadCompletionListener ) ; appContext = SpringUtil . getAppContext ( ) ; appFramework = FrameworkUtil . getAppFramework ( ) ; eventManager = EventManager . getInstance ( ) ; initialize ( ) ; }
Override the doAfterCompose method to set references to the application context and the framework and register the controller with the framework .
8,745
public static DropContainer render ( BaseComponent dropRoot , BaseComponent droppedItem ) { IDropRenderer dropRenderer = DropUtil . getDropRenderer ( droppedItem ) ; if ( dropRenderer == null || ! dropRenderer . isEnabled ( ) ) { return null ; } BaseComponent renderedItem = dropRenderer . renderDroppedItem ( droppedItem ) ; DropContainer dropContainer = null ; if ( renderedItem != null ) { String title = dropRenderer . getDisplayText ( droppedItem ) ; dropContainer = renderedItem . getAncestor ( DropContainer . class ) ; if ( dropContainer != null ) { dropContainer . setTitle ( title ) ; dropContainer . moveToTop ( dropRoot ) ; } else { dropContainer = DropContainer . create ( dropRoot , renderedItem , title , InfoPanelService . getActionListeners ( droppedItem ) ) ; } } return dropContainer ; }
Renders a droppedItem in a container .
8,746
private static DropContainer create ( BaseComponent dropRoot , BaseComponent cmpt , String title , List < ActionListener > actionListeners ) { DropContainer dc = ( DropContainer ) PageUtil . createPage ( TEMPLATE , null ) ; dc . actionListeners = actionListeners ; dc . setTitle ( title ) ; dc . setDropid ( SCLASS ) ; dc . setDragid ( SCLASS ) ; dc . addChild ( cmpt ) ; dc . moveToTop ( dropRoot ) ; ActionListener . bindActionListeners ( dc , actionListeners ) ; return dc ; }
Creates a new container for the contents to be rendered by the drop provider .
8,747
public void doAction ( Action action ) { switch ( action ) { case REMOVE : close ( ) ; break ; case HIDE : setVisible ( false ) ; break ; case SHOW : setVisible ( true ) ; break ; case COLLAPSE : setSize ( Size . MINIMIZED ) ; break ; case EXPAND : setSize ( Size . NORMAL ) ; break ; case TOP : moveToTop ( ) ; break ; } }
Perform the specified action on the drop container .
8,748
@ EventHandler ( "drop" ) private void onDrop ( DropEvent event ) { BaseComponent dragged = event . getRelatedTarget ( ) ; if ( dragged instanceof DropContainer ) { getParent ( ) . addChild ( dragged , this ) ; } }
Supports dragging drop container to a new position in the stream .
8,749
public Span addContent ( Row row , String label ) { Span cell = new Span ( ) ; cell . addChild ( CWFUtil . getTextComponent ( label ) ) ; row . addChild ( cell ) ; return cell ; }
Adds a cell with the specified content to the grid row .
8,750
public Cell addCell ( Row row , String label ) { Cell cell = new Cell ( label ) ; row . addChild ( cell ) ; return cell ; }
Adds a cell to the grid row .
8,751
public Column addColumn ( Grid grid , String label , String width , String sortBy ) { Column column = new Column ( ) ; grid . getColumns ( ) . addChild ( column ) ; column . setLabel ( label ) ; column . setWidth ( width ) ; column . setSortComparator ( sortBy ) ; column . setSortOrder ( SortOrder . ASCENDING ) ; return column ; }
Adds a column to a grid .
8,752
public String outputNameFor ( String output ) { Report report = openReport ( output ) ; return outputNameOf ( report ) ; }
Utility method to guess the output name generated for this output parameter .
8,753
protected void init ( Object target , PropertyInfo propInfo , PropertyGrid propGrid ) { super . init ( target , propInfo , propGrid ) ; Iterable < ? > iter = ( Iterable < ? > ) propInfo . getPropertyType ( ) . getSerializer ( ) ; for ( Object value : iter ) { appendItem ( value . toString ( ) , value ) ; } }
Initialize the list based on the configuration data which can specify an enumeration class an iterable class or the id of an iterable bean .
8,754
public Jashing bootstrap ( ) { if ( bootstrapped . compareAndSet ( false , true ) ) { ServiceManager eventSources = injector . getInstance ( ServiceManager . class ) ; eventSources . startAsync ( ) ; Service application = injector . getInstance ( JashingServer . class ) ; application . startAsync ( ) ; Runtime . getRuntime ( ) . addShutdownHook ( shutdownHook ) ; LOGGER . info ( "Jashing has started!" ) ; } else { throw new IllegalStateException ( "Jashing already bootstrapped" ) ; } return this ; }
Bootstaps Jashing . This operation is allowed only once . Bootstrapping already started Jashing is not permitted
8,755
public void shutdown ( ) { if ( bootstrapped . compareAndSet ( true , false ) ) { LOGGER . info ( "Shutting down Jashing..." ) ; injector . getInstance ( ServiceManager . class ) . stopAsync ( ) . awaitStopped ( ) ; injector . getInstance ( JashingServer . class ) . stopAsync ( ) . awaitTerminated ( ) ; if ( ! shutdownHook . isAlive ( ) ) { Runtime . getRuntime ( ) . removeShutdownHook ( shutdownHook ) ; } LOGGER . info ( "Jashing has stopped." ) ; } else { throw new IllegalStateException ( "Jashing is not bootstrapped" ) ; } }
Shutdowns Jashing . Permitted only for bootstrapped instance
8,756
public static void copyAttributes ( Element source , Map < String , String > dest ) { NamedNodeMap attributes = source . getAttributes ( ) ; if ( attributes != null ) { for ( int i = 0 ; i < attributes . getLength ( ) ; i ++ ) { Node attribute = attributes . item ( i ) ; dest . put ( attribute . getNodeName ( ) , attribute . getNodeValue ( ) ) ; } } }
Copy attributes from a DOM node to a map .
8,757
public static void copyAttributes ( Map < String , String > source , Element dest ) { for ( Entry < String , String > entry : source . entrySet ( ) ) { dest . setAttribute ( entry . getKey ( ) , entry . getValue ( ) ) ; } }
Copy attributes from a map to a DOM node .
8,758
private void initTopicTree ( ) { DefaultMutableTreeNode topicTree = getDataAsTree ( ) ; if ( topicTree != null ) { initTopicTree ( rootNode , topicTree . getRoot ( ) ) ; } }
Initializes the topic tree if there is one associated with this view .
8,759
private void initTopicTree ( HelpTopicNode htnParent , TreeNode ttnParent ) { for ( int i = 0 ; i < ttnParent . getChildCount ( ) ; i ++ ) { TreeNode ttnChild = ttnParent . getChildAt ( i ) ; HelpTopic ht = getTopic ( ttnChild ) ; HelpTopicNode htnChild = new HelpTopicNode ( ht ) ; htnParent . addChild ( htnChild ) ; initTopicTree ( htnChild , ttnChild ) ; } }
Duplicates JavaHelp topic tree into HelpTopicNode - based tree .
8,760
protected DefaultMutableTreeNode getDataAsTree ( ) { try { return ( DefaultMutableTreeNode ) MethodUtils . invokeMethod ( view , "getDataAsTree" , null ) ; } catch ( Exception e ) { return null ; } }
Invokes the getDataAsTree method on the underlying view if such a method exists .
8,761
public static Treenode findNodeByLabel ( Treeview tree , String label , boolean caseSensitive ) { for ( Treenode item : tree . getChildren ( Treenode . class ) ) { if ( caseSensitive ? label . equals ( item . getLabel ( ) ) : label . equalsIgnoreCase ( item . getLabel ( ) ) ) { return item ; } } return null ; }
Search the entire tree for a tree item matching the specified label .
8,762
public static String getPath ( Treenode item , boolean useLabels ) { StringBuilder sb = new StringBuilder ( ) ; boolean needsDelim = false ; while ( item != null ) { if ( needsDelim ) { sb . insert ( 0 , '\\' ) ; } else { needsDelim = true ; } sb . insert ( 0 , useLabels ? item . getLabel ( ) : item . getIndex ( ) ) ; item = ( Treenode ) item . getParent ( ) ; } return sb . toString ( ) ; }
Returns the path of the specified tree node . This consists of the indexes or labels of this and all parent nodes separated by a \ character .
8,763
public static void sort ( BaseComponent parent , boolean recurse ) { if ( parent == null || parent . getChildren ( ) . size ( ) < 2 ) { return ; } int i = 1 ; int size = parent . getChildren ( ) . size ( ) ; while ( i < size ) { Treenode item1 = ( Treenode ) parent . getChildren ( ) . get ( i - 1 ) ; Treenode item2 = ( Treenode ) parent . getChildren ( ) . get ( i ) ; if ( compare ( item1 , item2 ) > 0 ) { parent . swapChildren ( i - 1 , i ) ; i = i == 1 ? 2 : i - 1 ; } else { i ++ ; } } if ( recurse ) { for ( BaseComponent child : parent . getChildren ( ) ) { sort ( child , recurse ) ; } } }
Alphabetically sorts children under the specified parent .
8,764
private static int compare ( Treenode item1 , Treenode item2 ) { String label1 = item1 . getLabel ( ) ; String label2 = item2 . getLabel ( ) ; return label1 == label2 ? 0 : label1 == null ? - 1 : label2 == null ? - 1 : label1 . compareToIgnoreCase ( label2 ) ; }
Case insensitive comparison of labels of two tree items .
8,765
private static Treenode search ( Iterable < Treenode > root , String text , ITreenodeSearch search ) { for ( Treenode node : root ) { if ( search . isMatch ( node , text ) ) { return node ; } } return null ; }
Search the tree for a tree node whose label contains the specified text .
8,766
public Command get ( String commandName , boolean forceCreate ) { Command command = commands . get ( commandName ) ; if ( command == null && forceCreate ) { command = new Command ( commandName ) ; add ( command ) ; } return command ; }
Retrieves the command associated with the specified name from the registry .
8,767
private void bindShortcuts ( Map < Object , Object > shortcuts ) { for ( Object commandName : shortcuts . keySet ( ) ) { bindShortcuts ( commandName . toString ( ) , shortcuts . get ( commandName ) . toString ( ) ) ; } }
Binds the shortcuts specified in the map to the associated commands . The map key is the command name and the associated value is a list of shortcuts bound to the command .
8,768
public PropertiesLoaderBuilder loadProperty ( String name ) { if ( env . containsProperty ( name ) ) { props . put ( name , env . getProperty ( name ) ) ; } return this ; }
Loads a property from Spring Context by the name .
8,769
public PropertiesLoaderBuilder addProperty ( String name , String value ) { props . put ( name , value ) ; return this ; }
Adds a new property . Giving both name and value . This methods does not lookup in the Spring Context it only adds property and value as given .
8,770
protected < C extends BaseUIComponent > C createCell ( BaseComponent parent , Object value , String prefix , String style , String width , Class < C > clazz ) { C container = null ; try { container = clazz . newInstance ( ) ; container . setParent ( parent ) ; container . setStyles ( cellStyle ) ; if ( width != null ) { container . setWidth ( width ) ; } if ( value instanceof BaseComponent ) { ( ( BaseComponent ) value ) . setParent ( container ) ; } else if ( value != null ) { createLabel ( container , value , prefix , style ) ; } } catch ( Exception e ) { } ; return container ; }
Creates a component containing a label with the specified parameters .
8,771
public static byte [ ] removeEntry ( byte [ ] a , int idx ) { byte [ ] b = new byte [ a . length - 1 ] ; for ( int i = 0 ; i < b . length ; i ++ ) { if ( i < idx ) { b [ i ] = a [ i ] ; } else { b [ i ] = a [ i + 1 ] ; } } return b ; }
Gets a copy of the array with the specified entry removed .
8,772
private Map < String , Object > getConfigParams ( Class < ? > clazz ) { Map < String , Object > params = new HashMap < > ( ) ; for ( Field field : clazz . getDeclaredFields ( ) ) { if ( Modifier . isStatic ( field . getModifiers ( ) ) && field . getName ( ) . endsWith ( "_CONFIG" ) ) { try { String key = field . get ( null ) . toString ( ) ; String value = SpringUtil . getProperty ( "org.carewebframework.messaging.kafka." + key ) ; if ( value != null ) { params . put ( key , value ) ; } } catch ( Exception e ) { } } } return params ; }
A bit of a hack to return configuration parameters from the Spring property store as a map which is required to initialize Kafka consumers and producers . Uses reflection on the specified class to enumerate static fields with a name ending in _CONFIG . By Kafka convention these fields contain the names of configuration parameters .
8,773
public static String buildWhereClause ( Object object , MapSqlParameterSource params ) throws IllegalAccessException , InvocationTargetException , NoSuchMethodException { LOGGER . debug ( "Building query" ) ; final StringBuilder query = new StringBuilder ( ) ; boolean first = true ; for ( Field field : object . getClass ( ) . getDeclaredFields ( ) ) { if ( field . isAnnotationPresent ( QueryWhereClause . class ) || field . isAnnotationPresent ( QueryWhereClauses . class ) ) { final String fieldName = field . getName ( ) ; LOGGER . trace ( "New annotated field found: {}" , fieldName ) ; QueryWhereClause [ ] annotations = field . getAnnotationsByType ( QueryWhereClause . class ) ; for ( QueryWhereClause annotation : annotations ) { String whereValue = annotation . value ( ) ; int [ ] types = annotation . fieldTypes ( ) ; int index = 0 ; LOGGER . trace ( "Unprocessed whereClause: {}" , whereValue ) ; Matcher matcher = PARAM_PATTERN . matcher ( whereValue ) ; boolean hasValue = false ; while ( matcher . find ( ) ) { String originalParam = matcher . group ( 1 ) ; LOGGER . debug ( "New parameter found in the query: {}" , originalParam ) ; String convertedParam = originalParam . replaceAll ( "this" , fieldName ) ; Object value = null ; try { value = BeanUtils . getNestedProperty ( object , convertedParam ) ; } catch ( NestedNullException e ) { LOGGER . info ( "Bean not accessible= {}" , e . getMessage ( ) ) ; } if ( value == null ) { LOGGER . debug ( "Param {} was null, ignoring in the query" , convertedParam ) ; } else { hasValue = true ; whereValue = StringUtils . replace ( whereValue , "{" + originalParam + "}" , ":" + convertedParam ) ; if ( params != null ) { if ( index <= types . length - 1 ) { params . addValue ( convertedParam , value , types [ index ] ) ; } else { params . addValue ( convertedParam , value ) ; } } } index ++ ; } if ( hasValue ) { if ( ! first ) { query . append ( " AND " ) ; } else { first = false ; } query . append ( whereValue ) ; } } } } LOGGER . debug ( "built query={}" , query ) ; return query . toString ( ) ; }
Builds a where clause based upon the object values
8,774
public static void show ( boolean manage , String deflt , IEventListener closeListener ) { Map < String , Object > args = new HashMap < > ( ) ; args . put ( "manage" , manage ) ; args . put ( "deflt" , deflt ) ; PopupDialog . show ( RESOURCE_PREFIX + "layoutManager.fsp" , args , true , true , true , closeListener ) ; }
Invokes the layout manager dialog .
8,775
public int compareTo ( IManagedContext < DomainClass > o ) { int pri1 = o . getPriority ( ) ; int pri2 = getPriority ( ) ; return this == o ? 0 : pri1 < pri2 ? - 1 : 1 ; }
Compares by priority with higher priorities collating first .
8,776
public static void pruneMenus ( BaseComponent parent ) { while ( parent != null && parent instanceof BaseMenuComponent ) { if ( parent . getChildren ( ) . isEmpty ( ) ) { BaseComponent newParent = parent . getParent ( ) ; parent . destroy ( ) ; parent = newParent ; } else { break ; } } }
Recursively remove empty menu container elements . This is done after removing menu items to keep the menu structure lean .
8,777
public static BaseMenuComponent findMenu ( BaseComponent parent , String label , BaseComponent insertBefore ) { for ( BaseMenuComponent child : parent . getChildren ( BaseMenuComponent . class ) ) { if ( label . equalsIgnoreCase ( child . getLabel ( ) ) ) { return child ; } } BaseMenuComponent cmp = createMenuOrMenuitem ( parent ) ; cmp . setLabel ( label ) ; parent . addChild ( cmp , insertBefore ) ; return cmp ; }
Returns the menu with the specified label or creates one if it does not exist .
8,778
public static void sortMenu ( BaseComponent parent , int startIndex , int endIndex ) { List < BaseComponent > items = parent . getChildren ( ) ; int bottom = startIndex + 1 ; for ( int i = startIndex ; i < endIndex ; ) { BaseComponent item1 = items . get ( i ++ ) ; BaseComponent item2 = items . get ( i ) ; if ( item1 instanceof BaseMenuComponent && item2 instanceof BaseMenuComponent && ( ( BaseMenuComponent ) item1 ) . getLabel ( ) . compareToIgnoreCase ( ( ( BaseMenuComponent ) item2 ) . getLabel ( ) ) > 0 ) { parent . swapChildren ( i - 1 , i ) ; if ( i > bottom ) { i -= 2 ; } } } }
Alphabetically sorts a range of menu items .
8,779
public static String getPath ( BaseMenuComponent comp ) { StringBuilder sb = new StringBuilder ( ) ; getPath ( comp , sb ) ; return sb . toString ( ) ; }
Returns the path of the given menu or menu item .
8,780
private static void getPath ( BaseComponent comp , StringBuilder sb ) { while ( comp instanceof BaseMenuComponent ) { sb . insert ( 0 , "\\" + ( ( BaseMenuComponent ) comp ) . getLabel ( ) ) ; comp = comp . getParent ( ) ; } }
Recurses parent menu nodes to build the menu path .
8,781
public void onPluginEvent ( PluginEvent event ) { switch ( event . getAction ( ) ) { case SUBSCRIBE : plugin = event . getPlugin ( ) ; doSubscribe ( true ) ; break ; case LOAD : plugin . unregisterListener ( this ) ; break ; case UNSUBSCRIBE : doSubscribe ( false ) ; break ; } }
Listen for plugin lifecycle events .
8,782
public void retry ( Face face , Interest interest , OnData onData , OnTimeout onTimeout ) throws IOException { RetryContext context = new RetryContext ( face , interest , onData , onTimeout ) ; retryInterest ( context ) ; }
On timeout retry the request until the maximum number of allowed retries is reached .
8,783
private synchronized void retryInterest ( RetryContext context ) throws IOException { LOGGER . info ( "Retrying interest: " + context . interest . toUri ( ) ) ; context . face . expressInterest ( context . interest , context , context ) ; totalRetries ++ ; }
Synchronized helper method to prevent multiple threads from mashing totalRetries
8,784
public void register ( ) throws IOException { try { registeredPrefixId = face . registerPrefix ( prefix , this , new OnRegisterFailed ( ) { public void onRegisterFailed ( Name prefix ) { registeredPrefixId = UNREGISTERED ; logger . log ( Level . SEVERE , "Failed to register prefix: " + prefix . toUri ( ) ) ; } } , new ForwardingFlags ( ) ) ; logger . log ( Level . FINER , "Registered a new prefix: " + prefix . toUri ( ) ) ; } catch ( net . named_data . jndn . security . SecurityException e ) { throw new IOException ( "Failed to communicate to face due to security error" , e ) ; } }
Register a prefix for responding to interests .
8,785
public static boolean isMessageExcluded ( Message message , Recipient recipient ) { return isMessageExcluded ( message , recipient . getType ( ) , recipient . getValue ( ) ) ; }
Returns true if the message should be excluded based on the given recipient . A message is considered excluded if it has any constraint on the recipient s type and does not have a matching recipient for that type .
8,786
public static boolean isMessageExcluded ( Message message , RecipientType recipientType , String recipientValue ) { Recipient [ ] recipients = ( Recipient [ ] ) message . getMetadata ( "cwf.pub.recipients" ) ; if ( recipients == null || recipients . length == 0 ) { return false ; } boolean excluded = false ; for ( Recipient recipient : recipients ) { if ( recipient . getType ( ) == recipientType ) { excluded = true ; if ( recipient . getValue ( ) . equals ( recipientValue ) ) { return false ; } } } return excluded ; }
Returns true if the message should be excluded based on the given recipient values . A message is considered excluded if it has any constraint on the recipient type and does not have a matching recipient for that type .
8,787
public String getLabel ( ) { String label = getProperty ( labelProperty ) ; label = label == null ? node . getLabel ( ) : label ; if ( label == null ) { label = getDefaultInstanceName ( ) ; setProperty ( labelProperty , label ) ; } return label ; }
Returns the label property value .
8,788
private String getProperty ( String propertyName ) { return propertyName == null ? null : ( String ) getPropertyValue ( propertyName ) ; }
Returns a property value .
8,789
public QueueSpec setField ( String fieldName , Object value ) { fieldData . put ( fieldName , value ) ; return this ; }
Set a field s value .
8,790
public static void changeUser ( IUser user ) { try { getUserContext ( ) . requestContextChange ( user ) ; } catch ( Exception e ) { log . error ( "Error during user context change." , e ) ; } }
Request a user context change .
8,791
@ SuppressWarnings ( "unchecked" ) public static ISharedContext < IUser > getUserContext ( ) { return ( ISharedContext < IUser > ) ContextManager . getInstance ( ) . getSharedContext ( UserContext . class . getName ( ) ) ; }
Returns the managed user context .
8,792
private PHSCoverLetter12Document getPHSCoverLetter ( ) { PHSCoverLetter12Document phsCoverLetterDocument = PHSCoverLetter12Document . Factory . newInstance ( ) ; PHSCoverLetter12 phsCoverLetter = PHSCoverLetter12 . Factory . newInstance ( ) ; CoverLetterFile coverLetterFile = CoverLetterFile . Factory . newInstance ( ) ; phsCoverLetter . setFormVersion ( FormVersion . v1_2 . getVersion ( ) ) ; AttachedFileDataType attachedFileDataType = null ; for ( NarrativeContract narrative : pdDoc . getDevelopmentProposal ( ) . getNarratives ( ) ) { if ( narrative . getNarrativeType ( ) . getCode ( ) != null && Integer . parseInt ( narrative . getNarrativeType ( ) . getCode ( ) ) == NARRATIVE_PHS_COVER_LETTER ) { attachedFileDataType = getAttachedFileType ( narrative ) ; if ( attachedFileDataType != null ) { coverLetterFile . setCoverLetterFilename ( attachedFileDataType ) ; break ; } } } phsCoverLetter . setCoverLetterFile ( coverLetterFile ) ; phsCoverLetterDocument . setPHSCoverLetter12 ( phsCoverLetter ) ; return phsCoverLetterDocument ; }
This method is used to get PHSCoverLetter12Document attachment from the narrative attachments .
8,793
private void setBudgetYearDataType ( RRBudget1013 rrBudget , BudgetPeriodDto periodInfo ) { BudgetYearDataType budgetYear = rrBudget . addNewBudgetYear ( ) ; if ( periodInfo != null ) { budgetYear . setBudgetPeriodStartDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getStartDate ( ) ) ) ; budgetYear . setBudgetPeriodEndDate ( s2SDateTimeService . convertDateToCalendar ( periodInfo . getEndDate ( ) ) ) ; 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 ) ) ; BigDecimal directCosts = periodInfo . getDirectCostsTotal ( ) . bigDecimalValue ( ) ; budgetYear . setDirectCosts ( directCosts ) ; 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 ( ) ) ; } }
This method gets BudgetYearDataType details like BudgetPeriodStartDate BudgetPeriodEndDate BudgetPeriod KeyPersons OtherPersonnel TotalCompensation Equipment ParticipantTraineeSupportCosts Travel OtherDirectCosts DirectCosts IndirectCosts CognizantFederalAgency TotalCosts based on BudgetPeriodInfo for the RRBudget1013 .
8,794
public void setApplicationContext ( ApplicationContext appContext ) throws BeansException { try ( InputStream is = originalResource . getInputStream ( ) ; ) { ConfigurableListableBeanFactory beanFactory = ( ( AbstractRefreshableApplicationContext ) appContext ) . getBeanFactory ( ) ; StringBuilder sb = new StringBuilder ( ) ; Iterator < String > iter = IOUtils . lineIterator ( is , "UTF-8" ) ; boolean transformed = false ; while ( iter . hasNext ( ) ) { String line = iter . next ( ) ; if ( line . contains ( "${" ) ) { transformed = true ; line = beanFactory . resolveEmbeddedValue ( line ) ; } sb . append ( line ) ; } transformedResource = ! transformed ? originalResource : new ByteArrayResource ( sb . toString ( ) . getBytes ( ) ) ; } catch ( IOException e ) { throw MiscUtil . toUnchecked ( e ) ; } }
Use the application context to resolve any embedded property values within the original resource .
8,795
protected List < String > getCellLines ( String explanation ) { int startPos = 0 ; List < String > cellLines = new ArrayList < > ( ) ; for ( int commaPos = 0 ; commaPos > - 1 ; ) { commaPos = explanation . indexOf ( "," , startPos ) ; if ( commaPos >= 0 ) { String cellLine = ( explanation . substring ( startPos , commaPos ) . trim ( ) ) ; explanation = explanation . substring ( commaPos + 1 ) ; if ( cellLine . length ( ) > 0 ) { cellLines . add ( cellLine ) ; } } else if ( explanation . length ( ) > 0 ) { cellLines . add ( explanation . trim ( ) ) ; } } return cellLines ; }
This method splits the passed explanation comprising cell line information puts into a list and returns the list .
8,796
public void reset ( ) throws IOException { if ( t1 == null || t2 == null ) { throw new IllegalStateException ( "Cannot swap after close." ) ; } if ( getOutput ( ) . length ( ) > 0 ) { toggle = ! toggle ; try ( OutputStream unused = new FileOutputStream ( getOutput ( ) ) ) { } } else { throw new IOException ( "Cannot swap to an empty file." ) ; } }
Resets the input and output file before writing to the output again
8,797
public void close ( ) throws IOException { if ( t1 == null || t2 == null ) { return ; } try { if ( getOutput ( ) . length ( ) > 0 ) { Files . copy ( getOutput ( ) . toPath ( ) , output . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; } else if ( getInput ( ) . length ( ) > 0 ) { Files . copy ( getInput ( ) . toPath ( ) , output . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; } else { throw new IOException ( "Temporary files corrupted." ) ; } } finally { t1 . delete ( ) ; t2 . delete ( ) ; t1 = null ; t2 = null ; } }
Closes the temporary files and copies the result to the output file . Closing the TempFileHandler is a mandatory last step after which no other calls to the object should be made .
8,798
public AddressRequireCountryDataType getAddressRequireCountryDataType ( DepartmentalPersonDto person ) { AddressRequireCountryDataType address = AddressRequireCountryDataType . Factory . newInstance ( ) ; if ( person != null ) { String street1 = person . getAddress1 ( ) ; address . setStreet1 ( street1 ) ; String street2 = person . getAddress2 ( ) ; if ( street2 != null && ! street2 . equals ( "" ) ) { address . setStreet2 ( street2 ) ; } String city = person . getCity ( ) ; address . setCity ( city ) ; String county = person . getCounty ( ) ; if ( county != null && ! county . equals ( "" ) ) { address . setCounty ( county ) ; } String state = person . getState ( ) ; if ( state != null && ! state . equals ( "" ) ) { address . setState ( state ) ; } String zipcode = person . getPostalCode ( ) ; if ( zipcode != null && ! zipcode . equals ( "" ) ) { address . setZipCode ( zipcode ) ; } String country = person . getCountryCode ( ) ; address . setCountry ( CountryCodeType . Enum . forString ( country ) ) ; } return address ; }
Create AddressRequireCountryDataType from DepartmentalPerson object
8,799
public HumanNameDataType getHumanNameDataType ( KeyPersonDto keyPerson ) { HumanNameDataType humanName = HumanNameDataType . Factory . newInstance ( ) ; humanName . setFirstName ( keyPerson . getFirstName ( ) ) ; humanName . setLastName ( keyPerson . getLastName ( ) ) ; String middleName = keyPerson . getMiddleName ( ) ; if ( middleName != null && ! middleName . equals ( "" ) ) { humanName . setMiddleName ( middleName ) ; } return humanName ; }
Create HumanNameDataType from KeyPersonInfo object