Class SunCmpMappingsUtils

java.lang.Object
com.sun.jdo.api.persistence.mapping.ejb.SunCmpMappingsUtils

public class SunCmpMappingsUtils extends Object
Finder utilities for elements of the SunCmpMappings object graph.
Author:
vkraemer
  • Method Details

    • getFirstSunCmpMapping

      public static SunCmpMapping getFirstSunCmpMapping(SunCmpMappings scms, boolean addEmpty)
      Return the first SunCmpMapping element from the graph.
      Parameters:
      scms - The root of a SunCmpMappings object graph
      addEmpty - flag to add an empty version of the SunCmpMapping element to the graph if one is not found.
      Returns:
      The first SunCmpMapping element in the graph or null if it doesn't exists and addEmpty is false.
    • findEntityMapping

      public static EntityMapping findEntityMapping(SunCmpMappings scms, String bname, boolean addEmpty) throws IllegalArgumentException
      Find the EntityMapping element that correspond to a bean.
      Parameters:
      scms - the root of the SunCmpMappings graph
      bname - The value of the ejb-name element for a bean in the graph
      addEmpty - flag to add an empty version of the EntityMapping element to the graph if one is not found.
      Returns:
      the EntityMapping element, or null if addEmpty is false and the EntityMapping is not found.
      Throws:
      IllegalArgumentException - if more than one EntityMapping element has an ejb-name element with the matching value
    • findCmrFieldMapping

      public static CmrFieldMapping findCmrFieldMapping(EntityMapping em, String fname, boolean addEmpty) throws IllegalArgumentException
      Find the cmr-field-mapping element for a field in an EntityMapping object
      Parameters:
      em - The root of the search
      fname - the name of the field
      addEmpty - flag to add an empty version of the CmrFieldMapping element to the graph if one is not found.
      Returns:
      the CmrFieldMapping element or null if addEmpty is false and the field is not found.
      Throws:
      IllegalArgumentException - If there is more than one cmr-field with a matching cmr-field-name element in the EntityMapping graph.
    • findCmpFieldMapping

      public static CmpFieldMapping findCmpFieldMapping(EntityMapping em, String fname, boolean addEmpty) throws IllegalArgumentException
      Find the CmpFieldMapping element with a matching field-name element value
      Parameters:
      em - the root of the search
      fname - the value of the field-name element
      addEmpty - flag to add an empty version of the CmpFieldMapping element to the graph if one is not found.
      Returns:
      The CmpFieldMapping element or null if addEmpty is false and the field is not found.
      Throws:
      IllegalArgumentException - If there is more than one cmp-field with a matching field-name element in the EntityMapping graph.
    • findCompatibleBeansWithValue

      protected static List findCompatibleBeansWithValue(org.netbeans.modules.schema2beans.BaseBean root, String propName, String propVal, Class type) throws IllegalArgumentException
      A utility for finding beans in a graph of BaseBean objects. Search the bean graph, starting at a given root, for beans where the named property has the given value. The returned list is filtered by assignment compatibility.
      Parameters:
      root - The root of a search
      propName - The name of the element
      propVal - the value of the element
      type - The expected type of the value to be returned.
      Returns:
      The assignment compatible BaseBeans that were found.
      Throws:
      IllegalArgumentException - If the bean is not part of a complete bean graph.