21,6 → 21,8 |
import ak.backpath.BackPath; |
|
import ak.hostcaptain.util.StringConverter; |
import ak.hostcaptain.util.UserException; |
import ak.hostcaptain.core.CoreResources; |
import ak.hostcaptain.core.model.User; |
import ak.hostcaptain.core.model.UserManager; |
import ak.hostcaptain.core.model.InetDomain; |
58,14 → 60,16 |
else if("edit".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
Long domainId = StringConverter.parseLong(theForm.get("id")); |
InetDomain domain; |
DynaActionForm showForm = (DynaActionForm)RequestUtilsX.populateActionForm( |
this, request, "ak.hostcaptain.core.form.InetDomainEditForm"); |
|
if(domainId == null) { |
domain = InetDomainManager.getInstance().create(user); |
showForm.set("enabled", new Boolean(true)); |
} |
else { |
InetDomain domain = InetDomainManager.getInstance().get(user, domainId); |
domain = InetDomainManager.getInstance().get(user, domainId); |
showForm.set("name", domain.getName()); |
if(domain.getOwner() != null) |
showForm.set("owner", StringConverter.toString(domain.getOwner().getId())); |
74,7 → 78,11 |
} |
|
initUserList(request, user); |
request.setAttribute("domain", domain); |
if(domain.editableBy(user)) |
return mapping.findForward("default"); |
else |
return mapping.findForward("view"); |
} |
else if("delete".equals(mapping.getParameter())) { |
DynaActionForm theForm = (DynaActionForm)form; |
97,7 → 105,13 |
domain = InetDomainManager.getInstance().get(user, domainId); |
} |
|
domain.setName(user, (String)theForm.get("name")); |
String name = (String)theForm.get("name"); |
if(InetDomainManager.getInstance().nameExists(user, domain, name)) { |
handleErrors(mapping, form, request, response); |
throw new UserException(CoreResources.NONUNIQUE_DOMAIN_NAME); |
} |
domain.setName(user, name); |
|
domain.setOwner(user, UserManager.getInstance().get(user, |
StringConverter.parseLong(theForm.get("owner")))); |
|