Skip to content

Commit

Permalink
SEBSERV-493 DB model generation and ORM mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
anhefti committed Dec 4, 2023
1 parent a055e23 commit dd9a038
Show file tree
Hide file tree
Showing 101 changed files with 2,183 additions and 1,463 deletions.
6 changes: 4 additions & 2 deletions src/main/java/ch/ethz/seb/sebserver/gbl/api/EntityType.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import javax.annotation.Generated;

@Generated(value="org.mybatis.generator.api.MyBatisGenerator",comments="ch.ethz.seb.sebserver.gen.DomainModelNameReferencePlugin",date="2023-11-14T09:46:30.136+01:00")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator",comments="ch.ethz.seb.sebserver.gen.DomainModelNameReferencePlugin",date="2023-12-04T15:30:33.448+01:00")
public enum EntityType {
CONFIGURATION_ATTRIBUTE,
CONFIGURATION_VALUE,
Expand Down Expand Up @@ -35,5 +35,7 @@ public enum EntityType {
CLIENT_INDICATOR,
CLIENT_NOTIFICATION,
CLIENT_GROUP,
SEB_SECURITY_KEY_REGISTRY;
SEB_SECURITY_KEY_REGISTRY,
ENTITY_PRIVILEGE,
FEATURE_PRIVILEGE;
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public enum PrivilegeType {
WRITE;

/** Use this to check implicit privilege.
*
* <p>
* Implicit in this case means: if the privilegeType is of type PrivilegeType.WRITE,
* PrivilegeType.MODIFY and PrivilegeType.READ are implicitly included.
* If the privilegeType is of type PrivilegeType.MODIFY, the PrivilegeType.READ are implicitly included
Expand Down
20 changes: 19 additions & 1 deletion src/main/java/ch/ethz/seb/sebserver/gbl/model/Domain.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/** Defines the global names of the domain model and domain model fields.
* This shall be used as a static overall domain model names reference within SEB Server Web-Service as well as within the integrated GUI
* This file is generated by the org.eth.demo.sebserver.gen.DomainModelNameReferencePlugin and must not be edited manually.**/
@Generated(value="org.mybatis.generator.api.MyBatisGenerator",comments="ch.ethz.seb.sebserver.gen.DomainModelNameReferencePlugin",date="2023-11-14T09:46:30.104+01:00")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator",comments="ch.ethz.seb.sebserver.gen.DomainModelNameReferencePlugin",date="2023-12-04T15:30:33.413+01:00")
public interface Domain {

interface CONFIGURATION_ATTRIBUTE {
Expand Down Expand Up @@ -399,4 +399,22 @@ interface SEB_SECURITY_KEY_REGISTRY {
String ATTR_EXAM_ID = "examId";
String ATTR_EXAM_TEMPLATE_ID = "examTemplateId";
}

interface ENTITY_PRIVILEGE {
String TYPE_NAME = "EntityPrivilege";
String REFERENCE_NAME = "entityPrivileges";
String ATTR_ID = "id";
String ATTR_ENTITY_TYPE = "entityType";
String ATTR_ENTITY_ID = "entityId";
String ATTR_USER_UUID = "userUuid";
String ATTR_PRIVILEGE_TYPE = "privilegeType";
}

interface FEATURE_PRIVILEGE {
String TYPE_NAME = "FeaturePrivilege";
String REFERENCE_NAME = "featurePrivileges";
String ATTR_ID = "id";
String ATTR_FEATURE_ID = "featureId";
String ATTR_USER_UUID = "userUuid";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
import org.mybatis.dynamic.sql.SqlTable;

public final class AdditionalAttributeRecordDynamicSqlSupport {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
public static final AdditionalAttributeRecord additionalAttributeRecord = new AdditionalAttributeRecord();

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source field: additional_attributes.id")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source field: additional_attributes.id")
public static final SqlColumn<Long> id = additionalAttributeRecord.id;

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source field: additional_attributes.entity_type")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source field: additional_attributes.entity_type")
public static final SqlColumn<String> entityType = additionalAttributeRecord.entityType;

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source field: additional_attributes.entity_id")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source field: additional_attributes.entity_id")
public static final SqlColumn<Long> entityId = additionalAttributeRecord.entityId;

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source field: additional_attributes.name")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source field: additional_attributes.name")
public static final SqlColumn<String> name = additionalAttributeRecord.name;

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source field: additional_attributes.value")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source field: additional_attributes.value")
public static final SqlColumn<String> value = additionalAttributeRecord.value;

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
public static final class AdditionalAttributeRecord extends SqlTable {
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@

@Mapper
public interface AdditionalAttributeRecordMapper {
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
long count(SelectStatementProvider selectStatement);

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
int delete(DeleteStatementProvider deleteStatement);

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
@SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="record.id", before=false, resultType=Long.class)
int insert(InsertStatementProvider<AdditionalAttributeRecord> insertStatement);

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ConstructorArgs({
@Arg(column="id", javaType=Long.class, jdbcType=JdbcType.BIGINT, id=true),
Expand All @@ -56,7 +56,7 @@ public interface AdditionalAttributeRecordMapper {
})
AdditionalAttributeRecord selectOne(SelectStatementProvider selectStatement);

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
@SelectProvider(type=SqlProviderAdapter.class, method="select")
@ConstructorArgs({
@Arg(column="id", javaType=Long.class, jdbcType=JdbcType.BIGINT, id=true),
Expand All @@ -67,30 +67,30 @@ public interface AdditionalAttributeRecordMapper {
})
List<AdditionalAttributeRecord> selectMany(SelectStatementProvider selectStatement);

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
int update(UpdateStatementProvider updateStatement);

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
default QueryExpressionDSL<MyBatis3SelectModelAdapter<Long>> countByExample() {
return SelectDSL.selectWithMapper(this::count, SqlBuilder.count())
.from(additionalAttributeRecord);
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
default DeleteDSL<MyBatis3DeleteModelAdapter<Integer>> deleteByExample() {
return DeleteDSL.deleteFromWithMapper(this::delete, additionalAttributeRecord);
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
default int deleteByPrimaryKey(Long id_) {
return DeleteDSL.deleteFromWithMapper(this::delete, additionalAttributeRecord)
.where(id, isEqualTo(id_))
.build()
.execute();
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.476+01:00", comments="Source Table: additional_attributes")
default int insert(AdditionalAttributeRecord record) {
return insert(SqlBuilder.insert(record)
.into(additionalAttributeRecord)
Expand All @@ -102,7 +102,7 @@ default int insert(AdditionalAttributeRecord record) {
.render(RenderingStrategy.MYBATIS3));
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default int insertSelective(AdditionalAttributeRecord record) {
return insert(SqlBuilder.insert(record)
.into(additionalAttributeRecord)
Expand All @@ -114,19 +114,19 @@ default int insertSelective(AdditionalAttributeRecord record) {
.render(RenderingStrategy.MYBATIS3));
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<AdditionalAttributeRecord>>> selectByExample() {
return SelectDSL.selectWithMapper(this::selectMany, id, entityType, entityId, name, value)
.from(additionalAttributeRecord);
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default QueryExpressionDSL<MyBatis3SelectModelAdapter<List<AdditionalAttributeRecord>>> selectDistinctByExample() {
return SelectDSL.selectDistinctWithMapper(this::selectMany, id, entityType, entityId, name, value)
.from(additionalAttributeRecord);
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default AdditionalAttributeRecord selectByPrimaryKey(Long id_) {
return SelectDSL.selectWithMapper(this::selectOne, id, entityType, entityId, name, value)
.from(additionalAttributeRecord)
Expand All @@ -135,7 +135,7 @@ default AdditionalAttributeRecord selectByPrimaryKey(Long id_) {
.execute();
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(AdditionalAttributeRecord record) {
return UpdateDSL.updateWithMapper(this::update, additionalAttributeRecord)
.set(entityType).equalTo(record::getEntityType)
Expand All @@ -144,7 +144,7 @@ default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExample(Additiona
.set(value).equalTo(record::getValue);
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(AdditionalAttributeRecord record) {
return UpdateDSL.updateWithMapper(this::update, additionalAttributeRecord)
.set(entityType).equalToWhenPresent(record::getEntityType)
Expand All @@ -153,7 +153,7 @@ default UpdateDSL<MyBatis3UpdateModelAdapter<Integer>> updateByExampleSelective(
.set(value).equalToWhenPresent(record::getValue);
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default int updateByPrimaryKey(AdditionalAttributeRecord record) {
return UpdateDSL.updateWithMapper(this::update, additionalAttributeRecord)
.set(entityType).equalTo(record::getEntityType)
Expand All @@ -165,7 +165,7 @@ default int updateByPrimaryKey(AdditionalAttributeRecord record) {
.execute();
}

@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-11-14T09:46:30.162+01:00", comments="Source Table: additional_attributes")
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", date="2023-12-04T15:30:33.477+01:00", comments="Source Table: additional_attributes")
default int updateByPrimaryKeySelective(AdditionalAttributeRecord record) {
return UpdateDSL.updateWithMapper(this::update, additionalAttributeRecord)
.set(entityType).equalToWhenPresent(record::getEntityType)
Expand Down
Loading

0 comments on commit dd9a038

Please sign in to comment.