Imports
This commit is contained in:
parent
13151e2ab6
commit
dda8fc11e7
@ -33,8 +33,10 @@ import de.hsadmin.core.model.onetier.TicketValidator;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class CLIClientConnectorServlet extends HttpServlet {
|
public class CLIClientConnectorServlet extends HttpServlet {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7150004719303750077L;
|
private static final long serialVersionUID = 7150004719303750077L;
|
||||||
public static final String version = "1.0.9 (2010/Oct/05 18:34)";
|
public static final String version = "1.0.9 (2010/Oct/05 18:34)";
|
||||||
|
|
||||||
private Map<String, Class<?>> componentmap;
|
private Map<String, Class<?>> componentmap;
|
||||||
private Map<String, String> componentDescriptions;
|
private Map<String, String> componentDescriptions;
|
||||||
private ArgumentParser parser;
|
private ArgumentParser parser;
|
||||||
@ -432,8 +434,8 @@ public class CLIClientConnectorServlet extends HttpServlet {
|
|||||||
*/
|
*/
|
||||||
public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException {
|
public void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException {
|
||||||
try {
|
try {
|
||||||
ModuleInterface module;
|
ModuleInterface module = null;
|
||||||
|
Transaction tx = null;
|
||||||
// check login
|
// check login
|
||||||
String auth = req.getHeader("authorization");
|
String auth = req.getHeader("authorization");
|
||||||
if (auth == null) {
|
if (auth == null) {
|
||||||
@ -453,12 +455,11 @@ public class CLIClientConnectorServlet extends HttpServlet {
|
|||||||
// try to log in
|
// try to log in
|
||||||
String login = a[0];
|
String login = a[0];
|
||||||
ticket = a[1];
|
ticket = a[1];
|
||||||
module = null;
|
|
||||||
try {
|
try {
|
||||||
if (TicketAuthentication.getInstance().login(login, ticket)) {
|
if (TicketAuthentication.getInstance().login(login, ticket)) {
|
||||||
|
|
||||||
// login successful
|
// login successful
|
||||||
module = new GenericModuleImpl(new Transaction(login));
|
tx = new Transaction(login);
|
||||||
|
module = new GenericModuleImpl(tx);
|
||||||
|
|
||||||
// read arguments
|
// read arguments
|
||||||
BufferedReader read = req.getReader();
|
BufferedReader read = req.getReader();
|
||||||
@ -478,8 +479,8 @@ public class CLIClientConnectorServlet extends HttpServlet {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
resp.addHeader("X-hsadmin-error", "exception: " + e.getMessage());
|
resp.addHeader("X-hsadmin-error", "exception: " + e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (module != null && module.getTransaction() != null) {
|
if (tx != null) {
|
||||||
module.getTransaction().close();
|
tx.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,15 +336,6 @@ public abstract class AbstractModuleImpl implements ModuleInterface {
|
|||||||
return stack.toString();
|
return stack.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* determines if the login user is a hostmaster.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isHostmaster() {
|
|
||||||
// TODO: dummy
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setQueryParameter(Query query, String queryString,
|
public static void setQueryParameter(Query query, String queryString,
|
||||||
String argName, Object argValue) {
|
String argName, Object argValue) {
|
||||||
int argLen = argName.length();
|
int argLen = argName.length();
|
||||||
|
@ -13,7 +13,7 @@ public class EntitySessionHelper {
|
|||||||
* @param entityClass
|
* @param entityClass
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static AbstractModuleImpl createEntitySessionWrapper(Class<? extends AbstractEntity> entityClass) {
|
public static AbstractModuleImpl createEntitySessionWrapper(Class<? extends AbstractEntity> entityClass, Transaction tx) {
|
||||||
// get in instance
|
// get in instance
|
||||||
AbstractModuleImpl impl = null;
|
AbstractModuleImpl impl = null;
|
||||||
try {
|
try {
|
||||||
@ -27,11 +27,13 @@ public class EntitySessionHelper {
|
|||||||
}
|
}
|
||||||
// instantiate wrapper
|
// instantiate wrapper
|
||||||
impl = (AbstractModuleImpl) wrapperClass.newInstance();
|
impl = (AbstractModuleImpl) wrapperClass.newInstance();
|
||||||
|
impl.construct(tx);
|
||||||
} catch (ClassNotFoundException exc) {
|
} catch (ClassNotFoundException exc) {
|
||||||
log.info("entity class '"
|
log.info("entity class '"
|
||||||
+ entityClass.getCanonicalName()
|
+ entityClass.getCanonicalName()
|
||||||
+ "' has no session wrapper => using restrictive default access rights");
|
+ "' has no session wrapper => using restrictive default access rights");
|
||||||
impl = new SecureDefaultModuleImpl();
|
impl = new SecureDefaultModuleImpl();
|
||||||
|
impl.construct(tx);
|
||||||
} catch (Exception exc) {
|
} catch (Exception exc) {
|
||||||
throw new RuntimeException(exc);
|
throw new RuntimeException(exc);
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,7 @@ public class GenericModuleImpl implements ModuleInterface {
|
|||||||
public AbstractEntity initialize(AbstractEntity newEntity) throws HSAdminException {
|
public AbstractEntity initialize(AbstractEntity newEntity) throws HSAdminException {
|
||||||
log.trace("initialize(" + newEntity + ")");
|
log.trace("initialize(" + newEntity + ")");
|
||||||
AbstractModuleImpl wrapper =
|
AbstractModuleImpl wrapper =
|
||||||
EntitySessionHelper.createEntitySessionWrapper(newEntity.getClass());
|
EntitySessionHelper.createEntitySessionWrapper(newEntity.getClass(), tx);
|
||||||
wrapper.construct(tx);
|
|
||||||
return wrapper.initialize(newEntity);
|
return wrapper.initialize(newEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,34 +33,28 @@ public class GenericModuleImpl implements ModuleInterface {
|
|||||||
throw new HSAdminException("cannot add an already persistent entity");
|
throw new HSAdminException("cannot add an already persistent entity");
|
||||||
log.trace("add(" + newEntity + ")");
|
log.trace("add(" + newEntity + ")");
|
||||||
AbstractModuleImpl wrapper =
|
AbstractModuleImpl wrapper =
|
||||||
EntitySessionHelper.createEntitySessionWrapper(newEntity.getClass());
|
EntitySessionHelper.createEntitySessionWrapper(newEntity.getClass(), tx);
|
||||||
wrapper.construct(tx);
|
return wrapper.add(newEntity);
|
||||||
AbstractEntity result = null;
|
|
||||||
result = wrapper.add(newEntity);
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractEntity find(Class<? extends AbstractEntity> entityClass, Object key) throws HSAdminException {
|
public AbstractEntity find(Class<? extends AbstractEntity> entityClass, Object key) throws HSAdminException {
|
||||||
log.trace("find(" + entityClass + ", " + key + ")");
|
log.trace("find(" + entityClass + ", " + key + ")");
|
||||||
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(entityClass);
|
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(entityClass, tx);
|
||||||
wrapper.construct(tx);
|
|
||||||
return wrapper.find(entityClass, key);
|
return wrapper.find(entityClass, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractEntity findByString(Class<? extends AbstractEntity> entityClass, String key) throws HSAdminException {
|
public AbstractEntity findByString(Class<? extends AbstractEntity> entityClass, String key) throws HSAdminException {
|
||||||
log.trace("find(" + entityClass + ", " + key + ")");
|
log.trace("find(" + entityClass + ", " + key + ")");
|
||||||
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(entityClass);
|
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(entityClass, tx);
|
||||||
wrapper.construct(tx);
|
|
||||||
return wrapper.findByString(entityClass, key);
|
return wrapper.findByString(entityClass, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractEntity> search(Class<? extends AbstractEntity> entityClass, String condition, String orderBy) throws HSAdminException {
|
public List<AbstractEntity> search(Class<? extends AbstractEntity> entityClass, String condition, String orderBy) throws HSAdminException {
|
||||||
log.trace("search(" + entityClass + ", " + condition + ")");
|
log.trace("search(" + entityClass + ", " + condition + ")");
|
||||||
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(entityClass);
|
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(entityClass, tx);
|
||||||
wrapper.construct(tx);
|
|
||||||
return wrapper.search(entityClass, condition, orderBy);
|
return wrapper.search(entityClass, condition, orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +63,7 @@ public class GenericModuleImpl implements ModuleInterface {
|
|||||||
if (existingEntity.isNew())
|
if (existingEntity.isNew())
|
||||||
return add(existingEntity);
|
return add(existingEntity);
|
||||||
log.debug("update(" + existingEntity + ")");
|
log.debug("update(" + existingEntity + ")");
|
||||||
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(existingEntity.getClass());
|
AbstractModuleImpl wrapper = EntitySessionHelper.createEntitySessionWrapper(existingEntity.getClass(), tx);
|
||||||
wrapper.construct(tx);
|
|
||||||
return wrapper.update(existingEntity);
|
return wrapper.update(existingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,8 +71,7 @@ public class GenericModuleImpl implements ModuleInterface {
|
|||||||
public void delete(AbstractEntity existingEntity) throws HSAdminException {
|
public void delete(AbstractEntity existingEntity) throws HSAdminException {
|
||||||
log.trace("delete(" + existingEntity + ")");
|
log.trace("delete(" + existingEntity + ")");
|
||||||
AbstractModuleImpl wrapper =
|
AbstractModuleImpl wrapper =
|
||||||
EntitySessionHelper.createEntitySessionWrapper(existingEntity.getClass());
|
EntitySessionHelper.createEntitySessionWrapper(existingEntity.getClass(), tx);
|
||||||
wrapper.construct(tx);
|
|
||||||
wrapper.delete(existingEntity);
|
wrapper.delete(existingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
hsarback/src/de/hsadmin/core/model/LoginUser.java
Normal file
25
hsarback/src/de/hsadmin/core/model/LoginUser.java
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
package de.hsadmin.core.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transiente User-Klasse. Entkoppelt das core-Paket vom UnixUser-Modul.
|
||||||
|
* @author Peter Hormanns
|
||||||
|
*/
|
||||||
|
public class LoginUser {
|
||||||
|
|
||||||
|
// TODO UnixUser Referenzen im Core-Paket ersetzen
|
||||||
|
private String login;
|
||||||
|
|
||||||
|
public LoginUser(String loginName) {
|
||||||
|
login = loginName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogin() {
|
||||||
|
return login;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasHostmasterRole() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,15 +12,14 @@ public class DNSCheck {
|
|||||||
|
|
||||||
private String dnsServer;
|
private String dnsServer;
|
||||||
|
|
||||||
public DNSCheck(String dnsServer) {
|
public DNSCheck(String dnsServer) throws HSAdminException {
|
||||||
this.dnsServer = dnsServer;
|
this.dnsServer = dnsServer;
|
||||||
InetAddress dnsInetAddress;
|
InetAddress dnsInetAddress;
|
||||||
try {
|
try {
|
||||||
dnsInetAddress = InetAddress.getByName(dnsServer);
|
dnsInetAddress = InetAddress.getByName(dnsServer);
|
||||||
DNSService.SetDNSAddress(dnsInetAddress);
|
DNSService.SetDNSAddress(dnsInetAddress);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
// TODO Auto-generated catch block
|
throw new HSAdminException(e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,32 +4,38 @@ import static javax.persistence.GenerationType.SEQUENCE;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@javax.persistence.Entity(name = "BaseComponents")
|
@Entity(name = "BaseComponents")
|
||||||
@javax.persistence.Table(name = " basecomponent")
|
@Table(name = " basecomponent")
|
||||||
@javax.persistence.SequenceGenerator(name = "BaseComponentsSeqGen", sequenceName = "basecomponent_basecomponent_seq")
|
@SequenceGenerator(name = "BaseComponentsSeqGen", sequenceName = "basecomponent_basecomponent_seq")
|
||||||
public class BaseComponent extends de.hsadmin.core.model.AbstractEntity implements Serializable {
|
public class BaseComponent extends de.hsadmin.core.model.AbstractEntity implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8161827018235142603L;
|
private static final long serialVersionUID = -8161827018235142603L;
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
@javax.persistence.GeneratedValue(strategy = SEQUENCE, generator = "BaseComponentsSeqGen")
|
@GeneratedValue(strategy = SEQUENCE, generator = "BaseComponentsSeqGen")
|
||||||
@javax.persistence.Column(name = "basecomponent_id", columnDefinition = "integer")
|
@Column(name = "basecomponent_id", columnDefinition = "integer")
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "basecomponent_code", columnDefinition = "character varying(10)")
|
@Column(name = "basecomponent_code", columnDefinition = "character varying(10)")
|
||||||
private String feature;
|
private String feature;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "description", columnDefinition = "character varying(100)")
|
@Column(name = "description", columnDefinition = "character varying(100)")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "sorting", columnDefinition = "integer")
|
@Column(name = "sorting", columnDefinition = "integer")
|
||||||
private int sorting;
|
private int sorting;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "valid", columnDefinition = "boolean")
|
@Column(name = "valid", columnDefinition = "boolean")
|
||||||
private boolean valid;
|
private boolean valid;
|
||||||
|
|
||||||
public BaseComponent() {
|
public BaseComponent() {
|
||||||
|
@ -8,9 +8,19 @@ import java.io.Serializable;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@javax.persistence.Entity(name = "BasePacs")
|
import javax.persistence.Column;
|
||||||
@javax.persistence.Table(name = "basepacket")
|
import javax.persistence.Entity;
|
||||||
@javax.persistence.SequenceGenerator(name = "BasePacsSeqGen", sequenceName = "basepacket_basepacket_id_seq")
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity(name = "BasePacs")
|
||||||
|
@Table(name = "basepacket")
|
||||||
|
@SequenceGenerator(name = "BasePacsSeqGen", sequenceName = "basepacket_basepacket_id_seq")
|
||||||
public class BasePac implements Serializable {
|
public class BasePac implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1491121619195513435L;
|
private static final long serialVersionUID = 1491121619195513435L;
|
||||||
@ -25,28 +35,28 @@ public class BasePac implements Serializable {
|
|||||||
this.valid = true;
|
this.valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
@javax.persistence.GeneratedValue(strategy = SEQUENCE, generator = "BasePacsSeqGen")
|
@GeneratedValue(strategy = SEQUENCE, generator = "BasePacsSeqGen")
|
||||||
@javax.persistence.Column(name = "basepacket_id", columnDefinition = "integer")
|
@Column(name = "basepacket_id", columnDefinition = "integer")
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "basepacket_code", columnDefinition = "character varying(10)")
|
@Column(name = "basepacket_code", columnDefinition = "character varying(10)")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "description", columnDefinition = "character varying(100)")
|
@Column(name = "description", columnDefinition = "character varying(100)")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "sorting", columnDefinition = "integer")
|
@Column(name = "sorting", columnDefinition = "integer")
|
||||||
private int sorting;
|
private int sorting;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "valid", columnDefinition = "boolean")
|
@Column(name = "valid", columnDefinition = "boolean")
|
||||||
private boolean valid;
|
private boolean valid;
|
||||||
|
|
||||||
@javax.persistence.OneToMany(fetch = LAZY, cascade = ALL)
|
@OneToMany(fetch = LAZY, cascade = ALL)
|
||||||
private Set<Component> components;
|
private Set<Component> components;
|
||||||
|
|
||||||
@javax.persistence.OneToMany(fetch = LAZY, cascade = ALL)
|
@OneToMany(fetch = LAZY, cascade = ALL)
|
||||||
@javax.persistence.JoinTable(name = "packet_component", joinColumns = @javax.persistence.JoinColumn(name = "packet_id"), inverseJoinColumns = @javax.persistence.JoinColumn(name = "basepacket_id"))
|
@JoinTable(name = "packet_component", joinColumns = @JoinColumn(name = "packet_id"), inverseJoinColumns = @JoinColumn(name = "basepacket_id"))
|
||||||
private Set<Pac> pacs;
|
private Set<Pac> pacs;
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
|
@ -2,37 +2,41 @@ package de.hsadmin.mods.pac;
|
|||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
import javax.persistence.IdClass;
|
import javax.persistence.IdClass;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
@javax.persistence.Entity(name = "Components")
|
@Entity(name = "Components")
|
||||||
@javax.persistence.Table(name = "component")
|
@Table(name = "component")
|
||||||
@IdClass(ComponentId.class)
|
@IdClass(ComponentId.class)
|
||||||
public class Component implements Serializable {
|
public class Component implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 970709621200712794L;
|
private static final long serialVersionUID = 970709621200712794L;
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
private BasePac basePac;
|
private BasePac basePac;
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
private BaseComponent baseComponent;
|
private BaseComponent baseComponent;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "min_quantity", columnDefinition = "integer")
|
@Column(name = "min_quantity", columnDefinition = "integer")
|
||||||
private int minimumQuantity;
|
private int minimumQuantity;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "max_quantity", columnDefinition = "integer")
|
@Column(name = "max_quantity", columnDefinition = "integer")
|
||||||
private int maximimumQuantity;
|
private int maximimumQuantity;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "default_quantity", columnDefinition = "integer")
|
@Column(name = "default_quantity", columnDefinition = "integer")
|
||||||
private int defaultQuantity;
|
private int defaultQuantity;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "increment_quantity", columnDefinition = "integer")
|
@Column(name = "increment_quantity", columnDefinition = "integer")
|
||||||
private int incrementQuantity;
|
private int incrementQuantity;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "include_quantity", columnDefinition = "integer")
|
@Column(name = "include_quantity", columnDefinition = "integer")
|
||||||
private int includedQuantity;
|
private int includedQuantity;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "admin_only", columnDefinition = "boolean")
|
@Column(name = "admin_only", columnDefinition = "boolean")
|
||||||
private boolean adminOnly;
|
private boolean adminOnly;
|
||||||
|
|
||||||
public Component() {
|
public Component() {
|
||||||
|
@ -5,105 +5,129 @@ import static javax.persistence.FetchType.EAGER;
|
|||||||
import static javax.persistence.FetchType.LAZY;
|
import static javax.persistence.FetchType.LAZY;
|
||||||
import static javax.persistence.GenerationType.SEQUENCE;
|
import static javax.persistence.GenerationType.SEQUENCE;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.OrderBy;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@javax.persistence.Entity(name="Hives")
|
@Entity(name = "Hives")
|
||||||
@javax.persistence.Table(name="hive")
|
@Table(name = "hive")
|
||||||
@javax.persistence.SequenceGenerator(name="HivesSeqGen", sequenceName="hive_hive_id_seq")
|
@SequenceGenerator(name = "HivesSeqGen", sequenceName = "hive_hive_id_seq")
|
||||||
public class Hive
|
public class Hive extends AbstractEntity implements Serializable {
|
||||||
extends de.hsadmin.core.model.AbstractEntity
|
|
||||||
implements java.io.Serializable
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -2270234313165009590L;
|
private static final long serialVersionUID = -2270234313165009590L;
|
||||||
|
|
||||||
/// bean ctor
|
@Id
|
||||||
public Hive()
|
@GeneratedValue(strategy = SEQUENCE, generator = "HivesSeqGen")
|
||||||
{
|
@Column(name = "hive_id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "hive_name", columnDefinition = "character varying(3)", unique = true)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@JoinColumn(name = "inet_addr_id")
|
||||||
|
@ManyToOne(fetch = EAGER)
|
||||||
|
private INetAddress inetAddr;
|
||||||
|
|
||||||
|
@Column(name = "description", columnDefinition = "character varying(100)")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "hive")
|
||||||
|
@OrderBy("name")
|
||||||
|
private Set<Pac> pacs;
|
||||||
|
|
||||||
|
public Hive() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hive( String name, INetAddress inetAddr )
|
public Hive(String name, INetAddress inetAddr) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.inetAddr = inetAddr;
|
this.inetAddr = inetAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hive( String name, INetAddress inetAddr, String desc )
|
public Hive(String name, INetAddress inetAddr, String desc) {
|
||||||
{
|
|
||||||
this(name, inetAddr);
|
this(name, inetAddr);
|
||||||
this.description = desc;
|
this.description = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
public static String createQueryFromStringKey(String humanKey) {
|
||||||
public static String createQueryFromStringKey(String humanKey)
|
|
||||||
{
|
|
||||||
return "hiveName='" + humanKey + "'";
|
return "hiveName='" + humanKey + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public String createStringKey()
|
public String createStringKey() {
|
||||||
{
|
|
||||||
return getHiveName();
|
return getHiveName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public long id()
|
public long id() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// attribute id
|
public long getId() {
|
||||||
@javax.persistence.Id
|
return id;
|
||||||
@javax.persistence.GeneratedValue(strategy=SEQUENCE, generator="HivesSeqGen")
|
}
|
||||||
@javax.persistence.Column(name="hive_id")
|
|
||||||
private long id;
|
public void setId(long id) {
|
||||||
public long getId() { return id; }
|
this.id = id;
|
||||||
public void setId( long id ) { this.id = id; }
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
// attribute hiveName
|
|
||||||
@javax.persistence.Column(name="hive_name", columnDefinition="character varying(3)", unique=true)
|
|
||||||
private String name;
|
|
||||||
public String getName() { return name; }
|
|
||||||
@Override
|
@Override
|
||||||
public String getHiveName() { return name; }
|
public String getHiveName() {
|
||||||
public void setName( String hiveName ) { this.name = hiveName; }
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
// attribute inetAddr
|
public void setName(String hiveName) {
|
||||||
@javax.persistence.JoinColumn(name="inet_addr_id")
|
this.name = hiveName;
|
||||||
@javax.persistence.ManyToOne(fetch=EAGER)
|
}
|
||||||
private INetAddress inetAddr;
|
|
||||||
public INetAddress getInetAddr() { return inetAddr; }
|
|
||||||
public void setInetAddr( INetAddress inetAddr ) { this.inetAddr = inetAddr; }
|
|
||||||
|
|
||||||
// attribute description
|
public INetAddress getInetAddr() {
|
||||||
@javax.persistence.Column(name="description", columnDefinition="character varying(100)")
|
return inetAddr;
|
||||||
private String description;
|
}
|
||||||
public String getDescription() { return description; }
|
|
||||||
public void setDescription( String description ) { this.description = description; }
|
|
||||||
|
|
||||||
// virtual attribute pacs
|
public void setInetAddr(INetAddress inetAddr) {
|
||||||
@javax.persistence.OneToMany(fetch=LAZY, cascade=ALL, mappedBy="hive")
|
this.inetAddr = inetAddr;
|
||||||
@javax.persistence.OrderBy("name")
|
}
|
||||||
private Set<Pac> pacs;
|
|
||||||
public Set<Pac> getPacs() { return pacs; }
|
public String getDescription() {
|
||||||
public void setPacs( Set<Pac> pacs) { this.pacs = pacs; }
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<Pac> getPacs() {
|
||||||
|
return pacs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPacs(Set<Pac> pacs) {
|
||||||
|
this.pacs = pacs;
|
||||||
|
}
|
||||||
|
|
||||||
/// {$inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew()
|
public boolean isNew() {
|
||||||
{
|
|
||||||
return id == 0;
|
return id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public UnixUser owningUser( EntityManager em )
|
public UnixUser owningUser(EntityManager em) {
|
||||||
{
|
|
||||||
return null; // TODO: kinda somebody like root needed
|
return null; // TODO: kinda somebody like root needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,86 +2,94 @@ package de.hsadmin.mods.pac;
|
|||||||
|
|
||||||
import static javax.persistence.GenerationType.SEQUENCE;
|
import static javax.persistence.GenerationType.SEQUENCE;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@javax.persistence.Entity(name="INetAddresses")
|
@Entity(name = "INetAddresses")
|
||||||
@javax.persistence.Table(name="inet_addr")
|
@Table(name = "inet_addr")
|
||||||
@javax.persistence.SequenceGenerator(name="INetAddressesSeqGen", sequenceName="inet_addr_inet_addr_id_seq")
|
@SequenceGenerator(name = "INetAddressesSeqGen", sequenceName = "inet_addr_inet_addr_id_seq")
|
||||||
public class INetAddress
|
public class INetAddress extends AbstractEntity implements Serializable {
|
||||||
extends de.hsadmin.core.model.AbstractEntity
|
|
||||||
implements java.io.Serializable
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = -5792279453911426607L;
|
private static final long serialVersionUID = -5792279453911426607L;
|
||||||
|
|
||||||
/// bean ctor
|
@Id
|
||||||
public INetAddress()
|
@GeneratedValue(strategy = SEQUENCE, generator = "INetAddressesSeqGen")
|
||||||
{
|
@Column(name = "inet_addr_id")
|
||||||
|
private long id;
|
||||||
|
|
||||||
|
@Column(name = "inet_addr", columnDefinition = "inet", unique = true)
|
||||||
|
private String inetAddr;
|
||||||
|
|
||||||
|
@Column(name = "description", columnDefinition = "character varying(100)")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public INetAddress() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public INetAddress( String inetAddr )
|
public INetAddress(String inetAddr) {
|
||||||
{
|
|
||||||
this.inetAddr = inetAddr;
|
this.inetAddr = inetAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public INetAddress( String inetAddr, String desc )
|
public INetAddress(String inetAddr, String desc) {
|
||||||
{
|
|
||||||
this(inetAddr);
|
this(inetAddr);
|
||||||
description = desc;
|
description = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
public static String createQueryFromStringKey(String humanKey) {
|
||||||
public static String createQueryFromStringKey(String humanKey)
|
|
||||||
{
|
|
||||||
return "inetAddr='" + humanKey + "'";
|
return "inetAddr='" + humanKey + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public String createStringKey()
|
public String createStringKey() {
|
||||||
{
|
|
||||||
return getInetAddr();
|
return getInetAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public long id()
|
public long id() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// attribute id
|
public long getId() {
|
||||||
@javax.persistence.Id
|
return id;
|
||||||
@javax.persistence.GeneratedValue(strategy=SEQUENCE, generator="INetAddressesSeqGen")
|
}
|
||||||
@javax.persistence.Column(name="inet_addr_id")
|
|
||||||
private long id;
|
|
||||||
public long getId() { return id; }
|
|
||||||
public void setId( long id ) { this.id = id; }
|
|
||||||
|
|
||||||
// attribute inetAddr
|
public void setId(long id) {
|
||||||
@javax.persistence.Column(name="inet_addr", columnDefinition="inet", unique=true)
|
this.id = id;
|
||||||
private String inetAddr;
|
}
|
||||||
public String getInetAddr() { return inetAddr; }
|
|
||||||
public void setInetAddr( String inetAddr ) { this.inetAddr = inetAddr; }
|
|
||||||
|
|
||||||
// attribute description
|
public String getInetAddr() {
|
||||||
@javax.persistence.Column(name="description", columnDefinition="character varying(100)")
|
return inetAddr;
|
||||||
private String description;
|
}
|
||||||
public String getDescription() { return description; }
|
|
||||||
public void setDescription( String description ) { this.description = description; }
|
public void setInetAddr(String inetAddr) {
|
||||||
|
this.inetAddr = inetAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
/// {$inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew()
|
public boolean isNew() {
|
||||||
{
|
|
||||||
return id == 0;
|
return id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public UnixUser owningUser( EntityManager em )
|
public UnixUser owningUser(EntityManager em) {
|
||||||
{
|
|
||||||
return null; // TODO: kinda somebody like root needed
|
return null; // TODO: kinda somebody like root needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,61 +8,75 @@ import static javax.persistence.GenerationType.SEQUENCE;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
|
import de.hsadmin.core.model.AbstractEntity;
|
||||||
|
import de.hsadmin.core.model.EntityInfo;
|
||||||
import de.hsadmin.mods.cust.Customer;
|
import de.hsadmin.mods.cust.Customer;
|
||||||
import de.hsadmin.mods.user.UnixUser;
|
import de.hsadmin.mods.user.UnixUser;
|
||||||
|
|
||||||
@javax.persistence.Entity(name = "Pacs")
|
@Entity(name = "Pacs")
|
||||||
@javax.persistence.Table(name = "packet")
|
@Table(name = "packet")
|
||||||
@javax.persistence.SequenceGenerator(name = "PacsSeqGen", sequenceName = "packet_packet_id_seq")
|
@SequenceGenerator(name = "PacsSeqGen", sequenceName = "packet_packet_id_seq")
|
||||||
@de.hsadmin.core.model.EntityInfo(name = "Paket")
|
@EntityInfo(name = "Paket")
|
||||||
public class Pac extends de.hsadmin.core.model.AbstractEntity implements Serializable {
|
public class Pac extends AbstractEntity implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1201899873300190132L;
|
private static final long serialVersionUID = 1201899873300190132L;
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
@javax.persistence.GeneratedValue(strategy = SEQUENCE, generator = "PacsSeqGen")
|
@GeneratedValue(strategy = SEQUENCE, generator = "PacsSeqGen")
|
||||||
@javax.persistence.Column(name = "packet_id")
|
@Column(name = "packet_id")
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "packet_name", unique = true)
|
@Column(name = "packet_name", unique = true)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@javax.persistence.JoinColumn(name = "bp_id")
|
@JoinColumn(name = "bp_id")
|
||||||
@javax.persistence.ManyToOne(fetch = EAGER)
|
@ManyToOne(fetch = EAGER)
|
||||||
private Customer customer;
|
private Customer customer;
|
||||||
|
|
||||||
@javax.persistence.JoinColumn(name = "hive_id")
|
@JoinColumn(name = "hive_id")
|
||||||
@javax.persistence.ManyToOne(fetch = EAGER)
|
@ManyToOne(fetch = EAGER)
|
||||||
private Hive hive;
|
private Hive hive;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "created")
|
@Column(name = "created")
|
||||||
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date created;
|
private Date created;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "cancelled", nullable = true)
|
@Column(name = "cancelled", nullable = true)
|
||||||
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date cancelled;
|
private Date cancelled;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "order_number", nullable = true)
|
@Column(name = "order_number", nullable = true)
|
||||||
private String orderNo;
|
private String orderNo;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "webserver_group", nullable = true)
|
@Column(name = "webserver_group", nullable = true)
|
||||||
private String webserverGroup;
|
private String webserverGroup;
|
||||||
|
|
||||||
@javax.persistence.JoinColumn(name = "cur_inet_addr_id", nullable = true)
|
@JoinColumn(name = "cur_inet_addr_id", nullable = true)
|
||||||
@javax.persistence.ManyToOne(fetch = EAGER)
|
@ManyToOne(fetch = EAGER)
|
||||||
private INetAddress curINetAddr;
|
private INetAddress curINetAddr;
|
||||||
|
|
||||||
@javax.persistence.JoinColumn(name = "old_inet_addr_id", nullable = true)
|
@JoinColumn(name = "old_inet_addr_id", nullable = true)
|
||||||
@javax.persistence.ManyToOne(fetch = EAGER)
|
@ManyToOne(fetch = EAGER)
|
||||||
private INetAddress oldINetAddr;
|
private INetAddress oldINetAddr;
|
||||||
|
|
||||||
@javax.persistence.OneToMany(fetch = LAZY, cascade = ALL)
|
@OneToMany(fetch = LAZY, cascade = ALL)
|
||||||
private java.util.Set<PacComponent> pacComponents;
|
private java.util.Set<PacComponent> pacComponents;
|
||||||
|
|
||||||
@javax.persistence.OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "pac")
|
@OneToMany(fetch = LAZY, cascade = ALL, mappedBy = "pac")
|
||||||
private java.util.Set<UnixUser> unixUser;
|
private java.util.Set<UnixUser> unixUser;
|
||||||
|
|
||||||
public Pac() {
|
public Pac() {
|
||||||
@ -89,18 +103,15 @@ public class Pac extends de.hsadmin.core.model.AbstractEntity implements Seriali
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// / {@inheritDoc}
|
|
||||||
public static String createQueryFromStringKey(String humanKey) {
|
public static String createQueryFromStringKey(String humanKey) {
|
||||||
return "obj.name='" + humanKey + "'";
|
return "obj.name='" + humanKey + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// / {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public String createStringKey() {
|
public String createStringKey() {
|
||||||
return getName();
|
return getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// / {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public long id() {
|
public long id() {
|
||||||
return id;
|
return id;
|
||||||
@ -191,14 +202,14 @@ public class Pac extends de.hsadmin.core.model.AbstractEntity implements Seriali
|
|||||||
* This does not work, JPA/Hibernate always wants to create an invalid row
|
* This does not work, JPA/Hibernate always wants to create an invalid row
|
||||||
* in packet_component
|
* in packet_component
|
||||||
*
|
*
|
||||||
* @javax.persistence.ManyToOne(fetch=EAGER, optional=true) // optional
|
* @ManyToOne(fetch=EAGER, optional=true) // optional
|
||||||
* should be default anyway
|
* should be default anyway
|
||||||
*
|
*
|
||||||
* @javax.persistence.JoinTable( name="packet_component",
|
* @JoinTable( name="packet_component",
|
||||||
* joinColumns=@javax.persistence.JoinColumn(name="packet_id"),
|
* joinColumns=@JoinColumn(name="packet_id"),
|
||||||
* inverseJoinColumns=@javax.persistence.JoinColumn(name="basepacket_id") )
|
* inverseJoinColumns=@JoinColumn(name="basepacket_id") )
|
||||||
*/
|
*/
|
||||||
@javax.persistence.Transient
|
@Transient
|
||||||
public BasePac getBasePac() {
|
public BasePac getBasePac() {
|
||||||
return getPacComponents().iterator().next().getBasePac();
|
return getPacComponents().iterator().next().getBasePac();
|
||||||
}
|
}
|
||||||
@ -230,18 +241,15 @@ public class Pac extends de.hsadmin.core.model.AbstractEntity implements Seriali
|
|||||||
this.unixUser = unixUser;
|
this.unixUser = unixUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generic
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + "{ name=" + name + " }";
|
return super.toString() + "{ name=" + name + " }";
|
||||||
}
|
}
|
||||||
|
|
||||||
// / {$inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNew() {
|
public boolean isNew() {
|
||||||
return id == 0;
|
return id == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// / {$inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public String getHiveName() {
|
public String getHiveName() {
|
||||||
if (isNew())
|
if (isNew())
|
||||||
@ -250,7 +258,6 @@ public class Pac extends de.hsadmin.core.model.AbstractEntity implements Seriali
|
|||||||
return getHive().getHiveName();
|
return getHive().getHiveName();
|
||||||
}
|
}
|
||||||
|
|
||||||
// / {@inheritDoc}
|
|
||||||
@Override
|
@Override
|
||||||
public UnixUser owningUser(EntityManager em) {
|
public UnixUser owningUser(EntityManager em) {
|
||||||
return customer.owningUser(em);
|
return customer.owningUser(em);
|
||||||
@ -261,19 +268,15 @@ public class Pac extends de.hsadmin.core.model.AbstractEntity implements Seriali
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// / determines whether the given user has full read access on all merged
|
|
||||||
// fields of this entity
|
|
||||||
public boolean isReadAllowedFor(UnixUser loginUser) {
|
public boolean isReadAllowedFor(UnixUser loginUser) {
|
||||||
return getName().equals(loginUser.getName())
|
return getName().equals(loginUser.getName())
|
||||||
|| super.isReadAllowedFor(loginUser);
|
|| super.isReadAllowedFor(loginUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
// / query restriction for access control
|
|
||||||
public static String restriction() {
|
public static String restriction() {
|
||||||
return
|
return
|
||||||
// all pacs of customer
|
// all pacs of customer
|
||||||
"obj.customer.name=:loginUserName OR " +
|
"obj.customer.name=:loginUserName OR " +
|
||||||
|
|
||||||
// pac of packet admin
|
// pac of packet admin
|
||||||
"obj.name=:loginUserName";
|
"obj.name=:loginUserName";
|
||||||
}
|
}
|
||||||
|
@ -5,34 +5,42 @@ import static javax.persistence.FetchType.EAGER;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
import javax.persistence.IdClass;
|
import javax.persistence.IdClass;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
@javax.persistence.Entity(name = "PacComponents")
|
@Entity(name = "PacComponents")
|
||||||
@javax.persistence.Table(name = "packet_component")
|
@Table(name = "packet_component")
|
||||||
@IdClass(PacComponentId.class)
|
@IdClass(PacComponentId.class)
|
||||||
public class PacComponent implements Serializable {
|
public class PacComponent implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 5359873462163274873L;
|
private static final long serialVersionUID = 5359873462163274873L;
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
private Pac pac;
|
private Pac pac;
|
||||||
|
|
||||||
@javax.persistence.Id
|
@Id
|
||||||
private BaseComponent baseComponent;
|
private BaseComponent baseComponent;
|
||||||
|
|
||||||
@javax.persistence.JoinColumn(name = "basepacket_id", columnDefinition = "integer", nullable = false)
|
@JoinColumn(name = "basepacket_id", columnDefinition = "integer", nullable = false)
|
||||||
@javax.persistence.ManyToOne(fetch = EAGER)
|
@ManyToOne(fetch = EAGER)
|
||||||
private BasePac basePac;
|
private BasePac basePac;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "quantity", columnDefinition = "integer")
|
@Column(name = "quantity", columnDefinition = "integer")
|
||||||
private int quantity;
|
private int quantity;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "created", columnDefinition = "date", nullable = true)
|
@Column(name = "created", columnDefinition = "date", nullable = true)
|
||||||
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date created;
|
private Date created;
|
||||||
|
|
||||||
@javax.persistence.Column(name = "cancelled", columnDefinition = "date", nullable = true)
|
@Column(name = "cancelled", columnDefinition = "date", nullable = true)
|
||||||
@javax.persistence.Temporal(javax.persistence.TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date cancelled;
|
private Date cancelled;
|
||||||
|
|
||||||
public PacComponent() {
|
public PacComponent() {
|
||||||
|
Loading…
Reference in New Issue
Block a user