Package ch.agent.crnickl.api

Examples of ch.agent.crnickl.api.Database


    if (check(Permission.DISCOVER, parent, false)) {
      try {
        select_entities_by_parent = open(SELECT_ENTITIES_BY_PARENT, parent, select_entities_by_parent);
        select_entities_by_parent.setInt(1, getIdOrZero(parent));
        ResultSet rs = select_entities_by_parent.executeQuery();
        Database database = parent.getSurrogate().getDatabase();
        while (rs.next()) {
          int id = rs.getInt(1);
          if (id == 0)
            throw T2DBMsg.exception(E.E40105, parent == null ? null : parent.toString(), rs.getString(3));
          Surrogate surrogate = makeSurrogate(database, DBObjectType.CHRONICLE, id);
View Full Code Here


   * @return true if any value found
   * @throws T2DBException
   */
  public boolean getAttributeValue(List<Chronicle> chronicles, Attribute<?> attribute) throws T2DBException {
    // note: things would be easier here with Spring's SimpleJdbcTemplate and a named parameter
    Database db = null;
    if (sel_attibute_prop_in_ent == null)
      sel_attibute_prop_in_ent = new PreparedStatement[MAX_ENTITY_DEPTH];
   
    // index zero reserved for MAX_ENTITY_DEPTH elements or more
    int found = 0;
View Full Code Here

   * @throws T2DBException
   */
  public Surrogate findChronicle(Schema schema) throws T2DBException {
    Surrogate result = null;
    try {
      Database db = schema.getDatabase();
      DBObject query = new BasicDBObject();
      query.put(MongoDatabase.FLD_CHRON_SCHEMA, getId(schema));
      DBObject obj = getMongoDB(db).getChronicles().findOne(query);
      if (obj != null)
        result = makeSurrogate(db, DBObjectType.CHRONICLE, getObjectId((BasicDBObject)obj));
View Full Code Here

   */
  public Surrogate findChronicle(Property<?> property, Schema schema) throws T2DBException {
    Surrogate result = null;
    DBCursor cursor = null
    try {
      Database db = schema.getDatabase();
      cursor = getMongoDB(db).getAttributes().find(mongoObject(
          MongoDatabase.FLD_ATTR_PROP, getId(property)));
      while (cursor.hasNext()) {
        ObjectId chrOid = ((BasicDBObject) cursor.next()).getObjectId(MongoDatabase.FLD_ATTR_CHRON);
        Surrogate entityKey = makeSurrogate(db, DBObjectType.CHRONICLE, chrOid);
        Schema s = db.getChronicle(entityKey).getSchema(true);
        if (s.dependsOnSchema(schema)) {
          result = entityKey;
          break;
        }
      }
View Full Code Here

  public Surrogate findChronicle(SeriesDefinition ss, Schema schema) throws T2DBException {
    Surrogate result = null;
    DBCursor cursor1 = null
    DBCursor cursor2 = null
    try {
      Database db = schema.getDatabase();
      cursor1 = getMongoDB(db).getChronicles().find(mongoObject(
          MongoDatabase.FLD_CHRON_SCHEMA, getId(schema)));
      OUTER: while (cursor1.hasNext()) {
        ObjectId chronicleOid = getObjectId((BasicDBObject) cursor1.next());
        cursor2 = getMongoDB(db).getSeries().find(mongoObject(
            MongoDatabase.FLD_SER_CHRON, chronicleOid,
            MongoDatabase.FLD_SER_NUM, ss.getNumber()));
        while (cursor2.hasNext()) {
          Surrogate entityKey = makeSurrogate(db, DBObjectType.CHRONICLE, chronicleOid);
          Schema s = db.getChronicle(entityKey).getSchema(true);
          if (s.dependsOnSchema(schema)) {
            result = entityKey;
            break OUTER;
          }
        }
View Full Code Here

   * @param chronicle
   * @throws T2DBException
   */
  private void deleteAttributes(Chronicle chronicle) throws T2DBException {
    Surrogate s = chronicle.getSurrogate();
    Database db = s.getDatabase();
    try {
      getMongoDB(db).getAttributes().remove(
          mongoObject(MongoDatabase.FLD_ATTR_CHRON,getId(s)));
    } catch (Exception e) {
      throw T2DBMsg.exception(e, E.E40124, chronicle.getName(true));
View Full Code Here

TOP

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

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.