use of com.mongodb.BasicDBList in project GNS by MobilityFirst.
the class MongoRecords method parseJSONArrayLocationStringIntoDBList.
private BasicDBList parseJSONArrayLocationStringIntoDBList(String string) {
BasicDBList box1 = new BasicDBList();
BasicDBList box2 = new BasicDBList();
BasicDBList box = new BasicDBList();
try {
JSONArray json = new JSONArray(string);
box1.add(json.getJSONArray(0).getDouble(0));
box1.add(json.getJSONArray(0).getDouble(1));
box2.add(json.getJSONArray(1).getDouble(0));
box2.add(json.getJSONArray(1).getDouble(1));
box.add(box1);
box.add(box2);
} catch (JSONException e) {
DatabaseConfig.getLogger().log(Level.SEVERE, "{0} Unable to parse JSON: {1}", new Object[] { dbName, e.getMessage() });
}
return box;
}
use of com.mongodb.BasicDBList in project logging-log4j2 by apache.
the class MongoDbObject method set.
@Override
public void set(final String field, final NoSqlObject<BasicDBObject>[] values) {
final BasicDBList list = new BasicDBList();
for (final NoSqlObject<BasicDBObject> value : values) {
list.add(value.unwrap());
}
this.mongoObject.append(field, list);
}
use of com.mongodb.BasicDBList in project logging-log4j2 by apache.
the class MongoDbObject method set.
@Override
public void set(final String field, final Object[] values) {
final BasicDBList list = new BasicDBList();
Collections.addAll(list, values);
this.mongoObject.append(field, list);
}
use of com.mongodb.BasicDBList in project spring-data-mongodb by spring-projects.
the class DefaultMongoTypeMapper method writeTypeRestrictions.
/*
* (non-Javadoc)
* @see org.springframework.data.mongodb.core.convert.MongoTypeMapper#writeTypeRestrictions(java.util.Set)
*/
@Override
public void writeTypeRestrictions(Document result, @Nullable Set<Class<?>> restrictedTypes) {
if (ObjectUtils.isEmpty(restrictedTypes)) {
return;
}
BasicDBList restrictedMappedTypes = new BasicDBList();
for (Class<?> restrictedType : restrictedTypes) {
Alias typeAlias = getAliasFor(ClassTypeInformation.from(restrictedType));
if (!ObjectUtils.nullSafeEquals(Alias.NONE, typeAlias) && typeAlias.isPresent()) {
restrictedMappedTypes.add(typeAlias.getValue());
}
}
accessor.writeTypeTo(result, new Document("$in", restrictedMappedTypes));
}
use of com.mongodb.BasicDBList in project oc-explorer by devgateway.
the class GenericOCDSController method createTextSearchFriendlyCriteriaList.
/**
* We ensure {@link TextCriteria} is always returned first before {@link Criteria}
*
* @param criteria
* @return
* @see Criteria#createCriteriaList(Criteria[])
*/
private BasicDBList createTextSearchFriendlyCriteriaList(CriteriaDefinition[] criteria) {
BasicDBList bsonList = new BasicDBList();
Arrays.stream(criteria).sorted((c1, c2) -> c2.getClass().getSimpleName().compareTo(c1.getClass().getSimpleName())).map(CriteriaDefinition::getCriteriaObject).collect(Collectors.toCollection(() -> bsonList));
return bsonList;
}
Aggregations