Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.SeriesDefinition


  @Override
  public <T> UpdatableSeries<T> createSeries(String seriesName) throws T2DBException {
    Series<T> s = getSeries(seriesName);
    if (s != null)
      throw T2DBMsg.exception(D.D50108, s.getName(true));
    SeriesDefinition schema = getSchema(true).getSeriesDefinition(seriesName, true);
    UpdatableSeries<T> u = new UpdatableSeriesImpl<T>(this, seriesName, schema.getNumber(),
        new SurrogateImpl(getDatabase(), DBObjectType.SERIES, 0));
    seriesUpdate.put(seriesName, u);
    return u;
  }
View Full Code Here


          update(schema, 0, null, def);
        }
        done = true;
      }
      for (Integer seriesNr : schema.getDeletedSeriesDefinitions()) {
        SeriesDefinition ss = schema.getSeriesDefinition(seriesNr, true);
        policy.willDelete(schema, ss);
        deleteSeriesInSchema(schema, ss.getNumber());
        done = true;
      }
      for (SeriesDefinition ss : schema.getEditedSeriesDefinitions()) {
        int seriesNr = ss.getNumber();
        if (schema.getSeriesDefinition(seriesNr, false) == null) {
          createSchemaComponents(schema, ss, schema.getEditedAttributeDefinitions(seriesNr));
          done = true;
        } else {
          for (Integer attribNr : schema.getDeletedAttributeDefinitions(seriesNr)) {
            policy.willDelete(schema, ss, ss.getAttributeDefinition(attribNr, true));
            deleteAttributeInSchema(schema, seriesNr, attribNr);
            done = true;
          }
          for (AttributeDefinition<?> def : schema.getEditedAttributeDefinitions(seriesNr)) {
            int attribNr = def.getNumber();
            String description = attribNr == DatabaseBackend.MAGIC_NAME_NR ? ss.getDescription() : null;
            if (ss.getAttributeDefinition(attribNr, false) == null) {
              create(schema, seriesNr, description, def);
            } else {
              policy.willUpdate(schema, ss, def);
              update(schema, seriesNr, description, def);
            }
View Full Code Here

  }
 
  @Override
  public Collection<Attribute<?>> getAttributes() throws T2DBException {
    Collection<Attribute<?>> result = new ArrayList<Attribute<?>>();
    SeriesDefinition schema = getDefinition();
    if (schema != null) {
      Collection<AttributeDefinition<?>> defs = schema.getAttributeDefinitions();
      for (AttributeDefinition<?> def : defs) {
        if (!def.isComplete())
          throw T2DBMsg.exception(D.D50115, getName(true), def.getNumber());
        result.add(getAttribute(def.getName(), true));
      }
View Full Code Here

    int[] seriesNr = new int[names.length];
    Schema es = getSchema(true);
    if (es == null)
      throw T2DBMsg.exception(D.D40114, getName(true));
    for (int i = 0; i < names.length; i++) {
      SeriesDefinition ss = es.getSeriesDefinition(names[i], mustBeDefined);
      seriesNr[i] = ss == null ? 0 : ss.getNumber();
    }
    Series<T>[] series = getDatabase().getSeries(this, names, seriesNr);
    if (type != null) {
      for (Series<T> s : series) {
        if (s !=null)
View Full Code Here

 
  private Collection<SeriesDefinition> ref2(Collection<SeriesDefinition> sss) throws T2DBException {
    List<SeriesDefinition> ssCopies = new ArrayList<SeriesDefinition>();
    for (SeriesDefinition ss : sss) {
      Collection<AttributeDefinition<?>> defCopies = ref1(ss.getAttributeDefinitions());
      SeriesDefinition ssCopy = new SeriesDefinitionImpl(ss.getNumber(), ss.getDescription(), defCopies);
      ssCopies.add(ssCopy);
    }
    return ssCopies;
  }
View Full Code Here

    return seriesDefinitions.getComponents();
  }

  @Override
  public SeriesDefinition getSeriesDefinition(String name, boolean mustExist) throws T2DBException {
    SeriesDefinition schema = seriesDefinitions.getComponent(name);
    if (schema == null && mustExist)
      throw T2DBMsg.exception(D.D30121, name, getName());
    return schema;
  }
View Full Code Here

    return schema;
  }
 
  @Override
  public SeriesDefinition getSeriesDefinition(int number, boolean mustExist) throws T2DBException {
    SeriesDefinition schema = seriesDefinitions.getComponent(number);
    if (schema == null && mustExist)
      throw T2DBMsg.exception(D.D30125, number, getName());
    return schema;
  }
View Full Code Here

 
  @Override
  public void edit(SchemaComponent component) throws T2DBException {
    if (!(component instanceof SeriesDefinition))
      throw new IllegalArgumentException(component == null ? null : component.getClass().getName());
    SeriesDefinition arg = (SeriesDefinition) component;
    if (arg.isErasing())
      erasing = true;
    else {
      if (arg.getDescription() != null)
        setDescription(arg.getDescription());
      try {
        attributes.consolidate();
      } catch (T2DBException e) {
        throw T2DBMsg.exception(e, D.D30131, getName(), component.getName());
      }
View Full Code Here

  public SeriesDefinition addSeries(int seriesNr) throws T2DBException {
    return addSeries(seriesNr, false);
  }
 
  private SeriesDefinition addSeries(int seriesNr, boolean merging) throws T2DBException {
    SeriesDefinition ss = new SeriesDefinitionImpl(seriesNr, null, null);
    boolean added = getSeriesDefinitionsObject().addComponent(ss);
    if (!(added || merging))
      throw T2DBMsg.exception(D.D30124, seriesNr, this);
    return ss;
  }
View Full Code Here

   * @param seriesNr a series number
   * @return an edited series definition
   * @throws T2DBException
   */
  protected SeriesDefinition findEditedSeriesSchema(int seriesNr) throws T2DBException {
    SeriesDefinition schema = null;
    for (SeriesDefinition ss : this.getEditedSeriesDefinitions()) {
      if (ss.getNumber() == seriesNr) {
        schema = ss;
      }
    }
View Full Code Here

TOP

Related Classes of ch.agent.crnickl.api.SeriesDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.