Description description = securityFactory.createDescription();
description.setValue("security-subjectinfo-description");
subject.getDescription().add(description);
security.setDefaultSubject(subject);
RoleMappings roleMappings = securityFactory.createRoleMappings();
Role role = securityFactory.createRole();
role.setRoleName("security-role");
SubjectInfo subjectInfo = securityFactory.createSubjectInfo();
subjectInfo.setId("security-role-subjectinfo-id");
subjectInfo.setRealm("security-role-subjectinfo-realm");
description = securityFactory.createDescription();
description.setValue("security-role-subjectinfo-description");
subjectInfo.getDescription().add(description);
role.setRunAsSubject(subjectInfo);
description = securityFactory.createDescription();
description.setValue("security-role-description");
role.getDescription().add(description);
DistinguishedName distinguishedName = securityFactory.createDistinguishedName();
distinguishedName.setName("security-role-distinguishedname");
description = securityFactory.createDescription();
description.setValue("security-role-distinguished-name-description");
distinguishedName.getDescription().add(description);
role.getDistinguishedName().add(distinguishedName);
LoginDomainPrincipal loginDomainPrincipal = securityFactory.createLoginDomainPrincipal();
loginDomainPrincipal.setDomainName("security-role-logindomainprincipal-domainname");
loginDomainPrincipal.setName("security-role-logindomainprincipal-name");
loginDomainPrincipal.setClazz("security-role-logindomainprincipal-class");
description = securityFactory.createDescription();
description.setValue("security-role-logindomainprincipal-description");
loginDomainPrincipal.getDescription().add(description);
role.getLoginDomainPrincipal().add(loginDomainPrincipal);
Principal principal = securityFactory.createPrincipal();
principal.setName("security-role-principal-name");
principal.setClazz("security-role-principal-class");
description = securityFactory.createDescription();
description.setValue("security-role-principal-description");
principal.getDescription().add(description);
role.getPrincipal().add(principal);
RealmPrincipal realmPrincipal = securityFactory.createRealmPrincipal();
realmPrincipal.setName("security-role-realmprincipal-name");
realmPrincipal.setClazz("security-role-realmprincipal-class");
description = securityFactory.createDescription();
description.setValue("security-role-realmprincipal-description");
realmPrincipal.getDescription().add(description);
role.getRealmPrincipal().add(realmPrincipal);
roleMappings.getRole().add(role);
security.setRoleMappings(roleMappings);
application.setSecurity(applicationFactory.createSecurity(security));
JAXBElement<Application> jaxbElement = applicationFactory.createApplication(application);