}
public void addModulesToXml(Element parentElement, ModuleGroup group) throws FileNotFoundException {
Iterator<Module> it = group.getModules().iterator();
while (it.hasNext()) {
Module module = it.next();
logger.debug("Adding module "+module.getModuleName()+" to xml");
Element element = new Element("module");
element.setAttribute("id",String.valueOf(module.getId()));
element.setAttribute("moduleName",module.getModuleName());
if (module.getName()!=null)
element.setAttribute("name",module.getName());
if (module.getLongName()!=null)
element.setAttribute("longName",module.getLongName());
if (module.getDescription()!=null)
element.setAttribute("description",module.getDescription());
if (module.getIcon()!=null)
element.setAttribute("icon",module.getIcon());
if (module.getClientPanel()!=null)
element.setAttribute("clientPanel",module.getClientPanel());
Element permissionElement = new Element("permissions");
Element ownerElement = new Element("owner");
ownerElement.setAttribute("name",module.getOwner().getUserName());
permissionElement.addContent(ownerElement);
Element groupElement = new Element("group");
groupElement.setAttribute("name",module.getGroup().getGroupName());
permissionElement.addContent(groupElement);
Element permElement = new Element("permissions");
permElement.setAttribute("readUser",String.valueOf(module.isReadUser()));
permElement.setAttribute("readGroup",String.valueOf(module.isReadGroup()));
permElement.setAttribute("readOther",String.valueOf(module.isReadOther()));
permElement.setAttribute("writeUser",String.valueOf(module.isWriteUser()));
permElement.setAttribute("writeGroup",String.valueOf(module.isWriteGroup()));
permElement.setAttribute("writeOther",String.valueOf(module.isWriteOther()));
permissionElement.addContent(permElement);
element.addContent(permissionElement);