public void init() {
    assert name != null;
    assert type != null;
    assert legend != null;
    assert database != null;
    assert query != null;

    try {
      actualType = Type.valueOf(type);
      generatorClass = actualType.getGeneratorClass();
    } catch (Exception e) {
      logger.error("Invalid chart type: " + type, e);
    }

    if (orientation != null) {
      try {
        actualOrientation = Orientation.valueOf(orientation);
      } catch (Exception e) {
        logger.error("Invalid orientation: " + actualOrientation, e);
      }
    }
    actualDatabase = DatabaseLogic.findDatabaseByName(persistence.getModel(), database);
  }