|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.TypeUtil
public class TypeUtil
This class contains a set of utility static methods for Type generated files.
Field Summary | |
---|---|
static String |
REVISION
|
Fields inherited from interface com.jalios.jcms.TypeConstants |
---|
CHANGE_LEVEL_CLASS, CHANGE_LEVEL_JSP, CHANGE_LEVEL_NONE, DISPLAY_TPLT_TAG, EXTENSIONS_XML, FIELD_ELT, FIELD_NEW_MARK, FIELD_UPDATED_MARK, FIELDS_ELT, FILE_INDEX_LISTENER, LINK_INDEX_LISTENER, OLD_TYPES_DIR, PACKAGE_NAME, QUERY_TPLT_TAG, TAB_ELT, TABS_ELT, TEMPLATE_TAG, TEMPLATES_SUFFIX, TEMPLATES_TAG, TITLE_ELT, TYPE_ELT, TYPE_FORCE_UPDATE_MARK, TYPE_NEW_MARK, TYPE_UPDATED_MARK, TYPES_DIR, TYPES_XML |
Constructor Summary | |
---|---|
TypeUtil()
|
Method Summary | |
---|---|
static void |
appendJavaSignature(File file)
Compute and append the signature of the specified Java file at the end of the file. |
static void |
appendJspSignature(File file)
Compute and append the signature of the specified JSP file at the end of the file. |
static void |
appendXmlSignature(File file)
Compute and append the signature of the specified XML file at the end of the file. |
static void |
buildInheritedFieldList(org.jdom.Element elt,
List<org.jdom.Element> list,
boolean includeEltField)
Fill the given list with the inherited fields of the given type Element. |
static void |
buildInheritedFieldList(org.jdom.Element elt,
List<org.jdom.Element> list,
boolean includeEltField,
List<org.jdom.Element> extendedTypes)
Fill the given list with the inherited fields of the given type Element. |
static String |
getGeneratedSuperclass(String className)
|
static String |
getLabel(org.jdom.Element elt,
String lang)
Returns the label of the given element in the given language. |
static List<org.jdom.Element> |
getLinkedEltList(org.jdom.Element typeElt)
Returns the list of types linked to the given type. |
static List<org.jdom.Element> |
getSubEltList(org.jdom.Element typeElt)
Return the list of sub-types of the given type |
static List<org.jdom.Element> |
getSubEltList(List<org.jdom.Element> typeList,
Class<?> clazz)
Return all the types extending a given class |
static org.jdom.Element |
getSuperElt(org.jdom.Element typeElt)
Return the super type of a given type |
static List<org.jdom.Element> |
getSuperEltList(org.jdom.Element typeElt)
Return the list of super types of the given type (from the closest to the farthest) |
static org.jdom.Element |
getTreeChildType(org.jdom.Element typeElt)
Return the first sibling type with a field of type 'link' on the given type and with the 'parent' attribute to true. |
static boolean |
hasJavaSignatureChanged(File file)
Checks if the specified java file has changed since its generation |
static boolean |
hasJspSignatureChanged(File file)
Checks if the specified JSP file has changed since its generation. |
static boolean |
hasSignatureChanged(File file)
Checks if a file (java, or jsp) has changed since its generation. |
static boolean |
hasSignatureChanged(File file,
boolean excludeNonGenerated)
Checks if a file (java, or jsp) has changed since its generation. |
static boolean |
hasXmlSignatureChanged(File file)
Checks if the specified XML file has changed since its generation. |
static boolean |
isDBType(org.jdom.Element rootElt,
String typeName)
Returns true if the given typeName is a DBData (or extends a DBData class). |
static boolean |
isSubTypeOf(org.jdom.Element typeElt,
Class<?> clazz)
Check if the given type extends a given class |
static void |
unescapeJspDirective(File file)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public TypeUtil()
Method Detail |
---|
public static org.jdom.Element getSuperElt(org.jdom.Element typeElt)
typeElt
- the type to get the super type
public static String getGeneratedSuperclass(String className)
public static List<org.jdom.Element> getSuperEltList(org.jdom.Element typeElt)
typeElt
- the type to get the super type
public static boolean isSubTypeOf(org.jdom.Element typeElt, Class<?> clazz)
typeElt
- the type to checkclazz
- the clazz to check
public static List<org.jdom.Element> getSubEltList(List<org.jdom.Element> typeList, Class<?> clazz)
typeList
- the list of typeclazz
- the clazz to check
public static List<org.jdom.Element> getSubEltList(org.jdom.Element typeElt)
typeElt
- the type to get the sub-types
public static List<org.jdom.Element> getLinkedEltList(org.jdom.Element typeElt)
typeElt
- the type to get the linked types
public static org.jdom.Element getTreeChildType(org.jdom.Element typeElt)
typeElt
- the search type
public static String getLabel(org.jdom.Element elt, String lang)
elt
- the elementlang
- the language
public static void buildInheritedFieldList(org.jdom.Element elt, List<org.jdom.Element> list, boolean includeEltField)
elt
- the type elementlist
- the list to fillincludeEltField
- if true add fields of elt.public static void buildInheritedFieldList(org.jdom.Element elt, List<org.jdom.Element> list, boolean includeEltField, List<org.jdom.Element> extendedTypes)
elt
- the type elementlist
- the list to fillincludeEltField
- if true add fields of eltextendedTypes
- names of types having an extensionpublic static void unescapeJspDirective(File file) throws IOException
IOException
public static boolean hasJspSignatureChanged(File file) throws IOException
file
- a Java file (whatever.jsp)
true
if signature has changed or no signature could be found,
false
if signature has NOT been changed or if file does not exist or is empty.
IOException
public static void appendJspSignature(File file) throws IOException
file
- a Java file (whatever.jsp)
IOException
public static boolean hasXmlSignatureChanged(File file) throws IOException
file
- a Java file (whatever.jsp)
true
if signature has changed or no signature could be found,
false
if signature has NOT been changed or if file does not exist or is empty.
IOException
public static void appendXmlSignature(File file) throws IOException
file
- a Java file (whatever.jsp)
IOException
public static boolean hasJavaSignatureChanged(File file) throws IOException
file
- a Java file (whatever.java)
true
if signature has changed or no signature could be found,
false
if signature has NOT been changed or if file does not exist or is empty.
IOException
public static void appendJavaSignature(File file) throws IOException
file
- a Java file (whatever.java)
IOException
public static boolean hasSignatureChanged(File file) throws IOException
In order to perform this verification, checks if the actual/current signature of the specified file (java, or jsp) differs from the signature computed and appended in the file at the time of the generation.
file
- the file to check
true
if signature has changed or no signature could be found,
false
if signature has NOT been changed or if file does not exist or is empty or is not a generated file.
IOException
public static boolean hasSignatureChanged(File file, boolean excludeNonGenerated) throws IOException
In order to perform this verification, checks if the actual/current signature of the specified file (java, or jsp) differs from the signature computed and appended in the file at the time of the generation.
Warning: Be careful when invoking this method with boolean "excludeNonGenerated" as false : the signature
check will be performed for ALL files which match extension of file generated by JCMS (.class, .java, .jsp and .xml),
even though the file was not generated by JCMS (the file outside /WEB-INF/classes/generated or /types/).
Because the file content is loaded in memory to check the signature, it might require a lot of memory
if a file size is important (eg : store.xml, XML statistics, ...)
file
- the file to checkexcludeNonGenerated
- If set to true, signature will not be verified for files which are not in a generated directory (and false will be returned).
If set to false, signature will be check whatever the file is specified and corresponding value will be returned.true
if signature has changed or no signature could be found,
false
if signature has NOT been changed or if file does not exist or is empty.
IOException
public static boolean isDBType(org.jdom.Element rootElt, String typeName)
rootElt
- the root element of typestypeName
- the name of the type (only for non generated types)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |