Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

120 coffee BatchService separation #121

Merged
merged 4 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bom/bom-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<packaging>pom</packaging>

<properties>
<version.hu.icellmobilsoft.coffee>2.7.0-SNAPSHOT</version.hu.icellmobilsoft.coffee>
<version.hu.icellmobilsoft.coffee>2.8.0-SNAPSHOT</version.hu.icellmobilsoft.coffee>
<version.hu.icellmobilsoft.frappee>1.0.0-SNAPSHOT</version.hu.icellmobilsoft.frappee>
<version.org.eclipse.microprofile>6.0</version.org.eclipse.microprofile>
<version.hu.icellmobilsoft.roaster>2.1.0</version.hu.icellmobilsoft.roaster>
<version.io.smallrye.config.source.yaml>3.3.4</version.io.smallrye.config.source.yaml>
Expand Down Expand Up @@ -63,6 +64,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>hu.icellmobilsoft.frappee</groupId>
<artifactId>frappee-bom-project</artifactId>
<version>${version.hu.icellmobilsoft.frappee}</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>hu.icellmobilsoft.roaster</groupId>
Expand Down
10 changes: 9 additions & 1 deletion common/common-system-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,16 @@
<groupId>hu.icellmobilsoft.coffee</groupId>
<artifactId>coffee-system-jpa</artifactId>
</dependency>
<dependency>
<groupId>hu.icellmobilsoft.frappee</groupId>
<artifactId>frappee-hibernate-batch</artifactId>
</dependency>
<dependency>
<groupId>hu.icellmobilsoft.frappee</groupId>
<artifactId>frappee-hibernate-util-cdi</artifactId>
</dependency>

<dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -21,23 +21,41 @@

import jakarta.enterprise.context.Dependent;
import jakarta.inject.Inject;
import jakarta.persistence.EntityManager;

import hu.icellmobilsoft.coffee.model.base.javatime.AbstractIdentifiedAuditEntity;
import hu.icellmobilsoft.coffee.tool.utils.date.DateUtil;
import hu.icellmobilsoft.frappee.hibernate.batch.HibernateBatchService;
import hu.icellmobilsoft.frappee.hibernate.util.HibernateEntityHelper;
import hu.icellmobilsoft.sampler.common.system.jpa.jpa.EntityHelper;

/**
* Real batch save with JPA
*
*
* @author imre.scheffer
* @since 0.1.0
*
*/
@Dependent
public class BatchService extends hu.icellmobilsoft.coffee.jpa.sql.batch.BatchService {
public class CustomHibernateBatchService extends HibernateBatchService {

private final EntityHelper entityHelper;

/**
* Constructor.
*
* @param entityHelper
* {@link EntityHelper}
* @param em
* {@link EntityManager}
* @param hibernateEntityHelper
* {@link HibernateEntityHelper}
*/
@Inject
private EntityHelper entityHelper;
public CustomHibernateBatchService(EntityHelper entityHelper, EntityManager em, HibernateEntityHelper hibernateEntityHelper) {
super(em, hibernateEntityHelper);
this.entityHelper = entityHelper;
}

@Override
protected <E> void handleInsertAudit(E entity) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -31,7 +31,7 @@
import hu.icellmobilsoft.coffee.dto.exception.InvalidParameterException;
import hu.icellmobilsoft.coffee.jpa.helper.TransactionHelper;
import hu.icellmobilsoft.coffee.se.api.exception.BaseException;
import hu.icellmobilsoft.sampler.common.system.jpa.service.BatchService;
import hu.icellmobilsoft.frappee.jpa.batch.IJpaBatchService;
import hu.icellmobilsoft.sampler.common.system.rest.action.BaseAction;
import hu.icellmobilsoft.sampler.dto.sample.batch.javabasetypes.BaseJavaBaseTypesType;
import hu.icellmobilsoft.sampler.dto.sample.batch.javabasetypes.JavaBaseTypesInsertRequest;
Expand All @@ -45,15 +45,15 @@

/**
* Action class for {@link JavaBaseTypes}.
*
*
* @author csaba.balogh
* @since 2.0.0
*/
@Model
public class JavaBaseTypesAction extends BaseAction {

@Inject
private BatchService batchService;
private IJpaBatchService jpaBatchService;

@Inject
private TransactionHelper transactionHelper;
Expand Down Expand Up @@ -81,7 +81,7 @@ public JavaBaseTypesResponse insertJavaBaseTypes(JavaBaseTypesInsertRequest java

List<JavaBaseTypes> javaBaseTypesList = List.of(javaBaseTypes);

transactionHelper.executeWithTransaction(batchService::batchInsertNative, javaBaseTypesList, JavaBaseTypes.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchInsertNative, javaBaseTypesList, JavaBaseTypes.class);

return createResponse(javaBaseTypesInsertRequest, javaBaseTypes);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ public JavaBaseTypesResponse updateJavaBaseTypes(String javaBaseTypesId, JavaBas

List<JavaBaseTypes> javaBaseTypesList = List.of(javaBaseTypes);

transactionHelper.executeWithTransaction(batchService::batchUpdateNative, javaBaseTypesList, JavaBaseTypes.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchUpdateNative, javaBaseTypesList, JavaBaseTypes.class);

return createResponse(javaBaseTypesUpdateRequest, javaBaseTypes);
}
Expand All @@ -126,7 +126,7 @@ public JavaBaseTypesResponse updateJavaBaseTypes(String javaBaseTypesId, JavaBas
*/
public BaseResponse deleteAllJavaBaseTypes() throws BaseException {
List<JavaBaseTypes> javaBaseTypesList = javaBaseTypesService.findAll();
transactionHelper.executeWithTransaction(batchService::batchDeleteNative, javaBaseTypesList, JavaBaseTypes.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchDeleteNative, javaBaseTypesList, JavaBaseTypes.class);
return createBaseResponse();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -36,7 +36,7 @@
import hu.icellmobilsoft.coffee.dto.exception.enums.CoffeeFaultType;
import hu.icellmobilsoft.coffee.jpa.helper.TransactionHelper;
import hu.icellmobilsoft.coffee.se.api.exception.BaseException;
import hu.icellmobilsoft.sampler.common.system.jpa.service.BatchService;
import hu.icellmobilsoft.frappee.jpa.batch.IJpaBatchService;
import hu.icellmobilsoft.sampler.common.system.rest.action.BaseAction;
import hu.icellmobilsoft.sampler.dto.sample.batch.javadata.JavaDataInsertRequest;
import hu.icellmobilsoft.sampler.dto.sample.batch.javadata.JavaDataInsertType;
Expand All @@ -57,7 +57,7 @@
public class JavaDataAction extends BaseAction {

@Inject
private BatchService batchService;
private IJpaBatchService jpaBatchService;

@Inject
private TransactionHelper transactionHelper;
Expand Down Expand Up @@ -90,7 +90,7 @@ public JavaDataResponse insertJavaData(JavaDataInsertRequest javaDataInsertReque

List<JavaData> javaDataList = List.of(javaData);

transactionHelper.executeWithTransaction(batchService::batchInsertNative, javaDataList, JavaData.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchInsertNative, javaDataList, JavaData.class);

return createResponse(javaDataInsertRequest, javaData.getId(), data);
}
Expand Down Expand Up @@ -125,7 +125,7 @@ public JavaDataResponse updateJavaData(String javaDataId, JavaDataUpdateRequest

List<JavaData> javaDataList = List.of(javaData);

transactionHelper.executeWithTransaction(batchService::batchUpdateNative, javaDataList, JavaData.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchUpdateNative, javaDataList, JavaData.class);

return createResponse(javaDataUpdateRequest, javaDataId, data);
}
Expand All @@ -139,7 +139,7 @@ public JavaDataResponse updateJavaData(String javaDataId, JavaDataUpdateRequest
*/
public BaseResponse deleteAllJavaData() throws BaseException {
List<JavaData> javaDataList = javaDataService.findAll();
transactionHelper.executeWithTransaction(batchService::batchDeleteNative, javaDataList, JavaData.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchDeleteNative, javaDataList, JavaData.class);
return createBaseResponse();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -40,7 +40,7 @@
import hu.icellmobilsoft.coffee.jpa.helper.TransactionHelper;
import hu.icellmobilsoft.coffee.se.api.exception.BaseException;
import hu.icellmobilsoft.coffee.tool.utils.date.DateUtil;
import hu.icellmobilsoft.sampler.common.system.jpa.service.BatchService;
import hu.icellmobilsoft.frappee.jpa.batch.IJpaBatchService;
import hu.icellmobilsoft.sampler.common.system.rest.action.BaseAction;
import hu.icellmobilsoft.sampler.dto.sample.batch.javadateandtime.JavaDateAndTimeInsertRequest;
import hu.icellmobilsoft.sampler.dto.sample.batch.javadateandtime.JavaDateAndTimeResponse;
Expand All @@ -51,15 +51,15 @@

/**
* Action class for {@link JavaDateAndTime}.
*
*
* @author csaba.balogh
* @since 2.0.0
*/
@Model
public class JavaDateAndTimeAction extends BaseAction {

@Inject
private BatchService batchService;
private IJpaBatchService jpaBatchService;

@Inject
private TransactionHelper transactionHelper;
Expand Down Expand Up @@ -87,7 +87,7 @@ public JavaDateAndTimeResponse insertJavaDateAndTime(JavaDateAndTimeInsertReques

List<JavaDateAndTime> javaDateAndTimeList = List.of(javaDateAndTime);

transactionHelper.executeWithTransaction(batchService::batchInsertNative, javaDateAndTimeList, JavaDateAndTime.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchInsertNative, javaDateAndTimeList, JavaDateAndTime.class);

return createResponse(javaDateAndTimeInsertRequest, javaDateAndTime);
}
Expand Down Expand Up @@ -118,7 +118,7 @@ public JavaDateAndTimeResponse updateJavaDateAndTime(String javaDateAndTimeId, J

List<JavaDateAndTime> javaDateAndTimeList = List.of(javaDateAndTime);

transactionHelper.executeWithTransaction(batchService::batchUpdateNative, javaDateAndTimeList, JavaDateAndTime.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchUpdateNative, javaDateAndTimeList, JavaDateAndTime.class);

return createResponse(javaDateAndTimeUpdateRequest, javaDateAndTime);
}
Expand All @@ -132,7 +132,7 @@ public JavaDateAndTimeResponse updateJavaDateAndTime(String javaDateAndTimeId, J
*/
public BaseResponse deleteAllJavaDateAndTime() throws BaseException {
List<JavaDateAndTime> javaDateAndTimeList = javaDateAndTimeService.findAll();
transactionHelper.executeWithTransaction(batchService::batchDeleteNative, javaDateAndTimeList, JavaDateAndTime.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchDeleteNative, javaDateAndTimeList, JavaDateAndTime.class);
return createBaseResponse();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -32,7 +32,7 @@
import hu.icellmobilsoft.coffee.jpa.helper.TransactionHelper;
import hu.icellmobilsoft.coffee.se.api.exception.BaseException;
import hu.icellmobilsoft.coffee.tool.utils.enums.EnumUtil;
import hu.icellmobilsoft.sampler.common.system.jpa.service.BatchService;
import hu.icellmobilsoft.frappee.jpa.batch.IJpaBatchService;
import hu.icellmobilsoft.sampler.common.system.rest.action.BaseAction;
import hu.icellmobilsoft.sampler.dto.sample.batch.javaenumtypes.BaseJavaEnumTypesType;
import hu.icellmobilsoft.sampler.dto.sample.batch.javaenumtypes.BatchOperationTypeType;
Expand All @@ -48,15 +48,15 @@

/**
* Action class for {@link JavaEnumTypes}.
*
*
* @author csaba.balogh
* @since 2.0.0
*/
@Model
public class JavaEnumTypesAction extends BaseAction {

@Inject
private BatchService batchService;
private IJpaBatchService jpaBatchService;

@Inject
private TransactionHelper transactionHelper;
Expand Down Expand Up @@ -84,7 +84,7 @@ public JavaEnumTypesResponse insertJavaEnumTypes(JavaEnumTypesInsertRequest java

List<JavaEnumTypes> javaEnumTypesList = List.of(javaEnumTypes);

transactionHelper.executeWithTransaction(batchService::batchInsertNative, javaEnumTypesList, JavaEnumTypes.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchInsertNative, javaEnumTypesList, JavaEnumTypes.class);

return createResponse(javaEnumTypesInsertRequest, javaEnumTypes);
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public JavaEnumTypesResponse updateJavaEnumTypes(String javaEnumTypesId, JavaEnu

List<JavaEnumTypes> javaEnumTypesList = List.of(javaEnumTypes);

transactionHelper.executeWithTransaction(batchService::batchUpdateNative, javaEnumTypesList, JavaEnumTypes.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchUpdateNative, javaEnumTypesList, JavaEnumTypes.class);

return createResponse(javaEnumTypesUpdateRequest, javaEnumTypes);
}
Expand All @@ -129,7 +129,7 @@ public JavaEnumTypesResponse updateJavaEnumTypes(String javaEnumTypesId, JavaEnu
*/
public BaseResponse deleteAllJavaEnumTypes() throws BaseException {
List<JavaEnumTypes> javaEnumTypesList = javaEnumTypesService.findAll();
transactionHelper.executeWithTransaction(batchService::batchDeleteNative, javaEnumTypesList, JavaEnumTypes.class);
transactionHelper.executeWithTransaction(jpaBatchService::batchDeleteNative, javaEnumTypesList, JavaEnumTypes.class);
return createBaseResponse();
}

Expand Down
Loading
Loading