本文整理汇总了Java中com.mongodb.BasicDBList.add方法的典型用法代码示例。如果您正苦于以下问题:Java BasicDBList.add方法的具体用法?Java BasicDBList.add怎么用?Java BasicDBList.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mongodb.BasicDBList
的用法示例。
在下文中一共展示了BasicDBList.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
/**
* 解析
* @param group
* @param parser
* @return
*/
@Override
public Object parse(IGroup group, JsonRuleParser parser) {
// rules
BasicDBList operates = new BasicDBList();
for (JsonRule jsonRule : group.getRules()) {
operates.add(parser.parse(jsonRule));
}
// AND or OR
BasicDBObject andOrObj = new BasicDBObject();
andOrObj.append(EnumCondition.AND.equals(group.getCondition()) ? "$and" : "$or", operates);
// Not
if (group.getNot() != null && group.getNot()) {
BasicDBList list = new BasicDBList();
list.add(andOrObj);
return new BasicDBObject("$nor", list);
}
return andOrObj;
}
示例2: toDBList
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public static BasicDBList toDBList(MultiNameValues multiNameValues)
{
String[] names = multiNameValues.getNames();
BasicDBList basicDBList = new BasicDBList();
for (int i = 0; i < multiNameValues.count(); i++)
{
Object[] values = multiNameValues.values(i);
BasicBSONObject bsonObject = new BasicBSONObject(values.length);
for (int j = 0; j < names.length; j++)
{
bsonObject.append(names[j], values[j]);
}
basicDBList.add(bsonObject);
}
return basicDBList;
}
示例3: getDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
/**
* Create a Mongo DB Object baed on the content of this group
*
* @param id The Mongo Object id to assign to this DB Object. If null, a new Object id will be
* created
* @return - The Mongo DB Object based on the content of this group
*/
public BasicDBObject getDBObject(boolean includeId) {
BasicDBObject group = new BasicDBObject();
if (includeId) {
group.append(DB_ID, new ObjectId(id));
}
group.append(JSON_KEY_GROUP_NAME, name);
BasicDBList membersArray = new BasicDBList();
for (int i = 0; i < members.length; i++) {
membersArray.add(members[i]);
}
group.append(JSON_KEY_MEMBERS_LIST, membersArray);
return group;
}
示例4: getDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
/**
* Create a Mongo DB Object baed on the content of this group
*
* @param id The Mongo Object id to assign to this DB Object. If null, a new Object id will be
* created
* @return - The Mongo DB Object based on the content of this group
*/
public BasicDBObject getDBObject(boolean includeId) {
BasicDBObject group = new BasicDBObject();
if (includeId) {
group.append(DB_ID, new ObjectId(id));
}
group.append(JSON_KEY_GROUP_NAME, name);
BasicDBList membersArray = new BasicDBList();
for (int i = 0; i < members.length; i++) {
membersArray.add(members[i]);
}
group.append(JSON_KEY_MEMBERS_LIST, membersArray);
return group;
}
示例5: mongoSerialise
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
@Override
public BasicDBObject mongoSerialise() {
BasicDBObject dbObject = new BasicDBObject();
dbObject.put("i", getObjectId());
dbObject.put("x", getX());
dbObject.put("y", getY());
dbObject.put("t", ID);
BasicDBList tmpNpcArray = new BasicDBList();
for (NonPlayerCharacter npc : npcs) {
tmpNpcArray.add(npc.getObjectId());
}
dbObject.put("n", tmpNpcArray);
return dbObject;
}
示例6: saveWords
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
private DBObject saveWords(final Pattern pattern) {
final BasicDBList list = new BasicDBList();
for (int i = 0; i < pattern.getWords().size(); i++) {
final WordToken w = pattern.getWords(i);
final BasicDBObject o = new BasicDBObject()
.append("text", w.getCoveredText())
.append("pos", w.getPartOfSpeech());
if (w.getLemmas() != null && w.getLemmas().size() >= 1) {
o.put("lemma", w.getLemmas(0).getLemmaForm());
}
list.add(o);
}
return list;
}
示例7: toDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public DBObject toDBObject() {
DBObject object = new BasicDBObject();
if (xType != null && type != null && attributes != null) {
object.put(FIELD_XTYPE, xType);
object.put(FIELD_TYPE, type);
object.put(FIELD_ICON, icon);
object.put(FIELD_ATTR, attributes.toDBObject());
}
if (terminals != null) {
BasicDBList dbList = new BasicDBList();
for (Terminal t : terminals) {
dbList.add(t.toDBObject());
}
object.put(FIELD_TERMINALS, dbList);
}
return object;
}
示例8: memoryToDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public DBObject memoryToDBObject() {
DBObject dbObj = this.toDBObject();
BasicDBList dbList = new BasicDBList();
if (fields != null) {
for (Field field : fields) {
dbList.add(field.toDBObject());
}
}
if (tickTuple != null) {
dbList.add(tickTuple.toDBObject());
}
dbObj.put(FIELD_FIELDS, dbList);
dbObj.put(FIELD_SINGLETON, singleton);
dbObj.put(FIELD_DESCRIPTION, description);
dbObj.put(FIELD_LANGUAGE, language);
if (versionCode > 0) {
dbObj.put(FIELD_VERSION_CODE, versionCode);
}
return dbObj;
}
示例9: toDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public DBObject toDBObject() {
DBObject object = new BasicDBObject();
if (name != null) object.put(FIELD_NAME, name);
if (nMaxWires != null) object.put(FIELD_N_MAX_WIRES, nMaxWires);
if (position != null) {
object.put(FIELD_POSITION, position.toDBObject());
}
if (ddConfig != null) {
object.put(FIELD_DD_CONFIG, ddConfig.toDBObject());
}
if (direction != null) {
BasicDBList dbList = new BasicDBList();
for (Integer d : direction) {
dbList.add(d);
}
object.put(FIELD_DIRECTIONS, dbList);
}
return object;
}
示例10: getModules
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public static ModulesContainer getModules(User user, boolean includeExternalSharing, Integer page) throws SinfonierException {
ModulesContainer modules;
BasicDBList notDeletedAndAuthor = new BasicDBList();
notDeletedAndAuthor.add(new BasicDBObject(FIELD_STATUS, new BasicDBObject("$ne", STATUS_DELETED)));
notDeletedAndAuthor.add(new BasicDBObject(FIELD_AUTHOR_ID, user.getId()));
DBObject sortByName = new BasicDBObject(FIELD_NAME, 1);
if (user.isAdminUser() && includeExternalSharing) {
modules = find(page);
} else if (includeExternalSharing) {
BasicDBList list = new BasicDBList();
list.add(new BasicDBObject(FIELD_STATUS, new BasicDBObject("$in", new ArrayList(Arrays.asList(STATUS_PUBLISHED,STATUS_PREDEFINED)))));
list.add(new BasicDBObject("$and", notDeletedAndAuthor));
modules = find(new BasicDBObject("$or", list), sortByName, page);
} else {
modules = find(new BasicDBObject("$and", notDeletedAndAuthor), sortByName, page);
}
return modules;
}
示例11: toDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public DBObject toDBObject() {
DBObject object = new BasicDBObject();
if (type != null) {
object.put(FIELD_TYPE, type);
BasicDBList dbList = new BasicDBList();
for (String s : allowedTypes) {
dbList.add(s);
}
object.put(FIELD_ALLOWED, dbList);
}
return object;
}
示例12: toDBObject
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
@Override
public DBObject toDBObject() {
DBObject object = new BasicDBObject();
if (type == null || value == null) {
return object;
}
object.put(FIELD_TYPE, type);
object.put(FIELD_VALUE, value);
BasicDBList rangeDbList = new BasicDBList();
rangeDbList.add(0, getMinRange());
rangeDbList.add(1, getMaxRange());
object.put(FIELD_RANGE, rangeDbList);
return object;
}
示例13: serialize
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
public static DBObject serialize(TransformedWaveletDelta transformedWaveletDelta) {
BasicDBObject mongoTransformedWaveletDelta = new BasicDBObject();
mongoTransformedWaveletDelta.append(FIELD_AUTHOR,
serialize(transformedWaveletDelta.getAuthor()));
mongoTransformedWaveletDelta.append(FIELD_RESULTINGVERSION,
serialize(transformedWaveletDelta.getResultingVersion()));
mongoTransformedWaveletDelta.append(FIELD_APPLICATIONTIMESTAMP,
transformedWaveletDelta.getApplicationTimestamp());
mongoTransformedWaveletDelta.append(FIELD_APPLIEDATVERSION,
transformedWaveletDelta.getAppliedAtVersion());
BasicDBList mongoWaveletOperations = new BasicDBList();
for (WaveletOperation op : transformedWaveletDelta) {
mongoWaveletOperations.add(serialize(op));
}
mongoTransformedWaveletDelta.append(FIELD_OPS, mongoWaveletOperations);
return mongoTransformedWaveletDelta;
}
示例14: hasAll
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
@Override
public Query<T> hasAll(Object... objects) {
BasicDBList list = new BasicDBList();
for (Object object : objects) {
if (object == null) {
list.add(null);
continue;
}
FieldMapper mapper = FieldMapper.createFromField(object.getClass(), null, morphix);
list.add(mapper.marshal(new MappingData(), object));
}
set("size", list);
return query;
}
示例15: getPresencesForBuild
import com.mongodb.BasicDBList; //导入方法依赖的package包/类
@GET
@Path("/{product}/{major}.{minor}.{servicePack}/{build}")
public DBObject getPresencesForBuild(@BeanParam final Coordinates coordinates) {
try {
final DB db = this.client.getDB("bdd");
final DBCollection collection = db.getCollection("presence");
final BasicDBObject query = coordinates.getQueryObject(Field.PRODUCT, Field.VERSION, Field.BUILD);
final BasicDBList presencesForBuild = new BasicDBList();
final DBCursor cursor = collection.find(query);
while (cursor.hasNext()) {
presencesForBuild.add(cursor.next());
}
return presencesForBuild;
} catch (final Throwable th) {
th.printStackTrace();
return null;
}
}