Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Surrogate


  /**
   * Bug 4424 2013-03-16
   */
  public void test16() {
    try {
      Surrogate k = new SurrogateImpl((DatabaseBackend)db, DBObjectType.CHRONICLE, id(42));
      db.getProperty(k);
      expectException();
    } catch (Exception e) {
      assertException(e, D.D02102);
    }
View Full Code Here


  /**
   * Bug 4424 2013-03-16
   */
  public void test17() {
    try {
      Surrogate k = new SurrogateImpl((DatabaseBackend)db, DBObjectType.CHRONICLE, id(42));
      db.getValueType(k);
      expectException();
    } catch (Exception e) {
      assertException(e, D.D02102);
    }
View Full Code Here

  /**
   * Bug 4424 2013-03-16
   */
  public void test18() {
    try {
      Surrogate k = new SurrogateImpl((DatabaseBackend)db, DBObjectType.SCHEMA, id(42));
      db.getChronicle(k);
      expectException();
    } catch (Exception e) {
      assertException(e, D.D02102);
    }
View Full Code Here

   *
   * @param schema a schema
   * @throws T2DBException
   */
  public void createSchema(UpdatableSchema schema) throws T2DBException {
    Surrogate surrogate = null;
    Throwable cause = null;
    try {
      check(Permission.CREATE, schema);
      Schema base = schema.getBase();
      if (base != null)
View Full Code Here

   * @param schema a schema
   * @return a chronicle surrogate or null
   * @throws T2DBException
   */
  public Surrogate findChronicle(Schema schema) throws T2DBException {
    Surrogate result = null;
    Database database = schema.getSurrogate().getDatabase();
    try {
      find_entity_with_schema = open(FIND_ENTITY_WITH_SCHEMA, database, find_entity_with_schema);
      find_entity_with_schema.setInt(1, getId(schema));
      ResultSet rs = find_entity_with_schema.executeQuery();
View Full Code Here

   * @param schema a schema
   * @return a surrogate or null
   * @throws T2DBException
   */
  public Surrogate findChronicle(Property<?> property, Schema schema) throws T2DBException {
    Surrogate result = null;
    Database database = property.getSurrogate().getDatabase();
    try {
      find_entity_with_property = open(FIND_ENTITY_WITH_PROPERTY, property, find_entity_with_property);
      find_entity_with_property.setInt(1, getId(property));
      ResultSet rs = find_entity_with_property.executeQuery();
      while(rs.next()) {
        Surrogate entityKey = makeSurrogate(database, DBObjectType.CHRONICLE, rs.getInt(1));
        Schema s = database.getChronicle(entityKey).getSchema(true);
        if (s.dependsOnSchema(schema)) {
          result = entityKey;
          break;
        }
View Full Code Here

   * @param schema a schema
   * @return a surrogate or null
   * @throws T2DBException
   */
  public Surrogate findChronicle(SeriesDefinition ss, Schema schema) throws T2DBException {
    Surrogate result = null;
    Database database = schema.getSurrogate().getDatabase();
    try {
      find_entity_with_series = open(FIND_ENTITY_WITH_SERIES, database, find_entity_with_series);
      find_entity_with_series.setInt(1, ss.getNumber());
      ResultSet rs = find_entity_with_series.executeQuery();
      while (rs.next()) {
        Surrogate entityKey = makeSurrogate(database, DBObjectType.CHRONICLE, rs.getInt(1));
        Schema s = database.getChronicle(entityKey).getSchema(true);
        if (s.dependsOnSchema(schema)) {
          result = entityKey;
          break;
        }
View Full Code Here

    try {
      select_valuetype_by_name = open(SELECT_VALUETYPE_BY_NAME, database, select_valuetype_by_name);
      select_valuetype_by_name.setString(1, name);
      ResultSet rs = select_valuetype_by_name.executeQuery();
      if (rs.next()) {
        Surrogate surrogate = makeSurrogate(database, DBObjectType.VALUE_TYPE, rs.getInt(1));
        return getValueType(surrogate, name, rs.getBoolean(2), rs.getString(3));
      } else
        return null;
    } catch (Exception e) {
      throw T2DBMsg.exception(e, E.E10104, name);
View Full Code Here

    try {
      select_valuetype_by_pattern = open(SELECT_VALUETYPE_BY_PATTERN, database, select_valuetype_by_pattern);
      select_valuetype_by_pattern.setString(1, pattern);
      ResultSet rs = select_valuetype_by_pattern.executeQuery();
      while(rs.next()) {
        Surrogate surrogate = makeSurrogate(database, DBObjectType.VALUE_TYPE, rs.getInt(1));
        result.add(getValueType(surrogate, rs.getString(2), rs.getBoolean(3), rs.getString(4)));
      }
      return result;
    } catch (Exception e) {
      throw T2DBMsg.exception(e, E.E10106, pattern);
View Full Code Here

    try {
      select_property_by_name = open(SELECT_PROPERTY_BY_NAME, database, select_property_by_name);
      select_property_by_name.setString(1, name);
      ResultSet rs = select_property_by_name.executeQuery();
      if (rs.next()) {
        Surrogate surrogate = makeSurrogate(database, DBObjectType.PROPERTY, rs.getInt(1));
        return getProperty(surrogate, rs.getString(3), rs.getInt(2));
      } else
        return null;
    } catch (Exception e) {
      throw T2DBMsg.exception(e, E.E20104, name);
View Full Code Here

TOP

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

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.