* @return
* @throws Exception
*/
public Element exec(Element inParams, ServiceContext context) throws Exception
{
GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
SettingManager sm = gc.getBean(SettingManager.class);
Element params = (Element)inParams.clone();
// --- if we have a parameter specified in the config then use it instead
// --- of the usual params
String ptype = _config.getValue("type");
if (ptype != null) {
params.removeContent();
params.addContent(new Element("type").setText(ptype));
}
Element result = new Element("root");
@SuppressWarnings("unchecked")
List<Element> types = params.getChildren("type");
for (Element el : types) {
String type = el.getText();
if (type.equals("site")) {
result.addContent(gc.getBean(SettingManager.class).getValues(
new String[]{
SettingManager.SYSTEM_SITE_NAME_PATH,
"system/site/organization",
SettingManager.SYSTEM_SITE_SITE_ID_PATH,
"system/platform/version",
"system/platform/subVersion"
}));
} else if (type.equals("config")) {
// Return a set of properties which define what
// to display or not in the user interface
final List<Setting> publicSettings = context.getBean(SettingRepository.class).findAllByInternal(false);
List<String> publicSettingsKey = new ArrayList<String>();
for(Setting s : publicSettings) {
publicSettingsKey.add(s.getName());
}
result.addContent(new Element("config").addContent(gc.getBean(SettingManager.class).getValues(
publicSettingsKey.toArray(new String[0]))));
} else if (type.equals("inspire")) {
result.addContent(gc.getBean(SettingManager.class).getValues(
new String[]{
"system/inspire/enableSearchPanel",
"system/inspire/enable"
}));
} else if (type.equals("harvester")) {
result.addContent(gc.getBean(SettingManager.class).getValues(
new String[]{ "system/harvester/enableEditing"}));
} else if (type.equals("userGroupOnly")) {
result.addContent(gc.getBean(SettingManager.class).getValues(
new String[]{"system/metadataprivs/usergrouponly"}));
} else if (type.equals("categories")) {
result.addContent(context.getBean(MetadataCategoryRepository.class).findAllAsXml());
} else if (type.equals("groups")) {
String profile = params.getChildText("profile");
Element r = getGroups(context, Profile.findProfileIgnoreCase(profile), false);
result.addContent(r);
} else if (type.equals("groupsIncludingSystemGroups")) {
Element r = getGroups(context, null, true);
result.addContent(r);
} else if (type.equals("operations")) {
result.addContent(context.getBean(OperationRepository.class).findAllAsXml());
} else if (type.equals("regions")) {
RegionsDAO dao = context.getApplicationContext().getBean(RegionsDAO.class);
Element regions = dao.createSearchRequest(context).xmlResult();
result.addContent(regions);
} else if (type.equals("isolanguages")) {
result.addContent(context.getBean(IsoLanguageRepository.class).findAllAsXml());
} else if (type.equals("sources")) {
result.addContent(getSources(context, sm));
} else if (type.equals("users")) {
result.addContent(getUsers(context));
} else if (type.equals("templates")) {
result.addContent(getTemplates(context));
} else if (type.equals("z3950repositories")) {
result.addContent(getZRepositories(context, sm));
} else if (type.equals("me")) {
result.addContent(getMyInfo(context));
} else if (type.equals("auth")) {
result.addContent(getAuth(context));
} else if (type.equals(READ_ONLY)) {
result.addContent(getReadOnly(gc));
} else if (type.equals(INDEX)) {
result.addContent(getIndex(gc));
} else if (type.equals("schemas")) {
result.addContent(getSchemas(gc.getBean(SchemaManager.class)));
} else if (type.equals("status")) {
result.addContent(context.getBean(StatusValueRepository.class).findAllAsXml());
} else {