当前位置: 首页>>代码示例>>Java>>正文


Java QueryOperators类代码示例

本文整理汇总了Java中com.mongodb.QueryOperators的典型用法代码示例。如果您正苦于以下问题:Java QueryOperators类的具体用法?Java QueryOperators怎么用?Java QueryOperators使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

QueryOperators类属于com.mongodb包,在下文中一共展示了QueryOperators类的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: allImagesFor

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> allImagesFor(Product product, CatalogMediaType... catalogMediaTypes) {
    List<String> mimeTypes = new ArrayList<>();
    mimeTypes.add(MimeType.IMAGE_JPEG);
    mimeTypes.add(MimeType.IMAGE_GIF);
    mimeTypes.add(MimeType.IMAGE_PNG);
    mimeTypes.add(MimeType.IMAGE_BMP);
    mimeTypes.add(MimeType.IMAGE_TIFF);

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.PRODUCT_ID, product.getId());

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, mimeTypes);
    filter.put(Col.MIME_TYPE, inClause);

    if (catalogMediaTypes != null && catalogMediaTypes.length > 0) {
        List<Id> catMediaTypeIds = Ids.toIdList(catalogMediaTypes);

        DBObject inClause2 = new BasicDBObject();
        inClause2.put(QueryOperators.IN, catMediaTypeIds);
        filter.put(Col.MEDIA_TYPE_IDS, inClause2);
    }

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:27,代码来源:DefaultCatalogMedia.java


示例2: enabledImagesFor

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> enabledImagesFor(Product product) {
    List<String> mimeTypes = new ArrayList<>();
    mimeTypes.add(MimeType.IMAGE_JPEG);
    mimeTypes.add(MimeType.IMAGE_GIF);
    mimeTypes.add(MimeType.IMAGE_PNG);
    mimeTypes.add(MimeType.IMAGE_BMP);
    mimeTypes.add(MimeType.IMAGE_TIFF);

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.ENABLED, true);
    filter.put(Col.PRODUCT_ID, product.getId());

    Map<String, Object> inClause = new LinkedHashMap<>();
    inClause.put(QueryOperators.IN, mimeTypes);
    filter.put(Col.MIME_TYPE, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:20,代码来源:DefaultCatalogMedia.java


示例3: allVideosFor

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> allVideosFor(Product product) {
    List<String> mimeTypes = new ArrayList<>();
    mimeTypes.add(MimeType.VIDEO_WEBM);
    mimeTypes.add(MimeType.VIDEO_MP4);
    mimeTypes.add(MimeType.VIDEO_OGG);

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.PRODUCT_ID, product.getId());

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, mimeTypes);
    filter.put(Col.MIME_TYPE, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:17,代码来源:DefaultCatalogMedia.java


示例4: enabledVideosFor

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> enabledVideosFor(Product product) {
    List<String> mimeTypes = new ArrayList<>();
    mimeTypes.add(MimeType.VIDEO_WEBM);
    mimeTypes.add(MimeType.VIDEO_MP4);
    mimeTypes.add(MimeType.VIDEO_OGG);

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.ENABLED, true);
    filter.put(Col.PRODUCT_ID, product.getId());

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, mimeTypes);
    filter.put(Col.MIME_TYPE, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:18,代码来源:DefaultCatalogMedia.java


示例5: createBetweenFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
private DBObject createBetweenFilter(Object value) {
    JSONObject dateRange = parseDateRange(value);

    org.joda.time.format.DateTimeFormatter parser = ISODateTimeFormat.dateTime();

    BasicDBObjectBuilder start = BasicDBObjectBuilder.start();

    if (dateRange.get("startDate") != null) {
        DateTime startDate = parser.parseDateTime((String) dateRange.get("startDate"));
        start.add(QueryOperators.GTE, startDate.toDate());
    }

    if (dateRange.get("endDate") != null) {
        DateTime endDate = parser.parseDateTime((String) dateRange.get("endDate"));
        start.add(QueryOperators.LTE, endDate.toDate());
    }

    return start.get();
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:20,代码来源:AbstractMongoDao.java


示例6: thatAreMandatory

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<Attribute> thatAreMandatory(AttributeTargetObject targetObject, QueryOptions queryOptions,
    boolean includeOptOutAttributes) {
    Map<String, Object> filter = new LinkedHashMap<String, Object>();
    filter.put(Attribute.Col.ENABLED, true);

    if (includeOptOutAttributes) {
        Map<String, int[]> in = new LinkedHashMap<>();
        in.put(QueryOperators.IN, new int[] { InputType.MANDATORY.toId(), InputType.OPTOUT.toId() });

        filter.put(Attribute.Col.INPUT_TYPE, in);
    } else {
        filter.put(Attribute.Col.INPUT_TYPE, InputType.MANDATORY.toId());
    }

    if (targetObject != null) {
        filter.put(Attribute.Col.TARGET_OBJECT_ID, targetObject.getId());
    }

    return multiContextFind(Attribute.class, filter, Attribute.Col.CODE);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:22,代码来源:DefaultAttributes.java


示例7: thatAreMandatoryAndEditable

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<Attribute> thatAreMandatoryAndEditable(AttributeTargetObject targetObject, QueryOptions queryOptions,
    boolean includeOptOutAttributes) {
    Map<String, Object> filter = new LinkedHashMap<String, Object>();
    filter.put(Attribute.Col.ENABLED, true);
    filter.put(Attribute.Col.EDITABLE, true);

    if (includeOptOutAttributes) {
        Map<String, int[]> in = new LinkedHashMap<>();
        in.put(QueryOperators.IN, new int[] { InputType.MANDATORY.toId(), InputType.OPTOUT.toId() });

        filter.put(Attribute.Col.INPUT_TYPE, in);
    } else {
        filter.put(Attribute.Col.INPUT_TYPE, InputType.MANDATORY.toId());
    }

    if (targetObject != null) {
        filter.put(Attribute.Col.TARGET_OBJECT_ID, targetObject.getId());
    }

    return multiContextFind(Attribute.class, filter, Attribute.Col.CODE, queryOptions);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:23,代码来源:DefaultAttributes.java


示例8: forSearchFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<Attribute> forSearchFilter(List<AttributeTargetObject> targetObjects) {
    List<Map<String, Object>> filters = new ArrayList<>();

    for (AttributeTargetObject targetObject : targetObjects) {
        Map<String, Object> filter = new LinkedHashMap<>();
        filter.put(Attribute.Col.ENABLED, true);
        filter.put(Attribute.Col.INCLUDE_IN_SEARCH_FILTER, true);
        filter.put(Attribute.Col.TARGET_OBJECT_ID, targetObject.getId());
        filters.add(filter);
    }

    Map<String, Object> orFilter = new LinkedHashMap<>();
    orFilter.put(QueryOperators.OR, filters);

    return multiContextFind(Attribute.class, orFilter, Attribute.Col.CODE);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:18,代码来源:DefaultAttributes.java


示例9: forProductListFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<Attribute> forProductListFilter(List<AttributeTargetObject> targetObjects) {
    List<Map<String, Object>> filters = new ArrayList<>();

    for (AttributeTargetObject targetObject : targetObjects) {
        Map<String, Object> filter = new LinkedHashMap<>();
        filter.put(Attribute.Col.ENABLED, true);
        filter.put(Attribute.Col.INCLUDE_IN_PRODUCT_LIST_FILTER, true);
        filter.put(Attribute.Col.TARGET_OBJECT_ID, targetObject.getId());
        filters.add(filter);
    }

    Map<String, Object> orFilter = new LinkedHashMap<>();
    orFilter.put(QueryOperators.OR, filters);

    return multiContextFind(Attribute.class, orFilter, Attribute.Col.CODE);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:18,代码来源:DefaultAttributes.java


示例10: removeTilesWithIds

import com.mongodb.QueryOperators; //导入依赖的package包/类
public void removeTilesWithIds(final StackId stackId,
                               final List<String> tileIds)
        throws IllegalArgumentException {

    MongoUtil.validateRequiredParameter("stackId", stackId);
    MongoUtil.validateRequiredParameter("tileIds", tileIds);

    final MongoCollection<Document> tileCollection = getTileCollection(stackId);
    final Document tileQuery = new Document("tileId",
                                            new Document(QueryOperators.IN,
                                                         tileIds));
    final Document tileQueryForLog = new Document("tileId",
                                                  new Document(QueryOperators.IN,
                                                               Arrays.asList("list of",
                                                                             tileIds.size() + " tileIds")));
    final DeleteResult removeResult = tileCollection.deleteMany(tileQuery);

    LOG.debug("removeTilesWithIds: {}.remove({}) deleted {} document(s)",
              MongoUtil.fullName(tileCollection), tileQueryForLog.toJson(), removeResult.getDeletedCount());
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:21,代码来源:RenderDao.java


示例11: getTransformSpecs

import com.mongodb.QueryOperators; //导入依赖的package包/类
private List<TransformSpec> getTransformSpecs(final MongoCollection<Document> transformCollection,
                                              final Set<String> specIds) {
    final int specCount = specIds.size();
    final List<TransformSpec> transformSpecList = new ArrayList<>(specCount);
    if (specCount > 0) {

        final Document transformQuery = new Document();
        transformQuery.put("id", new Document(QueryOperators.IN, specIds));

        LOG.debug("getTransformSpecs: {}.find({})",
                  MongoUtil.fullName(transformCollection), transformQuery.toJson());

        try (MongoCursor<Document> cursor = transformCollection.find(transformQuery).iterator()) {
            Document document;
            TransformSpec transformSpec;
            while (cursor.hasNext()) {
                document = cursor.next();
                transformSpec = TransformSpec.fromJson(document.toJson());
                transformSpecList.add(transformSpec);
            }
        }

    }

    return transformSpecList;
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:27,代码来源:RenderDao.java


示例12: in

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public ConstraintBuilder in(String name, boolean negate, Iterable<?> values) {
  addContraint(name,
      new Document(
          negate ? QueryOperators.NIN : QueryOperators.IN,
          ImmutableSet.copyOf(unwrapBsonableIterable(values))));
  return this;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:Support.java


示例13: havingUsername

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<Account> havingUsername(String username, Merchant merchant) {
    if (username == null || merchant == null)
        return null;

    Map<String, Object> in = new HashMap<>();
    in.put(QueryOperators.IN, new Id[] { merchant.getId() });

    Map<String, Object> filter = new HashMap<>();
    filter.put(Account.Column.USERNAME, username);
    filter.put(Account.Column.ENABLED, true);
    filter.put(GlobalColumn.MERCHANT_ID, in);

    return find(Account.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:16,代码来源:DefaultAccounts.java


示例14: thatBelongTo

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public NewsSubscriber thatBelongTo(String email, Store store) {
    Map<String, Object> in = new HashMap<>();
    in.put(QueryOperators.IN, new Id[] { store.getId() });

    Map<String, Object> filter = new HashMap<>();
    filter.put(NewsSubscriber.Col.EMAIL, email);
    filter.put(GlobalColumn.STORE_ID, in);

    return findOne(NewsSubscriber.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:12,代码来源:DefaultNewsSubscribers.java


示例15: allDocumentsFor

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> allDocumentsFor(Product product) {
    List<String> mimeTypes = new ArrayList<>();
    mimeTypes.add(MimeType.APPLICATION_PDF);

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.PRODUCT_ID, product.getId());

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, mimeTypes);
    filter.put(Col.MIME_TYPE, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:15,代码来源:DefaultCatalogMedia.java


示例16: enabledDocumentsFor

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> enabledDocumentsFor(Product product) {
    List<String> mimeTypes = new ArrayList<>();
    mimeTypes.add(MimeType.APPLICATION_PDF);

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.ENABLED, true);
    filter.put(Col.PRODUCT_ID, product.getId());

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, mimeTypes);
    filter.put(Col.MIME_TYPE, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:16,代码来源:DefaultCatalogMedia.java


示例17: assetsThatBelongTo

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> assetsThatBelongTo(Id... productIds) {
    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.ENABLED, true);

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, productIds);
    filter.put(Col.PRODUCT_ID, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:12,代码来源:DefaultCatalogMedia.java


示例18: allAssetsThatBelongTo

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<CatalogMediaAsset> allAssetsThatBelongTo(Id... productIds) {
    Map<String, Object> filter = new LinkedHashMap<>();

    DBObject inClause = new BasicDBObject();
    inClause.put(QueryOperators.IN, productIds);
    filter.put(Col.PRODUCT_ID, inClause);

    return simpleContextFind(CatalogMediaAsset.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:11,代码来源:DefaultCatalogMedia.java


示例19: havingProgrammeChildProduct

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public List<Product> havingProgrammeChildProduct(Product childProduct) {
    if (childProduct == null || childProduct.getId() == null)
        return null;

    Map<String, Object> in = new LinkedHashMap<>();
    in.put(QueryOperators.IN, new Id[] { childProduct.getId() });

    Map<String, Object> filter = new LinkedHashMap<>();
    filter.put(Col.PROGRAMME_PRODUCTS, in);
    filter.put(Product.Col.DELETED, false);
    filter.put(Product.Col.TYPE, ProductType.PROGRAMME.toId());

    return simpleContextFind(Product.class, filter);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:16,代码来源:DefaultProducts.java


示例20: getNotInClauseForAlreadyFetchedResults

import com.mongodb.QueryOperators; //导入依赖的package包/类
protected <T extends MultiContextModel> Map<String, Object> getNotInClauseForAlreadyFetchedResults(
    List<T> resultObjects, String distinctFieldName) {
    List<Object> values = getValuesByDistinctField(resultObjects, distinctFieldName);

    Map<String, Object> notInClause = new LinkedHashMap<>();

    if (values != null && values.size() > 0) {
        notInClause.put(QueryOperators.NIN, values);
    }

    return notInClause;
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:13,代码来源:PostgresRepositorySupport.java


示例21: findSnapshots

import com.mongodb.QueryOperators; //导入依赖的package包/类
@Override
public <T extends Model> List<T> findSnapshots(Class<T> modelClass, Id id, Integer[] versions,
    QueryOptions queryOptions) {
    Map<String, Object> inClause = new HashMap<>();
    inClause.put(QueryOperators.IN, versions);

    Map<String, Object> filter = new HashMap<>();
    filter.put(GlobalColumn.HISTORY_ID, id);
    filter.put(GlobalColumn.VERSION, inClause);

    return findSnapshots(modelClass, filter, queryOptions);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:13,代码来源:AbstractMongoDao.java


示例22: buildQueryFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
/**
 * Build query filter from map.
 */
protected <T extends Model> DBObject buildQueryFilter(Class<T> modelClass, Map<String, Object> filter,
    QueryOptions queryOptions) {
    DBObject dbObject = new BasicDBObject();

    if (filter != null && filter.size() > 0) {
        List<ColumnInfo> columns = Annotations.getColumns(modelClass);

        Set<String> filterKeys = filter.keySet();

        for (String key : filterKeys) {
            Object value = filter.get(key);

            if (value == null) {
                dbObject.put(Models.columnName(columns, key), value);
            } else if (value instanceof String && ObjectId.isValid((String) value)) {
                dbObject.put(Models.columnName(columns, key), new ObjectId((String) filter.get(key)));
            } else if (isDateRange(value)) {
                DBObject between = createBetweenFilter(value);

                dbObject.put(Models.columnName(columns, key), between);
            }
            // TODO
            else if ((value instanceof Collection || value.getClass().isArray()) && !key.equals(QueryOperators.IN)
                && !key.equals(QueryOperators.AND) && !key.equals(QueryOperators.OR)) {
                dbObject.put(Models.columnName(columns, key), new BasicDBObject(QueryOperators.IN, value));
            } else if (isProbableBoolean(key, filter.get(key))) {
                dbObject.put(Models.columnName(columns, key), TypeConverter.asBoolean(filter.get(key)));
            } else {
                processFilterPart(modelClass, key, Models.columnName(columns, key), filter.get(key), dbObject,
                    queryOptions);

                // dbObject.put(columnName(columns, key),
                // processCommandIfExists(filter.get(key)));
            }
        }
    }

    return dbObject;
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:43,代码来源:AbstractMongoDao.java


示例23: addCtxObjFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
public static void addCtxObjFilter(Map<String, Object> targetFilter, String key, Object value) {
    Map<String, Object> valuePart = new LinkedHashMap<String, Object>();
    valuePart.put(ContextObject.VALUE, value);
    Map<String, Object> elemMatchPart = new LinkedHashMap<String, Object>();
    elemMatchPart.put(QueryOperators.ELEM_MATCH, valuePart);

    targetFilter.put(key, elemMatchPart);
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:9,代码来源:MongoQueries.java


示例24: addMerchantFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
public static void addMerchantFilter(Map<String, Object> targetFilter, Merchant merchant) {
    if (merchant == null) {
        ApplicationContext appCtx = App.get().context();
        merchant = appCtx.getMerchant();
    }

    if (merchant != null && merchant.getId() != null) {
        DBObject inClause = new BasicDBObject();
        inClause.put(QueryOperators.IN, new Id[] { merchant.getId() });

        targetFilter.put(GlobalColumn.MERCHANT_ID, inClause);
    }
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:14,代码来源:MongoQueries.java


示例25: addStoreFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
public static void addStoreFilter(Map<String, Object> targetFilter, Store store) {
    if (store == null) {
        ApplicationContext appCtx = App.get().context();
        store = appCtx.getStore();
    }

    if (store != null && store.getId() != null) {
        DBObject inClause = new BasicDBObject();
        inClause.put(QueryOperators.IN, new Id[] { store.getId() });

        targetFilter.put(GlobalColumn.STORE_ID, inClause);
    }
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:14,代码来源:MongoQueries.java


示例26: addRequestContextFilter

import com.mongodb.QueryOperators; //导入依赖的package包/类
public static void addRequestContextFilter(Map<String, Object> targetFilter, RequestContext reqCtx) {
    if (reqCtx == null) {
        ApplicationContext appCtx = App.get().context();
        reqCtx = appCtx.getRequestContext();
    }

    if (reqCtx != null && reqCtx.getId() != null) {
        DBObject inClause = new BasicDBObject();
        inClause.put(QueryOperators.IN, new Id[] { reqCtx.getId() });

        targetFilter.put(GlobalColumn.REQUEST_CONTEXT_ID, inClause);
    }
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:14,代码来源:MongoQueries.java


示例27: appendAttributeCondition

import com.mongodb.QueryOperators; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void appendAttributeCondition(AttributeTargetObject targetObject, String attributeCode, Object value,
    Map<String, Object> query) {
    Map<String, Object> attributes = (Map<String, Object>) query
        .get(AttributeSupport.AttributeSupportColumn.ATTRIBUTES);

    // ---------------------------------------------------------------
    // As this may not be the first command to set an attribute query,
    // we make sure that we always add to an existing list.
    // ---------------------------------------------------------------
    if (attributes == null) {
        attributes = new LinkedHashMap<>();
        attributes.put(QueryOperators.ALL, new ArrayList<>());
        query.put(AttributeSupport.AttributeSupportColumn.ATTRIBUTES, attributes);
    }

    List<Map<String, Object>> allAttributes = (List<Map<String, Object>>) attributes.get(QueryOperators.ALL);

    // ---------------------------------------------------------------
    // Build the actual attribute value query part.
    // ---------------------------------------------------------------

    Map<String, Object> valueMap = new LinkedHashMap<>();
    valueMap.put(FIELD_VAL, value);

    Id attributeId = Attributes.getAttributeId(targetObject.getId(), attributeCode);

    Map<String, Object> attrVal = new LinkedHashMap<>();
    attrVal.put(FIELD_ATTR_ID, attributeId);
    attrVal.put(FIELD_VAL, elemMatch(valueMap));

    allAttributes.add(elemMatch(attrVal));
}
 
开发者ID:geetools,项目名称:geeCommerce-Java-Shop-Software-and-PIM,代码行数:34,代码来源:MongoRepositorySupport.java


示例28: cloneStack

import com.mongodb.QueryOperators; //导入依赖的package包/类
public void cloneStack(final StackId fromStackId,
                       final StackId toStackId,
                       final List<Double> zValues,
                       final Boolean skipTransforms)
        throws IllegalArgumentException, IllegalStateException {

    MongoUtil.validateRequiredParameter("fromStackId", fromStackId);
    MongoUtil.validateRequiredParameter("toStackId", toStackId);

    if ((skipTransforms == null) || (! skipTransforms)) {
        final MongoCollection<Document> fromTransformCollection = getTransformCollection(fromStackId);
        final MongoCollection<Document> toTransformCollection = getTransformCollection(toStackId);
        cloneCollection(fromTransformCollection, toTransformCollection, new Document());
    }

    final Document filterQuery = new Document();
    if ((zValues != null) && (zValues.size() > 0)) {
        final BasicDBList list = new BasicDBList();
        list.addAll(zValues);
        final Document zFilter = new Document(QueryOperators.IN, list);
        filterQuery.append("z", zFilter);
    }

    final MongoCollection<Document> fromTileCollection = getTileCollection(fromStackId);
    final MongoCollection<Document> toTileCollection = getTileCollection(toStackId);
    cloneCollection(fromTileCollection, toTileCollection, filterQuery);
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:28,代码来源:RenderDao.java


示例29: getOutsideGroupQuery

import com.mongodb.QueryOperators; //导入依赖的package包/类
private Document getOutsideGroupQuery(final String groupId) {
    final List<Document> queryList = new ArrayList<>();
    queryList.add(new Document("pGroupId", groupId).append(
            "qGroupId", new Document(QueryOperators.NE, groupId)));
    queryList.add(new Document("qGroupId", groupId).append(
            "pGroupId", new Document(QueryOperators.NE, groupId)));
    return new Document(QueryOperators.OR, queryList);
}
 
开发者ID:saalfeldlab,项目名称:render,代码行数:9,代码来源:MatchDao.java



注:本文中的com.mongodb.QueryOperators类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。