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

Groups API #1565

Merged
merged 7 commits into from
Sep 16, 2016
Merged

Groups API #1565

merged 7 commits into from
Sep 16, 2016

Conversation

juanluisrp
Copy link
Contributor

Add an API to retrieve the group logo

Add an API to retrieve the group logo
Path imagePath = null;
FileTime lastModifiedTime = null;
if (StringUtils.isNotBlank(logoUUID) && !logoUUID.startsWith("http://") && !logoUUID.startsWith("https//")) {
imagePath = Resources.findImagePath(logoUUID,
Copy link
Member

Choose a reason for hiding this comment

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

Would be better to use a Utility function. Pretty sure there is more than one time this in the code.
Maybe use this https://github.com/geonetwork/core-geonetwork/blob/develop/services/src/main/java/org/fao/geonet/api/records/attachments/AttachmentsApi.java#L298 and we should move that to a Utility class.

Copy link
Contributor Author

@juanluisrp juanluisrp May 30, 2016

Choose a reason for hiding this comment

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

There is already a class to find the mime type in GN, MimeTypeFinder, but it degrades a lot the performance of the detection and it causes ConcurrentModificationException when multiple threads are querying the mime type of the same file.

@fxprunayre fxprunayre added this to the 3.1.0 milestone May 26, 2016
@fxprunayre
Copy link
Member

LGTM @juanluisrp, only minor comments. We should discuss in Bolsena some global stuff like ServiceContext.get() null check, i18n for exception (eg. https://github.com/geonetwork/core-geonetwork/blob/develop/services/src/main/java/org/fao/geonet/api/user/AccountCreationApi.java#L92).

throw new RuntimeException("ServiceContext not available");
}

GroupRepository groupRepository = context.getBean(GroupRepository.class);
Copy link
Member

Choose a reason for hiding this comment

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

@fxprunayre I was discussing with @juanluisrp about using @Autowired instead. Can that cause any issue with multinode feature?

The code in GeoNetwork seem mixed with both methods to get beans. If not a problem for multinode I would prefer we switch to @Autowired.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, it will be an issue with multinode. It looks like we might be able to define custom scope of Bean and be able to use Autowired even in multinode mode but I'm not really sure how and no support here to make progress on it.

So for the time being, the rule remains:

  • use Autowired if a bean is shared by all nodes
  • use getBean if not (which is the case most of the time unfortunately)

Copy link
Contributor Author

@juanluisrp juanluisrp May 30, 2016

Choose a reason for hiding this comment

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

For the i18n of the Exceptions, current implementation of LanguageUtils.parseAcceptLanguage doesn't work well because the three letters ISO code stored in the languages bean don't match the ones returned by Locale.getISO3Language. For example, the languagelist contains "fre" for French, but getISO3Language returns "fra".

Copy link
Member

Choose a reason for hiding this comment

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

doesn't work well because the three letters ISO cod

Yep this is something to discuss and see how we should handle that.

* Retrieve the exception message from a properties file.
* Add a log message instead of printing it to the standard output.
* Remove an extra space in the exception error message.
@juanluisrp
Copy link
Contributor Author

A couple of changes I've made related with i18n. The messages resource bundle is injected in the controller and I let it to format the message instead of using String.format(). This implies that the message format now uses {0}, {1}... for the params, instead of %s, as defined in MessageFormat.

@fxprunayre
Copy link
Member

This PR needs an update due to conflicts.

@juanluisrp
Copy link
Contributor Author

@fxprunayre conflicts resolved

@juanluisrp juanluisrp self-assigned this Sep 9, 2016
@Delawen Delawen merged commit 01cf746 into geonetwork:develop Sep 16, 2016
@juanluisrp juanluisrp deleted the groups-api branch September 16, 2016 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants