-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MODLD-131: transform DI event message to LD resource (#92)
* MODLD-131: transform DI event message to LD resource * MODLD-131: fix DataImportEventListenerIT * MODLD-131: fix DataImportEventListenerIT
- Loading branch information
Showing
25 changed files
with
495 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
33 changes: 33 additions & 0 deletions
33
src/main/java/org/folio/linked/data/integration/consumer/DataImportEventHandler.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,33 @@ | ||
package org.folio.linked.data.integration.consumer; | ||
|
||
import static org.apache.commons.lang3.ObjectUtils.isNotEmpty; | ||
import static org.folio.linked.data.util.Constants.FOLIO_PROFILE; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
import org.folio.linked.data.service.ResourceService; | ||
import org.folio.marc2ld.mapper.Marc2BibframeMapper; | ||
import org.folio.search.domain.dto.DataImportEvent; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Log4j2 | ||
@Component | ||
@Profile(FOLIO_PROFILE) | ||
@RequiredArgsConstructor | ||
public class DataImportEventHandler { | ||
|
||
private final Marc2BibframeMapper marc2BibframeMapper; | ||
private final ResourceService resourceService; | ||
|
||
public void handle(DataImportEvent event) { | ||
if (isNotEmpty(event.getMarc())) { | ||
var marc2ldResource = marc2BibframeMapper.map(event.getMarc()); | ||
Long id = resourceService.createResource(marc2ldResource); | ||
log.info("DataImportEvent with id [{}] was saved as LD resource with id [{}]", event.getId(), id); | ||
} else { | ||
log.error("DataImportEvent with id [{}], tenant [{}], eventType [{}] has no Marc record inside", | ||
event.getId(), event.getTenant(), event.getEventType()); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,5 +87,15 @@ | |
</update> | ||
</changeSet> | ||
|
||
|
||
<changeSet id="12_add_Identifier_type" author="[email protected]"> | ||
<preConditions onFail="MARK_RAN"> | ||
<sqlCheck expectedResult="0"> | ||
select count(*) from type_lookup tl where tl.type_uri = 'http://bibfra.me/vocab/lite/Identifier' | ||
</sqlCheck> | ||
</preConditions> | ||
<insert tableName="type_lookup"> | ||
<column name="type_uri" value="http://bibfra.me/vocab/lite/Identifier"/> | ||
<column name="type_hash" valueComputed="hashing.hash_text('http://bibfra.me/vocab/lite/Identifier')"/> | ||
</insert> | ||
</changeSet> | ||
</databaseChangeLog> |
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 |
---|---|---|
@@ -1,7 +1,10 @@ | ||
package org.folio.linked.data.e2e; | ||
|
||
import static org.folio.linked.data.test.TestUtil.FOLIO_TEST_PROFILE; | ||
import static org.folio.linked.data.util.Constants.FOLIO_PROFILE; | ||
|
||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
@ActiveProfiles({"folio", "test-folio"}) | ||
@ActiveProfiles({FOLIO_PROFILE, FOLIO_TEST_PROFILE}) | ||
class DatabaseFolioIT extends DatabaseIT { | ||
} |
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
Oops, something went wrong.