hive reference only for pac/web

pac names extended to 6 characters
This commit is contained in:
Peter Hormanns 2022-08-08 12:10:10 +02:00
parent 8e3050aade
commit 6c940d6bc7
3 changed files with 18 additions and 14 deletions

View File

@ -1,4 +1,4 @@
ALTER TABLE unixuser ALTER TABLE packet
ADD COLUMN storage_softlimit integer DEFAULT 0 NOT NULL; ALTER COLUMN packet_name character varying(6) NOT NULL;
ALTER TABLE unixuser ALTER TABLE packet
ADD COLUMN storage_hardlimit integer DEFAULT 0; ALTER COLUMN hive_id DROP NOT NULL;

View File

@ -429,9 +429,9 @@ CREATE SEQUENCE packet_packet_id_seq
CREATE TABLE packet ( CREATE TABLE packet (
packet_id integer DEFAULT nextval(('"packet_packet_id_seq"'::text)::regclass) NOT NULL, packet_id integer DEFAULT nextval(('"packet_packet_id_seq"'::text)::regclass) NOT NULL,
basepacket_id integer NOT NULL, basepacket_id integer NOT NULL,
packet_name character varying(5) NOT NULL, packet_name character varying(6) NOT NULL,
bp_id integer NOT NULL, bp_id integer NOT NULL,
hive_id integer NOT NULL, hive_id integer,
created date NOT NULL, created date NOT NULL,
cancelled date, cancelled date,
free boolean NOT NULL, free boolean NOT NULL,
@ -515,9 +515,11 @@ CREATE TABLE unixuser (
homedir character varying(128) NOT NULL, homedir character varying(128) NOT NULL,
locked boolean NOT NULL, locked boolean NOT NULL,
packet_id integer NOT NULL, packet_id integer NOT NULL,
quota_softlimit integer DEFAULT 0 NOT NULL,
userid integer NOT NULL, userid integer NOT NULL,
quota_softlimit integer DEFAULT 0 NOT NULL,
quota_hardlimit integer DEFAULT 0, quota_hardlimit integer DEFAULT 0,
storage_softlimit integer DEFAULT 0 NOT NULL,
storage_hardlimit integer DEFAULT 0,
CONSTRAINT unixuser_userid CHECK ((userid >= 10000)) CONSTRAINT unixuser_userid CHECK ((userid >= 10000))
); );

View File

@ -63,14 +63,16 @@ public class PacModuleImpl extends AbstractModuleImpl {
customer = (Customer) qCustomer.getSingleResult(); customer = (Customer) qCustomer.getSingleResult();
pac.setCustomer(customer); pac.setCustomer(customer);
Hive hive = pac.getHive(); Hive hive = pac.getHive();
if (hive == null || hive.getName() == null || hive.getName().length() == 0) { if ("PAC/WEB".equals(basepac.getName())) {
throw new HSAdminException("hive required"); if (hive == null || hive.getName() == null || hive.getName().length() == 0) {
throw new HSAdminException("hive required");
}
Query qHive = em.createQuery("SELECT h FROM Hives h WHERE h.name = :name");
qHive.setParameter("name", hive.getName());
hive = (Hive) qHive.getSingleResult();
pac.setHive(hive);
hive.getPacs().add(pac);
} }
Query qHive = em.createQuery("SELECT h FROM Hives h WHERE h.name = :name");
qHive.setParameter("name", hive.getName());
hive = (Hive) qHive.getSingleResult();
pac.setHive(hive);
hive.getPacs().add(pac);
Query qComponents = em.createQuery("SELECT c FROM Components c WHERE c.basePacket.basePacId = :basepac"); Query qComponents = em.createQuery("SELECT c FROM Components c WHERE c.basePacket.basePacId = :basepac");
qComponents.setParameter("basepac", basepac.id()); qComponents.setParameter("basepac", basepac.id());
List<?> componentsList = qComponents.getResultList(); List<?> componentsList = qComponents.getResultList();