// ----------> GENERATED FILE - DON'T TOUCH! <----------
// generator: ilarkesto.mda.legacy.generator.EntityGenerator
package scrum.server.project;
import java.util.*;
import ilarkesto.persistence.*;
import ilarkesto.core.logging.Log;
import ilarkesto.base.*;
import ilarkesto.base.time.*;
import ilarkesto.auth.*;
public abstract class GQuality
extends AEntity
implements ilarkesto.auth.ViewProtected<scrum.server.admin.User>, ilarkesto.search.Searchable, java.lang.Comparable<Quality> {
// --- AEntity ---
public final QualityDao getDao() {
return qualityDao;
}
protected void repairDeadDatob(ADatob datob) {
}
@Override
public void storeProperties(Map properties) {
super.storeProperties(properties);
properties.put("projectId", this.projectId);
properties.put("number", this.number);
properties.put("label", this.label);
properties.put("description", this.description);
properties.put("testDescription", this.testDescription);
}
public int compareTo(Quality other) {
return toString().toLowerCase().compareTo(other.toString().toLowerCase());
}
private static final ilarkesto.core.logging.Log LOG = ilarkesto.core.logging.Log.get(GQuality.class);
public static final String TYPE = "quality";
// -----------------------------------------------------------
// - Searchable
// -----------------------------------------------------------
public boolean matchesKey(String key) {
if (super.matchesKey(key)) return true;
if (matchesKey(getLabel(), key)) return true;
if (matchesKey(getDescription(), key)) return true;
if (matchesKey(getTestDescription(), key)) return true;
return false;
}
// -----------------------------------------------------------
// - project
// -----------------------------------------------------------
private String projectId;
private transient scrum.server.project.Project projectCache;
private void updateProjectCache() {
projectCache = this.projectId == null ? null : (scrum.server.project.Project)projectDao.getById(this.projectId);
}
public final String getProjectId() {
return this.projectId;
}
public final scrum.server.project.Project getProject() {
if (projectCache == null) updateProjectCache();
return projectCache;
}
public final void setProject(scrum.server.project.Project project) {
project = prepareProject(project);
if (isProject(project)) return;
this.projectId = project == null ? null : project.getId();
projectCache = project;
fireModified("project="+project);
}
protected scrum.server.project.Project prepareProject(scrum.server.project.Project project) {
return project;
}
protected void repairDeadProjectReference(String entityId) {
if (this.projectId == null || entityId.equals(this.projectId)) {
repairMissingMaster();
}
}
public final boolean isProjectSet() {
return this.projectId != null;
}
public final boolean isProject(scrum.server.project.Project project) {
if (this.projectId == null && project == null) return true;
return project != null && project.getId().equals(this.projectId);
}
protected final void updateProject(Object value) {
setProject(value == null ? null : (scrum.server.project.Project)projectDao.getById((String)value));
}
// -----------------------------------------------------------
// - number
// -----------------------------------------------------------
private int number;
public final int getNumber() {
return number;
}
public final void setNumber(int number) {
number = prepareNumber(number);
if (isNumber(number)) return;
this.number = number;
fireModified("number="+number);
}
protected int prepareNumber(int number) {
return number;
}
public final boolean isNumber(int number) {
return this.number == number;
}
protected final void updateNumber(Object value) {
setNumber((Integer)value);
}
// -----------------------------------------------------------
// - label
// -----------------------------------------------------------
private java.lang.String label;
public final java.lang.String getLabel() {
return label;
}
public final void setLabel(java.lang.String label) {
label = prepareLabel(label);
if (isLabel(label)) return;
this.label = label;
fireModified("label="+label);
}
protected java.lang.String prepareLabel(java.lang.String label) {
label = Str.removeUnreadableChars(label);
return label;
}
public final boolean isLabelSet() {
return this.label != null;
}
public final boolean isLabel(java.lang.String label) {
if (this.label == null && label == null) return true;
return this.label != null && this.label.equals(label);
}
protected final void updateLabel(Object value) {
setLabel((java.lang.String)value);
}
// -----------------------------------------------------------
// - description
// -----------------------------------------------------------
private java.lang.String description;
public final java.lang.String getDescription() {
return description;
}
public final void setDescription(java.lang.String description) {
description = prepareDescription(description);
if (isDescription(description)) return;
this.description = description;
fireModified("description="+description);
}
protected java.lang.String prepareDescription(java.lang.String description) {
description = Str.removeUnreadableChars(description);
return description;
}
public final boolean isDescriptionSet() {
return this.description != null;
}
public final boolean isDescription(java.lang.String description) {
if (this.description == null && description == null) return true;
return this.description != null && this.description.equals(description);
}
protected final void updateDescription(Object value) {
setDescription((java.lang.String)value);
}
// -----------------------------------------------------------
// - testDescription
// -----------------------------------------------------------
private java.lang.String testDescription;
public final java.lang.String getTestDescription() {
return testDescription;
}
public final void setTestDescription(java.lang.String testDescription) {
testDescription = prepareTestDescription(testDescription);
if (isTestDescription(testDescription)) return;
this.testDescription = testDescription;
fireModified("testDescription="+testDescription);
}
protected java.lang.String prepareTestDescription(java.lang.String testDescription) {
testDescription = Str.removeUnreadableChars(testDescription);
return testDescription;
}
public final boolean isTestDescriptionSet() {
return this.testDescription != null;
}
public final boolean isTestDescription(java.lang.String testDescription) {
if (this.testDescription == null && testDescription == null) return true;
return this.testDescription != null && this.testDescription.equals(testDescription);
}
protected final void updateTestDescription(Object value) {
setTestDescription((java.lang.String)value);
}
public void updateProperties(Map<?, ?> properties) {
for (Map.Entry entry : properties.entrySet()) {
String property = (String) entry.getKey();
if (property.equals("id")) continue;
Object value = entry.getValue();
if (property.equals("projectId")) updateProject(value);
if (property.equals("number")) updateNumber(value);
if (property.equals("label")) updateLabel(value);
if (property.equals("description")) updateDescription(value);
if (property.equals("testDescription")) updateTestDescription(value);
}
}
protected void repairDeadReferences(String entityId) {
super.repairDeadReferences(entityId);
repairDeadProjectReference(entityId);
}
// --- ensure integrity ---
public void ensureIntegrity() {
super.ensureIntegrity();
if (!isProjectSet()) {
repairMissingMaster();
return;
}
try {
getProject();
} catch (EntityDoesNotExistException ex) {
LOG.info("Repairing dead project reference");
repairDeadProjectReference(this.projectId);
}
}
// -----------------------------------------------------------
// - dependencies
// -----------------------------------------------------------
static scrum.server.project.ProjectDao projectDao;
public static final void setProjectDao(scrum.server.project.ProjectDao projectDao) {
GQuality.projectDao = projectDao;
}
static QualityDao qualityDao;
public static final void setQualityDao(QualityDao qualityDao) {
GQuality.qualityDao = qualityDao;
}
}