HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2013-04-25 25058b9701d2183c73c22b4057256a972c00e924
introduce attribute free to pac definition
6 files modified
71 ■■■■ changed files
hsarback/database/schema.sql 3 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/util/ReflectionUtil.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/util/TextUtil.java 11 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/Pac.java 35 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/CustomerRemote.java 10 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PacRemote.java 10 ●●●● patch | view | raw | blame | history
hsarback/database/schema.sql
@@ -411,8 +411,7 @@
    hive_id integer NOT NULL,
    created date NOT NULL,
    cancelled date,
    order_number character varying(20),
    webserver_group character varying(10),
    free boolean NOT NULL,
    cur_inet_addr_id integer,
    old_inet_addr_id integer,
    CONSTRAINT ckt_packet CHECK (((cancelled IS NULL) OR (cancelled > created)))
hsarback/src/de/hsadmin/core/util/ReflectionUtil.java
@@ -62,7 +62,7 @@
                clasz.getMethod(setterName(f), String.class).invoke(entity, valueObject);
            } else
            if (type.equals(Date.class)) {
                clasz.getMethod(setterName(f), Date.class).invoke(entity, TextUtil.parse((String) valueObject));
                clasz.getMethod(setterName(f), Date.class).invoke(entity, TextUtil.parseDate((String) valueObject));
            } else
            if (type.getCanonicalName().equals("long")) {
                clasz.getMethod(setterName(f), long.class).invoke(entity, Long.parseLong((String) valueObject));
hsarback/src/de/hsadmin/core/util/TextUtil.java
@@ -53,7 +53,7 @@
        return df.format(date);
    }
    public static synchronized Date parse(String dateString) {
    public static synchronized Date parseDate(String dateString) {
        try {
            return df.parse(dateString);
        } catch (ParseException e) {
@@ -66,4 +66,13 @@
        }
    }
    public static synchronized String format(boolean free) {
        return free ? "true" : "false";
    }
    public static synchronized boolean parseBool(String boolString) {
        boolean parsedValue = "T".equals(boolString.toUpperCase()) || "TRUE".equals(boolString.toUpperCase());
        return parsedValue;
    }
}
hsarback/src/de/hsadmin/mods/pac/Pac.java
@@ -68,12 +68,9 @@
    @Temporal(TemporalType.DATE)
    private Date cancelled;
    @Column(name = "order_number", nullable = true)
    private String orderNo;
    @Column(name = "webserver_group", nullable = true)
    private String webserverGroup;
    @Column(name = "free", nullable = false)
    private boolean free = false;
    @JoinColumn(name = "cur_inet_addr_id", nullable = true)
    @ManyToOne(fetch = EAGER)
    private INetAddress curINetAddr;
@@ -101,9 +98,7 @@
        this.name = name;
        this.customer = cust;
        this.hive = hive;
        this.created = new Date();
        this.webserverGroup = "httpd";
        this.curINetAddr = hive.getInetAddr();
        initPacComponents(basePac);
    }
@@ -189,22 +184,6 @@
    public void setCancelled(Date cancelled) {
        this.cancelled = cancelled;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public String getwebserverGroup() {
        return webserverGroup;
    }
    public void setwebserverGroup(String webserverGroup) {
        this.webserverGroup = webserverGroup;
    }
    public INetAddress getCurINetAddr() {
@@ -306,4 +285,12 @@
            // pac of packet admin
            "obj.name=:loginUserName";
    }
    public boolean isFree() {
        return free;
    }
    public void setFree(boolean free) {
        this.free = free;
    }
}
hsarback/src/de/hsadmin/remote/CustomerRemote.java
@@ -100,11 +100,11 @@
        }
        String memberSince = (String) setParams.get("membersince");
        if (assertNotNull(memberSince)) {
            cust.setMemberSince(TextUtil.parse(memberSince));
            cust.setMemberSince(TextUtil.parseDate(memberSince));
        }
        String memberUntil = (String) setParams.get("memberuntil");
        if (assertNotNull(memberUntil)) {
            cust.setMemberUntil(TextUtil.parse(memberUntil));
            cust.setMemberUntil(TextUtil.parseDate(memberUntil));
        }
        String memberRole = (String) setParams.get("memberrole");
        if (assertNotNull(memberRole)) {
@@ -112,15 +112,15 @@
        }
        String authorContract = (String) setParams.get("authorcontract");
        if (assertNotNull(authorContract)) {
            cust.setAuthorContract(TextUtil.parse(authorContract));
            cust.setAuthorContract(TextUtil.parseDate(authorContract));
        }
        String nonDiscContract = (String) setParams.get("nondisccontract");
        if (assertNotNull(nonDiscContract)) {
            cust.setNonDiscContract(TextUtil.parse(nonDiscContract));
            cust.setNonDiscContract(TextUtil.parseDate(nonDiscContract));
        }
        String sharesUpdated = (String) setParams.get("sharesupdated");
        if (assertNotNull(sharesUpdated)) {
            cust.setSharesUpdated(TextUtil.parse(sharesUpdated));
            cust.setSharesUpdated(TextUtil.parseDate(sharesUpdated));
        }
        String sharesSigned = (String) setParams.get("sharessigned");
        if (assertNotNull(sharesSigned)) {
hsarback/src/de/hsadmin/remote/PacRemote.java
@@ -25,6 +25,7 @@
        resultMap.put("customer", pac.getCustomer().getName());
        resultMap.put("curinetaddr", pac.getCurINetAddr().getInetAddr());
        resultMap.put("created", TextUtil.format(pac.getCreated()));
        resultMap.put("free", TextUtil.format(pac.isFree()));
        Date cancelled = pac.getCancelled();
        if (cancelled != null) {
            resultMap.put("cancelled", TextUtil.format(cancelled));
@@ -58,14 +59,19 @@
        }
        String createdStr = (String) setParams.get("created");
        if (createdStr != null && !createdStr.isEmpty()) {
            Date createdDate = TextUtil.parse(createdStr);
            Date createdDate = TextUtil.parseDate(createdStr);
            pac.setCreated(createdDate);
        }
        String cancelledStr = (String) setParams.get("cancelled");
        if (cancelledStr != null && !cancelledStr.isEmpty()) {
            Date cancelledDate = TextUtil.parse(cancelledStr);
            Date cancelledDate = TextUtil.parseDate(cancelledStr);
            pac.setCancelled(cancelledDate);
        }
        String isFreeString = (String) setParams.get("free");
        if (isFreeString != null && !isFreeString.isEmpty()) {
            boolean isFree = TextUtil.parseBool(isFreeString);
            pac.setFree(isFree);
        }
        INetAddress curINetAddr = pac.getCurINetAddr();
        String inetAddrString = (String) setParams.get("curinetaddr");
        if ((curINetAddr == null || curINetAddr.getInetAddr() == null) && assertNotNull(inetAddrString)) {