Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

261: lookup product class when group not explicitly given #263

Merged
merged 4 commits into from
Mar 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import gov.nasa.pds.api.registry.exceptions.UnknownGroupNameException;
import gov.nasa.pds.api.registry.model.ReferencingLogicTransmuter;
import gov.nasa.pds.api.registry.model.RequestAndResponseContext;
import gov.nasa.pds.api.registry.search.QuickSearch;

class Member implements EndpointHandler
{
Expand All @@ -30,7 +31,11 @@ public ResponseEntity<Object> transmute(ControlContext control, UserContext cont
throws ApplicationTypeException, IOException, LidVidNotFoundException, MembershipException,
NothingFoundException, UnknownGroupNameException
{
ReferencingLogic transmuter = ReferencingLogicTransmuter.getBySwaggerGroup(content.getGroup()).impl();
ReferencingLogic transmuter;

if (0 < content.getGroup().length()) transmuter = ReferencingLogicTransmuter.getBySwaggerGroup(content.getGroup()).impl();
else transmuter = ReferencingLogicTransmuter.getByProductClass(QuickSearch.getValue(control.getConnection(), false, content.getLidVid(), "product_class")).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);
Expand Down