public class SyncUtil extends Object
Constructor and Description |
---|
SyncUtil() |
Modifier and Type | Method and Description |
---|---|
static boolean |
arePropertiesEquivalent(Object obj1,
Object obj2)
Returns whether the properties of two objects are equivalent.
|
static void |
eagerLoad(org.hibernate.Session session,
Collection<?> objs)
Eager loads the given hibernate entity objects.
|
static ChannelResume |
getCurrentChannel()
Returns the channel that corresponds to the file currently being
read or written.
|
static boolean |
isDefaultValue(Field field,
Object value)
Indicates whether a value is the default value for a field.
|
static boolean |
isEquivalent(Object obj1,
Object obj2)
Returns whether two objects are equivalent.
|
static boolean |
isEquivalentSortedCollection(Collection<?> col1,
Collection<?> col2)
Returns whether two sorted collections are equivalent.
|
static String |
normalizeFilename(String filename)
Normalizes a filename by replacing special characters by underscore.
|
static <T extends IFileElement> |
read(Class<T> clazz,
IFile file,
ChannelResume currentChannel)
Reads a structure file.
|
static void |
shallowUpdate(org.hibernate.Session session,
Object obj)
Performs a shallow update on a hibernate entity object.
|
static void |
writeIfModified(IFileElement obj,
IFile file,
ChannelResume currentChannel)
Writes a structure file, only if the semantics in the object is different.
|
public static ChannelResume getCurrentChannel()
#read(Class, File, ChannelResume)
,
#write(Object, File, ChannelResume)
,
#writeIfModified(Object, File, ChannelResume)
public static <T extends IFileElement> T read(Class<T> clazz, IFile file, ChannelResume currentChannel) throws InvalidStructureFileException, InvalidStructureVersionException, IOException
T
- the class mapped to the file root element.clazz
- the class mapped to the file root element.file
- the file.currentChannel
- the channel the file belongs to.null
if the file does not exist.InvalidStructureFileException
- if the file format is invalid.InvalidStructureVersionException
- if the structure is out of date.IOException
public static void writeIfModified(IFileElement obj, IFile file, ChannelResume currentChannel)
The write operation will occur locally or in the portal cluster depending
on the file
object type. If it is a IFile
the
write will be cluster-wide, otherwise it will occur only locally.
obj
- the object to be written.file
- the file.currentChannel
- the channel the file belongs to.public static boolean isDefaultValue(Field field, Object value)
field
- the field.value
- the value.IDefaultAware
public static boolean isEquivalentSortedCollection(Collection<?> col1, Collection<?> col2)
equivalent
, in the same order.col1
- a collection.col2
- the other collection.public static boolean isEquivalent(Object obj1, Object obj2)
By default only fields that would be output to the object's XML representation are compared. Relations to other entities are not compared (performs only a shallow comparison).
Custom equivalence rules are used if the object implements
ICustomEquivalence
.
obj1
- a object.obj2
- other object.public static boolean arePropertiesEquivalent(Object obj1, Object obj2)
By default only fields that would be output to the object's XML representation are compared. Relations to other entities are not compared (performs only a shallow comparison).
Custom equivalence rules are not used. To use them, use
isEquivalent(Object, Object)
instead of this method.
obj1
- a object.obj2
- other object.isEquivalent(Object, Object)
,
isEquivalentSortedCollection(Collection, Collection)
public static void shallowUpdate(org.hibernate.Session session, Object obj)
session
- hibernate session for persistence access.obj
- object representing updated data.public static void eagerLoad(org.hibernate.Session session, Collection<?> objs)
session
- hibernate session for persistence access.objs
- the objects to load. All of them must be of the same class.LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.