Package org.omnaest.utils.propertyfile

Examples of org.omnaest.utils.propertyfile.PropertyFile


                                                       useJavaStyleUnicodeEscaping );
   
    //
    String locale = tableRowList.get( 0 ).get( 2 );
    String propertyFileName = tableRow.get( 0 ).replaceAll( Pattern.quote( "{locale}" ), locale );
    PropertyFile propertyFile = new PropertyFile( propertyFileName );
   
    //
    assertTrue( propertyFile.getFile().exists() );
   
    //
    propertyFile.load();
    PropertyFileContent propertyFileContent = propertyFile.getPropertyFileContent();
   
    //
    assertTrue( propertyFileContent.hasPropertyKeyAndValueList( propertyKey, propertyValueList ) );
   
    //clean up
    {
      //
      propertyFileName = tableRow.get( 0 ).replaceAll( Pattern.quote( "{locale}" ), "" );
      propertyFile = new PropertyFile( propertyFileName );
      propertyFile.load();
      propertyFile.getPropertyFileContent().getPropertyMap().remove( propertyKey );
      propertyFile.store();
     
      //
      propertyFileName = tableRow.get( 0 ).replaceAll( Pattern.quote( "{locale}" ), "de_DE" );
      propertyFile = new PropertyFile( propertyFileName );
      propertyFile.load();
      propertyFile.getPropertyFileContent().getPropertyMap().remove( propertyKey );
      propertyFile.store();
    }
   
  }
View Full Code Here


      {
        //
        PropertyKeyToValueMap propertyKeyToValueMap = filenameToPropertyKeyToValueMap.get( fileName );
       
        //         
        PropertyFile propertyFile = new PropertyFile( fileName );
        if ( fileEncoding != null )
        {
          propertyFile.setFileEncoding( fileEncoding );
        }
        propertyFile.setUseJavaStyleUnicodeEscaping( useJavaStyleUnicodeEscaping );
        propertyFile.load();
        PropertyMap propertyMap = propertyFile.getPropertyFileContent().getPropertyMap();
       
        //
        boolean contentChanged = false;
        for ( String propertyKey : propertyKeyToValueMap.keySet() )
        {
          //
          String value = propertyKeyToValueMap.get( propertyKey );
         
          //
          if ( StringUtils.isNotEmpty( value ) )
          {
            //
            String[] values = value.split( Pattern.quote( FileGroupToPropertiesAdapter.MULTILINE_VALUES_SEPARATOR ) );
           
            //
            Property property = propertyMap.containsKey( propertyKey ) ? property = propertyMap.get( propertyKey )
                                                                      : new Property();
           
            //
            property.setKey( propertyKey );
            property.clearValues();
            property.addAllValues( Arrays.asList( values ) );
           
            //
            propertyMap.put( property );
           
            //
            contentChanged = true;
          }
          else if ( propertyMap.containsKey( propertyKey ) && deletePropertiesWithBlankValue )
          {
            //
            propertyMap.remove( propertyKey );
           
            //
            contentChanged = true;
          }
        }
       
        //
        if ( contentChanged )
        {
          propertyFile.store();
        }
      }
     
      //
      if ( !missingPropertyInformationList.isEmpty() )
View Full Code Here

   * @return
   */
  protected PropertyFile resolvePropertyFile( String groupToken, String fileEncoding, boolean useJavaStyleUnicodeEscaping )
  {
    //
    PropertyFile retval = null;
   
    //
    if ( groupToken != null )
    {
      //
      Map<String, File> groupTokenToFileMap = this.fileGroup.getGroupTokenToFileMap();
     
      //
      File file = groupTokenToFileMap.get( groupToken );
      if ( file != null )
      {
        //
        retval = new PropertyFile( file );
        retval.setFileEncoding( fileEncoding );
        retval.setUseJavaStyleUnicodeEscaping( useJavaStyleUnicodeEscaping );
      }
    }
   
    //
    return retval;
View Full Code Here

   * @return
   */
  protected PropertyFile resolveAndLoadPropertyFile( String groupToken )
  {
    //
    PropertyFile propertyFile = this.resolvePropertyFile( groupToken, this.fileEncoding, this.useJavaStyleUnicodeEscaping );
   
    //
    if ( propertyFile != null )
    {
      //
      PropertyFile propertyFileFromCache = this.propertyFileCache.get( propertyFile.getFile() );
      if ( propertyFileFromCache != null )
      {
        propertyFile = propertyFileFromCache;
      }
      else
View Full Code Here

   
    //
    if ( propertyKey != null && groupToken != null )
    {
      //
      PropertyFile propertyFile = this.resolveAndLoadPropertyFile( groupToken );
      if ( propertyFile != null )
      {
        //
        PropertyFileContent propertyFileContent = propertyFile.getPropertyFileContent();
        PropertyMap propertyMap = propertyFileContent.getPropertyMap();
       
        //
        Property property = propertyMap.get( propertyKey );
        if ( property != null )
View Full Code Here

   
    //
    for ( String groupToken : this.determineGroupTokenList() )
    {
      //
      PropertyFile propertyFile = this.resolveAndLoadPropertyFile( groupToken );
      if ( propertyFile != null )
      {
        //
        PropertyFileContent propertyFileContent = propertyFile.getPropertyFileContent();
        PropertyMap propertyMap = propertyFileContent.getPropertyMap();
       
        //
        retset.addAll( propertyMap.keySet() );
      }
View Full Code Here

TOP

Related Classes of org.omnaest.utils.propertyfile.PropertyFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.