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

JsonQueryObjectModelConverter#toJson: ignores QueryPart#addGuid #1255

Open
mhendrikxce opened this issue May 24, 2022 · 3 comments
Open

JsonQueryObjectModelConverter#toJson: ignores QueryPart#addGuid #1255

mhendrikxce opened this issue May 24, 2022 · 3 comments

Comments

@mhendrikxce
Copy link

mhendrikxce commented May 24, 2022

I believe the GUID filter of QueryPart is ignored.

To reproduce:

  1. Create a Query with a QueryPart that adds a GUID using addGuid
  2. Pass query to ClientIfcModel#queryNew with a IfcModelChangeListener that prints all added
  3. Notice that all components are loaded

Problem analysis
The issue is that JsonQueryObjectModelConverter#toJson skips the QueryPart's GUID's.

Adding:

if (queryPart.hasGuids()) {
    ArrayNode guidsNode = OBJECT_MAPPER.createArrayNode();
    queryPartNode.set("guids", guidsNode);
    for (String guid : queryPart.getGuids()) {
        guidsNode.add(guid);
    }
}

under the block processing the oids in the toJson method seems to resolve the issue.

@hlg
Copy link
Member

hlg commented May 24, 2022

Looks plausible. Thanks for reporting! Would you like to make a pull request?
For reference, here is the OIDs block:

if (queryPart.hasOids()) {
ArrayNode oidsNode = OBJECT_MAPPER.createArrayNode();
queryPartNode.set("oids", oidsNode);
for (long oid : queryPart.getOids()) {
oidsNode.add(oid);
}
}

@mhendrikxce
Copy link
Author

mhendrikxce commented May 24, 2022

Thanks for the fast reply and follow-up!

I'll follow-up with a PR.

@mhendrikxce
Copy link
Author

Read for review: #1257

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants