com.sap.ide.webdynpro.checklayer.context
Class CheckLayerHelper

java.lang.Object
  |
  +--com.sap.ide.webdynpro.checklayer.context.CheckLayerHelper

public class CheckLayerHelper
extends java.lang.Object

Title: CheckLayerHelper

Description: Web Dynpro

Copyright: Copyright (c) 2003, 2004

Company: SAP AG

Version:
$Id: //tc/WebDynproGeneration/630_VAL_REL/src/_webdynpro_tools_checklayer/java/com/sap/ide/webdynpro/checklayer/context/CheckLayerHelper.java#3 $

Constructor Summary
CheckLayerHelper()
           
 
Method Summary
static java.lang.String getAbsolutePath(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement contextElement)
           
static com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum getCardinality(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
           
static com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum getCardinality(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node, boolean isOrigin)
           
static boolean getInititializeLeadSelection(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
           
static com.sap.ide.metamodel.webdynpro.component.controller.ContextElement getMappedElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element, com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)
           
static com.sap.ide.metamodel.webdynpro.component.controller.ContextElementMapping getMapping(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element, com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)
           
static com.sap.ide.metamodel.webdynpro.model.ModelClass getModelClass(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node)
           
static com.sap.ide.metamodel.webdynpro.model.ModelClass getModelClass(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node, boolean isOrigin)
           
static com.sap.ide.metamodel.webdynpro.component.controller.ContextElement getOriginContextElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element, com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)
          Returns the origin context element for the given element.
static com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] getOutgoingControllerUsages(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement contextElement)
           
static java.lang.String getQualifiedName(com.sap.ide.metamodel.webdynpro.type.JavaNativeType type)
          TODO Has to be replaced by CompoundType implementation
static com.sap.ide.metamodel.webdynpro.model.ModelClassProperty getReferencedProperty(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelAttribute attribute)
           
static com.sap.ide.metamodel.webdynpro.model.ModelClassProperty getReferencedProperty(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelAttribute attribute, boolean isOrigin)
           
static java.lang.String getRelativePath(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement contextElement)
           
static com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum getSelectionCardinality(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
          Retrieves correct value of the selection cardinality.
static boolean getSingleton(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
           
static boolean getSingleton(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node, boolean isOrigin)
           
static com.sap.ide.metamodel.dictionary.datatype.DtStructure getStructure(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
          Retrieves the corresponding dictionary structure reference.
static com.sap.ide.metamodel.dictionary.datatype.DtStructure getStructure(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node, boolean isOrigin)
          Retrieves the corresponding dictionary structure reference.
static com.sap.ide.metamodel.dictionary.datatype.DtField getStructureElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute)
          Retrieves the corresponding dictionary field reference.
static com.sap.ide.metamodel.dictionary.datatype.DtField getStructureElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute, boolean isOrigin)
          Retrieves the corresponding dictionary field reference.
static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole getSupplyingRelationRole(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode modelNode)
           
static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole getSupplyingRelationRole(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode modelNode, boolean isOrigin)
           
static com.sap.ide.metamodel.general.DevelopmentObject getType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute)
           
static com.sap.ide.metamodel.general.DevelopmentObject getType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute, boolean isOrigin)
           
static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole[] getValidSupplyingRelationRoles(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node)
          Returns the list of suitable supplying relation roles.
static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole[] getValidSupplyingRelationRoles(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node, boolean isOrigin)
          Returns the list of suitable supplying relation roles.
static boolean hasStructureBinding(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element)
           
static boolean hasStructureBinding(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element, boolean isOrigin)
           
static boolean hasType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute)
           
static boolean hasType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute, boolean isOrigin)
           
static boolean hasValidMapping(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element, com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)
           
static boolean hasValidStructureElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextValueAttribute attribute, boolean isOrigin)
           
static boolean isIndependentContextElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element)
           
static java.lang.String isValidRepeatedNode(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element, com.sap.ide.metamodel.webdynpro.component.controller.ContextRecursionNode recursionNode)
           
static boolean isValidSelectionCardinality(com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum selection, com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum cardinality)
           
static boolean isValidSingletonValue(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
          Checks if the singleton value of the given context node is valid
static boolean isValidSingletonValue(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node, boolean isOrigin)
          Checks if the singleton value of the given context node is valid
static boolean isValidSupplyingRelationRole(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node, com.sap.ide.metamodel.webdynpro.model.ModelRelationRole role)
          Checks if supplying relation role of the given node is valid.
static java.lang.String isValidType(com.sap.ide.metamodel.general.DevelopmentObject sourceType, com.sap.ide.metamodel.general.DevelopmentObject targetType)
          Checks if the given types are identical
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckLayerHelper

public CheckLayerHelper()
Method Detail

isValidSingletonValue

public static boolean isValidSingletonValue(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
Checks if the singleton value of the given context node is valid
Parameters:
node - the context element to check
Returns:
true - if the value is valid
false - if the value is invalid

isValidSingletonValue

public static boolean isValidSingletonValue(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node,
                                            boolean isOrigin)
Checks if the singleton value of the given context node is valid
Parameters:
node - the context element to check
Returns:
true - if the value is valid
false - if the value is invalid

isValidSupplyingRelationRole

public static boolean isValidSupplyingRelationRole(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node,
                                                   com.sap.ide.metamodel.webdynpro.model.ModelRelationRole role)
Checks if supplying relation role of the given node is valid.
Parameters:
node - the node to check. The supplying relation role of this node will be checked
role - the model relation role to be validated
Returns:
true - if the node has a valid supplying relation role
false - If it is invalid in respect to the referenced model class or the model class referenced by the parent node

isValidSelectionCardinality

public static boolean isValidSelectionCardinality(com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum selection,
                                                  com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum cardinality)

hasValidStructureElement

public static boolean hasValidStructureElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextValueAttribute attribute,
                                               boolean isOrigin)

hasValidMapping

public static boolean hasValidMapping(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element,
                                      com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)

getMappedElement

public static com.sap.ide.metamodel.webdynpro.component.controller.ContextElement getMappedElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element,
                                                                                                   com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)

getMapping

public static com.sap.ide.metamodel.webdynpro.component.controller.ContextElementMapping getMapping(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element,
                                                                                                    com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)

getOriginContextElement

public static com.sap.ide.metamodel.webdynpro.component.controller.ContextElement getOriginContextElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element,
                                                                                                          com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] controllerUsages)
Returns the origin context element for the given element.
Parameters:
element - mapped to context element of other controller context
Returns:
the origin element. The method always returns a valid element. If the origin element is null (e.g. has been deleted by the user), the previous context element within a mapping chain will be returned. e.g. e1 -> e2 -> null ; e2 will be returned

getModelClass

public static com.sap.ide.metamodel.webdynpro.model.ModelClass getModelClass(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node)

getModelClass

public static com.sap.ide.metamodel.webdynpro.model.ModelClass getModelClass(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node,
                                                                             boolean isOrigin)

getReferencedProperty

public static com.sap.ide.metamodel.webdynpro.model.ModelClassProperty getReferencedProperty(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelAttribute attribute)

getReferencedProperty

public static com.sap.ide.metamodel.webdynpro.model.ModelClassProperty getReferencedProperty(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelAttribute attribute,
                                                                                             boolean isOrigin)

getValidSupplyingRelationRoles

public static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole[] getValidSupplyingRelationRoles(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node)
Returns the list of suitable supplying relation roles. If the parent node is not a model node or if it has not an associated model class an empty array is returned. Otherwise the model relation roles are calculated depending on the model class of the parent node. If the node is mapped it retrieves the supplying relation roles of the origin element.
Parameters:
node - the node for which the model relations should be retrieved
Returns:
list of suitable model relation roles. Might return an empty array, but does never return null.

getValidSupplyingRelationRoles

public static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole[] getValidSupplyingRelationRoles(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode node,
                                                                                                       boolean isOrigin)
Returns the list of suitable supplying relation roles. If the parent node is not a model node or if it has not an associated model class an empty array is returned. Otherwise the model relation roles are calculated depending on the model class of the parent node.
Parameters:
node - the node for which the model relations should be retrieved
isOrigin - determines for optimization purposes whether the given node is an origin node or not
Returns:
list of suitable model relation roles. Might return an empty array, but does never return null.

getSupplyingRelationRole

public static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole getSupplyingRelationRole(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode modelNode)

getSupplyingRelationRole

public static com.sap.ide.metamodel.webdynpro.model.ModelRelationRole getSupplyingRelationRole(com.sap.ide.metamodel.webdynpro.component.controller.ContextModelNode modelNode,
                                                                                               boolean isOrigin)

getOutgoingControllerUsages

public static com.sap.ide.metamodel.webdynpro.component.controller.ControllerUsage[] getOutgoingControllerUsages(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement contextElement)

getType

public static com.sap.ide.metamodel.general.DevelopmentObject getType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute)

getType

public static com.sap.ide.metamodel.general.DevelopmentObject getType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute,
                                                                      boolean isOrigin)

hasType

public static boolean hasType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute)

hasType

public static boolean hasType(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute,
                              boolean isOrigin)

isValidRepeatedNode

public static java.lang.String isValidRepeatedNode(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element,
                                                   com.sap.ide.metamodel.webdynpro.component.controller.ContextRecursionNode recursionNode)
Parameters:
element -  
recursionNode -  
Returns:
null if valid, a text describing the constraint violation otherwise

isValidType

public static java.lang.String isValidType(com.sap.ide.metamodel.general.DevelopmentObject sourceType,
                                           com.sap.ide.metamodel.general.DevelopmentObject targetType)
Checks if the given types are identical
Parameters:
sourceType -  
targetType -  
Returns:
null if valid, a text describing the constraint violation otherwise

getQualifiedName

public static java.lang.String getQualifiedName(com.sap.ide.metamodel.webdynpro.type.JavaNativeType type)
TODO Has to be replaced by CompoundType implementation
Parameters:
type -  
Returns:
 

getRelativePath

public static java.lang.String getRelativePath(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement contextElement)

getAbsolutePath

public static java.lang.String getAbsolutePath(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement contextElement)

getStructure

public static com.sap.ide.metamodel.dictionary.datatype.DtStructure getStructure(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
Retrieves the corresponding dictionary structure reference.
Parameters:
node - The context node for which the structure should be retrieved. It might be a ContextValueNode or a ContextModelNode.
Returns:
Returns the dictionary structure or null in case the ModelClass or ContextValueNode does not have a dictionary structure binding.

getStructure

public static com.sap.ide.metamodel.dictionary.datatype.DtStructure getStructure(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node,
                                                                                 boolean isOrigin)
Retrieves the corresponding dictionary structure reference.
Parameters:
node - The context node for which the structure should be retrieved. It might be a ContextValueNode or a ContextModelNode.
isOrigin - For optimization purposes. Should be true in case the given node is not mapped to any other context node.
Returns:
Returns the dictionary structure or null in case the ModelClass or ContextValueNode does not have a dictionary structure binding.

getStructureElement

public static com.sap.ide.metamodel.dictionary.datatype.DtField getStructureElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute)
Retrieves the corresponding dictionary field reference. As Web Dynpro does support nested structures, the element will always be of type DtField.
Parameters:
attribute - The context attribute for which the corresponding structure field should be retrieved. It might be a ContextValueAttribute or a ContextModelAttribute.
Returns:
Returns the dictionary structure field or null in case the ModelClassProperty or ContextValueAttribute does not have a dictionary structure binding.

getStructureElement

public static com.sap.ide.metamodel.dictionary.datatype.DtField getStructureElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextAttribute attribute,
                                                                                    boolean isOrigin)
Retrieves the corresponding dictionary field reference. As Web Dynpro does support nested structures, the element will always be of type DtField.
Parameters:
attribute - The context attribute for which the corresponding structure field should be retrieved. It might be a ContextValueAttribute or a ContextModelAttribute.
isOrigin - For optimization purposes. Should be true in case the given attribute is not mapped to any other context attribute.
Returns:
Returns the dictionary structure field or null in case the ModelClassProperty or ContextValueAttribute does not have a dictionary structure binding.

hasStructureBinding

public static boolean hasStructureBinding(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element)

hasStructureBinding

public static boolean hasStructureBinding(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element,
                                          boolean isOrigin)

getCardinality

public static com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum getCardinality(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)

getCardinality

public static com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum getCardinality(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node,
                                                                                  boolean isOrigin)

getSelectionCardinality

public static com.sap.ide.metamodel.webdynpro.enum.CardinalityEnum getSelectionCardinality(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)
Retrieves correct value of the selection cardinality. In case the given node is mapped the mapping type determines whether the selection cardinality is defined by the given node itself or the value is defined by the mapped element. In case the mapped element is also mapped the same algorithm is applied. In case all mapping types are set to COLLECTION_AND_SELECTION the actual selection cardinality is retrieved by the origin element itself.
Parameters:
node - the context element for which the selection cardinality should be retrieved
Returns:
the actual selection cardinality which might be defined by one of the mapped context nodes

getInititializeLeadSelection

public static boolean getInititializeLeadSelection(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)

isIndependentContextElement

public static boolean isIndependentContextElement(com.sap.ide.metamodel.webdynpro.component.controller.ContextElement element)

getSingleton

public static boolean getSingleton(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node)

getSingleton

public static boolean getSingleton(com.sap.ide.metamodel.webdynpro.component.controller.ContextNode node,
                                   boolean isOrigin)


Copyright © 2005 SAP AG. All Rights Reserved.