use of org.springframework.context.NoSuchMessageException in project ORCID-Source by ORCID.
the class ProfileEntityManagerImpl method getApplications.
@Override
public List<ApplicationSummary> getApplications(String orcid) {
List<OrcidOauth2TokenDetail> tokenDetails = orcidOauth2TokenService.findByUserName(orcid);
List<ApplicationSummary> applications = new ArrayList<ApplicationSummary>();
Map<Pair<String, Set<ScopePathType>>, ApplicationSummary> existingApplications = new HashMap<Pair<String, Set<ScopePathType>>, ApplicationSummary>();
if (tokenDetails != null && !tokenDetails.isEmpty()) {
for (OrcidOauth2TokenDetail token : tokenDetails) {
if (token.getTokenDisabled() == null || !token.getTokenDisabled()) {
ClientDetailsEntity client = clientDetailsEntityCacheManager.retrieve(token.getClientDetailsId());
if (client != null) {
ApplicationSummary applicationSummary = new ApplicationSummary();
// Check the scopes
Set<ScopePathType> scopesGrantedToClient = ScopePathType.getScopesFromSpaceSeparatedString(token.getScope());
Map<ScopePathType, String> scopePathMap = new HashMap<ScopePathType, String>();
String scopeFullPath = ScopePathType.class.getName() + ".";
for (ScopePathType tempScope : scopesGrantedToClient) {
try {
scopePathMap.put(tempScope, localeManager.resolveMessage(scopeFullPath + tempScope.toString()));
} catch (NoSuchMessageException e) {
LOGGER.warn("No message to display for scope " + tempScope.toString());
}
}
// the application summary element
if (!scopePathMap.isEmpty()) {
applicationSummary.setScopePaths(scopePathMap);
applicationSummary.setOrcidHost(orcidUrlManager.getBaseHost());
applicationSummary.setOrcidUri(orcidUrlManager.getBaseUriHttp() + "/" + client.getId());
applicationSummary.setOrcidPath(client.getId());
applicationSummary.setName(client.getClientName());
applicationSummary.setWebsiteValue(client.getClientWebsite());
applicationSummary.setApprovalDate(token.getDateCreated());
applicationSummary.setTokenId(String.valueOf(token.getId()));
// Add member information
if (!PojoUtil.isEmpty(client.getGroupProfileId())) {
ProfileEntity member = profileEntityCacheManager.retrieve(client.getGroupProfileId());
applicationSummary.setGroupOrcidPath(member.getId());
applicationSummary.setGroupName(getMemberDisplayName(member));
}
if (shouldBeAddedToTheApplicationsList(applicationSummary, scopesGrantedToClient, existingApplications)) {
applications.add(applicationSummary);
}
}
}
}
}
}
return applications;
}
use of org.springframework.context.NoSuchMessageException in project webofneeds by researchstudio-sat.
the class LinkedDataWebController method readAtomDeep.
/**
* This request URL should be protected by WebID filter because the result
* contains events data - which is data with restricted access. See
* filterChainProxy in node-context.xml.
*
* @param request
* @param identifier
* @return
*/
@RequestMapping(value = "${uri.path.data}/atom/{identifier}/deep", method = RequestMethod.GET, produces = { "application/ld+json", "application/trig", "application/n-quads" })
public ResponseEntity<Dataset> readAtomDeep(HttpServletRequest request, @PathVariable(value = "identifier") String identifier, @RequestParam(value = "layer-size", required = false) Integer layerSize) {
logger.debug("readAtom() called");
URI atomUri = URI.create(this.atomResourceURIPrefix + "/" + identifier);
try {
Dataset dataset = linkedDataService.getAtomDataset(atomUri, true, layerSize, WonAclRequestHelper.getWonAclEvaluationContext(request));
// TODO: atom information does change over time. The immutable atom information
// should never expire, the mutable should
HttpHeaders headers = new HttpHeaders();
addCORSHeader(headers);
return new ResponseEntity<>(dataset, headers, HttpStatus.OK);
} catch (NoSuchAtomException | NoSuchConnectionException | NoSuchMessageException e) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
}
use of org.springframework.context.NoSuchMessageException in project spring-framework by spring-projects.
the class MessageTag method doEndTag.
/**
* Resolves the message, escapes it if demanded,
* and writes it to the page (or exposes it as variable).
* @see #resolveMessage()
* @see org.springframework.web.util.HtmlUtils#htmlEscape(String)
* @see org.springframework.web.util.JavaScriptUtils#javaScriptEscape(String)
* @see #writeMessage(String)
*/
@Override
public int doEndTag() throws JspException {
try {
// Resolve the unescaped message.
String msg = resolveMessage();
// HTML and/or JavaScript escape, if demanded.
msg = htmlEscape(msg);
msg = this.javaScriptEscape ? JavaScriptUtils.javaScriptEscape(msg) : msg;
// Expose as variable, if demanded, else write to the page.
if (this.var != null) {
this.pageContext.setAttribute(this.var, msg, TagUtils.getScope(this.scope));
} else {
writeMessage(msg);
}
return EVAL_PAGE;
} catch (IOException ex) {
throw new JspTagException(ex.getMessage(), ex);
} catch (NoSuchMessageException ex) {
throw new JspTagException(getNoSuchMessageExceptionDescription(ex));
}
}
Aggregations