Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MID-6319: only audit metamodel left, added beans, query experiments
Metamodel describes the table, but beans are necessary if we want to query whole "entities" instead of just columns. The bean has the same role like JPA entity (sans the mapping). Some experimental one-to-many processing tried in throw-away code.
- Loading branch information
Showing
80 changed files
with
390 additions
and
5,888 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...ql-impl/src/main/java/com/evolveum/midpoint/repo/sql/pure/FlexibleRelationalPathBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.evolveum.midpoint.repo.sql.pure; | ||
|
||
import com.querydsl.core.types.PathMetadata; | ||
import com.querydsl.sql.RelationalPathBase; | ||
|
||
/** | ||
* Extension of {@link RelationalPathBase} that provides midPoint specific features. | ||
* This allows to add metadata about Prism objects in addition to pure DB metadata. | ||
* <p> | ||
* Typical migration from originally generated Querydsl class: | ||
* <ul> | ||
* <li>extend from this class instead of {@code RelationalPathBase}</li> | ||
* <li>rename fields as needed (missing uppercase for words), also in related bean</li> | ||
* <li>rename static final field to capitalized table name (this will stand out + fix checkstyle)</li> | ||
* <li>simplify bean to public fields and no setters/getters</li> | ||
* <li>add PK-based equals/hashCode to beans (not critical, but handy for grouping transformations)</li> | ||
* <li>TODO: add prism-related metadata?</li> | ||
* <li>TODO: change types as needed, e.g. date/time-related? (also in bean)</li> | ||
* </ul> | ||
* | ||
* @param <T> entity type - typically a pure DTO bean for the table mapped by Q-type | ||
*/ | ||
public class FlexibleRelationalPathBase<T> extends RelationalPathBase<T> { | ||
|
||
private static final long serialVersionUID = -3374516272567011096L; | ||
|
||
public FlexibleRelationalPathBase( | ||
Class<? extends T> type, String variable, String schema, String table) { | ||
super(type, variable, schema, table); | ||
} | ||
|
||
public FlexibleRelationalPathBase( | ||
Class<? extends T> type, PathMetadata metadata, String schema, String table) { | ||
super(type, metadata, schema, table); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
repo/repo-sql-impl/src/main/java/com/evolveum/midpoint/repo/sql/pure/MAuditDelta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.evolveum.midpoint.repo.sql.pure; | ||
|
||
import java.sql.Blob; | ||
|
||
/** | ||
* MAuditDelta is a Querydsl bean type | ||
*/ | ||
@SuppressWarnings("unused") | ||
public class MAuditDelta { | ||
|
||
// TODO why is checksum part of PK? why not (recordId, deltaNumber) or even totally unique single ID? | ||
public Long recordId; | ||
public String checksum; | ||
public Blob delta; | ||
public String deltaoid; | ||
public Integer deltatype; | ||
public Blob fullresult; | ||
public String objectnameNorm; | ||
public String objectnameOrig; | ||
public String resourcenameNorm; | ||
public String resourcenameOrig; | ||
public String resourceoid; | ||
public Integer status; | ||
|
||
@Override | ||
public String toString() { | ||
return "MAuditDelta{" + | ||
"recordId=" + recordId + | ||
", checksum='" + checksum + '\'' + | ||
// ", delta=" + delta + | ||
// ", deltaoid='" + deltaoid + '\'' + | ||
// ", deltatype=" + deltatype + | ||
// ", fullresult=" + fullresult + | ||
// ", objectnameNorm='" + objectnameNorm + '\'' + | ||
// ", objectnameOrig='" + objectnameOrig + '\'' + | ||
// ", resourcenameNorm='" + resourcenameNorm + '\'' + | ||
// ", resourcenameOrig='" + resourcenameOrig + '\'' + | ||
// ", resourceoid='" + resourceoid + '\'' + | ||
", status=" + status + | ||
'}'; | ||
} | ||
} | ||
|
Oops, something went wrong.