DataTypeUtils.java :  » UML » MetaBoss » com » metaboss » sdlctools » models » metabossmodel » datadictionarymodel » Java Open Source

Java Open Source » UML » MetaBoss 
MetaBoss » com » metaboss » sdlctools » models » metabossmodel » datadictionarymodel » DataTypeUtils.java
// THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
// CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
// BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
// OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Copyright 2000-2005  Softaris Pty.Ltd. All Rights Reserved.
package com.metaboss.sdlctools.models.metabossmodel.datadictionarymodel;

import java.util.Collection;
import java.util.Iterator;
import java.util.Properties;

/** Set of DataType utility and helper methods realising some facilities seemingly not provided by MDR. */
public class DataTypeUtils
{
  /** This class is a "toolbox" with static utilities and can not be instantiated */
  private DataTypeUtils()
  {
  }
  
  /** @return Properties object populated with current typetemplate properties.
   * Key of the property is populated by the key and the value by value */
  public static Properties getTypetemplatePropertiesAsProperties(DataType pDataType)
  {
    Properties lPropertiesMap = new Properties();
    Collection lCombinedTypetemplateProperties = pDataType.getCombinedTypetemplateProperties();
    if (!lCombinedTypetemplateProperties.isEmpty())
    {
      for (Iterator lCombinedTypetemplatePropertiesIterator = lCombinedTypetemplateProperties.iterator(); lCombinedTypetemplatePropertiesIterator.hasNext();)
      {
        // Iterate through properties, discard containers and put
        // keys and values from the non-container properties in the map
        Property lProperty = (Property)lCombinedTypetemplatePropertiesIterator.next();
        PropertyDescriptor lPropertyDescriptor = lProperty.getDescriptor();
        if (!lPropertyDescriptor.isContainer())
        {
          String lPropertyValue = lProperty.getValue();
          if (lPropertyValue != null)
            lPropertiesMap.put(lProperty.getKey(), lPropertyValue);
        }          
      }
    }
    return lPropertiesMap;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.