diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql index ba76af5..5895bcc 100644 --- a/hsarback/database/data.sql +++ b/hsarback/database/data.sql @@ -2,11 +2,13 @@ -- Table: basepacket -- INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number) - VALUES ('DW/B', 'Dynamic-Web/Base', 200, true, 100); + VALUES ('DW/B', 'Dynamic-Web/Base', 300, true, 100); INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number) - VALUES ('SW/B', 'Static-Web/Base', 300, true, 200); + VALUES ('SW/B', 'Static-Web/Base', 400, true, 200); INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number) - VALUES ('PAC', 'PAC/Web', 100, true, 300); + VALUES ('WEB', 'Web/Base', 100, true, 300); +INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number) + VALUES ('HIVE', 'Managed Server', 200, true, 400); -- -- Table: basecomponent diff --git a/hsarback/src/de/hsadmin/mods/pac/BasePac.java b/hsarback/src/de/hsadmin/mods/pac/BasePac.java index 384ca05..8a1ded1 100644 --- a/hsarback/src/de/hsadmin/mods/pac/BasePac.java +++ b/hsarback/src/de/hsadmin/mods/pac/BasePac.java @@ -158,4 +158,9 @@ public class BasePac implements Serializable { public void setArticleNumber(int articleNumber) { this.articleNumber = articleNumber; } + + @Override + public String toString() { + return "BasePac \"" + getName() + "\""; + } } diff --git a/hsarback/src/de/hsadmin/mods/pac/Pac.java b/hsarback/src/de/hsadmin/mods/pac/Pac.java index 4b634d2..d6465c7 100644 --- a/hsarback/src/de/hsadmin/mods/pac/Pac.java +++ b/hsarback/src/de/hsadmin/mods/pac/Pac.java @@ -37,6 +37,11 @@ import de.hsadmin.mods.user.UnixUser; @AnnModuleImpl(de.hsadmin.mods.pac.PacModuleImpl.class) public class Pac extends AbstractEntity implements Serializable { + public static final String PAC_WEB_BASE = "WEB"; + public static final String PAC_HIVE = "HIVE"; + public static final String PAC_DW_BASE = "DW/B"; + public static final String PAC_SW_BASE = "SW/B"; + private static final long serialVersionUID = 1L; @Id @@ -85,7 +90,7 @@ public class Pac extends AbstractEntity implements Serializable { @Transient private BasePac basepac; - + public Pac() { basepac = new BasePac(); curINetAddr = new INetAddress(); diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java index 60c5889..b665e08 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java @@ -25,7 +25,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { EntityManager em, T entity) throws ProcessorException { Pac pac = (Pac) entity; String basepacName = pac.getBasepac().getName(); - if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) { + if (basepacName.equals(Pac.PAC_WEB_BASE) || basepacName.equals(Pac.PAC_DW_BASE) || basepacName.equals(Pac.PAC_SW_BASE)) { String pacName = pac.getName(); Hive hive = pac.getHive(); UnixUser unixUser = getPacAdminUser(pac); @@ -79,7 +79,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { throws ProcessorException { Pac pac = (Pac) entity; String basepacName = pac.getBasepac().getName(); - if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) { + if (basepacName.equals(Pac.PAC_WEB_BASE) || basepacName.equals(Pac.PAC_DW_BASE) || basepacName.equals(Pac.PAC_SW_BASE)) { return createSetQuotaProc(pac); } else { return new NullProcessor(); @@ -90,7 +90,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { public Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException { Pac pac = (Pac) entity; String basepacName = pac.getBasepac().getName(); - if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) { + if (basepacName.equals(Pac.PAC_WEB_BASE) || basepacName.equals(Pac.PAC_DW_BASE) || basepacName.equals(Pac.PAC_SW_BASE)) { Hive hive = pac.getHive(); WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName())); waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor( diff --git a/hsarback/src/de/hsadmin/remote/PacRemote.java b/hsarback/src/de/hsadmin/remote/PacRemote.java index 2170ccd..566e4a8 100644 --- a/hsarback/src/de/hsadmin/remote/PacRemote.java +++ b/hsarback/src/de/hsadmin/remote/PacRemote.java @@ -51,7 +51,7 @@ public class PacRemote extends AbstractRemote { Pac pac = (Pac) entity; BasePac basePac = pac.getBasepac(); String basePacName = (String) setParams.get("basepac"); - if ((basePac == null || basePac.getName() == null) && assertNotNull(basePacName)) { + if (assertNotNull(basePacName)) { basePac = new BasePac(); basePac.setName(basePacName); pac.setBasepac(basePac); diff --git a/hsarback/test/de/hsadmin/remote/InitDataTest.java b/hsarback/test/de/hsadmin/remote/InitDataTest.java index 9fd02a4..9cab47c 100644 --- a/hsarback/test/de/hsadmin/remote/InitDataTest.java +++ b/hsarback/test/de/hsadmin/remote/InitDataTest.java @@ -77,7 +77,7 @@ public class InitDataTest { setParams.put("name", "aaa00"); setParams.put("hive", "h99"); setParams.put("customer", "hsh00-aaa"); - setParams.put("basepac", "PAC/WEB"); + setParams.put("basepac", "WEB"); setParams.put("curinetaddr", "176.9.242.74"); Object[] params = new Object[] { user, cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),