generated from NASA-PDS/template-repo-java
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update swagger.yml to match the proposal plus any additions and clarification on the original ticket NASA-PDS/pds-api#202. Re-arranged the code to fit the new API. Required some new exceptions and tweaks to the basic interfaces to support the membership concept outside of just referencing in general and that a lidvid necessarily match a particular product type. Added new swagger transmutation layers to support the easy removal of deprecated code in the future and to support easier maintenance in the future. Left the old referencing suff only because there is a chance it may come back in the newish future to support some other use cases. The new swagger transmutation layers still all funnel through a single processor once all of the inputs have been collected. The deprecated code mostly works itself through the new API showing that what could be done still can using the inew API. Did not want to update the standard handler to also check that desired class matches the lid(vid) so did not route those but they could also be done with a touch more code change just for that demonstration whcih is why it was not done.
- Loading branch information
Al Niessner
authored and
Al Niessner
committed
Sep 1, 2022
1 parent
bea5885
commit f526aa3
Showing
16 changed files
with
1,033 additions
and
196 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
39 changes: 39 additions & 0 deletions
39
service/src/main/java/gov/nasa/pds/api/registry/controller/Member.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,39 @@ | ||
package gov.nasa.pds.api.registry.controller; | ||
|
||
import java.io.IOException; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
|
||
import gov.nasa.pds.api.registry.ControlContext; | ||
import gov.nasa.pds.api.registry.ReferencingLogic; | ||
import gov.nasa.pds.api.registry.UserContext; | ||
import gov.nasa.pds.api.registry.exceptions.ApplicationTypeException; | ||
import gov.nasa.pds.api.registry.exceptions.LidVidNotFoundException; | ||
import gov.nasa.pds.api.registry.exceptions.MembershipException; | ||
import gov.nasa.pds.api.registry.exceptions.NothingFoundException; | ||
import gov.nasa.pds.api.registry.exceptions.UnknownGroupNameException; | ||
import gov.nasa.pds.api.registry.model.ReferencingLogicTransmuter; | ||
import gov.nasa.pds.api.registry.model.RequestAndResponseContext; | ||
|
||
class Member implements EndpointHandler | ||
{ | ||
final private boolean offspring, twoSteps; | ||
public Member (boolean offspring, boolean twoSteps) | ||
{ | ||
this.offspring = offspring; | ||
this.twoSteps = twoSteps; | ||
} | ||
|
||
@Override | ||
public ResponseEntity<Object> transmute(ControlContext control, UserContext content) | ||
throws ApplicationTypeException, IOException, LidVidNotFoundException, MembershipException, | ||
NothingFoundException, UnknownGroupNameException | ||
{ | ||
ReferencingLogic transmuter = ReferencingLogicTransmuter.getBySwaggerGroup(content.getGroup()).impl(); | ||
RequestAndResponseContext context = this.offspring ? transmuter.member(control, content, this.twoSteps) : | ||
transmuter.memberOf(control, content, this.twoSteps); | ||
return new ResponseEntity<Object>(context.getResponse(), HttpStatus.OK); | ||
} | ||
|
||
} |
Oops, something went wrong.