-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31e5304
commit 64f9639
Showing
23 changed files
with
250 additions
and
244 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.folio.controller; | ||
|
||
import static org.springframework.http.HttpStatus.CREATED; | ||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; | ||
import static org.springframework.http.HttpStatus.OK; | ||
|
||
import java.util.UUID; | ||
|
||
import org.folio.domain.dto.EcsTlr; | ||
import org.folio.rest.resource.TlrApi; | ||
import org.folio.service.EcsTlrService; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
|
||
@RestController | ||
@Log4j2 | ||
@AllArgsConstructor | ||
public class EcsTlrController implements TlrApi { | ||
|
||
private final EcsTlrService ecsTlrService; | ||
|
||
@Override | ||
public ResponseEntity<EcsTlr> getEcsTlrById(UUID requestId) { | ||
log.debug("getEcsTlrById:: parameters id: {}", requestId); | ||
|
||
return ecsTlrService.get(requestId) | ||
.map(ResponseEntity.status(OK)::body) | ||
.orElseGet(() -> ResponseEntity.notFound().build()); | ||
} | ||
|
||
@Override | ||
public ResponseEntity<EcsTlr> postEcsTlr(EcsTlr ecsTlr) { | ||
log.debug("postEcsTlr:: parameters ecsTlr: {}", ecsTlr); | ||
|
||
try { | ||
return new ResponseEntity<>(ecsTlrService.post(ecsTlr), CREATED); | ||
} catch (Exception e) { | ||
log.error("postEcsTlr:: unexpected error: {}", e.getMessage()); | ||
return new ResponseEntity<>(ecsTlr, INTERNAL_SERVER_ERROR); | ||
} | ||
} | ||
} |
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
47 changes: 0 additions & 47 deletions
47
src/main/java/org/folio/controller/TitleLevelRequestsController.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.folio.domain.mapper; | ||
|
||
import org.folio.domain.dto.EcsTlr; | ||
import org.folio.domain.entity.EcsTlrEntity; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.NullValueCheckStrategy; | ||
|
||
@Mapper(componentModel = "spring", nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS) | ||
public interface EcsTlrMapper { | ||
EcsTlr mapEntityToDto(EcsTlrEntity ecsTlrEntity); | ||
EcsTlrEntity mapDtoToEntity(EcsTlr ecsTlr); | ||
} |
12 changes: 0 additions & 12 deletions
12
src/main/java/org/folio/domain/mapper/TitleLevelRequestMapper.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...ository/TitleLevelRequestsRepository.java → ...rg/folio/repository/EcsTlrRepository.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package org.folio.repository; | ||
|
||
import org.folio.domain.entity.TitleLevelRequestEntity; | ||
import org.folio.domain.entity.EcsTlrEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
import java.util.UUID; | ||
|
||
@Repository | ||
public interface TitleLevelRequestsRepository extends JpaRepository<TitleLevelRequestEntity, UUID> { | ||
public interface EcsTlrRepository extends JpaRepository<EcsTlrEntity, UUID> { | ||
} |
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,11 @@ | ||
package org.folio.service; | ||
|
||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
import org.folio.domain.dto.EcsTlr; | ||
|
||
public interface EcsTlrService { | ||
Optional<EcsTlr> get(UUID requestId); | ||
EcsTlr post(EcsTlr ecsTlr); | ||
} |
11 changes: 0 additions & 11 deletions
11
src/main/java/org/folio/service/TitleLevelRequestsService.java
This file was deleted.
Oops, something went wrong.
36 changes: 36 additions & 0 deletions
36
src/main/java/org/folio/service/impl/EcsTlrServiceImpl.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 org.folio.service.impl; | ||
|
||
import java.util.Optional; | ||
import java.util.UUID; | ||
|
||
import org.folio.domain.dto.EcsTlr; | ||
import org.folio.domain.mapper.EcsTlrMapper; | ||
import org.folio.repository.EcsTlrRepository; | ||
import org.folio.service.EcsTlrService; | ||
import org.springframework.stereotype.Service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Log4j2 | ||
public class EcsTlrServiceImpl implements EcsTlrService { | ||
|
||
private final EcsTlrRepository ecsTlrRepository; | ||
private final EcsTlrMapper requestsMapper; | ||
|
||
@Override | ||
public Optional<EcsTlr> get(UUID id) { | ||
return ecsTlrRepository.findById(id) | ||
.map(requestsMapper::mapEntityToDto); | ||
} | ||
|
||
@Override | ||
public EcsTlr post(EcsTlr ecsTlr) { | ||
log.debug("post:: parameters ecsTlr: {}", () -> ecsTlr); | ||
|
||
return requestsMapper.mapEntityToDto(ecsTlrRepository.save( | ||
requestsMapper.mapDtoToEntity(ecsTlr))); | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
src/main/java/org/folio/service/impl/TitleLevelRequestsServiceImpl.java
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
Oops, something went wrong.