// ----------> GENERATED FILE - DON'T TOUCH! <---------- // generator: ilarkesto.mda.legacy.generator.EntityGenerator package scrum.server.impediments; import java.util.*; import ilarkesto.persistence.*; import ilarkesto.core.logging.Log; import ilarkesto.base.*; import ilarkesto.base.time.*; import ilarkesto.auth.*; public abstract class GImpediment extends AEntity implements ilarkesto.auth.ViewProtected<scrum.server.admin.User>, ilarkesto.search.Searchable, java.lang.Comparable<Impediment> { // --- AEntity --- public final ImpedimentDao getDao() { return impedimentDao; } 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("date", this.date == null ? null : this.date.toString()); properties.put("description", this.description); properties.put("solution", this.solution); properties.put("closed", this.closed); } public int compareTo(Impediment other) { return toString().toLowerCase().compareTo(other.toString().toLowerCase()); } private static final ilarkesto.core.logging.Log LOG = ilarkesto.core.logging.Log.get(GImpediment.class); public static final String TYPE = "impediment"; // ----------------------------------------------------------- // - 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(getSolution(), 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); } // ----------------------------------------------------------- // - date // ----------------------------------------------------------- private ilarkesto.base.time.Date date; public final ilarkesto.base.time.Date getDate() { return date; } public final void setDate(ilarkesto.base.time.Date date) { date = prepareDate(date); if (isDate(date)) return; this.date = date; fireModified("date="+date); } protected ilarkesto.base.time.Date prepareDate(ilarkesto.base.time.Date date) { return date; } public final boolean isDateSet() { return this.date != null; } public final boolean isDate(ilarkesto.base.time.Date date) { if (this.date == null && date == null) return true; return this.date != null && this.date.equals(date); } protected final void updateDate(Object value) { value = value == null ? null : new ilarkesto.base.time.Date((String)value); setDate((ilarkesto.base.time.Date)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); } // ----------------------------------------------------------- // - solution // ----------------------------------------------------------- private java.lang.String solution; public final java.lang.String getSolution() { return solution; } public final void setSolution(java.lang.String solution) { solution = prepareSolution(solution); if (isSolution(solution)) return; this.solution = solution; fireModified("solution="+solution); } protected java.lang.String prepareSolution(java.lang.String solution) { solution = Str.removeUnreadableChars(solution); return solution; } public final boolean isSolutionSet() { return this.solution != null; } public final boolean isSolution(java.lang.String solution) { if (this.solution == null && solution == null) return true; return this.solution != null && this.solution.equals(solution); } protected final void updateSolution(Object value) { setSolution((java.lang.String)value); } // ----------------------------------------------------------- // - closed // ----------------------------------------------------------- private boolean closed; public final boolean isClosed() { return closed; } public final void setClosed(boolean closed) { closed = prepareClosed(closed); if (isClosed(closed)) return; this.closed = closed; fireModified("closed="+closed); } protected boolean prepareClosed(boolean closed) { return closed; } public final boolean isClosed(boolean closed) { return this.closed == closed; } protected final void updateClosed(Object value) { setClosed((Boolean)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("date")) updateDate(value); if (property.equals("description")) updateDescription(value); if (property.equals("solution")) updateSolution(value); if (property.equals("closed")) updateClosed(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) { GImpediment.projectDao = projectDao; } static ImpedimentDao impedimentDao; public static final void setImpedimentDao(ImpedimentDao impedimentDao) { GImpediment.impedimentDao = impedimentDao; } }