Merge remote-tracking branch 'origin/newweb'
This commit is contained in:
commit
a0025d844b
@ -7,8 +7,6 @@ import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.hsadmin.core.qserv.AbstractProcessor;
|
||||
import de.hsadmin.core.qserv.ProcessorException;
|
||||
import de.hsadmin.core.util.Config;
|
||||
|
||||
public class JDBCProcessor extends AbstractProcessor {
|
||||
|
@ -18,7 +18,9 @@ import javax.persistence.Temporal;
|
||||
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 @@ public class QueueTask extends AbstractEntity implements Serializable {
|
||||
@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;
|
||||
|
||||
|
@ -25,7 +25,6 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
import de.hsadmin.core.model.AnnModuleImpl;
|
||||
import de.hsadmin.mods.pac.Pac;
|
||||
import de.hsadmin.mods.user.UnixUser;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public abstract class Database extends AbstractEntity implements Serializable {
|
||||
@Column(name = "database_id", columnDefinition = "integer", updatable=false, insertable=false)
|
||||
private long id;
|
||||
|
||||
@AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.READONLY)
|
||||
@Column(name = "engine", columnDefinition = "character varying(12)", updatable=false)
|
||||
private String instance;
|
||||
|
||||
@ -58,7 +58,7 @@ public abstract class Database extends AbstractEntity implements Serializable {
|
||||
|
||||
@JoinColumn(name = "packet_id", columnDefinition = "integer", updatable=false)
|
||||
@ManyToOne(fetch = EAGER)
|
||||
@AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
|
||||
private Pac pac;
|
||||
|
||||
@AnnFieldIO(validation="[A-Za-z0-9\\_\\-]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
|
@ -51,13 +51,13 @@ public abstract class DatabaseUser extends AbstractEntity implements Serializabl
|
||||
@Transient
|
||||
private String password;
|
||||
|
||||
@AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-zA-Z]*", rw=ReadWriteAccess.READONLY)
|
||||
@Column(name = "engine", columnDefinition = "character varying(12)", updatable=false)
|
||||
protected String instance;
|
||||
|
||||
@JoinColumn(name = "packet_id", columnDefinition = "integer", updatable=false)
|
||||
@ManyToOne(fetch = EAGER)
|
||||
@AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9]*", rw=ReadWriteAccess.READONLY)
|
||||
protected Pac pac;
|
||||
|
||||
protected DatabaseUser() {
|
||||
|
@ -18,8 +18,8 @@ import javax.persistence.Transient;
|
||||
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
import de.hsadmin.core.model.AnnFieldIO;
|
||||
import de.hsadmin.core.model.HSAdminException;
|
||||
import de.hsadmin.core.model.AnnModuleImpl;
|
||||
import de.hsadmin.core.model.HSAdminException;
|
||||
import de.hsadmin.core.model.ReadWriteAccess;
|
||||
import de.hsadmin.core.model.SearchFilter;
|
||||
import de.hsadmin.mods.dom.Domain;
|
||||
|
@ -5,9 +5,9 @@ import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
import de.hsadmin.core.model.AbstractModuleImpl;
|
||||
import de.hsadmin.core.model.AuthorisationException;
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
import de.hsadmin.core.model.HSAdminException;
|
||||
import de.hsadmin.core.model.Transaction;
|
||||
import de.hsadmin.hostsharing.BasePacType;
|
||||
|
@ -45,7 +45,7 @@ public class EMailAlias extends AbstractEntity implements Serializable {
|
||||
|
||||
@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)
|
||||
|
@ -28,7 +28,7 @@ public class INetAddress extends AbstractEntity implements Serializable {
|
||||
private long id;
|
||||
|
||||
@Column(name = "inet_addr", unique = true, length=-1)
|
||||
private String inetAddr;
|
||||
private String name;
|
||||
|
||||
@Column(name = "description", columnDefinition = "character varying(100)")
|
||||
private String description;
|
||||
@ -37,7 +37,7 @@ public class INetAddress extends AbstractEntity implements Serializable {
|
||||
}
|
||||
|
||||
public INetAddress(String inetAddr) {
|
||||
this.inetAddr = inetAddr;
|
||||
this.name = inetAddr;
|
||||
}
|
||||
|
||||
public INetAddress(String inetAddr, String desc) {
|
||||
@ -68,11 +68,19 @@ public class INetAddress extends AbstractEntity implements Serializable {
|
||||
}
|
||||
|
||||
public String getInetAddr() {
|
||||
return inetAddr;
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setInetAddr(String inetAddr) {
|
||||
this.inetAddr = inetAddr;
|
||||
this.name = inetAddr;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String inetAddr) {
|
||||
this.name = inetAddr;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
@ -25,7 +25,9 @@ import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
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.hostsharing.BasePacType;
|
||||
import de.hsadmin.mods.cust.Customer;
|
||||
import de.hsadmin.mods.user.UnixUser;
|
||||
@ -46,6 +48,7 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
private long id;
|
||||
|
||||
@Column(name = "packet_name", unique = true)
|
||||
@AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[a-z0-9]*")
|
||||
private String name;
|
||||
|
||||
@JoinColumn(name = "bp_id")
|
||||
@ -54,10 +57,12 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
|
||||
@JoinColumn(name = "basepacket_id")
|
||||
@ManyToOne(fetch = EAGER)
|
||||
private BasePac basePac;
|
||||
@AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[A-Za-z0-9\\/]*")
|
||||
private BasePac basepac;
|
||||
|
||||
@JoinColumn(name = "hive_id")
|
||||
@ManyToOne(fetch = EAGER)
|
||||
@AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[a-z0-9]*")
|
||||
private Hive hive;
|
||||
|
||||
@Column(name = "created")
|
||||
@ -73,6 +78,7 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
|
||||
@JoinColumn(name = "cur_inet_addr_id", nullable = true)
|
||||
@ManyToOne(fetch = EAGER)
|
||||
@AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[0-9\\.]*")
|
||||
private INetAddress curINetAddr;
|
||||
|
||||
@JoinColumn(name = "old_inet_addr_id", nullable = true)
|
||||
@ -83,16 +89,17 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
private Set<PacComponent> pacComponents;
|
||||
|
||||
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy="pac")
|
||||
@AnnFieldIO(rw=ReadWriteAccess.WRITEONCE,validation="[a-z0-9\\-\\.\\_]*")
|
||||
private Set<UnixUser> unixUser;
|
||||
|
||||
public void initPacComponents(EntityManager em, BasePac aBasepac, boolean setDefaults) {
|
||||
Query qAttachedBasepac = em.createQuery("SELECT b FROM BasePacs b WHERE b.valid = :valid AND b.name = :name");
|
||||
qAttachedBasepac.setParameter("valid", Boolean.TRUE);
|
||||
qAttachedBasepac.setParameter("name", aBasepac.getName());
|
||||
basePac = (BasePac) qAttachedBasepac.getSingleResult();
|
||||
basepac = (BasePac) qAttachedBasepac.getSingleResult();
|
||||
pacComponents = new HashSet<PacComponent>();
|
||||
Date today = new Date();
|
||||
for (Component comp : basePac.getComponents()) {
|
||||
for (Component comp : basepac.getComponents()) {
|
||||
PacComponent pacComp = new PacComponent();
|
||||
pacComp.setCreated(today);
|
||||
pacComp.setBaseComponent(comp.getBaseComponent());
|
||||
@ -193,11 +200,11 @@ public class Pac extends AbstractEntity implements Serializable {
|
||||
}
|
||||
|
||||
public BasePac getBasepac() {
|
||||
return basePac;
|
||||
return basepac;
|
||||
}
|
||||
|
||||
public void setBasepac(BasePac basepac) {
|
||||
this.basePac = basepac;
|
||||
this.basepac = basepac;
|
||||
}
|
||||
|
||||
public Set<PacComponent> getPacComponents() {
|
||||
|
@ -48,7 +48,7 @@ public class UnixUser extends AbstractEntity implements Serializable {
|
||||
@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;
|
||||
@ -61,11 +61,11 @@ public class UnixUser extends AbstractEntity implements Serializable {
|
||||
@Column(name = "shell", columnDefinition = "character varying(32)")
|
||||
private String shell;
|
||||
|
||||
@AnnFieldIO(validation="[a-z0-9\\/\\_\\-\\.]*", rw=ReadWriteAccess.WRITEONCE)
|
||||
@AnnFieldIO(validation="[a-z0-9\\/\\_\\-\\.]*", rw=ReadWriteAccess.READONLY)
|
||||
@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;
|
||||
|
||||
|
@ -6,9 +6,9 @@ import java.util.List;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import de.hsadmin.core.model.AuthorisationException;
|
||||
import de.hsadmin.core.model.AbstractEntity;
|
||||
import de.hsadmin.core.model.AbstractModuleImpl;
|
||||
import de.hsadmin.core.model.AuthorisationException;
|
||||
import de.hsadmin.core.model.HSAdminException;
|
||||
import de.hsadmin.core.model.Transaction;
|
||||
import de.hsadmin.hostsharing.BasePacType;
|
||||
|
@ -21,6 +21,10 @@ public abstract class AbstractRemote implements IRemote {
|
||||
|
||||
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;
|
||||
|
@ -13,10 +13,10 @@ import de.hsadmin.core.model.AnnFieldIO;
|
||||
import de.hsadmin.core.model.AuthenticationException;
|
||||
import de.hsadmin.core.model.DefaultSelectableValues;
|
||||
import de.hsadmin.core.model.HSAdminException;
|
||||
import de.hsadmin.core.model.KindOfSelectableValue;
|
||||
import de.hsadmin.core.model.ReadWriteAccess;
|
||||
import de.hsadmin.core.model.SelectableValue;
|
||||
import de.hsadmin.core.model.Transaction;
|
||||
import de.hsadmin.core.model.KindOfSelectableValue;
|
||||
|
||||
public class ModulePropertiesRemote implements IRemote {
|
||||
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
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 {
|
||||
@ -27,6 +28,11 @@ public class MysqlDbRemote extends AbstractRemote {
|
||||
map.put("encoding", encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
|
||||
return Database.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getEntityClass() {
|
||||
return MySqlDatabase.class;
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
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 {
|
||||
@ -23,6 +24,11 @@ public class MysqlUserRemote extends AbstractRemote {
|
||||
map.put("instance", instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
|
||||
return DatabaseUser.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getEntityClass() {
|
||||
return MySqlUser.class;
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
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 {
|
||||
@ -27,6 +28,11 @@ public class PgsqlDbRemote extends AbstractRemote {
|
||||
map.put("encoding", encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
|
||||
return Database.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getEntityClass() {
|
||||
return PgSqlDatabase.class;
|
||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
||||
|
||||
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 {
|
||||
@ -23,6 +24,11 @@ public class PgsqlUserRemote extends AbstractRemote {
|
||||
map.put("instance", instance);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getAnnotatedEntityClass() {
|
||||
return DatabaseUser.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractEntity> getEntityClass() {
|
||||
return PgSqlUser.class;
|
||||
|
@ -22,6 +22,7 @@ public class PropertyRemote implements IRemote {
|
||||
Map<String, String> whereParams) throws HSAdminException {
|
||||
String user = runAsUser;
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String,Object>>();
|
||||
addRolesModule(result);
|
||||
Transaction transaction = new Transaction(user);
|
||||
try {
|
||||
if (transaction.login(user, ticket)) {
|
||||
@ -33,7 +34,7 @@ public class PropertyRemote implements IRemote {
|
||||
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) {
|
||||
@ -82,6 +83,21 @@ public class PropertyRemote implements IRemote {
|
||||
}
|
||||
}
|
||||
|
||||
private void addRolesModule(final List<Map<String, Object>> result) {
|
||||
final HashMap<String, Object> propertyProperties = new HashMap<String, Object>();
|
||||
propertyProperties.put("module", "role");
|
||||
propertyProperties.put("name", "role");
|
||||
propertyProperties.put("searchable", "equals");
|
||||
propertyProperties.put("readwriteable", "read");
|
||||
propertyProperties.put("type", "string");
|
||||
propertyProperties.put("displaySequence", "1");
|
||||
propertyProperties.put("displayVisible", "always");
|
||||
propertyProperties.put("minLength", "0");
|
||||
propertyProperties.put("maxLength", "20");
|
||||
propertyProperties.put("validationRegexp", "[A-Z_]*");
|
||||
result.add(propertyProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> add(String runAsUser, String ticket,
|
||||
Map<String, Object> setParams) throws HSAdminException {
|
||||
|
Loading…
Reference in New Issue
Block a user