feature/remove-office-data-import #155

Merged
hsh-michaelhoennig merged 14 commits from feature/remove-office-data-import into master 2025-02-05 09:29:44 +01:00
Showing only changes of commit 31cc461e9f - Show all commits

View File

@ -4,7 +4,6 @@ import com.opencsv.CSVParserBuilder;
import com.opencsv.CSVReader; import com.opencsv.CSVReader;
import com.opencsv.CSVReaderBuilder; import com.opencsv.CSVReaderBuilder;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import net.hostsharing.hsadminng.hs.booking.project.HsBookingProject;
import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset; import net.hostsharing.hsadminng.hs.hosting.asset.HsHostingAsset;
import net.hostsharing.hsadminng.rbac.context.ContextBasedTest; import net.hostsharing.hsadminng.rbac.context.ContextBasedTest;
import net.hostsharing.hsadminng.persistence.BaseEntity; import net.hostsharing.hsadminng.persistence.BaseEntity;
@ -158,10 +157,6 @@ public class CsvDataImport extends ContextBasedTest {
public <T extends BaseEntity> T persist(final Integer id, final T entity) { public <T extends BaseEntity> T persist(final Integer id, final T entity) {
try { try {
// if (entity instanceof HsBookingProject bp) { // FIXME: for bookingproject + bookingitem? or not at all?
// //noinspection unchecked
// return (T) persistViaSql(id, bp);
// }
if (entity instanceof HsHostingAsset ha) { if (entity instanceof HsHostingAsset ha) {
//noinspection unchecked //noinspection unchecked
return (T) persistViaSql(id, ha); return (T) persistViaSql(id, ha);
@ -189,36 +184,6 @@ public class CsvDataImport extends ContextBasedTest {
} }
} }
@SneakyThrows
public BaseEntity<HsBookingProject> persistViaSql(final Integer id, final HsBookingProject entity) {
if (entity.getUuid() == null) {
entity.setUuid(UUID.randomUUID());
}
final var query = em.createNativeQuery("""
insert into hs_booking.project(
uuid,
version,
debitorUuid,
caption)
values (
:uuid,
:version,
:debitorUuid,
:caption)
""")
.setParameter("uuid", entity.getUuid())
.setParameter("version", entity.getVersion())
.setParameter("debitorUuid", entity.getDebitor().getUuid())
.setParameter("caption", entity.getCaption());
final var count = query.executeUpdate();
logError(() -> {
assertThat(count).isEqualTo(1);
});
return entity;
}
@SneakyThrows @SneakyThrows
public BaseEntity<HsHostingAsset> persistViaSql(final Integer id, final HsHostingAsset entity) { public BaseEntity<HsHostingAsset> persistViaSql(final Integer id, final HsHostingAsset entity) {
if (entity.getUuid() == null) { if (entity.getUuid() == null) {