/
QContainerMapping.java
48 lines (39 loc) · 1.57 KB
/
QContainerMapping.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* Copyright (C) 2010-2021 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.repo.sqale.qmodel.common;
import org.jetbrains.annotations.NotNull;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.repo.sqale.qmodel.SqaleTableMapping;
/**
* Mapping between {@link QContainer} and {@link Containerable}.
*/
public class QContainerMapping<S extends Containerable, Q extends QContainer<R>, R extends MContainer>
extends SqaleTableMapping<S, Q, R> {
public static final String DEFAULT_ALIAS_NAME = "c";
public static final QContainerMapping<Containerable, QContainer<MContainer>, MContainer> INSTANCE =
new QContainerMapping<>(QContainer.TABLE_NAME, DEFAULT_ALIAS_NAME,
Containerable.class, QContainer.CLASS);
protected QContainerMapping(
@NotNull String tableName,
@NotNull String defaultAliasName,
@NotNull Class<S> schemaType,
@NotNull Class<Q> queryType) {
super(tableName, defaultAliasName, schemaType, queryType);
// TODO how CID is mapped?
// addItemMapping(PrismConstants.T_ID, uuidMapper(path(q -> q.oid)));
}
@Override
protected Q newAliasInstance(String alias) {
//noinspection unchecked
return (Q) new QContainer<>(MContainer.class, alias);
}
@Override
public R newRowObject() {
//noinspection unchecked
return (R) new MContainer();
}
}