hs.hsadmin/hsarback/src/de/hsadmin/mods/pac/BaseComponent.java

109 lines
2.4 KiB
Java
Raw Normal View History

2010-10-01 21:52:51 +02:00
package de.hsadmin.mods.pac;
import static javax.persistence.GenerationType.SEQUENCE;
import java.io.Serializable;
import javax.persistence.EntityManager;
import de.hsadmin.mods.user.UnixUser;
@javax.persistence.Entity(name = "BaseComponents")
@javax.persistence.Table(name = " basecomponent")
@javax.persistence.SequenceGenerator(name = "BaseComponentsSeqGen", sequenceName = "basecomponent_basecomponent_seq")
2010-10-04 19:44:49 +02:00
public class BaseComponent extends de.hsadmin.core.model.AbstractEntity implements Serializable {
2010-10-01 21:52:51 +02:00
private static final long serialVersionUID = -8161827018235142603L;
@javax.persistence.Id
@javax.persistence.GeneratedValue(strategy = SEQUENCE, generator = "BaseComponentsSeqGen")
@javax.persistence.Column(name = "basecomponent_id", columnDefinition = "integer")
private long id;
@javax.persistence.Column(name = "basecomponent_code", columnDefinition = "character varying(10)")
private String feature;
@javax.persistence.Column(name = "description", columnDefinition = "character varying(100)")
private String description;
@javax.persistence.Column(name = "sorting", columnDefinition = "integer")
private int sorting;
@javax.persistence.Column(name = "valid", columnDefinition = "boolean")
private boolean valid;
public BaseComponent() {
}
public BaseComponent(String feature, String desc, int sortPos, boolean valid) {
this.feature = feature;
this.description = desc;
this.sorting = sortPos;
this.valid = valid;
}
public static String createQueryFromStringKey(String humanKey) {
return "feature='" + humanKey + "'";
}
@Override
public String createStringKey() {
return getFeature();
}
@Override
public long id() {
return id;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getFeature() {
return feature;
}
public void setFeature(String code) {
this.feature = code;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getSorting() {
return sorting;
}
public void setSorting(int sorting) {
this.sorting = sorting;
}
public boolean getValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
@Override
public boolean isNew() {
return id == 0;
}
@Override
public UnixUser owningUser(EntityManager em) {
return null; // TODO: kinda somebody like root needed
}
}