This repository has been archived by the owner on Dec 17, 2024. It is now read-only.
forked from Onlineberatung/onlineBeratung-agencyService
-
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.
- Loading branch information
Showing
23 changed files
with
422 additions
and
54 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
61 changes: 61 additions & 0 deletions
61
src/main/java/de/caritas/cob/agencyservice/api/admin/service/UpdateAgencyLinkBuilder.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,61 @@ | ||
package de.caritas.cob.agencyservice.api.admin.service; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; | ||
|
||
import de.caritas.cob.agencyservice.api.admin.hallink.CreateAgencyLinkBuilder; | ||
import de.caritas.cob.agencyservice.api.admin.hallink.HalLinkBuilder; | ||
import de.caritas.cob.agencyservice.api.model.HalLink; | ||
import de.caritas.cob.agencyservice.api.model.HalLink.MethodEnum; | ||
import de.caritas.cob.agencyservice.api.model.UpdateLinks; | ||
import de.caritas.cob.agencyservice.api.repository.agency.Agency; | ||
import de.caritas.cob.agencyservice.generated.api.admin.controller.AgencyadminApi; | ||
|
||
/** | ||
* Link builder to create hal links for update agency results. | ||
*/ | ||
public class UpdateAgencyLinkBuilder implements HalLinkBuilder { | ||
|
||
private final Agency agency; | ||
|
||
private UpdateAgencyLinkBuilder(Agency agency) { | ||
this.agency = agency; | ||
} | ||
|
||
/** | ||
* Creates an {@link CreateAgencyLinkBuilder} instance. | ||
* | ||
* @return a instance of {@link CreateAgencyLinkBuilder} | ||
*/ | ||
public static UpdateAgencyLinkBuilder getInstance(Agency agency) { | ||
requireNonNull(agency); | ||
return new UpdateAgencyLinkBuilder(agency); | ||
} | ||
|
||
/** | ||
* Creates the {@link CreateAgencyLinkBuilder}. | ||
* | ||
* @return the generated {@link CreateAgencyLinkBuilder} | ||
*/ | ||
public UpdateLinks buildUpdateAgencyLinks() { | ||
return new UpdateLinks() | ||
.self(buildSelfLink()) | ||
.delete(buildDeleteHalLink()) | ||
.agency(buildAgencyLink()); | ||
} | ||
|
||
private HalLink buildAgencyLink() { | ||
return buildHalLink(methodOn(AgencyadminApi.class).getAgency(agency.getId()), MethodEnum.GET); | ||
} | ||
|
||
private HalLink buildDeleteHalLink() { | ||
return buildHalLink( | ||
methodOn(AgencyadminApi.class).deleteAgency(agency.getId()), MethodEnum.DELETE); | ||
} | ||
|
||
private HalLink buildSelfLink() { | ||
return buildHalLink( | ||
methodOn(AgencyadminApi.class).updateAgency(agency.getId(), null), MethodEnum.PUT); | ||
} | ||
|
||
} |
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
14 changes: 8 additions & 6 deletions
14
...itas/cob/agencyservice/api/admin/validation/validators/AgencyConsultingTypeValidator.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
Oops, something went wrong.