Examples of DBObject


Examples of com.mongodb.DBObject

     * @return
     */
    private MongoRelations prepareAffiliations(DBObject db) {
      List<?> affiliations = MongoUtils.asList(db, Dictionary.FIELD_AFFILIATIONS);
      for (Object each : affiliations) {
        DBObject affiliation = DBObject.class.cast(each);
        this.affiliations.put(MongoUtils.asString(affiliation, Dictionary.FIELD_JID), MongoUtils.asString(affiliation, Dictionary.FIELD_AFFILIATION));
      }
      return this;
    }
View Full Code Here

Examples of com.mongodb.DBObject

      }
      return this;
    }

    private MongoRelations prepareRelations(DBObject db) {
      DBObject relation = new BasicDBObject();
      // 恒定信息: JID, 创建者
      relation.put(Dictionary.FIELD_JID, MongoUtils.asString(db, Dictionary.FIELD_JID));
      relation.put(Dictionary.FIELD_CREATOR, MongoUtils.asString(db, Dictionary.FIELD_CREATOR));
      // 加载Roles
      for (Object each : MongoUtils.asList(db, Dictionary.FIELD_ROLES)) {
        DBObject roles = DBObject.class.cast(each);
        relation.put(Dictionary.FIELD_ROLES, roles);
        // 加载岗位
        relation.put(Dictionary.FIELD_AFFILIATION, this.affiliations.get(roles.get(Dictionary.FIELD_JID)));
        super.add(new MongoRelation(relation));
      }
      return this;
    }
View Full Code Here

Examples of com.mongodb.DBObject

    private String name;

    public MongoRelation(DBObject db) {
      this.creator = MongoUtils.asString(db, Dictionary.FIELD_CREATOR);
      this.affiliation = MongoUtils.asString(db, Dictionary.FIELD_AFFILIATION);
      DBObject roles = MongoUtils.asDBObject(db, Dictionary.FIELD_ROLES);
      this.jid = MongoUtils.asString(roles, Dictionary.FIELD_JID);
      this.role = MongoUtils.asString(roles, Dictionary.FIELD_ROLE);
      this.name = MongoUtils.asString(roles, Dictionary.FIELD_NICK);
      this.resource = MongoUtils.asString(roles, Dictionary.FIELD_RESOURCE);
    }
View Full Code Here

Examples of com.mongodb.DBObject

   * @see com.sissi.ucenter.relation.RelationContext#iSubscribedWho(com.sissi.context.JID)
   */
  @SuppressWarnings("deprecation")
  public Set<JID> iSubscribedWho(JID from) {
    // {"$match":{"affiliations.jid",from.bare,"affiliations.nick":{"$exists":true}}}
    DBObject match = BasicDBObjectBuilder.start("$match", BasicDBObjectBuilder.start().add(MongoConfig.FIELD_AFFILIATIONS + "." + MongoConfig.FIELD_JID, from.asStringWithBare()).add(MongoConfig.FIELD_AFFILIATIONS + "." + MongoConfig.FIELD_NICK, BasicDBObjectBuilder.start("$exists", true).get()).get()).get();
    return new JIDGroup(MongoUtils.asList(this.config.collection().aggregate(this.matchPersistent, match, super.unwindAffiliation, match, this.projectSubscribed).getCommandResult(), Dictionary.FIELD_RESULT));
  }
View Full Code Here

Examples of com.rakaiz.tailorbills.model.DBObject

  protected void fillDBObject() throws Exception {
  };

  protected DBObject createDBObject() {
    return new DBObject(0, "No Name");
  }
View Full Code Here

Examples of com.rakaizsys.eims.model.DBObject

public class SampleJRDataSourceFactory {
 
  public static List<DBObject> createBeanCollection() {
    ArrayList<DBObject> arrayList = new ArrayList<DBObject>(1);
    arrayList.add(new DBObject());
    return arrayList;
  }
View Full Code Here

Examples of de.willuhn.datasource.rmi.DBObject

      {
        // Daten in den Cache laden
        DBIterator list = factory.load();
        while (list.hasNext())
        {
          DBObject o = (DBObject) list.next();
          cache.data.put(o.getID(),o);
          cache.values.add(o);
        }
      }
      caches.put(type,cache);
    }
View Full Code Here

Examples of org.databene.jdbacl.model.DBObject

    out.println("  </div>");
    out.println("</div>");
  }

  private void exportChange(StructuralChange<?> change, boolean defectsColumn, FilePrintWriter out) throws IOException {
    DBObject mainObject = mainObject(change);
    SanityCheck check = change.getCheck();

    out.println("<tr>");
    // column #1: object
    printCell(renderMainObject(mainObject, out.getFile()), out);
    // column #2: type
    printCell(change.getType(), out);
    // column #3: details
    printCell(change.getDetails(), out);
    // column #4: constraint name
    DBObject affectedObject = change.getAffectedObject();
    printCell(affectedObject instanceof DBConstraint ? affectedObject.getName() : null, out);
    // column #5: defects
    if (defectsColumn) {
      SanityCheckVerdict verdict = check.getVerdict();
      File targetPage = (verdict == SanityCheckVerdict.PASSED ? ReportUtil.getDocPage(check) : ReportUtil.getDefectsOrErrorPage(check));
      String label = (verdict == SanityCheckVerdict.FAILED ? String.valueOf(check.getDefectCount()) : (verdict == SanityCheckVerdict.ERROR ? "ERROR" : "NONE"));
View Full Code Here

Examples of org.exoplatform.services.database.DBObject

         {
            if (!resultSet.next())
               throw new IllegalArgumentException(
                  "Illegal index or length: sum of the index and the length cannot be greater than the list size");

            DBObject bean = dao.createInstance();
            dao.getDBObjectMapper().mapResultSet(resultSet, bean);

            if (p >= index)
            {
               if (entities == null)
               {
                  entities = (E[])Array.newInstance(bean.getClass(), length);
               }
               entities[counter++] = (E)bean;
            }
         }
View Full Code Here

Examples of org.h2.engine.DbObject

        }
        case RIGHTS: {
            if (admin) {
                for (Right r : database.getAllRights()) {
                    Role role = r.getGrantedRole();
                    DbObject grantee = r.getGrantee();
                    String rightType = grantee.getType() == DbObject.USER ? "USER" : "ROLE";
                    if (role == null) {
                        Table granted = r.getGrantedTable();
                        String tableName = identifier(granted.getName());
                        if (!checkIndex(session, tableName, indexFrom, indexTo)) {
                            continue;
                        }
                        add(rows,
                                // GRANTEE
                                identifier(grantee.getName()),
                                // GRANTEETYPE
                                rightType,
                                // GRANTEDROLE
                                "",
                                // RIGHTS
                                r.getRights(),
                                // TABLE_SCHEMA
                                identifier(granted.getSchema().getName()),
                                // TABLE_NAME
                                identifier(granted.getName()),
                                // ID
                                "" + r.getId()
                        );
                    } else {
                        add(rows,
                                // GRANTEE
                                identifier(grantee.getName()),
                                // GRANTEETYPE
                                rightType,
                                // GRANTEDROLE
                                identifier(role.getName()),
                                // RIGHTS
                                "",
                                // TABLE_SCHEMA
                                "",
                                // TABLE_NAME
                                "",
                                // ID
                                "" + r.getId()
                        );
                    }
                }
            }
            break;
        }
        case FUNCTION_ALIASES: {
            for (SchemaObject aliasAsSchemaObject : database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
                FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
                for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) {
                    int returnsResult = method.getDataType() == Value.NULL ? DatabaseMetaData.procedureNoResult
                            : DatabaseMetaData.procedureReturnsResult;
                    add(rows,
                            // ALIAS_CATALOG
                            catalog,
                            // ALIAS_SCHEMA
                            alias.getSchema().getName(),
                            // ALIAS_NAME
                            identifier(alias.getName()),
                            // JAVA_CLASS
                            alias.getJavaClassName(),
                            // JAVA_METHOD
                            alias.getJavaMethodName(),
                            // DATA_TYPE
                            "" + DataType.convertTypeToSQLType(method.getDataType()),
                            // COLUMN_COUNT INT
                            "" + method.getParameterCount(),
                            // RETURNS_RESULT SMALLINT
                            "" + returnsResult,
                            // REMARKS
                            replaceNullWithEmpty(alias.getComment()),
                            // ID
                            "" + alias.getId(),
                            // SOURCE
                            alias.getSource()
                            // when adding more columns, see also below
                    );
                }
            }
            for (UserAggregate agg : database.getAllAggregates()) {
                int returnsResult = DatabaseMetaData.procedureReturnsResult;
                add(rows,
                        // ALIAS_CATALOG
                        catalog,
                        // ALIAS_SCHEMA
                        Constants.SCHEMA_MAIN,
                        // ALIAS_NAME
                        identifier(agg.getName()),
                        // JAVA_CLASS
                        agg.getJavaClassName(),
                        // JAVA_METHOD
                        "",
                        // DATA_TYPE
                        "" + DataType.convertTypeToSQLType(Value.NULL),
                        // COLUMN_COUNT INT
                        "1",
                        // RETURNS_RESULT SMALLINT
                        "" + returnsResult,
                        // REMARKS
                        replaceNullWithEmpty(agg.getComment()),
                        // ID
                        "" + agg.getId(),
                        // SOURCE
                        ""
                        // when adding more columns, see also below
                );
            }
            break;
        }
        case FUNCTION_COLUMNS: {
            for (SchemaObject aliasAsSchemaObject : database.getAllSchemaObjects(DbObject.FUNCTION_ALIAS)) {
                FunctionAlias alias = (FunctionAlias) aliasAsSchemaObject;
                for (FunctionAlias.JavaMethod method : alias.getJavaMethods()) {
                    Class<?>[] columnList = method.getColumnClasses();
                    for (int k = 0; k < columnList.length; k++) {
                        if (method.hasConnectionParam() && k == 0) {
                            continue;
                        }
                        Class<?> clazz = columnList[k];
                        int dataType = DataType.getTypeFromClass(clazz);
                        DataType dt = DataType.getDataType(dataType);
                        int nullable = clazz.isPrimitive() ? DatabaseMetaData.columnNoNulls
                                : DatabaseMetaData.columnNullable;
                        add(rows,
                                // ALIAS_CATALOG
                                catalog,
                                // ALIAS_SCHEMA
                                alias.getSchema().getName(),
                                // ALIAS_NAME
                                identifier(alias.getName()),
                                // JAVA_CLASS
                                alias.getJavaClassName(),
                                // JAVA_METHOD
                                alias.getJavaMethodName(),
                                // COLUMN_COUNT
                                "" + method.getParameterCount(),
                                // POS INT
                                "" + (k + (method.hasConnectionParam() ? 0 : 1)),
                                // COLUMN_NAME
                                "P" + (k + 1),
                                // DATA_TYPE
                                "" + DataType.convertTypeToSQLType(dt.type),
                                // TYPE_NAME
                                dt.name,
                                // PRECISION INT
                                "" + MathUtils.convertLongToInt(dt.defaultPrecision),
                                // SCALE
                                "" + dt.defaultScale,
                                // RADIX
                                "10",
                                // NULLABLE SMALLINT
                                "" + nullable,
                                // COLUMN_TYPE
                                "" + DatabaseMetaData.procedureColumnIn,
                                // REMARKS
                                "",
                                // COLUMN_DEFAULT
                                null
                        );
                    }
                }
            }
            break;
        }
        case SCHEMATA: {
            String collation = database.getCompareMode().getName();
            for (Schema schema : database.getAllSchemas()) {
                add(rows,
                        // CATALOG_NAME
                        catalog,
                        // SCHEMA_NAME
                        identifier(schema.getName()),
                        // SCHEMA_OWNER
                        identifier(schema.getOwner().getName()),
                        // DEFAULT_CHARACTER_SET_NAME
                        CHARACTER_SET_NAME,
                        // DEFAULT_COLLATION_NAME
                        collation,
                        // IS_DEFAULT
                        Constants.SCHEMA_MAIN.equals(schema.getName()) ? "TRUE" : "FALSE",
                        // REMARKS
                        replaceNullWithEmpty(schema.getComment()),
                        // ID
                        "" + schema.getId()
                );
            }
            break;
        }
        case TABLE_PRIVILEGES: {
            for (Right r : database.getAllRights()) {
                Table table = r.getGrantedTable();
                if (table == null || table.isHidden()) {
                    continue;
                }
                String tableName = identifier(table.getName());
                if (!checkIndex(session, tableName, indexFrom, indexTo)) {
                    continue;
                }
                addPrivileges(rows, r.getGrantee(), catalog, table, null, r.getRightMask());
            }
            break;
        }
        case COLUMN_PRIVILEGES: {
            for (Right r : database.getAllRights()) {
                Table table = r.getGrantedTable();
                if (table == null || table.isHidden()) {
                    continue;
                }
                String tableName = identifier(table.getName());
                if (!checkIndex(session, tableName, indexFrom, indexTo)) {
                    continue;
                }
                DbObject grantee = r.getGrantee();
                int mask = r.getRightMask();
                for (Column column : table.getColumns()) {
                    addPrivileges(rows, grantee, catalog, table, column.getName(), mask);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.