From 93db501810a8ae2b2cb13c03139873ee6e0715fb Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Thu, 16 Dec 2010 17:24:21 +0000 Subject: [PATCH] Weitere Module --- .../src/de/hsadmin/mods/email/EMailAlias.java | 7 ++-- .../mods/email/EMailAliasModuleImpl.java | 2 +- .../de/hsadmin/remote/EMailAddressRemote.java | 16 ++++----- .../de/hsadmin/remote/QueueTaskRemote.java | 14 +++++--- hsarweb/WebContent/WEB-INF/web.xml | 2 +- hsarweb/build.xml | 1 + hsarweb/src/de/hsadmin/web/GenericModule.java | 3 +- .../src/de/hsadmin/web/MainApplication.java | 6 ++-- .../src/de/hsadmin/web/QueueTaskModule.java | 31 ++++++++++++++++++ .../src/de/hsadmin/web/UnixUserModule.java | 30 +++++++++++++++++ hsarweb/src/icons/database.png | Bin 0 -> 390 bytes hsarweb/src/icons/database_key.png | Bin 0 -> 764 bytes hsarweb/src/icons/table.png | Bin 0 -> 566 bytes hsarweb/src/icons/table_key.png | Bin 0 -> 746 bytes hsarweb/src/texts/domain.properties | 4 +-- hsarweb/src/texts/domain_de.properties | 4 +-- hsarweb/src/texts/emailaddress.properties | 4 +-- hsarweb/src/texts/emailaddress_de.properties | 4 +-- hsarweb/src/texts/emailalias.properties | 4 +-- hsarweb/src/texts/emailalias_de.properties | 4 +-- hsarweb/src/texts/main.properties | 2 +- hsarweb/src/texts/q.properties | 10 ++++++ hsarweb/src/texts/q_de.properties | 10 ++++++ hsarweb/src/texts/user.properties | 11 +++++++ hsarweb/src/texts/user_de.properties | 11 +++++++ 25 files changed, 144 insertions(+), 36 deletions(-) create mode 100644 hsarweb/src/de/hsadmin/web/QueueTaskModule.java create mode 100644 hsarweb/src/de/hsadmin/web/UnixUserModule.java create mode 100644 hsarweb/src/icons/database.png create mode 100644 hsarweb/src/icons/database_key.png create mode 100644 hsarweb/src/icons/table.png create mode 100644 hsarweb/src/icons/table_key.png create mode 100644 hsarweb/src/texts/q.properties create mode 100644 hsarweb/src/texts/q_de.properties create mode 100644 hsarweb/src/texts/user.properties create mode 100644 hsarweb/src/texts/user_de.properties diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAlias.java b/hsarback/src/de/hsadmin/mods/email/EMailAlias.java index 92fa609..050500a 100644 --- a/hsarback/src/de/hsadmin/mods/email/EMailAlias.java +++ b/hsarback/src/de/hsadmin/mods/email/EMailAlias.java @@ -30,8 +30,7 @@ import de.hsadmin.mods.user.UnixUser; @Table(name = "emailalias") @SequenceGenerator(name = "EMailAliasesSeqGen", sequenceName = "emailalias_emailalias_id_seq") @EntityInfo(name = "E-Mail-Alias") -@SearchFilter("pac = :loginUserPac OR " - + "pac.customer.name = :loginUserName") +@SearchFilter("obj.pac = :loginUserPac OR obj.pac.customer.name = :loginUserName") public class EMailAlias extends AbstractEntity implements Serializable { private static final long serialVersionUID = -4711415079723587161L; @@ -192,9 +191,9 @@ public class EMailAlias extends AbstractEntity implements Serializable { public static String restriction() { return // all aliases of all pacs of customer - "pac.customer.name=:loginUserName OR " + + "obj.pac.customer.name=:loginUserName OR " + // all aliases of packet admin - "pac.name=:loginUserName"; + "obj.pac.name=:loginUserName"; } } diff --git a/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java b/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java index c4a436c..caf4c9b 100644 --- a/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java +++ b/hsarback/src/de/hsadmin/mods/email/EMailAliasModuleImpl.java @@ -12,7 +12,7 @@ public class EMailAliasModuleImpl extends AbstractModuleImpl { public List search(Class entityClass, String condition, String orderBy) throws HSAdminException { if (orderBy == null || orderBy.length() == 0) { - orderBy = "ORDER BY name ASC"; + orderBy = "ORDER BY obj.name ASC"; } return super.search(entityClass, condition, orderBy); } diff --git a/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java b/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java index ce984fc..80d76b2 100644 --- a/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java +++ b/hsarback/src/de/hsadmin/remote/EMailAddressRemote.java @@ -21,14 +21,14 @@ public class EMailAddressRemote extends AbstractRemote { String emailaddress = adr.getEMailAddress(); String fulldomain = adr.getFullDomain(); map.put("id", Long.toString(id)); - map.put("domain", domain); - map.put("admin", admin); - map.put("pac", pac); - map.put("target", target); - map.put("localpart", localpart); - map.put("subdomain", subdomain); - map.put("emailaddress", emailaddress); - map.put("fulldomain", fulldomain); + if (assertNotNull(domain)) map.put("domain", domain); + if (assertNotNull(admin)) map.put("admin", admin); + if (assertNotNull(pac)) map.put("pac", pac); + if (assertNotNull(target)) map.put("target", target); + if (assertNotNull(localpart)) map.put("localpart", localpart); + if (assertNotNull(subdomain)) map.put("subdomain", subdomain); + if (assertNotNull(emailaddress)) map.put("emailaddress", emailaddress); + if (assertNotNull(fulldomain)) map.put("fulldomain", fulldomain); } @Override diff --git a/hsarback/src/de/hsadmin/remote/QueueTaskRemote.java b/hsarback/src/de/hsadmin/remote/QueueTaskRemote.java index 53fdc61..632e43e 100644 --- a/hsarback/src/de/hsadmin/remote/QueueTaskRemote.java +++ b/hsarback/src/de/hsadmin/remote/QueueTaskRemote.java @@ -7,6 +7,8 @@ import java.util.Map; import de.hsadmin.core.model.AbstractEntity; import de.hsadmin.core.qserv.QueueTask; +import de.hsadmin.core.qserv.QueueTask.QueueTaskStatus; +import de.hsadmin.mods.user.UnixUser; public class QueueTaskRemote extends AbstractRemote { @@ -21,11 +23,13 @@ public class QueueTaskRemote extends AbstractRemote { protected void entity2map(AbstractEntity entity, Map resultMap) { QueueTask task = (QueueTask) entity; resultMap.put("id", Long.toString(task.getId())); - resultMap.put("status", task.getStatus().toString()); - resultMap.put("title", task.getTitle()); - resultMap.put("details", task.getDetails()); - resultMap.put("exception", task.getException()); - resultMap.put("user", task.getUser().getName()); + QueueTaskStatus status = task.getStatus(); + if (status != null) resultMap.put("status", status.toString()); + if (assertNotNull(task.getTitle())) resultMap.put("title", task.getTitle()); + if (assertNotNull(task.getDetails())) resultMap.put("details", task.getDetails()); + if (assertNotNull(task.getException())) resultMap.put("exception", task.getException()); + UnixUser user = task.getUser(); + if (user != null) resultMap.put("user", user.getName()); Date started = task.getStarted(); if (assertNotNull(started)) { resultMap.put("started", df.format(started)); diff --git a/hsarweb/WebContent/WEB-INF/web.xml b/hsarweb/WebContent/WEB-INF/web.xml index f2d2dfe..90ed4dd 100644 --- a/hsarweb/WebContent/WEB-INF/web.xml +++ b/hsarweb/WebContent/WEB-INF/web.xml @@ -25,7 +25,7 @@ HSAdmin Module hsarmodules - de.hsadmin.web.DomainModule,de.hsadmin.web.EMailAddressModule,de.hsadmin.web.EMailAliasModule + de.hsadmin.web.UnixUserModule,de.hsadmin.web.DomainModule,de.hsadmin.web.EMailAddressModule,de.hsadmin.web.EMailAliasModule,de.hsadmin.web.QueueTaskModule diff --git a/hsarweb/build.xml b/hsarweb/build.xml index 0a0d023..2d69b64 100644 --- a/hsarweb/build.xml +++ b/hsarweb/build.xml @@ -15,6 +15,7 @@ + diff --git a/hsarweb/src/de/hsadmin/web/GenericModule.java b/hsarweb/src/de/hsadmin/web/GenericModule.java index 65ffb3d..f2dcd86 100644 --- a/hsarweb/src/de/hsadmin/web/GenericModule.java +++ b/hsarweb/src/de/hsadmin/web/GenericModule.java @@ -1,5 +1,6 @@ package de.hsadmin.web; +import java.io.Serializable; import java.text.DateFormat; import java.text.ParseException; import java.util.Calendar; @@ -20,7 +21,7 @@ import com.vaadin.ui.themes.BaseTheme; import de.hsadmin.web.config.ModuleConfig; import de.hsadmin.web.config.PropertyConfig; -public abstract class GenericModule { +public abstract class GenericModule implements Serializable { private static final long serialVersionUID = 1L; private static final DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT); diff --git a/hsarweb/src/de/hsadmin/web/MainApplication.java b/hsarweb/src/de/hsadmin/web/MainApplication.java index ed03054..07d7875 100644 --- a/hsarweb/src/de/hsadmin/web/MainApplication.java +++ b/hsarweb/src/de/hsadmin/web/MainApplication.java @@ -41,7 +41,7 @@ public class MainApplication extends Application implements HttpServletRequestLi public void init() { localeConfig = new LocaleConfig(Locale.getDefault(), "main"); remote = new Remote(this); - Window mainWindow = new Window(localeConfig.getText("title")); + Window mainWindow = new Window(localeConfig.getText("applicationtitle")); TabSheet tabs = new TabSheet(); tabs.setWidth(100.0f, Sizeable.UNITS_PERCENTAGE); tabs.setHeight(680.0f, Sizeable.UNITS_PIXELS); @@ -56,9 +56,9 @@ public class MainApplication extends Application implements HttpServletRequestLi firstModule = module; } ModuleConfig moduleConfig = module.getModuleConfig(); - String label = moduleConfig.getLabel("title"); + String label = moduleConfig.getLabel("moduletitle"); modules.put(label, module); - tabs.addTab(module.getComponent(), label, new ThemeResource(moduleConfig.getLabel("icon"))); + tabs.addTab(module.getComponent(), label, new ThemeResource(moduleConfig.getLabel("moduleicon"))); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); diff --git a/hsarweb/src/de/hsadmin/web/QueueTaskModule.java b/hsarweb/src/de/hsadmin/web/QueueTaskModule.java new file mode 100644 index 0000000..d63385c --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/QueueTaskModule.java @@ -0,0 +1,31 @@ +package de.hsadmin.web; + +import java.util.Date; + +import de.hsadmin.web.config.ModuleConfig; +import de.hsadmin.web.config.PropertyConfig; + +public class QueueTaskModule extends GenericModule { + + private static final long serialVersionUID = 1L; + + private ModuleConfig moduleConfig; + + public QueueTaskModule() { + moduleConfig = new ModuleConfig("q"); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "title", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "status", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "started", Date.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "finished", Date.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "user", String.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "details", String.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "exception", String.class, "", true)); + } + + @Override + public ModuleConfig getModuleConfig() { + return moduleConfig; + } + +} diff --git a/hsarweb/src/de/hsadmin/web/UnixUserModule.java b/hsarweb/src/de/hsadmin/web/UnixUserModule.java new file mode 100644 index 0000000..7f576e8 --- /dev/null +++ b/hsarweb/src/de/hsadmin/web/UnixUserModule.java @@ -0,0 +1,30 @@ +package de.hsadmin.web; + +import de.hsadmin.web.config.ModuleConfig; +import de.hsadmin.web.config.PropertyConfig; + +public class UnixUserModule extends GenericModule { + + private static final long serialVersionUID = 1L; + + private ModuleConfig moduleConfig; + + public UnixUserModule() { + moduleConfig = new ModuleConfig("user"); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "id", Long.class, "", true, true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "name", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "comment", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "shell", String.class, "")); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "userid", Long.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "homedir", String.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "pac", String.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "quota_softlimit", Long.class, "", true)); + moduleConfig.addProperty(new PropertyConfig(moduleConfig, "quota_hardlimit", Long.class, "", true)); + } + + @Override + public ModuleConfig getModuleConfig() { + return moduleConfig; + } + +} diff --git a/hsarweb/src/icons/database.png b/hsarweb/src/icons/database.png new file mode 100644 index 0000000000000000000000000000000000000000..3d09261a26eb97c6dedc1d3504cbc2cf915eb642 GIT binary patch literal 390 zcmV;10eSw3P);1k*-!zk~CMF9Bv_3(^PCOq;8(Zs~5pkxC`Czx(!Sg&Qcw=J& zxm*s3L;~q_`XljO2nK`6ZG=!LG!>7>X*g{!E0s!GG#b@LMn(oH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