public int compare(JSSecurityDomain o1, JSSecurityDomain o2) { boolean o1HasOwner = o1.getOwnerDomain() != null; boolean o2HasOwner = o2.getOwnerDomain() != null; if (o1HasOwner==o2HasOwner){ return 0; } else if (o1HasOwner){ return 1; } else { return -1; } } });
public void write(Object o, OutputElement xml) throws XMLStreamException { try { JSSecurityDomain domain = (JSSecurityDomain) o; xml.setAttribute("name",domain.getName()); xml.setAttribute("ownerDomain",domain.getOwnerDomain()); xml.setAttribute("remote",domain.isRemote()); xml.setAttribute("enabled",domain.isEnabled()); } catch (Exception e) { e.printStackTrace(); } }
public void read(InputElement xml, Object o) { try { JSSecurityDomain domain = (JSSecurityDomain) o; domain.setName(xml.getAttribute("name").toString()); domain.setOwnerDomain(xml.getAttribute("ownerDomain",(String)null)); domain.setRemote(xml.getAttribute("remote",false)); domain.setEnabled(xml.getAttribute("enabled",true)); } catch (Exception e) { e.printStackTrace(); } } };
if (jsDomain.getName().equals(SecurityDomain.SYSTEM_NAME) || jsDomain.getName().equals(SecurityDomain.DEFAULT_NAME)){ break; if (jsDomain.getName().length() == 0){ throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "SecurityDomain", "Name of Security Domain must not be empty!" })); if (jsDomain.getOwnerDomain() != null){ if (jsDomain.getOwnerDomain().equals(SecurityDomain.SYSTEM_NAME)){ ownerDomainId=defaultDomainId; } else if (jsDomain.getOwnerDomain().equals(SecurityDomain.SYSTEM_NAME)) { ownerDomainId=systemDomainId; } else { SecurityDomain ownerDomain = domainAccessManager.getDomainByName(jsDomain.getOwnerDomain()); if (ownerDomain == null){ throw new SerializerException(SerializerException.CREATE_OBJECT_FAILED.create(new String[] { "SecurityDomain","Could not find owner domain with name "+jsDomain.getOwnerDomain()+"for domain with name "+jsDomain.getName()})); if (jsDomain.isRemote()){ ownerDomainId=defaultDomainId; newDomain.setName(jsDomain.getName()); newDomain.setOwnerDomainId(ownerDomainId); newDomain.setRemote(jsDomain.isRemote()); newDomain.setEnabled(jsDomain.isEnabled()); try{ domainStorageManager.addDomain(newDomain);