示例#1
0
 public void ensureIntegrity() {
   super.ensureIntegrity();
   if (!isProjectSet()) {
     repairMissingMaster();
     return;
   }
   try {
     getProject();
   } catch (EntityDoesNotExistException ex) {
     LOG.info("Repairing dead project reference");
     repairDeadProjectReference(this.projectId);
   }
   if (this.authorsIds == null) this.authorsIds = new java.util.HashSet<String>();
   Set<String> authors = new HashSet<String>(this.authorsIds);
   for (String entityId : authors) {
     try {
       userDao.getById(entityId);
     } catch (EntityDoesNotExistException ex) {
       LOG.info("Repairing dead author reference");
       repairDeadAuthorReference(entityId);
     }
   }
   if (this.releasesIds == null) this.releasesIds = new java.util.HashSet<String>();
   Set<String> releases = new HashSet<String>(this.releasesIds);
   for (String entityId : releases) {
     try {
       releaseDao.getById(entityId);
     } catch (EntityDoesNotExistException ex) {
       LOG.info("Repairing dead release reference");
       repairDeadReleaseReference(entityId);
     }
   }
 }
示例#2
0
 // --- ensure integrity ---
 @Override
 public void onEnsureIntegrity() {
   super.onEnsureIntegrity();
   if (!isSprintSet()) {
     repairMissingMaster();
   }
   try {
     getSprint();
   } catch (ilarkesto.core.persistance.EntityDoesNotExistException ex) {
     LOG.info("Repairing dead sprint reference");
     repairDeadSprintReference(this.sprintId);
   }
 }
示例#3
0
 public void ensureIntegrity() {
   super.ensureIntegrity();
   if (!isProjectSet()) {
     repairMissingMaster();
     return;
   }
   try {
     getProject();
   } catch (EntityDoesNotExistException ex) {
     LOG.info("Repairing dead project reference");
     repairDeadProjectReference(this.projectId);
   }
 }
示例#4
0
public abstract class GProjectSprintSnapshot extends ilarkesto.persistence.AEntity
    implements ilarkesto.auth.ViewProtected<scrum.server.admin.User>,
        java.lang.Comparable<ProjectSprintSnapshot> {

  public static class ProjectSprintSnapshotMetadata
      implements ilarkesto.core.persistance.meta.EntityMetadata {

    public static final transient ilarkesto.core.persistance.meta.EntityFieldMetadata sprint =
        new ilarkesto.core.persistance.meta.EntityFieldMetadata() {

          public static final String name = "sprint";
          public static final String label = "null";

          public String getName() {
            return name;
          };

          public String getLabel() {
            return label;
          };

          public Object getValue(ilarkesto.core.persistance.Entity entity) {
            return ((ProjectSprintSnapshot) entity).getSprint();
          }
        };

    public static final transient ilarkesto.core.persistance.meta.EntityFieldMetadata
        remainingWork =
            new ilarkesto.core.persistance.meta.EntityFieldMetadata() {

              public static final String name = "remainingWork";
              public static final String label = "null";

              public String getName() {
                return name;
              };

              public String getLabel() {
                return label;
              };

              public Object getValue(ilarkesto.core.persistance.Entity entity) {
                return ((ProjectSprintSnapshot) entity).getRemainingWork();
              }
            };

    public static final transient ilarkesto.core.persistance.meta.EntityFieldMetadata burnedWork =
        new ilarkesto.core.persistance.meta.EntityFieldMetadata() {

          public static final String name = "burnedWork";
          public static final String label = "null";

          public String getName() {
            return name;
          };

          public String getLabel() {
            return label;
          };

          public Object getValue(ilarkesto.core.persistance.Entity entity) {
            return ((ProjectSprintSnapshot) entity).getBurnedWork();
          }
        };

    public static transient ilarkesto.core.persistance.meta.EntityFieldMetadata[] fields =
        new ilarkesto.core.persistance.meta.EntityFieldMetadata[] {
          sprint, remainingWork, burnedWork
        };

    public ilarkesto.core.persistance.meta.EntityFieldMetadata[] getFields() {
      return fields;
    }

    public ilarkesto.core.persistance.meta.EntityFieldMetadata getField(String fieldName) {
      if ("sprint".equals(fieldName)) return sprint;
      if ("sprintId".equals(fieldName)) return sprint;
      if ("remainingWork".equals(fieldName)) return remainingWork;
      if ("burnedWork".equals(fieldName)) return burnedWork;
      return null;
    }
  }

  public static final transient ProjectSprintSnapshotMetadata metadata =
      new ProjectSprintSnapshotMetadata();

  @Override
  public ProjectSprintSnapshotMetadata getMetadata() {
    return metadata;
  };

  protected static final ilarkesto.core.logging.Log log =
      ilarkesto.core.logging.Log.get(ProjectSprintSnapshot.class);

  // --- AEntity ---

  public final scrum.server.project.ProjectSprintSnapshotDao getDao() {
    return projectSprintSnapshotDao;
  }

  protected void repairDeadDatob(ADatob datob) {}

  public abstract static class AProjectSprintSnapshotQuery
      extends ilarkesto.core.persistance.AEntityQuery<ProjectSprintSnapshot> {
    @Override
    public Class<ProjectSprintSnapshot> getType() {
      return ProjectSprintSnapshot.class;
    }
  }

  public static Set<ProjectSprintSnapshot> listAll() {
    return new ilarkesto.core.persistance.AllByTypeQuery(ProjectSprintSnapshot.class).list();
  }

  public static ProjectSprintSnapshot getById(String id) {
    return (ProjectSprintSnapshot) AEntity.getById(id);
  }

  @Override
  public Set<ilarkesto.core.persistance.Entity> getReferencedEntities() {
    Set<ilarkesto.core.persistance.Entity> ret = super.getReferencedEntities();
    // --- references ---
    try {
      Utl.addIfNotNull(ret, getSprint());
    } catch (EntityDoesNotExistException ex) {
    }
    return ret;
  }

  @Override
  public void storeProperties(Map<String, String> properties) {
    super.storeProperties(properties);
    properties.put(
        "sprintId", ilarkesto.core.persistance.Persistence.propertyAsString(this.sprintId));
    properties.put(
        "remainingWork",
        ilarkesto.core.persistance.Persistence.propertyAsString(this.remainingWork));
    properties.put(
        "burnedWork", ilarkesto.core.persistance.Persistence.propertyAsString(this.burnedWork));
  }

  @Override
  public int compareTo(ProjectSprintSnapshot other) {
    return ilarkesto.core.localization.GermanComparator.INSTANCE.compare(
        toString(), other.toString());
  }

  private static final ilarkesto.core.logging.Log LOG =
      ilarkesto.core.logging.Log.get(GProjectSprintSnapshot.class);

  public static final String TYPE = "ProjectSprintSnapshot";
  // -----------------------------------------------------------
  // - sprint
  // -----------------------------------------------------------

  private String sprintId;

  public final String getSprintId() {
    return this.sprintId;
  }

  public final scrum.server.sprint.Sprint getSprint() {
    try {
      return this.sprintId == null
          ? null
          : (scrum.server.sprint.Sprint) AEntity.getById(this.sprintId);
    } catch (ilarkesto.core.persistance.EntityDoesNotExistException ex) {
      throw ex.setCallerInfo("ProjectSprintSnapshot.sprint");
    }
  }

  public final void setSprint(scrum.server.sprint.Sprint sprint) {
    sprint = prepareSprint(sprint);
    if (isSprint(sprint)) return;
    setSprintId(sprint == null ? null : sprint.getId());
  }

  public final void setSprintId(String id) {
    if (Utl.equals(sprintId, id)) return;
    this.sprintId = id;
    updateLastModified();
    fireModified(
        "sprintId", ilarkesto.core.persistance.Persistence.propertyAsString(this.sprintId));
  }

  private final void updateSprintId(String id) {
    setSprintId(id);
  }

  protected scrum.server.sprint.Sprint prepareSprint(scrum.server.sprint.Sprint sprint) {
    return sprint;
  }

  protected void repairDeadSprintReference(String entityId) {
    if (!isPersisted()) return;
    if (this.sprintId == null || entityId.equals(this.sprintId)) {
      repairMissingMaster();
    }
  }

  public final boolean isSprintSet() {
    return this.sprintId != null;
  }

  public final boolean isSprint(scrum.server.sprint.Sprint sprint) {
    if (this.sprintId == null && sprint == null) return true;
    return sprint != null && sprint.getId().equals(this.sprintId);
  }

  protected final void updateSprint(Object value) {
    setSprint(
        value == null ? null : (scrum.server.sprint.Sprint) sprintDao.getById((String) value));
  }
  // -----------------------------------------------------------
  // - remainingWork
  // -----------------------------------------------------------

  private int remainingWork;

  public final int getRemainingWork() {
    return remainingWork;
  }

  public final void setRemainingWork(int remainingWork) {
    remainingWork = prepareRemainingWork(remainingWork);
    if (isRemainingWork(remainingWork)) return;
    this.remainingWork = remainingWork;
    updateLastModified();
    fireModified(
        "remainingWork",
        ilarkesto.core.persistance.Persistence.propertyAsString(this.remainingWork));
  }

  private final void updateRemainingWork(int remainingWork) {
    if (isRemainingWork(remainingWork)) return;
    this.remainingWork = remainingWork;
    updateLastModified();
    fireModified(
        "remainingWork",
        ilarkesto.core.persistance.Persistence.propertyAsString(this.remainingWork));
  }

  protected int prepareRemainingWork(int remainingWork) {
    return remainingWork;
  }

  public final boolean isRemainingWork(int remainingWork) {
    return this.remainingWork == remainingWork;
  }

  protected final void updateRemainingWork(Object value) {
    setRemainingWork((Integer) value);
  }
  // -----------------------------------------------------------
  // - burnedWork
  // -----------------------------------------------------------

  private int burnedWork;

  public final int getBurnedWork() {
    return burnedWork;
  }

  public final void setBurnedWork(int burnedWork) {
    burnedWork = prepareBurnedWork(burnedWork);
    if (isBurnedWork(burnedWork)) return;
    this.burnedWork = burnedWork;
    updateLastModified();
    fireModified(
        "burnedWork", ilarkesto.core.persistance.Persistence.propertyAsString(this.burnedWork));
  }

  private final void updateBurnedWork(int burnedWork) {
    if (isBurnedWork(burnedWork)) return;
    this.burnedWork = burnedWork;
    updateLastModified();
    fireModified(
        "burnedWork", ilarkesto.core.persistance.Persistence.propertyAsString(this.burnedWork));
  }

  protected int prepareBurnedWork(int burnedWork) {
    return burnedWork;
  }

  public final boolean isBurnedWork(int burnedWork) {
    return this.burnedWork == burnedWork;
  }

  protected final void updateBurnedWork(Object value) {
    setBurnedWork((Integer) value);
  }

  public void updateProperties(Map<String, String> properties) {
    super.updateProperties(properties);
    for (Map.Entry<String, String> entry : properties.entrySet()) {
      String property = entry.getKey();
      if (property.equals("id")) continue;
      String value = entry.getValue();
      if (property.equals("sprintId"))
        updateSprintId(ilarkesto.core.persistance.Persistence.parsePropertyReference(value));
      if (property.equals("remainingWork"))
        updateRemainingWork(ilarkesto.core.persistance.Persistence.parsePropertyint(value));
      if (property.equals("burnedWork"))
        updateBurnedWork(ilarkesto.core.persistance.Persistence.parsePropertyint(value));
    }
  }

  protected void repairDeadReferences(String entityId) {
    if (!isPersisted()) return;
    super.repairDeadReferences(entityId);
    repairDeadSprintReference(entityId);
  }

  // --- ensure integrity ---
  @Override
  public void onEnsureIntegrity() {
    super.onEnsureIntegrity();
    if (!isSprintSet()) {
      repairMissingMaster();
    }
    try {
      getSprint();
    } catch (ilarkesto.core.persistance.EntityDoesNotExistException ex) {
      LOG.info("Repairing dead sprint reference");
      repairDeadSprintReference(this.sprintId);
    }
  }

  // -----------------------------------------------------------
  // - dependencies
  // -----------------------------------------------------------

  static scrum.server.sprint.SprintDao sprintDao;

  public static final void setSprintDao(scrum.server.sprint.SprintDao sprintDao) {
    GProjectSprintSnapshot.sprintDao = sprintDao;
  }

  static scrum.server.project.ProjectSprintSnapshotDao projectSprintSnapshotDao;

  public static final void setProjectSprintSnapshotDao(
      scrum.server.project.ProjectSprintSnapshotDao projectSprintSnapshotDao) {
    GProjectSprintSnapshot.projectSprintSnapshotDao = projectSprintSnapshotDao;
  }
}
示例#5
0
public abstract class GWikipage extends AEntity
    implements ilarkesto.auth.ViewProtected<scrum.server.admin.User>,
        ilarkesto.search.Searchable,
        java.lang.Comparable<Wikipage> {

  // --- AEntity ---

  public final scrum.server.collaboration.WikipageDao getDao() {
    return wikipageDao;
  }

  protected void repairDeadDatob(ADatob datob) {}

  @Override
  public void storeProperties(Map properties) {
    super.storeProperties(properties);
    properties.put("projectId", this.projectId);
    properties.put("name", this.name);
    properties.put("text", this.text);
  }

  public int compareTo(Wikipage other) {
    return toString().toLowerCase().compareTo(other.toString().toLowerCase());
  }

  private static final ilarkesto.core.logging.Log LOG =
      ilarkesto.core.logging.Log.get(GWikipage.class);

  public static final String TYPE = "wikipage";

  // -----------------------------------------------------------
  // - Searchable
  // -----------------------------------------------------------

  public boolean matchesKey(String key) {
    if (super.matchesKey(key)) return true;
    if (matchesKey(getName(), key)) return true;
    if (matchesKey(getText(), 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;
    updateLastModified();
    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));
  }

  // -----------------------------------------------------------
  // - name
  // -----------------------------------------------------------

  private java.lang.String name;

  public final java.lang.String getName() {
    return name;
  }

  public final void setName(java.lang.String name) {
    name = prepareName(name);
    if (isName(name)) return;
    this.name = name;
    updateLastModified();
    fireModified("name=" + name);
  }

  protected java.lang.String prepareName(java.lang.String name) {
    name = Str.removeUnreadableChars(name);
    return name;
  }

  public final boolean isNameSet() {
    return this.name != null;
  }

  public final boolean isName(java.lang.String name) {
    if (this.name == null && name == null) return true;
    return this.name != null && this.name.equals(name);
  }

  protected final void updateName(Object value) {
    setName((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - text
  // -----------------------------------------------------------

  private java.lang.String text;

  public final java.lang.String getText() {
    return text;
  }

  public final void setText(java.lang.String text) {
    text = prepareText(text);
    if (isText(text)) return;
    this.text = text;
    updateLastModified();
    fireModified("text=" + text);
  }

  protected java.lang.String prepareText(java.lang.String text) {
    text = Str.removeUnreadableChars(text);
    return text;
  }

  public final boolean isTextSet() {
    return this.text != null;
  }

  public final boolean isText(java.lang.String text) {
    if (this.text == null && text == null) return true;
    return this.text != null && this.text.equals(text);
  }

  protected final void updateText(Object value) {
    setText((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("name")) updateName(value);
      if (property.equals("text")) updateText(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) {
    GWikipage.projectDao = projectDao;
  }

  static scrum.server.collaboration.WikipageDao wikipageDao;

  public static final void setWikipageDao(scrum.server.collaboration.WikipageDao wikipageDao) {
    GWikipage.wikipageDao = wikipageDao;
  }
}
示例#6
0
public abstract class GSystemConfig extends AEntity
    implements ilarkesto.auth.ViewProtected<scrum.server.admin.User>,
        ilarkesto.auth.EditProtected<scrum.server.admin.User>,
        java.lang.Comparable<SystemConfig> {

  // --- AEntity ---

  public final scrum.server.admin.SystemConfigDao getDao() {
    return systemConfigDao;
  }

  protected void repairDeadDatob(ADatob datob) {}

  @Override
  public void storeProperties(Map properties) {
    super.storeProperties(properties);
    properties.put("url", this.url);
    properties.put("adminEmail", this.adminEmail);
    properties.put("googleAnalyticsId", this.googleAnalyticsId);
    properties.put("smtpServer", this.smtpServer);
    properties.put("smtpPort", this.smtpPort);
    properties.put("smtpTls", this.smtpTls);
    properties.put("smtpUser", this.smtpUser);
    properties.put("smtpPassword", this.smtpPassword);
    properties.put("smtpFrom", this.smtpFrom);
    properties.put("instanceName", this.instanceName);
    properties.put("loginPageLogoUrl", this.loginPageLogoUrl);
    properties.put("loginPageMessage", this.loginPageMessage);
    properties.put("registerPageMessage", this.registerPageMessage);
    properties.put("aboutPageMessage", this.aboutPageMessage);
    properties.put("userEmailMandatory", this.userEmailMandatory);
    properties.put("registrationDisabled", this.registrationDisabled);
    properties.put("projectCreationDisabled", this.projectCreationDisabled);
    properties.put("defaultUserPassword", this.defaultUserPassword);
    properties.put("openIdDisabled", this.openIdDisabled);
    properties.put("openIdDomains", this.openIdDomains);
    properties.put("versionCheckEnabled", this.versionCheckEnabled);
    properties.put("ldapEnabled", this.ldapEnabled);
    properties.put("ldapUrl", this.ldapUrl);
    properties.put("ldapUser", this.ldapUser);
    properties.put("ldapPassword", this.ldapPassword);
    properties.put("ldapBaseDn", this.ldapBaseDn);
    properties.put("ldapUserFilterRegex", this.ldapUserFilterRegex);
    properties.put("maxFileSize", this.maxFileSize);
    properties.put("subscriptionKeySeed", this.subscriptionKeySeed);
  }

  public int compareTo(SystemConfig other) {
    return toString().toLowerCase().compareTo(other.toString().toLowerCase());
  }

  private static final ilarkesto.core.logging.Log LOG =
      ilarkesto.core.logging.Log.get(GSystemConfig.class);

  public static final String TYPE = "systemConfig";

  // -----------------------------------------------------------
  // - url
  // -----------------------------------------------------------

  private java.lang.String url;

  public final java.lang.String getUrl() {
    return url;
  }

  public final void setUrl(java.lang.String url) {
    url = prepareUrl(url);
    if (isUrl(url)) return;
    this.url = url;
    updateLastModified();
    fireModified("url=" + url);
  }

  protected java.lang.String prepareUrl(java.lang.String url) {
    // url = Str.removeUnreadableChars(url);
    return url;
  }

  public final boolean isUrlSet() {
    return this.url != null;
  }

  public final boolean isUrl(java.lang.String url) {
    if (this.url == null && url == null) return true;
    return this.url != null && this.url.equals(url);
  }

  protected final void updateUrl(Object value) {
    setUrl((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - adminEmail
  // -----------------------------------------------------------

  private java.lang.String adminEmail;

  public final java.lang.String getAdminEmail() {
    return adminEmail;
  }

  public final void setAdminEmail(java.lang.String adminEmail) {
    adminEmail = prepareAdminEmail(adminEmail);
    if (isAdminEmail(adminEmail)) return;
    this.adminEmail = adminEmail;
    updateLastModified();
    fireModified("adminEmail=" + adminEmail);
  }

  protected java.lang.String prepareAdminEmail(java.lang.String adminEmail) {
    // adminEmail = Str.removeUnreadableChars(adminEmail);
    return adminEmail;
  }

  public final boolean isAdminEmailSet() {
    return this.adminEmail != null;
  }

  public final boolean isAdminEmail(java.lang.String adminEmail) {
    if (this.adminEmail == null && adminEmail == null) return true;
    return this.adminEmail != null && this.adminEmail.equals(adminEmail);
  }

  protected final void updateAdminEmail(Object value) {
    setAdminEmail((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - googleAnalyticsId
  // -----------------------------------------------------------

  private java.lang.String googleAnalyticsId;

  public final java.lang.String getGoogleAnalyticsId() {
    return googleAnalyticsId;
  }

  public final void setGoogleAnalyticsId(java.lang.String googleAnalyticsId) {
    googleAnalyticsId = prepareGoogleAnalyticsId(googleAnalyticsId);
    if (isGoogleAnalyticsId(googleAnalyticsId)) return;
    this.googleAnalyticsId = googleAnalyticsId;
    updateLastModified();
    fireModified("googleAnalyticsId=" + googleAnalyticsId);
  }

  protected java.lang.String prepareGoogleAnalyticsId(java.lang.String googleAnalyticsId) {
    // googleAnalyticsId = Str.removeUnreadableChars(googleAnalyticsId);
    return googleAnalyticsId;
  }

  public final boolean isGoogleAnalyticsIdSet() {
    return this.googleAnalyticsId != null;
  }

  public final boolean isGoogleAnalyticsId(java.lang.String googleAnalyticsId) {
    if (this.googleAnalyticsId == null && googleAnalyticsId == null) return true;
    return this.googleAnalyticsId != null && this.googleAnalyticsId.equals(googleAnalyticsId);
  }

  protected final void updateGoogleAnalyticsId(Object value) {
    setGoogleAnalyticsId((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - smtpServer
  // -----------------------------------------------------------

  private java.lang.String smtpServer;

  public final java.lang.String getSmtpServer() {
    return smtpServer;
  }

  public final void setSmtpServer(java.lang.String smtpServer) {
    smtpServer = prepareSmtpServer(smtpServer);
    if (isSmtpServer(smtpServer)) return;
    this.smtpServer = smtpServer;
    updateLastModified();
    fireModified("smtpServer=" + smtpServer);
  }

  protected java.lang.String prepareSmtpServer(java.lang.String smtpServer) {
    // smtpServer = Str.removeUnreadableChars(smtpServer);
    return smtpServer;
  }

  public final boolean isSmtpServerSet() {
    return this.smtpServer != null;
  }

  public final boolean isSmtpServer(java.lang.String smtpServer) {
    if (this.smtpServer == null && smtpServer == null) return true;
    return this.smtpServer != null && this.smtpServer.equals(smtpServer);
  }

  protected final void updateSmtpServer(Object value) {
    setSmtpServer((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - smtpPort
  // -----------------------------------------------------------

  private java.lang.Integer smtpPort;

  public final java.lang.Integer getSmtpPort() {
    return smtpPort;
  }

  public final void setSmtpPort(java.lang.Integer smtpPort) {
    smtpPort = prepareSmtpPort(smtpPort);
    if (isSmtpPort(smtpPort)) return;
    this.smtpPort = smtpPort;
    updateLastModified();
    fireModified("smtpPort=" + smtpPort);
  }

  protected java.lang.Integer prepareSmtpPort(java.lang.Integer smtpPort) {
    return smtpPort;
  }

  public final boolean isSmtpPortSet() {
    return this.smtpPort != null;
  }

  public final boolean isSmtpPort(java.lang.Integer smtpPort) {
    if (this.smtpPort == null && smtpPort == null) return true;
    return this.smtpPort != null && this.smtpPort.equals(smtpPort);
  }

  protected final void updateSmtpPort(Object value) {
    setSmtpPort((java.lang.Integer) value);
  }

  // -----------------------------------------------------------
  // - smtpTls
  // -----------------------------------------------------------

  private boolean smtpTls;

  public final boolean isSmtpTls() {
    return smtpTls;
  }

  public final void setSmtpTls(boolean smtpTls) {
    smtpTls = prepareSmtpTls(smtpTls);
    if (isSmtpTls(smtpTls)) return;
    this.smtpTls = smtpTls;
    updateLastModified();
    fireModified("smtpTls=" + smtpTls);
  }

  protected boolean prepareSmtpTls(boolean smtpTls) {
    return smtpTls;
  }

  public final boolean isSmtpTls(boolean smtpTls) {
    return this.smtpTls == smtpTls;
  }

  protected final void updateSmtpTls(Object value) {
    setSmtpTls((Boolean) value);
  }

  // -----------------------------------------------------------
  // - smtpUser
  // -----------------------------------------------------------

  private java.lang.String smtpUser;

  public final java.lang.String getSmtpUser() {
    return smtpUser;
  }

  public final void setSmtpUser(java.lang.String smtpUser) {
    smtpUser = prepareSmtpUser(smtpUser);
    if (isSmtpUser(smtpUser)) return;
    this.smtpUser = smtpUser;
    updateLastModified();
    fireModified("smtpUser="******"smtpPassword="******"smtpFrom=" + smtpFrom);
  }

  protected java.lang.String prepareSmtpFrom(java.lang.String smtpFrom) {
    // smtpFrom = Str.removeUnreadableChars(smtpFrom);
    return smtpFrom;
  }

  public final boolean isSmtpFromSet() {
    return this.smtpFrom != null;
  }

  public final boolean isSmtpFrom(java.lang.String smtpFrom) {
    if (this.smtpFrom == null && smtpFrom == null) return true;
    return this.smtpFrom != null && this.smtpFrom.equals(smtpFrom);
  }

  protected final void updateSmtpFrom(Object value) {
    setSmtpFrom((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - instanceName
  // -----------------------------------------------------------

  private java.lang.String instanceName;

  public final java.lang.String getInstanceName() {
    return instanceName;
  }

  public final void setInstanceName(java.lang.String instanceName) {
    instanceName = prepareInstanceName(instanceName);
    if (isInstanceName(instanceName)) return;
    this.instanceName = instanceName;
    updateLastModified();
    fireModified("instanceName=" + instanceName);
  }

  protected java.lang.String prepareInstanceName(java.lang.String instanceName) {
    // instanceName = Str.removeUnreadableChars(instanceName);
    return instanceName;
  }

  public final boolean isInstanceNameSet() {
    return this.instanceName != null;
  }

  public final boolean isInstanceName(java.lang.String instanceName) {
    if (this.instanceName == null && instanceName == null) return true;
    return this.instanceName != null && this.instanceName.equals(instanceName);
  }

  protected final void updateInstanceName(Object value) {
    setInstanceName((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - loginPageLogoUrl
  // -----------------------------------------------------------

  private java.lang.String loginPageLogoUrl;

  public final java.lang.String getLoginPageLogoUrl() {
    return loginPageLogoUrl;
  }

  public final void setLoginPageLogoUrl(java.lang.String loginPageLogoUrl) {
    loginPageLogoUrl = prepareLoginPageLogoUrl(loginPageLogoUrl);
    if (isLoginPageLogoUrl(loginPageLogoUrl)) return;
    this.loginPageLogoUrl = loginPageLogoUrl;
    updateLastModified();
    fireModified("loginPageLogoUrl=" + loginPageLogoUrl);
  }

  protected java.lang.String prepareLoginPageLogoUrl(java.lang.String loginPageLogoUrl) {
    // loginPageLogoUrl = Str.removeUnreadableChars(loginPageLogoUrl);
    return loginPageLogoUrl;
  }

  public final boolean isLoginPageLogoUrlSet() {
    return this.loginPageLogoUrl != null;
  }

  public final boolean isLoginPageLogoUrl(java.lang.String loginPageLogoUrl) {
    if (this.loginPageLogoUrl == null && loginPageLogoUrl == null) return true;
    return this.loginPageLogoUrl != null && this.loginPageLogoUrl.equals(loginPageLogoUrl);
  }

  protected final void updateLoginPageLogoUrl(Object value) {
    setLoginPageLogoUrl((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - loginPageMessage
  // -----------------------------------------------------------

  private java.lang.String loginPageMessage;

  public final java.lang.String getLoginPageMessage() {
    return loginPageMessage;
  }

  public final void setLoginPageMessage(java.lang.String loginPageMessage) {
    loginPageMessage = prepareLoginPageMessage(loginPageMessage);
    if (isLoginPageMessage(loginPageMessage)) return;
    this.loginPageMessage = loginPageMessage;
    updateLastModified();
    fireModified("loginPageMessage=" + loginPageMessage);
  }

  protected java.lang.String prepareLoginPageMessage(java.lang.String loginPageMessage) {
    // loginPageMessage = Str.removeUnreadableChars(loginPageMessage);
    return loginPageMessage;
  }

  public final boolean isLoginPageMessageSet() {
    return this.loginPageMessage != null;
  }

  public final boolean isLoginPageMessage(java.lang.String loginPageMessage) {
    if (this.loginPageMessage == null && loginPageMessage == null) return true;
    return this.loginPageMessage != null && this.loginPageMessage.equals(loginPageMessage);
  }

  protected final void updateLoginPageMessage(Object value) {
    setLoginPageMessage((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - registerPageMessage
  // -----------------------------------------------------------

  private java.lang.String registerPageMessage;

  public final java.lang.String getRegisterPageMessage() {
    return registerPageMessage;
  }

  public final void setRegisterPageMessage(java.lang.String registerPageMessage) {
    registerPageMessage = prepareRegisterPageMessage(registerPageMessage);
    if (isRegisterPageMessage(registerPageMessage)) return;
    this.registerPageMessage = registerPageMessage;
    updateLastModified();
    fireModified("registerPageMessage=" + registerPageMessage);
  }

  protected java.lang.String prepareRegisterPageMessage(java.lang.String registerPageMessage) {
    // registerPageMessage = Str.removeUnreadableChars(registerPageMessage);
    return registerPageMessage;
  }

  public final boolean isRegisterPageMessageSet() {
    return this.registerPageMessage != null;
  }

  public final boolean isRegisterPageMessage(java.lang.String registerPageMessage) {
    if (this.registerPageMessage == null && registerPageMessage == null) return true;
    return this.registerPageMessage != null && this.registerPageMessage.equals(registerPageMessage);
  }

  protected final void updateRegisterPageMessage(Object value) {
    setRegisterPageMessage((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - aboutPageMessage
  // -----------------------------------------------------------

  private java.lang.String aboutPageMessage;

  public final java.lang.String getAboutPageMessage() {
    return aboutPageMessage;
  }

  public final void setAboutPageMessage(java.lang.String aboutPageMessage) {
    aboutPageMessage = prepareAboutPageMessage(aboutPageMessage);
    if (isAboutPageMessage(aboutPageMessage)) return;
    this.aboutPageMessage = aboutPageMessage;
    updateLastModified();
    fireModified("aboutPageMessage=" + aboutPageMessage);
  }

  protected java.lang.String prepareAboutPageMessage(java.lang.String aboutPageMessage) {
    // aboutPageMessage = Str.removeUnreadableChars(aboutPageMessage);
    return aboutPageMessage;
  }

  public final boolean isAboutPageMessageSet() {
    return this.aboutPageMessage != null;
  }

  public final boolean isAboutPageMessage(java.lang.String aboutPageMessage) {
    if (this.aboutPageMessage == null && aboutPageMessage == null) return true;
    return this.aboutPageMessage != null && this.aboutPageMessage.equals(aboutPageMessage);
  }

  protected final void updateAboutPageMessage(Object value) {
    setAboutPageMessage((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - userEmailMandatory
  // -----------------------------------------------------------

  private boolean userEmailMandatory;

  public final boolean isUserEmailMandatory() {
    return userEmailMandatory;
  }

  public final void setUserEmailMandatory(boolean userEmailMandatory) {
    userEmailMandatory = prepareUserEmailMandatory(userEmailMandatory);
    if (isUserEmailMandatory(userEmailMandatory)) return;
    this.userEmailMandatory = userEmailMandatory;
    updateLastModified();
    fireModified("userEmailMandatory=" + userEmailMandatory);
  }

  protected boolean prepareUserEmailMandatory(boolean userEmailMandatory) {
    return userEmailMandatory;
  }

  public final boolean isUserEmailMandatory(boolean userEmailMandatory) {
    return this.userEmailMandatory == userEmailMandatory;
  }

  protected final void updateUserEmailMandatory(Object value) {
    setUserEmailMandatory((Boolean) value);
  }

  // -----------------------------------------------------------
  // - registrationDisabled
  // -----------------------------------------------------------

  private boolean registrationDisabled;

  public final boolean isRegistrationDisabled() {
    return registrationDisabled;
  }

  public final void setRegistrationDisabled(boolean registrationDisabled) {
    registrationDisabled = prepareRegistrationDisabled(registrationDisabled);
    if (isRegistrationDisabled(registrationDisabled)) return;
    this.registrationDisabled = registrationDisabled;
    updateLastModified();
    fireModified("registrationDisabled=" + registrationDisabled);
  }

  protected boolean prepareRegistrationDisabled(boolean registrationDisabled) {
    return registrationDisabled;
  }

  public final boolean isRegistrationDisabled(boolean registrationDisabled) {
    return this.registrationDisabled == registrationDisabled;
  }

  protected final void updateRegistrationDisabled(Object value) {
    setRegistrationDisabled((Boolean) value);
  }

  // -----------------------------------------------------------
  // - projectCreationDisabled
  // -----------------------------------------------------------

  private boolean projectCreationDisabled;

  public final boolean isProjectCreationDisabled() {
    return projectCreationDisabled;
  }

  public final void setProjectCreationDisabled(boolean projectCreationDisabled) {
    projectCreationDisabled = prepareProjectCreationDisabled(projectCreationDisabled);
    if (isProjectCreationDisabled(projectCreationDisabled)) return;
    this.projectCreationDisabled = projectCreationDisabled;
    updateLastModified();
    fireModified("projectCreationDisabled=" + projectCreationDisabled);
  }

  protected boolean prepareProjectCreationDisabled(boolean projectCreationDisabled) {
    return projectCreationDisabled;
  }

  public final boolean isProjectCreationDisabled(boolean projectCreationDisabled) {
    return this.projectCreationDisabled == projectCreationDisabled;
  }

  protected final void updateProjectCreationDisabled(Object value) {
    setProjectCreationDisabled((Boolean) value);
  }

  // -----------------------------------------------------------
  // - defaultUserPassword
  // -----------------------------------------------------------

  private java.lang.String defaultUserPassword;

  public final java.lang.String getDefaultUserPassword() {
    return defaultUserPassword;
  }

  public final void setDefaultUserPassword(java.lang.String defaultUserPassword) {
    defaultUserPassword = prepareDefaultUserPassword(defaultUserPassword);
    if (isDefaultUserPassword(defaultUserPassword)) return;
    this.defaultUserPassword = defaultUserPassword;
    updateLastModified();
    fireModified("defaultUserPassword="******"openIdDisabled=" + openIdDisabled);
  }

  protected boolean prepareOpenIdDisabled(boolean openIdDisabled) {
    return openIdDisabled;
  }

  public final boolean isOpenIdDisabled(boolean openIdDisabled) {
    return this.openIdDisabled == openIdDisabled;
  }

  protected final void updateOpenIdDisabled(Object value) {
    setOpenIdDisabled((Boolean) value);
  }

  // -----------------------------------------------------------
  // - openIdDomains
  // -----------------------------------------------------------

  private java.lang.String openIdDomains;

  public final java.lang.String getOpenIdDomains() {
    return openIdDomains;
  }

  public final void setOpenIdDomains(java.lang.String openIdDomains) {
    openIdDomains = prepareOpenIdDomains(openIdDomains);
    if (isOpenIdDomains(openIdDomains)) return;
    this.openIdDomains = openIdDomains;
    updateLastModified();
    fireModified("openIdDomains=" + openIdDomains);
  }

  protected java.lang.String prepareOpenIdDomains(java.lang.String openIdDomains) {
    // openIdDomains = Str.removeUnreadableChars(openIdDomains);
    return openIdDomains;
  }

  public final boolean isOpenIdDomainsSet() {
    return this.openIdDomains != null;
  }

  public final boolean isOpenIdDomains(java.lang.String openIdDomains) {
    if (this.openIdDomains == null && openIdDomains == null) return true;
    return this.openIdDomains != null && this.openIdDomains.equals(openIdDomains);
  }

  protected final void updateOpenIdDomains(Object value) {
    setOpenIdDomains((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - versionCheckEnabled
  // -----------------------------------------------------------

  private boolean versionCheckEnabled;

  public final boolean isVersionCheckEnabled() {
    return versionCheckEnabled;
  }

  public final void setVersionCheckEnabled(boolean versionCheckEnabled) {
    versionCheckEnabled = prepareVersionCheckEnabled(versionCheckEnabled);
    if (isVersionCheckEnabled(versionCheckEnabled)) return;
    this.versionCheckEnabled = versionCheckEnabled;
    updateLastModified();
    fireModified("versionCheckEnabled=" + versionCheckEnabled);
  }

  protected boolean prepareVersionCheckEnabled(boolean versionCheckEnabled) {
    return versionCheckEnabled;
  }

  public final boolean isVersionCheckEnabled(boolean versionCheckEnabled) {
    return this.versionCheckEnabled == versionCheckEnabled;
  }

  protected final void updateVersionCheckEnabled(Object value) {
    setVersionCheckEnabled((Boolean) value);
  }

  // -----------------------------------------------------------
  // - ldapEnabled
  // -----------------------------------------------------------

  private boolean ldapEnabled;

  public final boolean isLdapEnabled() {
    return ldapEnabled;
  }

  public final void setLdapEnabled(boolean ldapEnabled) {
    ldapEnabled = prepareLdapEnabled(ldapEnabled);
    if (isLdapEnabled(ldapEnabled)) return;
    this.ldapEnabled = ldapEnabled;
    updateLastModified();
    fireModified("ldapEnabled=" + ldapEnabled);
  }

  protected boolean prepareLdapEnabled(boolean ldapEnabled) {
    return ldapEnabled;
  }

  public final boolean isLdapEnabled(boolean ldapEnabled) {
    return this.ldapEnabled == ldapEnabled;
  }

  protected final void updateLdapEnabled(Object value) {
    setLdapEnabled((Boolean) value);
  }

  // -----------------------------------------------------------
  // - ldapUrl
  // -----------------------------------------------------------

  private java.lang.String ldapUrl;

  public final java.lang.String getLdapUrl() {
    return ldapUrl;
  }

  public final void setLdapUrl(java.lang.String ldapUrl) {
    ldapUrl = prepareLdapUrl(ldapUrl);
    if (isLdapUrl(ldapUrl)) return;
    this.ldapUrl = ldapUrl;
    updateLastModified();
    fireModified("ldapUrl=" + ldapUrl);
  }

  protected java.lang.String prepareLdapUrl(java.lang.String ldapUrl) {
    // ldapUrl = Str.removeUnreadableChars(ldapUrl);
    return ldapUrl;
  }

  public final boolean isLdapUrlSet() {
    return this.ldapUrl != null;
  }

  public final boolean isLdapUrl(java.lang.String ldapUrl) {
    if (this.ldapUrl == null && ldapUrl == null) return true;
    return this.ldapUrl != null && this.ldapUrl.equals(ldapUrl);
  }

  protected final void updateLdapUrl(Object value) {
    setLdapUrl((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - ldapUser
  // -----------------------------------------------------------

  private java.lang.String ldapUser;

  public final java.lang.String getLdapUser() {
    return ldapUser;
  }

  public final void setLdapUser(java.lang.String ldapUser) {
    ldapUser = prepareLdapUser(ldapUser);
    if (isLdapUser(ldapUser)) return;
    this.ldapUser = ldapUser;
    updateLastModified();
    fireModified("ldapUser="******"ldapPassword="******"ldapBaseDn=" + ldapBaseDn);
  }

  protected java.lang.String prepareLdapBaseDn(java.lang.String ldapBaseDn) {
    // ldapBaseDn = Str.removeUnreadableChars(ldapBaseDn);
    return ldapBaseDn;
  }

  public final boolean isLdapBaseDnSet() {
    return this.ldapBaseDn != null;
  }

  public final boolean isLdapBaseDn(java.lang.String ldapBaseDn) {
    if (this.ldapBaseDn == null && ldapBaseDn == null) return true;
    return this.ldapBaseDn != null && this.ldapBaseDn.equals(ldapBaseDn);
  }

  protected final void updateLdapBaseDn(Object value) {
    setLdapBaseDn((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - ldapUserFilterRegex
  // -----------------------------------------------------------

  private java.lang.String ldapUserFilterRegex;

  public final java.lang.String getLdapUserFilterRegex() {
    return ldapUserFilterRegex;
  }

  public final void setLdapUserFilterRegex(java.lang.String ldapUserFilterRegex) {
    ldapUserFilterRegex = prepareLdapUserFilterRegex(ldapUserFilterRegex);
    if (isLdapUserFilterRegex(ldapUserFilterRegex)) return;
    this.ldapUserFilterRegex = ldapUserFilterRegex;
    updateLastModified();
    fireModified("ldapUserFilterRegex=" + ldapUserFilterRegex);
  }

  protected java.lang.String prepareLdapUserFilterRegex(java.lang.String ldapUserFilterRegex) {
    // ldapUserFilterRegex = Str.removeUnreadableChars(ldapUserFilterRegex);
    return ldapUserFilterRegex;
  }

  public final boolean isLdapUserFilterRegexSet() {
    return this.ldapUserFilterRegex != null;
  }

  public final boolean isLdapUserFilterRegex(java.lang.String ldapUserFilterRegex) {
    if (this.ldapUserFilterRegex == null && ldapUserFilterRegex == null) return true;
    return this.ldapUserFilterRegex != null && this.ldapUserFilterRegex.equals(ldapUserFilterRegex);
  }

  protected final void updateLdapUserFilterRegex(Object value) {
    setLdapUserFilterRegex((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - maxFileSize
  // -----------------------------------------------------------

  private java.lang.Integer maxFileSize;

  public final java.lang.Integer getMaxFileSize() {
    return maxFileSize;
  }

  public final void setMaxFileSize(java.lang.Integer maxFileSize) {
    maxFileSize = prepareMaxFileSize(maxFileSize);
    if (isMaxFileSize(maxFileSize)) return;
    this.maxFileSize = maxFileSize;
    updateLastModified();
    fireModified("maxFileSize=" + maxFileSize);
  }

  protected java.lang.Integer prepareMaxFileSize(java.lang.Integer maxFileSize) {
    return maxFileSize;
  }

  public final boolean isMaxFileSizeSet() {
    return this.maxFileSize != null;
  }

  public final boolean isMaxFileSize(java.lang.Integer maxFileSize) {
    if (this.maxFileSize == null && maxFileSize == null) return true;
    return this.maxFileSize != null && this.maxFileSize.equals(maxFileSize);
  }

  protected final void updateMaxFileSize(Object value) {
    setMaxFileSize((java.lang.Integer) value);
  }

  // -----------------------------------------------------------
  // - subscriptionKeySeed
  // -----------------------------------------------------------

  private java.lang.String subscriptionKeySeed;

  public final java.lang.String getSubscriptionKeySeed() {
    return subscriptionKeySeed;
  }

  public final void setSubscriptionKeySeed(java.lang.String subscriptionKeySeed) {
    subscriptionKeySeed = prepareSubscriptionKeySeed(subscriptionKeySeed);
    if (isSubscriptionKeySeed(subscriptionKeySeed)) return;
    this.subscriptionKeySeed = subscriptionKeySeed;
    updateLastModified();
    fireModified("subscriptionKeySeed=" + subscriptionKeySeed);
  }

  protected java.lang.String prepareSubscriptionKeySeed(java.lang.String subscriptionKeySeed) {
    // subscriptionKeySeed = Str.removeUnreadableChars(subscriptionKeySeed);
    return subscriptionKeySeed;
  }

  public final boolean isSubscriptionKeySeedSet() {
    return this.subscriptionKeySeed != null;
  }

  public final boolean isSubscriptionKeySeed(java.lang.String subscriptionKeySeed) {
    if (this.subscriptionKeySeed == null && subscriptionKeySeed == null) return true;
    return this.subscriptionKeySeed != null && this.subscriptionKeySeed.equals(subscriptionKeySeed);
  }

  protected final void updateSubscriptionKeySeed(Object value) {
    setSubscriptionKeySeed((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("url")) updateUrl(value);
      if (property.equals("adminEmail")) updateAdminEmail(value);
      if (property.equals("googleAnalyticsId")) updateGoogleAnalyticsId(value);
      if (property.equals("smtpServer")) updateSmtpServer(value);
      if (property.equals("smtpPort")) updateSmtpPort(value);
      if (property.equals("smtpTls")) updateSmtpTls(value);
      if (property.equals("smtpUser")) updateSmtpUser(value);
      if (property.equals("smtpPassword")) updateSmtpPassword(value);
      if (property.equals("smtpFrom")) updateSmtpFrom(value);
      if (property.equals("instanceName")) updateInstanceName(value);
      if (property.equals("loginPageLogoUrl")) updateLoginPageLogoUrl(value);
      if (property.equals("loginPageMessage")) updateLoginPageMessage(value);
      if (property.equals("registerPageMessage")) updateRegisterPageMessage(value);
      if (property.equals("aboutPageMessage")) updateAboutPageMessage(value);
      if (property.equals("userEmailMandatory")) updateUserEmailMandatory(value);
      if (property.equals("registrationDisabled")) updateRegistrationDisabled(value);
      if (property.equals("projectCreationDisabled")) updateProjectCreationDisabled(value);
      if (property.equals("defaultUserPassword")) updateDefaultUserPassword(value);
      if (property.equals("openIdDisabled")) updateOpenIdDisabled(value);
      if (property.equals("openIdDomains")) updateOpenIdDomains(value);
      if (property.equals("versionCheckEnabled")) updateVersionCheckEnabled(value);
      if (property.equals("ldapEnabled")) updateLdapEnabled(value);
      if (property.equals("ldapUrl")) updateLdapUrl(value);
      if (property.equals("ldapUser")) updateLdapUser(value);
      if (property.equals("ldapPassword")) updateLdapPassword(value);
      if (property.equals("ldapBaseDn")) updateLdapBaseDn(value);
      if (property.equals("ldapUserFilterRegex")) updateLdapUserFilterRegex(value);
      if (property.equals("maxFileSize")) updateMaxFileSize(value);
      if (property.equals("subscriptionKeySeed")) updateSubscriptionKeySeed(value);
    }
  }

  protected void repairDeadReferences(String entityId) {
    super.repairDeadReferences(entityId);
  }

  // --- ensure integrity ---

  public void ensureIntegrity() {
    super.ensureIntegrity();
  }

  static scrum.server.admin.SystemConfigDao systemConfigDao;

  public static final void setSystemConfigDao(scrum.server.admin.SystemConfigDao systemConfigDao) {
    GSystemConfig.systemConfigDao = systemConfigDao;
  }
}
示例#7
0
public abstract class GBlogEntry extends AEntity
    implements ilarkesto.auth.ViewProtected<scrum.server.admin.User>,
        ilarkesto.search.Searchable,
        java.lang.Comparable<BlogEntry> {

  // --- AEntity ---

  public final scrum.server.pr.BlogEntryDao getDao() {
    return blogEntryDao;
  }

  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("authorsIds", this.authorsIds);
    properties.put("title", this.title);
    properties.put("text", this.text);
    properties.put("dateAndTime", this.dateAndTime == null ? null : this.dateAndTime.toString());
    properties.put("releasesIds", this.releasesIds);
    properties.put("published", this.published);
  }

  public int compareTo(BlogEntry other) {
    return toString().toLowerCase().compareTo(other.toString().toLowerCase());
  }

  private static final ilarkesto.core.logging.Log LOG =
      ilarkesto.core.logging.Log.get(GBlogEntry.class);

  public static final String TYPE = "blogEntry";

  // -----------------------------------------------------------
  // - Searchable
  // -----------------------------------------------------------

  public boolean matchesKey(String key) {
    if (super.matchesKey(key)) return true;
    if (matchesKey(getTitle(), key)) return true;
    if (matchesKey(getText(), 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;
    updateLastModified();
    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;
    updateLastModified();
    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);
  }

  // -----------------------------------------------------------
  // - authors
  // -----------------------------------------------------------

  private java.util.Set<String> authorsIds = new java.util.HashSet<String>();

  public final java.util.Set<scrum.server.admin.User> getAuthors() {
    return (java.util.Set) userDao.getByIdsAsSet(this.authorsIds);
  }

  public final void setAuthors(Collection<scrum.server.admin.User> authors) {
    authors = prepareAuthors(authors);
    if (authors == null) authors = Collections.emptyList();
    java.util.Set<String> ids = getIdsAsSet(authors);
    if (this.authorsIds.equals(ids)) return;
    this.authorsIds = ids;
    updateLastModified();
    fireModified("authors=" + Str.format(authors));
  }

  protected Collection<scrum.server.admin.User> prepareAuthors(
      Collection<scrum.server.admin.User> authors) {
    return authors;
  }

  protected void repairDeadAuthorReference(String entityId) {
    if (this.authorsIds.remove(entityId)) fireModified("authors-=" + entityId);
  }

  public final boolean containsAuthor(scrum.server.admin.User author) {
    if (author == null) return false;
    return this.authorsIds.contains(author.getId());
  }

  public final int getAuthorsCount() {
    return this.authorsIds.size();
  }

  public final boolean isAuthorsEmpty() {
    return this.authorsIds.isEmpty();
  }

  public final boolean addAuthor(scrum.server.admin.User author) {
    if (author == null) throw new IllegalArgumentException("author == null");
    boolean added = this.authorsIds.add(author.getId());
    if (added) updateLastModified();
    if (added) fireModified("authors+=" + author);
    return added;
  }

  public final boolean addAuthors(Collection<scrum.server.admin.User> authors) {
    if (authors == null) throw new IllegalArgumentException("authors == null");
    boolean added = false;
    for (scrum.server.admin.User author : authors) {
      added = added | this.authorsIds.add(author.getId());
    }
    return added;
  }

  public final boolean removeAuthor(scrum.server.admin.User author) {
    if (author == null) throw new IllegalArgumentException("author == null");
    if (this.authorsIds == null) return false;
    boolean removed = this.authorsIds.remove(author.getId());
    if (removed) updateLastModified();
    if (removed) fireModified("authors-=" + author);
    return removed;
  }

  public final boolean removeAuthors(Collection<scrum.server.admin.User> authors) {
    if (authors == null) return false;
    if (authors.isEmpty()) return false;
    boolean removed = false;
    for (scrum.server.admin.User _element : authors) {
      removed = removed | removeAuthor(_element);
    }
    return removed;
  }

  public final boolean clearAuthors() {
    if (this.authorsIds.isEmpty()) return false;
    this.authorsIds.clear();
    updateLastModified();
    fireModified("authors cleared");
    return true;
  }

  protected final void updateAuthors(Object value) {
    Collection<String> ids = (Collection<String>) value;
    setAuthors((java.util.Set) userDao.getByIdsAsSet(ids));
  }

  // -----------------------------------------------------------
  // - title
  // -----------------------------------------------------------

  private java.lang.String title;

  public final java.lang.String getTitle() {
    return title;
  }

  public final void setTitle(java.lang.String title) {
    title = prepareTitle(title);
    if (isTitle(title)) return;
    this.title = title;
    updateLastModified();
    fireModified("title=" + title);
  }

  protected java.lang.String prepareTitle(java.lang.String title) {
    // title = Str.removeUnreadableChars(title);
    return title;
  }

  public final boolean isTitleSet() {
    return this.title != null;
  }

  public final boolean isTitle(java.lang.String title) {
    if (this.title == null && title == null) return true;
    return this.title != null && this.title.equals(title);
  }

  protected final void updateTitle(Object value) {
    setTitle((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - text
  // -----------------------------------------------------------

  private java.lang.String text;

  public final java.lang.String getText() {
    return text;
  }

  public final void setText(java.lang.String text) {
    text = prepareText(text);
    if (isText(text)) return;
    this.text = text;
    updateLastModified();
    fireModified("text=" + text);
  }

  protected java.lang.String prepareText(java.lang.String text) {
    // text = Str.removeUnreadableChars(text);
    return text;
  }

  public final boolean isTextSet() {
    return this.text != null;
  }

  public final boolean isText(java.lang.String text) {
    if (this.text == null && text == null) return true;
    return this.text != null && this.text.equals(text);
  }

  protected final void updateText(Object value) {
    setText((java.lang.String) value);
  }

  // -----------------------------------------------------------
  // - dateAndTime
  // -----------------------------------------------------------

  private ilarkesto.core.time.DateAndTime dateAndTime;

  public final ilarkesto.core.time.DateAndTime getDateAndTime() {
    return dateAndTime;
  }

  public final void setDateAndTime(ilarkesto.core.time.DateAndTime dateAndTime) {
    dateAndTime = prepareDateAndTime(dateAndTime);
    if (isDateAndTime(dateAndTime)) return;
    this.dateAndTime = dateAndTime;
    updateLastModified();
    fireModified("dateAndTime=" + dateAndTime);
  }

  protected ilarkesto.core.time.DateAndTime prepareDateAndTime(
      ilarkesto.core.time.DateAndTime dateAndTime) {
    return dateAndTime;
  }

  public final boolean isDateAndTimeSet() {
    return this.dateAndTime != null;
  }

  public final boolean isDateAndTime(ilarkesto.core.time.DateAndTime dateAndTime) {
    if (this.dateAndTime == null && dateAndTime == null) return true;
    return this.dateAndTime != null && this.dateAndTime.equals(dateAndTime);
  }

  protected final void updateDateAndTime(Object value) {
    value = value == null ? null : new ilarkesto.core.time.DateAndTime((String) value);
    setDateAndTime((ilarkesto.core.time.DateAndTime) value);
  }

  // -----------------------------------------------------------
  // - releases
  // -----------------------------------------------------------

  private java.util.Set<String> releasesIds = new java.util.HashSet<String>();

  public final java.util.Set<scrum.server.release.Release> getReleases() {
    return (java.util.Set) releaseDao.getByIdsAsSet(this.releasesIds);
  }

  public final void setReleases(Collection<scrum.server.release.Release> releases) {
    releases = prepareReleases(releases);
    if (releases == null) releases = Collections.emptyList();
    java.util.Set<String> ids = getIdsAsSet(releases);
    if (this.releasesIds.equals(ids)) return;
    this.releasesIds = ids;
    updateLastModified();
    fireModified("releases=" + Str.format(releases));
  }

  protected Collection<scrum.server.release.Release> prepareReleases(
      Collection<scrum.server.release.Release> releases) {
    return releases;
  }

  protected void repairDeadReleaseReference(String entityId) {
    if (this.releasesIds.remove(entityId)) fireModified("releases-=" + entityId);
  }

  public final boolean containsRelease(scrum.server.release.Release release) {
    if (release == null) return false;
    return this.releasesIds.contains(release.getId());
  }

  public final int getReleasesCount() {
    return this.releasesIds.size();
  }

  public final boolean isReleasesEmpty() {
    return this.releasesIds.isEmpty();
  }

  public final boolean addRelease(scrum.server.release.Release release) {
    if (release == null) throw new IllegalArgumentException("release == null");
    boolean added = this.releasesIds.add(release.getId());
    if (added) updateLastModified();
    if (added) fireModified("releases+=" + release);
    return added;
  }

  public final boolean addReleases(Collection<scrum.server.release.Release> releases) {
    if (releases == null) throw new IllegalArgumentException("releases == null");
    boolean added = false;
    for (scrum.server.release.Release release : releases) {
      added = added | this.releasesIds.add(release.getId());
    }
    return added;
  }

  public final boolean removeRelease(scrum.server.release.Release release) {
    if (release == null) throw new IllegalArgumentException("release == null");
    if (this.releasesIds == null) return false;
    boolean removed = this.releasesIds.remove(release.getId());
    if (removed) updateLastModified();
    if (removed) fireModified("releases-=" + release);
    return removed;
  }

  public final boolean removeReleases(Collection<scrum.server.release.Release> releases) {
    if (releases == null) return false;
    if (releases.isEmpty()) return false;
    boolean removed = false;
    for (scrum.server.release.Release _element : releases) {
      removed = removed | removeRelease(_element);
    }
    return removed;
  }

  public final boolean clearReleases() {
    if (this.releasesIds.isEmpty()) return false;
    this.releasesIds.clear();
    updateLastModified();
    fireModified("releases cleared");
    return true;
  }

  protected final void updateReleases(Object value) {
    Collection<String> ids = (Collection<String>) value;
    setReleases((java.util.Set) releaseDao.getByIdsAsSet(ids));
  }

  // -----------------------------------------------------------
  // - published
  // -----------------------------------------------------------

  private boolean published;

  public final boolean isPublished() {
    return published;
  }

  public final void setPublished(boolean published) {
    published = preparePublished(published);
    if (isPublished(published)) return;
    this.published = published;
    updateLastModified();
    fireModified("published=" + published);
  }

  protected boolean preparePublished(boolean published) {
    return published;
  }

  public final boolean isPublished(boolean published) {
    return this.published == published;
  }

  protected final void updatePublished(Object value) {
    setPublished((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("authorsIds")) updateAuthors(value);
      if (property.equals("title")) updateTitle(value);
      if (property.equals("text")) updateText(value);
      if (property.equals("dateAndTime")) updateDateAndTime(value);
      if (property.equals("releasesIds")) updateReleases(value);
      if (property.equals("published")) updatePublished(value);
    }
  }

  protected void repairDeadReferences(String entityId) {
    super.repairDeadReferences(entityId);
    repairDeadProjectReference(entityId);
    if (this.authorsIds == null) this.authorsIds = new java.util.HashSet<String>();
    repairDeadAuthorReference(entityId);
    if (this.releasesIds == null) this.releasesIds = new java.util.HashSet<String>();
    repairDeadReleaseReference(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);
    }
    if (this.authorsIds == null) this.authorsIds = new java.util.HashSet<String>();
    Set<String> authors = new HashSet<String>(this.authorsIds);
    for (String entityId : authors) {
      try {
        userDao.getById(entityId);
      } catch (EntityDoesNotExistException ex) {
        LOG.info("Repairing dead author reference");
        repairDeadAuthorReference(entityId);
      }
    }
    if (this.releasesIds == null) this.releasesIds = new java.util.HashSet<String>();
    Set<String> releases = new HashSet<String>(this.releasesIds);
    for (String entityId : releases) {
      try {
        releaseDao.getById(entityId);
      } catch (EntityDoesNotExistException ex) {
        LOG.info("Repairing dead release reference");
        repairDeadReleaseReference(entityId);
      }
    }
  }

  // -----------------------------------------------------------
  // - dependencies
  // -----------------------------------------------------------

  static scrum.server.project.ProjectDao projectDao;

  public static final void setProjectDao(scrum.server.project.ProjectDao projectDao) {
    GBlogEntry.projectDao = projectDao;
  }

  static scrum.server.release.ReleaseDao releaseDao;

  public static final void setReleaseDao(scrum.server.release.ReleaseDao releaseDao) {
    GBlogEntry.releaseDao = releaseDao;
  }

  static scrum.server.pr.BlogEntryDao blogEntryDao;

  public static final void setBlogEntryDao(scrum.server.pr.BlogEntryDao blogEntryDao) {
    GBlogEntry.blogEntryDao = blogEntryDao;
  }
}