Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Schema


      find_entity_with_property.setInt(1, getId(property));
      ResultSet rs = find_entity_with_property.executeQuery();
      while(rs.next()) {
        if (schemaIds.contains(rs.getInt(1))) {
          Surrogate entityKey = makeSurrogate(database, DBObjectType.CHRONICLE, rs.getInt(1));
          Schema schema = database.getChronicle(entityKey).getSchema(true); // hope caching is on
          if (schemaIds.contains(getId(schema)))
            result.add(entityKey);
        }
      }
    } catch (Exception e) {
View Full Code Here


        find_entity_with_series.setInt(1, ss.getNumber());
        ResultSet rs = find_entity_with_series.executeQuery();
        while (rs.next()) {
          if (schemaIds.contains(rs.getInt(1))) {
            Surrogate entityKey = makeSurrogate(database, DBObjectType.CHRONICLE, rs.getInt(1));
            Schema schema = database.getChronicle(entityKey).getSchema(true); // hope caching is on
            if (schemaIds.contains(getId(schema)))
              result.add(entityKey);
          }
        }
      } catch (Exception e) {
View Full Code Here

      ((DatabaseBackend)chronicle.getSurrogate().getDatabase()).getNamingPolicy().checkSimpleName(name, false); // redundant but bugs exist
      String description = chronicle.getDescription(false);
      if (description == null)
        description = "";
      Chronicle collection = chronicle.getCollection();
      Schema schema = chronicle.getSchema(false);
      if (collection != null) {
        check(Permission.MODIFY, collection);
        if (schema != null && schema.equals(collection.getSchema(true)))
          schema = null; // don't repeat yourself
      }
      if (schema != null)
        check(Permission.READ, schema);
      create_entity = open(CREATE_ENTITY, chronicle, create_entity);
View Full Code Here

  @Override
  public Attribute<?> getAttribute(String attrName, boolean mustExist) throws T2DBException {
    Attribute<?> result = attributesUpdate == null ? null : attributesUpdate.get(attrName);
    if (result == null) {
      if (getSurrogate().inConstruction()) {
        Schema esch = getSchema(true);
        if (esch == null) {
          if (mustExist)
            throw T2DBMsg.exception(D.D40114, getName(true));
        } else {
          AttributeDefinition<?> def = getSchema(true).getAttributeDefinition(attrName, mustExist);
View Full Code Here

    return result;
  }

  @Override
  public Schema getSchema(boolean effective) throws T2DBException {
    Schema result = null;
    if (schema != null)
      result = schema;
    else {
      if (getSurrogate().inConstruction()) {
        if (collection != null)
View Full Code Here

   *
   * @param attributes a collection of attributes
   * @throws T2DBException
   */
  public void updateAttributes(Collection<Attribute<?>> attributes) throws T2DBException {
    Schema schema = getSchema(true);
    if (schema == null)
      throw T2DBMsg.exception(D.D30115);
    for (Attribute<?> attribute : attributes) {
      Property<?> property = attribute.getProperty();
      ValueType<?> type = property.getValueType();
      AttributeDefinition<?> def = schema.getAttributeDefinition(property.getName(), true);
      if (def == null)
        throw T2DBMsg.exception(D.D30114, property.getName());
      String value = type.toString(attribute.get());
      if (value == null || value.length() == 0) {
        getDatabase().deleteAttributeValue(this, def);
View Full Code Here

    boolean anything = false;
    String name = getName(false);
    String description = getDescription(false);
    Chronicle current = getDatabase().getChronicle(this);
    Chronicle collection = getCollection();
    Schema schema = getSchema(false);
    if (!equals(name, current.getName(false))) {
      getDatabase().getNamingPolicy().checkSimpleName(name, false);
      anything = true;
    }
    if (!equals(description, current.getDescription(false))) {
View Full Code Here

    }
    List<Surrogate> keys = new ArrayList<Surrogate>(schemaList.size());
    for (Schema sch : schemaList) {
      keys.add(sch.getSurrogate());
    }
    Schema finalResult = result.consolidate(name, surrogate, keys);
    return finalResult;
  }
View Full Code Here

   * @param rawData a raw data object
   * @throws T2DBException
   */
  public ChronicleImpl(RawData rawData) throws T2DBException {
    super(rawData.getSurrogate());
    Schema schema = null;
    if (rawData.getSchema() != null)
      schema = getDatabase().getSchema(rawData.getSchema());
    data = new Data();
    data.name = rawData.getName();
    data.description = rawData.getDescription();
View Full Code Here

  }

  @Override
  public Schema getSchema(boolean effective) throws T2DBException {
    getData();
    Schema es = data.schema;
    if (effective && es == null) {
      Chronicle c = getCollection();
      if (c != null)
        es = c.getSchema(effective);
    }
View Full Code Here

TOP

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

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.