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

emissions grid using jersey #104

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

emissions grid using jersey #104

wants to merge 13 commits into from

Conversation

billyc
Copy link
Collaborator

@billyc billyc commented May 24, 2019

Seems to all be working and the Jersey code is WAAAAY better than what I had before.

@billyc billyc requested a review from Janekdererste May 24, 2019 13:19
while (result != null) {
log.info("-- JSON size: " + result.getSecond().length());

Bin b = new Bin();
Copy link
Member

@Janekdererste Janekdererste May 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use single character names

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're being pedantic, the code is crystal-clear, but I will fix it for you. Would Bin bin be more appropriate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I am. Yes it is.

b.setData(result.getSecond());
mergedViz.addBin(b);

result = analyzer.processNextTimeBin();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, we can leave it like this for now. But having a while loop with a null condition looks error prone. Maybe the Iterator Interface is what you want here? I'm not sure, but maybe that would come close to the yield return we were talking about.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main thing I was wondering about in this commit. It feels dirty to me as well. In Java I'm not sure what the least-errorprone / most-appropriate form would be. I'll look at the Iterator interface.

@Lob
private String data = "";
@OneToMany(mappedBy = "visualization", fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.ALL)
Set<Bin> bins = new HashSet();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bins property should be private.

}

@GET
@Path("/bins")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be a good idea to rename the endpoints.

data -> bin
bins -> startTimes

return findVisualization(agent, vizId).getData();
if (startTimes == null)
throw new InvalidInputException("No time bins found");
return startTimes;
}

private Visualization findVisualization(Agent agent, String vizId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this method still used? otherwise please remove.

Copy link
Member

@Janekdererste Janekdererste left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make changes and merge

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

Successfully merging this pull request may close these issues.

3 participants