Locale locale = LanguageCodeConverters.languageCodeToLocale(params[1]);
if (StringUtils.isEmpty(request.getParameter("path"))
&& StringUtils.isEmpty(request.getParameter("nodeuuid"))
&& StringUtils.isEmpty(request.getParameter("type"))) {
throw new JahiaBadRequestException("One of therequired parameters is missing");
}
ExtendedNodeType type = null;
JCRSessionWrapper session = JCRSessionFactory.getInstance().getCurrentUserSession(
workspace, locale);
JCRNodeWrapper node = null;
try {
if (request.getParameter("path") != null) {
node = session.getNode(request.getParameter("path"));
type = node.getPrimaryNodeType();
} else if (request.getParameter("nodeuuid") != null) {
node = session.getNodeByUUID(request.getParameter("nodeuuid"));
type = node.getPrimaryNodeType();
} else {
node = null;
type = NodeTypeRegistry.getInstance().getNodeType(request.getParameter("type"));
}
} catch (PathNotFoundException e) {
throw new JahiaBadRequestException(e);
} catch (ItemNotFoundException e) {
throw new JahiaBadRequestException(e);
} catch (NoSuchNodeTypeException e) {
throw new JahiaBadRequestException(e);
}
if (type == null) {
throw new JahiaBadRequestException("Cannot determine node type");
}
ExtendedPropertyDefinition definition = type.getPropertyDefinition(name);
if (definition == null) {
throw new JahiaBadRequestException("Unable to find property defintion with the name '"
+ name + "'");
}
JSONArray results = new JSONArray();