-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from companieshouse/feature/create-get-endpoint
LP-304 Implement GET Endpoint to retrieve submission resource
- Loading branch information
Showing
8 changed files
with
254 additions
and
8 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
7 changes: 7 additions & 0 deletions
7
...ava/uk/gov/companieshouse/limitedpartnershipsapi/exception/ResourceNotFoundException.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,7 @@ | ||
package uk.gov.companieshouse.limitedpartnershipsapi.exception; | ||
|
||
public class ResourceNotFoundException extends ServiceException{ | ||
public ResourceNotFoundException(String message) { | ||
super(message); | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
src/main/java/uk/gov/companieshouse/limitedpartnershipsapi/utils/TransactionUtils.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,28 @@ | ||
package uk.gov.companieshouse.limitedpartnershipsapi.utils; | ||
|
||
import org.apache.commons.lang.StringUtils; | ||
import org.springframework.stereotype.Component; | ||
import uk.gov.companieshouse.api.model.transaction.Transaction; | ||
|
||
import java.util.Objects; | ||
|
||
import static uk.gov.companieshouse.limitedpartnershipsapi.utils.Constants.FILING_KIND_LIMITED_PARTNERSHIP; | ||
import static uk.gov.companieshouse.limitedpartnershipsapi.utils.Constants.LINK_RESOURCE; | ||
|
||
@Component | ||
public class TransactionUtils { | ||
|
||
public boolean isTransactionLinkedToLimitedPartnershipSubmission(Transaction transaction, String limitedPartnershipSubmissionSelfLink) { | ||
if (StringUtils.isBlank(limitedPartnershipSubmissionSelfLink)) { | ||
return false; | ||
} | ||
|
||
if (Objects.isNull(transaction) || Objects.isNull(transaction.getResources())) { | ||
return false; | ||
} | ||
|
||
return transaction.getResources().entrySet().stream() | ||
.filter(resource -> FILING_KIND_LIMITED_PARTNERSHIP.equals(resource.getValue().getKind())) | ||
.anyMatch(resource -> limitedPartnershipSubmissionSelfLink.equals(resource.getValue().getLinks().get(LINK_RESOURCE))); | ||
} | ||
} |
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.