public class SchemaTools
extends java.lang.Object
| Modifier and Type | Method and Description | 
|---|---|
| static void | addRelationObject(SchemaI schema,
                 java.lang.Object bo,
                 java.lang.String attPath,
                 java.lang.Object addMe)Adds the given relations to the attribute of a given
 bo specified by the attributepath | 
| static void | addSingleAttributeRelationObject(EntityI entity,
                                java.lang.Object bo,
                                java.lang.String attributeName,
                                java.lang.Object value)Adds the given value as relational object to the
 given attribute of the given bo | 
| static void | addSingleAttributeRelationObject(SchemaI schema,
                                java.lang.Object bo,
                                java.lang.String attributeName,
                                java.lang.Object value)Adds the given value as relational object to the
 given attribute of the given bo | 
| static void | checkSyntacticallyValidAttPath(java.lang.String attrPath) | 
| static java.util.Collection | collectValues(SchemaI schema,
             BOI bo,
             java.lang.String attPath)Collects all values for the last attribute in the given attribute path, resolving the many-relations in the path. | 
| static java.util.Collection | collectValues(SchemaI schema,
             BOI bo,
             java.lang.String attPath,
             boolean nullIfNullOnPath)Collects all values for the last attribute in the given attribute path, resolving the many-relations in the path. | 
| static java.util.Collection | collectValues(SchemaI schema,
             BOI bo,
             java.lang.String attPath,
             boolean nullIfNullOnPath,
             boolean nullIfAttrMissingOnPath)Collects all values for the last attribute in the given attribute path, resolving the many-relations in the path. | 
| static void | debug(java.lang.String msg)Convenience method for logging (log debug messages) | 
| static void | debug(java.lang.String msg,
     java.lang.Throwable cause)Convenience method for logging (log debug messages) | 
| static java.lang.String | determineProjectBasePackageName(SchemaI schema)This method tries to determine the name of the "base package" of a project
 from the package/classnames of the EntityIs in the given SchemaI. | 
| static java.lang.String[] | determineProjectPackageNames(SchemaI _schema)Determinates the ProjectPackageNames from a given  Schemaby iterating the entitylist and adding the entity packages | 
| static java.util.Map | entitiesToClasses(java.util.Collection entities)Maps the provided EntityI objects into an IdentityHashMap with EntityI#getClazz() as
 their values. | 
| static AttributeI[] | getAllPossibleRelationsTo(EntityI ent)Returns all persistent AttributeI-s possibly referring to a given EntityI (or one of it's super classes), even if
 they're marked as ignoreBackRelation. | 
| static java.util.List | getAllRelations(EntityI entity)Returns a  Listof all attributes of the given
 entity which are relations, including the attributes from
 entity bases | 
| static AnnotatedValue | getAnnotatedValue(SchemaI schema,
                 java.lang.Object bo,
                 java.lang.String attPath) | 
| static AnnotatedValue | getAnnotatedValue(SchemaI schema,
                 java.lang.Object bo,
                 java.lang.String[] attPath) | 
| static AnnotatedValue | getAnnotatedValue(SchemaI schema,
                 java.lang.Object bo,
                 java.lang.String[] attPath,
                 boolean assumeOnlySingleRelations) | 
| static AnnotatedValue | getAnnotatedValue(SchemaI schema,
                 java.lang.Object bo,
                 java.lang.String attPath,
                 boolean assumeOnlySingleRelations) | 
| static AnnotatedValue | getAnnotatedValueAsString(SchemaI schema,
                         java.lang.Object bo,
                         java.lang.String attPath)Tries to get the value for given the attribute (chain) for the given
  BOusing the givenSchemaIas aStringand returns
 anAnnotatedValuewhich allows to get more info in the case that
 errors occurred during the call. | 
| static AnnotatedValue | getAnnotatedValueAsString(SchemaI schema,
                         java.lang.Object bo,
                         java.lang.String[] attPath)Tries to get the value for given the attribute path for the given
  BOusing the givenSchemaIas aStringand returns
 anAnnotatedValuewhich allows to get more info in the case that
 errors occurred during the call. | 
| static AttributeI | getAttribute(SchemaI schema,
            java.lang.Object bo,
            java.lang.String attPath)Retrieves the attribute with the given attribute path. | 
| static AttributeI | getAttribute(SchemaI schema,
            java.lang.Object bo,
            java.lang.String attPath,
            boolean noThrow)Retrieves the attribute with the given attribute path. | 
| static BOI | getBOForLastPathElement(SchemaI schema,
                       BOI rootBO,
                       java.lang.String path)Returns the BO for which the final attribute is called, i.e. the second to last attribute. | 
| static EntityI | getEntityForObject(SchemaI schema,
                  java.lang.Object bo)Returns the entity from a given schema for a given bo | 
| static java.util.List<java.lang.String> | getPackageList(SchemaI schema) | 
| static java.util.Map | getRelationObjects(SchemaI schema,
                  java.lang.Object bo,
                  java.lang.String attPath)Returns the relation objects from a attribute specified
 by the attributepath | 
| static AttributeI | getSingleAttribute(EntityI entity,
                  java.lang.String attributeName)Returns an attribute from a given entity by attribute name | 
| static java.util.Map | getSingleAttributeRelationObjects(EntityI entity,
                                 java.lang.Object bo,
                                 java.lang.String attributeName)Returns a map with the relations for a single
 attribute of a bo by the given schema | 
| static java.util.Map | getSingleAttributeRelationObjects(SchemaI schema,
                                 java.lang.Object bo,
                                 java.lang.String attributeName)Returns a map with the relations for a single
 attribute of a bo by the given schema | 
| static java.lang.Object | getSingleAttributeValue(EntityI entity,
                       java.lang.Object bo,
                       java.lang.String attributeName)Retrieves the value of an attribute from a given entity and business object by the specified attribute name. | 
| static java.lang.Object | getSingleAttributeValue(EntityI entity,
                       java.lang.Object bo,
                       java.lang.String attributeName,
                       boolean assumeOnlySingleRelations)Retrieves the value of an attribute from a given entity and business object by the specified attribute name. | 
| static java.lang.Object | getSingleAttributeValue(SchemaI schema,
                       java.lang.Object bo,
                       java.lang.String attributeName)Retrieves the value of an attribute by its name from a given schema and business object. | 
| static java.lang.Object | getSingleAttributeValue(SchemaI schema,
                       java.lang.Object bo,
                       java.lang.String attributeName,
                       boolean assumeOnlySingleRelations)Retrieves the value of an attribute from a given schema and business object by the attribute name. | 
| static java.lang.String | getSingleAttributeValueAsString(EntityI entity,
                               java.lang.Object bo,
                               java.lang.String attributeName)Returns the value of an attribute as  Stringfrom a
 given entity and bo by the given attribute name, if the attribute
 is transient it will be returned from the transient properties | 
| static java.lang.String | getSingleAttributeValueAsString(SchemaI schema,
                               java.lang.Object bo,
                               java.lang.String attributeName)Returns the value of an attribute as  Stringfrom
 a given schema and bo by the given attribute name | 
| static java.lang.Object | getValue(SchemaI schema,
        java.lang.Object bo,
        java.lang.String attPath)Returns the value of an attribute specified by the attribute path. | 
| static java.lang.Object | getValue(SchemaI schema,
        java.lang.Object bo,
        java.lang.String attPath,
        boolean nullIfNullOnPath)Returns the value of an attribute specified by the attribute path. | 
| static java.lang.Object | getValue(SchemaI schema,
        java.lang.Object bo,
        java.lang.String attPath,
        boolean nullIfNullOnPath,
        boolean nullIfAttrMissingOnPath)Returns the value of an attribute specified by the attribute path. | 
| static java.lang.Object | getValue(SchemaI schema,
        java.lang.Object bo,
        java.lang.String attPath,
        boolean nullIfNullOnPath,
        boolean nullIfAttrMissingOnPath,
        boolean assumeOnlySingleRelations)Returns the value of an attribute specified by the attribute path. | 
| static java.lang.String | getValueAsString(SchemaI schema,
                java.lang.Object bo,
                java.lang.String attPath)Returns the value of an attribute specified by the attribute path as a  String. | 
| static java.lang.String | getValueAsString(SchemaI schema,
                java.lang.Object bo,
                java.lang.String attPath,
                boolean nullIfNullOnPath)Returns the value of an attribute specified by the attribute path as a  String. | 
| static boolean | hasRelationObject(SchemaI schema,
                 java.lang.Object bo,
                 java.lang.String attPath,
                 java.lang.Object hasMe)Checks if the attribute of a given bo, specified by the
 attributepath, contains the given relation objects | 
| static boolean | hasSingleAttributeRelationObject(EntityI entity,
                                java.lang.Object bo,
                                java.lang.String attPath,
                                java.lang.Object value)Checks if the given relational object is set on the
 given attribute of the given bo | 
| static boolean | hasSingleAttributeRelationObject(SchemaI schema,
                                java.lang.Object bo,
                                java.lang.String attPath,
                                java.lang.Object value)Checks if the given relational object is set on the
 given attribute of the given bo | 
| static boolean | hasValue(SchemaI schema,
        java.lang.Object bo,
        java.lang.String attPath)Checks if the attribute specified by the given path has a value set in the provided business object (BO). | 
| static void | info(electric.xml.Attribute att,
    java.lang.String msg)Convenience method for logging with attribute prefix (log info messages) | 
| static void | info(electric.xml.Attribute att,
    java.lang.String msg,
    java.lang.Throwable cause)Convenience method for logging with attribute prefix (log info messages) | 
| static void | info(electric.xml.Element el,
    java.lang.String msg)Convenience method for logging with element prefix (log info messages) | 
| static void | info(electric.xml.Element el,
    java.lang.String msg,
    java.lang.Throwable cause)Convenience method for logging with element prefix (log info messages) | 
| static boolean | isAnyBOOnPathDeleted(SchemaI schema,
                    BOI bo,
                    java.lang.String attPath)Checks if the given BO or any BO along the specified attribute path is deleted. | 
| static boolean | isTransientAttribute(java.lang.String attrName)Checks if a given attributename is a transient attribute
 by checking if the first char is an underscore | 
| static void | removeRelationObject(SchemaI schema,
                    java.lang.Object bo,
                    java.lang.String attPath,
                    java.lang.Object removeMe)Removes the given relations from the attribute of a given
 bo specified by the attributepath | 
| static void | removeSingleAttributeRelationObject(EntityI entity,
                                   java.lang.Object bo,
                                   java.lang.String attributeName,
                                   java.lang.Object value)Removes the given relation object from the
 given attribute from the given bo | 
| static void | removeSingleAttributeRelationObject(SchemaI schema,
                                   java.lang.Object bo,
                                   java.lang.String attributeName,
                                   java.lang.Object value)Removes the given relation object from the
 given attribute from the given bo | 
| static void | setSingleAttributeValue(EntityI entity,
                       java.lang.Object bo,
                       java.lang.String attributeName,
                       java.lang.Object value)Sets the value for the attribute with the given attributename
 in the given bo by a given entity | 
| static void | setSingleAttributeValue(SchemaI schema,
                       java.lang.Object bo,
                       java.lang.String attributeName,
                       java.lang.Object value)Sets the value for the attribute with the given attributename
 in the given bo by a given schema | 
| static void | setSingleAttributeValueAsString(EntityI entity,
                               java.lang.Object bo,
                               java.lang.String attributeName,
                               java.lang.String value)Sets the provided  Stringvalue as the value for the specified attribute on the given business object
 associated with the provided entity. | 
| static void | setSingleAttributeValueAsString(EntityI entity,
                               java.lang.Object bo,
                               java.lang.String attributeName,
                               java.lang.String value,
                               boolean checkConstraints)Sets the provided  Stringvalue as the value for the specified attribute on the given business object
 associated with the provided entity. | 
| static void | setSingleAttributeValueAsString(SchemaI schema,
                               java.lang.Object bo,
                               java.lang.String attributeName,
                               java.lang.String value)Sets the provided  Stringvalue as the value for the specified attribute on the given business object
 within the context of the provided schema. | 
| static void | setSingleAttributeValueAsString(SchemaI schema,
                               java.lang.Object bo,
                               java.lang.String attributeName,
                               java.lang.String value,
                               boolean checkConstraints)Sets the provided  Stringvalue as the value for the specified attribute on the given business object
 within the context of the provided schema. | 
| static void | setValue(SchemaI schema,
        java.lang.Object bo,
        java.lang.String attPath,
        java.lang.Object value)Sets the given value on a given attribute by
 path on the given bo for the given schema | 
| static void | setValueAsString(SchemaI schema,
                java.lang.Object bo,
                java.lang.String attPath,
                java.lang.String value)Sets the given value as  Stringon a given
 attribute by path on the given bo for the given schema. | 
| static void | setValueAsString(SchemaI schema,
                java.lang.Object bo,
                java.lang.String attPath,
                java.lang.String value,
                boolean checkConstraints)Sets the given value as  Stringon a given
 attribute by path on the given bo for the given schema | 
| static java.lang.String[] | splitAtDelim(java.lang.String s,
            char delim) | 
| static java.lang.String[] | splitAtDot(java.lang.String s)Returns a given  Stringsplit into aString-Array by using the dots in the
 givenStringas delimiter. | 
| static void | updateRelation(EntityI entity,
              java.lang.Object bo,
              java.lang.String attPath,
              java.lang.Object[] values)Updates the relations on the given attribute on the given bo | 
| static void | warn(electric.xml.Attribute att,
    java.lang.String msg)Convenience method for logging with attribute prefix (log warn messages) | 
| static void | warn(electric.xml.Attribute att,
    java.lang.String msg,
    java.lang.Throwable cause)Convenience method for logging with attribute prefix (log warn messages) | 
| static void | warn(electric.xml.Element el,
    java.lang.String msg)Convenience method for logging with element prefix (log debug messages) | 
| static void | warn(electric.xml.Element el,
    java.lang.String msg,
    java.lang.Throwable cause)Convenience method for logging with element prefix (log debug messages) | 
public static boolean isTransientAttribute(java.lang.String attrName)
attrName - the attribute to checktrue if the given attribute name starts with underscorepublic static void checkSyntacticallyValidAttPath(java.lang.String attrPath)
                                           throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic static java.lang.String[] splitAtDot(java.lang.String s)
String split into a
 String-Array by using the dots in the
 given String as delimiter.
 Own implementation because this method is called very often and
 String#split() is rather slow and costly.
 [FIXME: Sollte dies nicht eher in texttools stehen? Da gibts auch schon sowas wie splitBydelimeter]s - the String to splitString as String-Array splitted at the dots positionspublic static java.lang.String[] splitAtDelim(java.lang.String s,
                                              char delim)
public static java.util.List<java.lang.String> getPackageList(SchemaI schema)
public static AttributeI getAttribute(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
schema - The schema interface to search for the attribute.bo - The business object for which to find the attribute within the schema.attPath - The attribute path to locate.public static AttributeI getAttribute(SchemaI schema, java.lang.Object bo, java.lang.String attPath, boolean noThrow)
schema - The schema interface to search for the attribute.bo - The business object for which to find the attribute within the schema.attPath - The attribute path to locate.noThrow - If true, no exceptions will be thrown. If an attribute or entity cannot be found,
                 the method returns null. If false, exceptions may be thrown.noThrow is set to true).NullHasNoTypeException - If there is no entity for the business object in the given schema
                                    while looking for it in the relation chain and noThrow is set to false.AttributeResolveException - If the right entity for the business object or the attribute in the entity
                                    could not be found and noThrow is set to false.public static java.util.List getAllRelations(EntityI entity)
List of all attributes of the given
 entity which are relations, including the attributes from
 entity basesentity - the entity to get the relational attribues fromList of all relational attributes from the given entity including the attributes from entity basespublic static EntityI getEntityForObject(SchemaI schema, java.lang.Object bo)
schema - the schema to get entity frombo - NullHasNoTypeException - if the given bo was nullEntityResolveException - if the entity couldnt be resolvedpublic static AttributeI getSingleAttribute(EntityI entity, java.lang.String attributeName)
entity - the entity to get attribute fromattributeName - the attribute nameAttributeResolveException - if the given att was null or the attribute couldn't be resolved from entitypublic static java.lang.Object getSingleAttributeValue(SchemaI schema, java.lang.Object bo, java.lang.String attributeName)
schema - The schema from which to retrieve the entity.bo - The business object for which to obtain the entity from the schema.attributeName - The name of the attribute for which to retrieve the value.Object.AttributeResolveException - If the given attribute is null or if no attribute of that
                                   name could be found in the given schema for the given business object.public static java.lang.Object getSingleAttributeValue(SchemaI schema, java.lang.Object bo, java.lang.String attributeName, boolean assumeOnlySingleRelations)
schema - The schema to get the entity from.bo - The business object for which to obtain the entity from the schema.attributeName - The name of the attribute for which to retrieve the value.assumeOnlySingleRelations - If true, assumes that all 1-n relations encountered are used as 1-1 relations.
                                  If they have at most one entry, that entry is returned as the value of the relation.
                                  If they have more than one entry, the method fails.Object.AttributeResolveException - If the given attribute is null or if no attribute of that
                                   name could be found in the given schema for the given business object.public static java.lang.Object getSingleAttributeValue(EntityI entity, java.lang.Object bo, java.lang.String attributeName)
entity - The entity from which to retrieve the attribute for the business object.bo - The business object for which to obtain the attribute value.attributeName - The name of the attribute for which to retrieve the value.Object.AttributeResolveException - If the given attribute is null or the specified entity does not have an attribute with that name.public static java.lang.Object getSingleAttributeValue(EntityI entity, java.lang.Object bo, java.lang.String attributeName, boolean assumeOnlySingleRelations)
entity - The entity from which to retrieve the attribute for the business object.bo - The business object for which to obtain the attribute value.attributeName - The name of the attribute for which to retrieve the value.assumeOnlySingleRelations - If true, assumes that all 1-n relations encountered are actually used as 1-1 relations.
                                   If they have at most one entry, that entry is returned as the value of the relation.
                                   If they have more than one entry, the method fails.Object.AttributeResolveException - If the given attribute is null or the specified entity does not have an attribute with that name.public static java.lang.String getSingleAttributeValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attributeName)
String from
 a given schema and bo by the given attribute nameschema - the schema to get entity frombo - the bo to get entity from schema forattributeName - the attribute name to get value forStringpublic static java.lang.String getSingleAttributeValueAsString(EntityI entity, java.lang.Object bo, java.lang.String attributeName)
String from a
 given entity and bo by the given attribute name, if the attribute
 is transient it will be returned from the transient propertiesentity - the entity to get attribute from bobo - the bo to get the value fromattributeName - the attribute name to get value forStringAttributeResolveException - if the attribute couldn be resolvedpublic static void setSingleAttributeValue(SchemaI schema, java.lang.Object bo, java.lang.String attributeName, java.lang.Object value)
schema - the schema to get Entity for the bobo - the bo to set attributevalue inattributeName - the name of the attribute to set the value forvalue - the value to set for the attributepublic static void setSingleAttributeValue(EntityI entity, java.lang.Object bo, java.lang.String attributeName, java.lang.Object value)
entity - the entity to get the attribute to set forbo - the bo to set attributevalue inattributeName - the name of the attribute to set the value forvalue - the value to set for the attributepublic static void setSingleAttributeValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attributeName, java.lang.String value)
String value as the value for the specified attribute on the given business object
 within the context of the provided schema.
 Constraints will be checked before setting the value.schema - The schema from which to obtain the entity for the business object.bo - The business object on which to set the attribute value.attributeName - The name of the attribute for which to set the value.value - The value to set as a String.public static void setSingleAttributeValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attributeName, java.lang.String value, boolean checkConstraints)
String value as the value for the specified attribute on the given business object
 within the context of the provided schema.schema - The schema from which to obtain the entity for the business object.bo - The business object on which to set the attribute value.attributeName - The name of the attribute for which to set the value.value - The value to set as a String.checkConstraints - If true, constraints will be checked before setting the value.public static void setSingleAttributeValueAsString(EntityI entity, java.lang.Object bo, java.lang.String attributeName, java.lang.String value)
String value as the value for the specified attribute on the given business object
 associated with the provided entity.
 Constraints will be checked before setting the value.entity - The entity associated with the business object.bo - The business object on which to set the attribute value.attributeName - The name of the attribute for which to set the value.value - The value to set as a String.AttributeResolveException - If the given attribute is null or the entity does not have an attribute with that name.public static void setSingleAttributeValueAsString(EntityI entity, java.lang.Object bo, java.lang.String attributeName, java.lang.String value, boolean checkConstraints)
String value as the value for the specified attribute on the given business object
 associated with the provided entity.entity - The entity associated with the business object.bo - The business object on which to set the attribute value.attributeName - The name of the attribute for which to set the value.value - The value to set as a String.checkConstraints - If true, constraints will be checked before setting the value.AttributeResolveException - If the given attribute is null or the entity does not have an attribute with that name.public static java.util.Map getSingleAttributeRelationObjects(SchemaI schema, java.lang.Object bo, java.lang.String attributeName)
schema - the schema to get an entity for the bobo - the bo to get relations for the attributeattributeName - the attribute to get relations forpublic static java.util.Map getSingleAttributeRelationObjects(EntityI entity, java.lang.Object bo, java.lang.String attributeName)
entity - the entity to get attribute from for the bobo - the bo to get relations for the attributeattributeName - the attribute to get relations forAttributeResolveExceptionpublic static void addSingleAttributeRelationObject(SchemaI schema, java.lang.Object bo, java.lang.String attributeName, java.lang.Object value)
schema - the schema to get entity for the bobo - the bo to add the relational object to the attributeattributeName - the name of the attribute to add the relational object onvalue - the relational object to add to the attribute on the bopublic static void addSingleAttributeRelationObject(EntityI entity, java.lang.Object bo, java.lang.String attributeName, java.lang.Object value)
entity - the entity to get attribute for from the bobo - the bo to add the relational object to the attributeattributeName - the name of the attribute to add the relational object onvalue - the relational object to add to the attribute on the boAttributeResolveExceptionpublic static void removeSingleAttributeRelationObject(SchemaI schema, java.lang.Object bo, java.lang.String attributeName, java.lang.Object value)
schema - the schema to get entity for the bobo - the bo to remove the relational object from the attributeattributeName - the name of the attribute to remove the relational object fromvalue - the relational object to removepublic static void removeSingleAttributeRelationObject(EntityI entity, java.lang.Object bo, java.lang.String attributeName, java.lang.Object value)
entity - the entity to get attribute for from the bobo - the bo to remove the relational object from the attributeattributeName - the name of the attribute to remove the relational object fromvalue - the relational object to removeAttributeResolveExceptionpublic static boolean hasSingleAttributeRelationObject(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.Object value)
schema - the schema to get entity for the bobo - the bo to check the relational object on the attributeattPath - the name of the attribute to check the relational object onvalue - the relational object to checkpublic static boolean hasSingleAttributeRelationObject(EntityI entity, java.lang.Object bo, java.lang.String attPath, java.lang.Object value)
entity - the entity to get attribute for from the bobo - the bo to check the relational object on the attributeattPath - the name of the attribute to check the relational object onvalue - the relational object to checkAttributeResolveExceptionpublic static void updateRelation(EntityI entity, java.lang.Object bo, java.lang.String attPath, java.lang.Object[] values)
entity - the entity to get attribute for from the bobo - the bo to update the relations on the attributeattPath - the name of the attribute to update the relationsvalues - the relations to updatepublic static java.lang.Object getValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
schema - The schema to get the entity for the business object.bo - The business object to retrieve the attribute value from.attPath - The attribute path specifying where to find the attribute.AttributeResolveException - If the attribute could not be resolved.public static java.lang.Object getValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath, boolean nullIfNullOnPath)
schema - The schema to get the entity for the business object.bo - The business object to retrieve the attribute value from.attPath - The attribute path specifying where to find the attribute.nullIfNullOnPath - If true, returns null for a null intermediate object on the path.AttributeResolveException - If the attribute could not be resolved and "nullIfAttrMissingOnPath" was passed
                                   as false.public static java.lang.Object getValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath, boolean nullIfNullOnPath, boolean nullIfAttrMissingOnPath)
schema - The schema to get the entity for the business object.bo - The business object to retrieve the attribute value from.attPath - The attribute path specifying where to find the attribute.nullIfNullOnPath - If true, returns null for a null intermediate object on the path.nullIfAttrMissingOnPath - If true, returns null if an attribute is missing on the path.AttributeResolveException - If the attribute could not be resolved and "nullIfAttrMissingOnPath" was passed
                                   as false.public static java.lang.Object getValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath, boolean nullIfNullOnPath, boolean nullIfAttrMissingOnPath, boolean assumeOnlySingleRelations)
schema - The schema containing the entity definitions for the business objects.bo - The business object from which to start retrieving the value.attPath - The attribute path (e.g. "Kunde.AbstraktePerson.StandardKontakt.Strasse") to the desired value.nullIfNullOnPath - If true, returns null if any intermediate object on the path is null.nullIfAttrMissingOnPath - If true, returns null instead of throwing an exception if an attribute is
                                  missing on the path.assumeOnlySingleRelations - If true, assumes all 1-n relations will have at most one entry and retrieves it.
                                  Throws an exception if more than one is found.AttributeResolveException - If the attribute could not be resolved and "nullIfAttrMissingOnPath" is false,
                                   or if a 1-n relation has more than one entry with "assumeOnlySingleRelations" true.public static java.util.Collection collectValues(SchemaI schema, BOI bo, java.lang.String attPath)
schema - The schema to get the entity for the business object.bo - The business object to start collecting values from.attPath - The attribute path specifying where to find the values.Collection with all collected values, or null if attPath is emptypublic static java.util.Collection collectValues(SchemaI schema, BOI bo, java.lang.String attPath, boolean nullIfNullOnPath)
schema - The schema to get the entity for the business object.bo - The business object to start collecting values from.attPath - The attribute path specifying where to find the values.nullIfNullOnPath - If true, null will be returned if any value on the path is null.Collection with all collected values, or null if:
         - attPath is empty
         - A value on the path is null (and nullIfNullOnPath is true).public static java.util.Collection collectValues(SchemaI schema, BOI bo, java.lang.String attPath, boolean nullIfNullOnPath, boolean nullIfAttrMissingOnPath)
schema - The schema to get the entity for the business object.bo - The business object to start collecting values from.attPath - The attribute path specifying where to find the values.nullIfNullOnPath - If true, null will be returned if any value on the path is null.nullIfAttrMissingOnPath - If true, null will be returned if any attribute on the path could not be found.Collection with all collected values, or null if:
         - attPath is empty
         - A value on the path is null (and nullIfNullOnPath is true)
         - Some attribute on the path could not be found (and nullIfAttrMissingOnPath is true).public static java.lang.String getValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
String.schema - The schema to get the entity for the business object.bo - The business object to get the attribute value from.attPath - The attribute path specifying where to find the attribute.String.public static java.lang.String getValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attPath, boolean nullIfNullOnPath)
String.schema - The schema to get the entity for the business object.bo - The business object to get the attribute value from.attPath - The attribute path specifying where to find the attribute.nullIfNullOnPath - If true, null will be returned if no business object was found for the given attribute path.String, or null if no matching attribute path was found and nullIfNullOnPath is true.public static AnnotatedValue getAnnotatedValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
BO using the provided
 SchemaI. This method returns an AnnotatedValue, allowing you to obtain more information in case of errors during
 retrieval.schema - The SchemaI to be used for retrieval.bo - The BO from which the value should be retrieved.attPath - The attribute or attribute chain from which the value should be retrieved.AnnotatedValue containing either the retrieved value or representing an error that occurred during retrieval.public static AnnotatedValue getAnnotatedValue(SchemaI schema, java.lang.Object bo, java.lang.String[] attPath)
BO using the provided
 SchemaI. This method returns an AnnotatedValue, allowing you to obtain more information in case of errors during
 retrieval.schema - The SchemaI to be used for retrieval.bo - The BO from which the value should be retrieved.attPath - A String array with attribute names representing the path via which the value should be retrieved.AnnotatedValue containing either the retrieved value or representing an error that occurred during retrieval.public static AnnotatedValue getAnnotatedValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath, boolean assumeOnlySingleRelations)
BO using the provided
 SchemaI. This method returns an AnnotatedValue, allowing you to obtain more information in case of errors during
 retrieval.schema - The SchemaI to be used for retrieval.bo - The BO from which the value should be retrieved.attPath - The attribute or attribute chain from which the value should be retrieved.assumeOnlySingleRelations - If true, assume that all 1-n relations encountered are actually used as 1-1 relations
                                 (technically not possible in MyTISM but in some cases useful). If they have at most one entry,
                                 use that as the value of the relation; if they have more than one, fail.AnnotatedValue containing either the retrieved value or representing an error that occurred during retrieval.public static AnnotatedValue getAnnotatedValue(SchemaI schema, java.lang.Object bo, java.lang.String[] attPath, boolean assumeOnlySingleRelations)
BO using the provided
 SchemaI. This method returns an AnnotatedValue, allowing you to obtain more information in case of errors during
 retrieval.schema - The SchemaI to be used for retrieval.bo - The BO from which the value should be retrieved.attPath - A String array with attribute names representing the path via which the value should be retrieved.assumeOnlySingleRelations - If true, assume that all 1-n relations encountered are actually used as 1-1 relations
                                 (technically not possible in MyTISM but in some cases useful). If they have at most one entry,
                                 use that as the value of the relation; if they have more than one, fail.AnnotatedValue containing either the retrieved value or representing an error that occurred during retrieval.public static AnnotatedValue getAnnotatedValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
BO using the given SchemaI as a String and returns
 an AnnotatedValue which allows to get more info in the case that
 errors occurred during the call.schema - the SchemaI that should be usedbo - the BO from which the value should be retrievedattPath - the attribute or attribute chaing from which the value
    should be retrievedAnnotatedValue that either holds the value as a
    String or represents an error that occurred during the retrievalpublic static AnnotatedValue getAnnotatedValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String[] attPath)
BO using the given SchemaI as a String and returns
 an AnnotatedValue which allows to get more info in the case that
 errors occurred during the call.schema - the SchemaI that should be usedbo - the BO from which the value should be retrievedattPath - A String array with attribute names representing the path via which the value
    should be retrievedAnnotatedValue that either holds the value as a
    String or represents an error that occurred during the retrievalpublic static boolean hasValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
This method traverses the attribute path within the specified BO and determines whether the target attribute has a value assigned. It handles different attribute types, including maps, and considers empty maps as having no value.
schema - The schema used to resolve the attribute.bo - The business object to use as start for reaching the attribute via the given path.attPath - The path to the attribute.true if the attribute has a value set, false otherwise.public static boolean isAnyBOOnPathDeleted(SchemaI schema, BOI bo, java.lang.String attPath)
This method traverses the attribute path from the given BO and checks if any BO along the path, including the starting BO,
 is marked as deleted. It handles cases where the path contains relations to other BOs and returns false if the path
 is empty or if any attribute along the path does not exist or has a non-BO value (i.e. a many-relation).
schema - The schema used to resolve the BO's entity.bo - The starting business object.attPath - The attribute path to traverse.true if the starting BO or any BO along the path is deleted, false otherwise.public static void setValue(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.Object value)
schema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributevalue - the value to set on the attributepublic static void setValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.String value)
String on a given
 attribute by path on the given bo for the given schema.
 Checks for constraints before setting the value.schema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributevalue - the value to set on the attributepublic static void setValueAsString(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.String value, boolean checkConstraints)
String on a given
 attribute by path on the given bo for the given schemaschema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributevalue - the value to set on the attributecheckConstraints - if true we shall check for constraints before setting the valuepublic static java.util.Map getRelationObjects(SchemaI schema, java.lang.Object bo, java.lang.String attPath)
schema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributeMappublic static void addRelationObject(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.Object addMe)
schema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributeaddMe - the relation objects to add to the attributepublic static void removeRelationObject(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.Object removeMe)
schema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributeremoveMe - the relation objects to remove from the attributepublic static boolean hasRelationObject(SchemaI schema, java.lang.Object bo, java.lang.String attPath, java.lang.Object hasMe)
schema - the schema to get entity for the bobo - the bo to get the attribute by the pathattPath - the attributepath where to find the attributehasMe - the relation objects to check on the attributetrue if the given attribute contains the given objectpublic static void debug(java.lang.String msg)
msg - the message to logpublic static void debug(java.lang.String msg,
                         java.lang.Throwable cause)
msg - the message to logcause - the cause for the log (mostly from an exception)public static void warn(electric.xml.Attribute att,
                        java.lang.String msg)
att - the attribute to get a messageprefix formsg - the message to logpublic static void warn(electric.xml.Attribute att,
                        java.lang.String msg,
                        java.lang.Throwable cause)
att - the attribute to get a messageprefix formsg - the message to logcause - the cause for the log (mostly from an exception)public static void warn(electric.xml.Element el,
                        java.lang.String msg)
el - the element to get a messageprefix formsg - the message to logpublic static void warn(electric.xml.Element el,
                        java.lang.String msg,
                        java.lang.Throwable cause)
el - the element to get a messageprefix formsg - the message to logcause - the cause for the log (mostly from an exception)public static void info(electric.xml.Attribute att,
                        java.lang.String msg)
att - the attribute to get a messageprefix formsg - the message to logpublic static void info(electric.xml.Attribute att,
                        java.lang.String msg,
                        java.lang.Throwable cause)
att - the attribute to get a messageprefix formsg - the message to logcause - the cause for the log (mostly from an exception)public static void info(electric.xml.Element el,
                        java.lang.String msg)
el - the element to get a messageprefix formsg - the message to logpublic static void info(electric.xml.Element el,
                        java.lang.String msg,
                        java.lang.Throwable cause)
el - the element to get a messageprefix formsg - the message to logcause - the cause for the log (mostly from an exception)public static java.lang.String determineProjectBasePackageName(SchemaI schema)
public static java.lang.String[] determineProjectPackageNames(SchemaI _schema)
Schema
 by iterating the entitylist and adding the entity packages_schema - the Schema to get ProjectPackageNames forStringArray with the ProjectPackageNames of
         the entities in the Schemapublic static java.util.Map entitiesToClasses(java.util.Collection entities)
public static BOI getBOForLastPathElement(SchemaI schema, BOI rootBO, java.lang.String path)
schema - The schema that is used to check the attributes & valuesrootBO - The BO on which the attribute path startspath - The attribute path to checkpublic static AttributeI[] getAllPossibleRelationsTo(EntityI ent)
ent - The EntityI to search attributes able to refer to itAttributeI within the schema being able to relate to the given entity.Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.