//---
//--------------------------------------------------------------------------
public Element exec(Element params, ServiceContext context) throws Exception
{
AccessManager am = context.getBean(AccessManager.class);
String metadataId = Utils.getIdentifierFromParameters(params, context);
//-----------------------------------------------------------------------
//--- check access
Metadata info = context.getBean(MetadataRepository.class).findOne(metadataId);
if (info == null)
throw new MetadataNotFoundEx(metadataId);
Element ownerId = new Element("ownerid").setText(info.getSourceInfo().getOwner() + "");
Element groupOwner = new Element("groupOwner").setText(info.getSourceInfo().getGroupOwner() + "");
Element hasOwner = new Element("owner");
if (am.isOwner(context, metadataId))
hasOwner.setText("true");
else
hasOwner.setText("false");
//--- get all operations
OperationRepository opRepository = context.getBean(OperationRepository.class);
List<Operation> operationList = opRepository.findAll();
// elOper is for returned XML and keeps backwards compatibility
Element elOper = new Element(Geonet.Elem.OPERATIONS);
for (Operation operation : operationList) {
elOper.addContent(operation.asXml());
}
//-----------------------------------------------------------------------
//--- retrieve groups operations
Set<Integer> userGroups = am.getUserGroups(context.getUserSession(), context.getIpAddress(), false);
Element elGroup = context.getBean(GroupRepository.class).findAllAsXml();
final UserGroupRepository userGroupRepository = context.getBean(UserGroupRepository.class);
OperationAllowedRepository opAllowRepository = context.getBean(OperationAllowedRepository.class);