* @param apRoot
* @param xmlDoc
* @return Element
*/
public static Element getAuthorizationXml (ChannelStaticData sd, Element apRoot, Document xmlDoc) {
IAuthorizationPrincipal ap = sd.getAuthorizationPrincipal();
String princTagname = "principal";
if (ap != null && apRoot == null) {
apRoot = xmlDoc.createElement(princTagname);
apRoot.setAttribute("token", ap.getPrincipalString());
apRoot.setAttribute("type", ap.getType().getName());
String name = ap.getKey();
try {
name = EntityNameFinderService.instance().getNameFinder(ap.getType()).getName(name);
} catch (Exception e) {
Utility.logMessage("ERROR", e.toString(), e);
}
apRoot.setAttribute("name", name);
}
try {
// owner, activity, target
IPermission[] perms = ap.getAllPermissions(OWNER, null, null);
for (int yy = 0; yy < perms.length; yy++) {
Element prm = getPermissionXml(xmlDoc, perms[yy].getPrincipal(), perms[yy].getActivity(),
perms[yy].getType(), perms[yy].getTarget());
apRoot.appendChild(prm);
}