HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2015-09-11 041111d8459fa1617f9f7608a01764a3251eeb52
introduce annotated class property on AbstractRemote
pac is readonly property
9 files modified
44 ■■■■■ changed files
hsarback/src/de/hsadmin/core/qserv/QueueTask.java 8 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/email/EMailAlias.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/user/UnixUser.java 4 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/AbstractRemote.java 4 ●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/MysqlDbRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/MysqlUserRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PgsqlDbRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PgsqlUserRemote.java 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/remote/PropertyRemote.java 2 ●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/core/qserv/QueueTask.java
@@ -18,7 +18,9 @@
import javax.persistence.Transient;
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.AnnFieldIO;
import de.hsadmin.core.model.AnnModuleImpl;
import de.hsadmin.core.model.ReadWriteAccess;
import de.hsadmin.mods.qstat.QTaskModuleImpl;
import de.hsadmin.mods.user.UnixUser;
@@ -35,26 +37,32 @@
    @Column(name = "task_id", columnDefinition = "integer")
    private long id;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @JoinColumn(name="user_id", columnDefinition="integer", nullable=true)
    @ManyToOne(fetch=FetchType.EAGER)
    private UnixUser user;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "started", columnDefinition = "date")
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date started;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "finished", columnDefinition = "date", nullable = true)
    @Temporal(javax.persistence.TemporalType.TIMESTAMP)
    private Date finished;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "title", columnDefinition = "character varying(192)")
    private String title;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "details", columnDefinition = "text", nullable = true)
    private String details;
    private Processor proc;
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "exception", columnDefinition = "text", nullable = true)
    private String exception;
hsarback/src/de/hsadmin/mods/email/EMailAlias.java
@@ -45,7 +45,7 @@
    @ManyToOne()
    @JoinColumn(name = "pac_id", columnDefinition = "integer")
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
    private Pac pac;
    @AnnFieldIO(validation="[a-z0-9\\_\\-\\.\\+]*", rw=ReadWriteAccess.WRITEONCE)
hsarback/src/de/hsadmin/mods/user/UnixUser.java
@@ -48,7 +48,7 @@
    @Transient
    private String password;
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
    @AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
    @JoinColumn(name = "packet_id", columnDefinition = "integer", updatable=false)
    @ManyToOne(fetch = FetchType.LAZY)
    private Pac pac;
@@ -65,7 +65,7 @@
    @Column(name = "homedir", columnDefinition = "character varying(48)", updatable=false)
    private String homedir;
    @AnnFieldIO(rw=ReadWriteAccess.READWRITE)
    @AnnFieldIO(rw=ReadWriteAccess.READONLY)
    @Column(name = "locked", columnDefinition = "boolean")
    private boolean locked;
hsarback/src/de/hsadmin/remote/AbstractRemote.java
@@ -21,6 +21,10 @@
    protected abstract Class<? extends AbstractEntity> getEntityClass();
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return getEntityClass();
    }
    protected abstract void entity2map(Transaction tx, AbstractEntity entity, Map<String, Object> resultMap);
    protected abstract void map2entity(Transaction tx, Map<String, Object> setParams, AbstractEntity entity) throws HSAdminException;
hsarback/src/de/hsadmin/remote/MysqlDbRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.Database;
import de.hsadmin.mods.db.MySqlDatabase;
public class MysqlDbRemote extends AbstractRemote {
@@ -28,6 +29,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return Database.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return MySqlDatabase.class;
    }
hsarback/src/de/hsadmin/remote/MysqlUserRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.DatabaseUser;
import de.hsadmin.mods.db.MySqlUser;
public class MysqlUserRemote extends AbstractRemote {
@@ -24,6 +25,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return DatabaseUser.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return MySqlUser.class;
    }
hsarback/src/de/hsadmin/remote/PgsqlDbRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.Database;
import de.hsadmin.mods.db.PgSqlDatabase;
public class PgsqlDbRemote extends AbstractRemote {
@@ -28,6 +29,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return Database.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return PgSqlDatabase.class;
    }
hsarback/src/de/hsadmin/remote/PgsqlUserRemote.java
@@ -4,6 +4,7 @@
import de.hsadmin.core.model.AbstractEntity;
import de.hsadmin.core.model.Transaction;
import de.hsadmin.mods.db.DatabaseUser;
import de.hsadmin.mods.db.PgSqlUser;
public class PgsqlUserRemote extends AbstractRemote {
@@ -24,6 +25,11 @@
    }
    @Override
    protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
        return DatabaseUser.class;
    }
    @Override
    protected Class<? extends AbstractEntity> getEntityClass() {
        return PgSqlUser.class;
    }
hsarback/src/de/hsadmin/remote/PropertyRemote.java
@@ -33,7 +33,7 @@
                    Object newInstance = remoteClass.newInstance();
                    if (newInstance instanceof AbstractRemote) {
                        AbstractRemote remote = (AbstractRemote) newInstance;
                        Class<? extends AbstractEntity> entityClass = remote.getEntityClass();
                        Class<? extends AbstractEntity> entityClass = remote.getAnnotatedEntityClass();
                        for (Field f: entityClass.getDeclaredFields()) {
                            AnnFieldIO fieldIO = f.getAnnotation(AnnFieldIO.class);
                            if (fieldIO != null) {