Document aDoc = sessionData.model;
Element rootElem = (anElem != null ? anElem : GroupsManagerXML.createElement(ELEMENT_TAGNAME,
aDoc, false));
Utility.logMessage("DEBUG", "EntityWrapper.getXml(): START, Element: " + rootElem);
try {
IEntity ent = (IEntity) gm;
rootElem.setAttribute("id", GroupsManagerXML.getNextUid());
rootElem.setAttribute("key", gm.getKey());
rootElem.setAttribute("type", gm.getLeafType().getName());
rootElem.setAttribute("displayName", GroupsManagerXML.getEntityName(ent.getLeafType(),
ent.getKey()));
rootElem.setAttribute("selected", "false");
// set user permissions for entity
IGroupsManagerPermissions gmp = sessionData.gmPermissions;
IAuthorizationPrincipal ap = sessionData.authPrincipal;
applyPermissions (rootElem, gm, gmp, ap);