Class RUtil
- java.lang.Object
-
- com.evolveum.midpoint.repo.sql.util.RUtil
-
public final class RUtil extends Object
- Author:
- lazyman
-
-
Field Summary
Fields Modifier and Type Field Description static int
COLUMN_LENGTH_OID
This constant is used for oid column size in database.static int
COLUMN_LENGTH_QNAME
static QName
CUSTOM_OBJECT
static int
JDBC_BATCH_SIZE
Currently set in ctx-session.xml as constant, used for batch inserts (e.g.static String
LOB_STRING_TYPE
This constant is used for mapping type forLob
fields.static String
NS_SQL_REPO
This namespace is used for wrapping xml parts of objects during save to database.static String
QNAME_DELIMITER
static String
SQL_REPO_OBJECT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
computeChecksum(byte[]... objects)
static void
copyResultFromJAXB(QName itemName, OperationResultType jaxb, OperationResult repo, PrismContext prismContext)
static Element
createFakeParentElement()
static void
executeStatement(Connection connection, String sql)
static OrgFilter
findOrgFilter(ObjectFilter filter)
static OrgFilter
findOrgFilter(ObjectQuery query)
static void
fixCompositeIDHandling(org.hibernate.SessionFactory sessionFactory)
This method is used to override "hasIdentifierMapper" in EntityMetaModels of entities which have composite id and class defined for it.static String
fixDBSchemaObjectNameLength(String input)
static byte[]
getByteArrayFromXml(String xml, boolean compress)
static String
getDebugString(RObject object)
static Integer
getIntegerFromString(String val)
static <T extends SchemaEnum>
TgetRepoEnumValue(Object object, Class<T> type)
static String
getTableName(Class hqlType, org.hibernate.Session session)
static String
getXmlFromByteArray(byte[] array, boolean compressed)
static String
getXmlFromByteArray(byte[] array, boolean compressed, boolean useUtf16)
static REmbeddedReference
jaxbRefToEmbeddedRepoRef(ObjectReferenceType jaxb, RelationRegistry relationRegistry)
static RObjectReference
jaxbRefToRepo(ObjectReferenceType reference, RObject owner, RReferenceOwner refOwner, RelationRegistry relationRegistry)
static Set<RPolyString>
listPolyToSet(List<PolyStringType> list)
static <T> Set<T>
listToSet(List<T> list)
static @NotNull String
qnameToString(QName qname)
static <T extends Objectable>
voidrevive(Objectable object, PrismContext prismContext)
static Set
safeListReferenceToSet(List<ObjectReferenceType> list, RObject owner, RReferenceOwner refOwner, RelationRegistry relationRegistry)
static List<ObjectReferenceType>
safeSetReferencesToList(Set<? extends RObjectReference> set, PrismContext prismContext)
static ItemName
stringToQName(String text)
static Integer
toInteger(Long l)
static Long
toLong(Integer i)
static Long
toLong(Short s)
static Short
toShort(Long l)
static String
trimString(String message, int size)
-
-
-
Field Detail
-
JDBC_BATCH_SIZE
public static final int JDBC_BATCH_SIZE
Currently set in ctx-session.xml as constant, used for batch inserts (e.g. in OrgClosureManager)- See Also:
- Constant Field Values
-
LOB_STRING_TYPE
public static final String LOB_STRING_TYPE
This constant is used for mapping type forLob
fields.MaterializedClobType
was not working properly with PostgreSQL, causing TEXT types (clobs) to be saved not in table row but somewhere else and it always messed up UTF-8 encoding- See Also:
- Constant Field Values
-
COLUMN_LENGTH_QNAME
public static final int COLUMN_LENGTH_QNAME
- See Also:
- Constant Field Values
-
QNAME_DELIMITER
public static final String QNAME_DELIMITER
- See Also:
- Constant Field Values
-
COLUMN_LENGTH_OID
public static final int COLUMN_LENGTH_OID
This constant is used for oid column size in database.- See Also:
- Constant Field Values
-
NS_SQL_REPO
public static final String NS_SQL_REPO
This namespace is used for wrapping xml parts of objects during save to database.- See Also:
- Constant Field Values
-
SQL_REPO_OBJECT
public static final String SQL_REPO_OBJECT
- See Also:
- Constant Field Values
-
CUSTOM_OBJECT
public static final QName CUSTOM_OBJECT
-
-
Method Detail
-
revive
public static <T extends Objectable> void revive(Objectable object, PrismContext prismContext) throws DtoTranslationException
- Throws:
DtoTranslationException
-
createFakeParentElement
public static Element createFakeParentElement()
-
listPolyToSet
public static Set<RPolyString> listPolyToSet(List<PolyStringType> list)
-
safeSetReferencesToList
public static List<ObjectReferenceType> safeSetReferencesToList(Set<? extends RObjectReference> set, PrismContext prismContext)
-
safeListReferenceToSet
public static Set safeListReferenceToSet(List<ObjectReferenceType> list, RObject owner, RReferenceOwner refOwner, RelationRegistry relationRegistry)
-
jaxbRefToRepo
public static RObjectReference jaxbRefToRepo(ObjectReferenceType reference, RObject owner, RReferenceOwner refOwner, RelationRegistry relationRegistry)
-
jaxbRefToEmbeddedRepoRef
public static REmbeddedReference jaxbRefToEmbeddedRepoRef(ObjectReferenceType jaxb, RelationRegistry relationRegistry)
-
fixCompositeIDHandling
public static void fixCompositeIDHandling(org.hibernate.SessionFactory sessionFactory)
This method is used to override "hasIdentifierMapper" in EntityMetaModels of entities which have composite id and class defined for it. It's workaround for bug as found in forum https://forum.hibernate.org/viewtopic.php?t=978915&highlight=- Parameters:
sessionFactory
-
-
copyResultFromJAXB
public static void copyResultFromJAXB(QName itemName, OperationResultType jaxb, OperationResult repo, PrismContext prismContext) throws DtoTranslationException
- Throws:
DtoTranslationException
-
computeChecksum
public static String computeChecksum(byte[]... objects)
-
getRepoEnumValue
public static <T extends SchemaEnum> T getRepoEnumValue(Object object, Class<T> type)
-
getByteArrayFromXml
public static byte[] getByteArrayFromXml(String xml, boolean compress)
-
getXmlFromByteArray
public static String getXmlFromByteArray(byte[] array, boolean compressed)
-
getXmlFromByteArray
public static String getXmlFromByteArray(byte[] array, boolean compressed, boolean useUtf16)
-
findOrgFilter
public static OrgFilter findOrgFilter(ObjectQuery query)
-
findOrgFilter
public static OrgFilter findOrgFilter(ObjectFilter filter)
-
executeStatement
public static void executeStatement(Connection connection, String sql) throws SQLException
- Throws:
SQLException
-
-