com.psddev.dari.db.Query.fromType()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(174)

本文整理了Java中com.psddev.dari.db.Query.fromType方法的一些代码示例,展示了Query.fromType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.fromType方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:fromType

Query.fromType介绍

[英]Queries over objects of types that are compatible with the given type.
[中]查询与给定类型兼容的类型的对象。

代码示例

代码示例来源:origin: perfectsense/dari

  1. /** @deprecated Use {@link #fromType} instead. */
  2. @Deprecated
  3. public static Query<Object> from(UUID typeId) {
  4. return fromType(ObjectType.getInstance(typeId));
  5. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Generates a {@code Predicate<ObjectType>} to filter {@link ObjectType}s against CMS display criteria
  3. * and optionally check the specified type-level permission against the current
  4. * {@link ToolUser}'s permissions.
  5. * @param permissions A List of the type-level permissions to be checked. If {@code null},
  6. * type permission will not be checked.
  7. * @return a new {@code Predicate<ObjectType>}
  8. */
  9. public java.util.function.Predicate<ObjectType> createTypeDisplayPredicate(Collection<String> permissions) {
  10. return (ObjectType type) ->
  11. type.isConcrete()
  12. && !Modification.class.isAssignableFrom(type.getObjectClass())
  13. && (ObjectUtils.isBlank(permissions) || permissions.stream().allMatch((String permission) -> hasPermission("type/" + type.getId() + "/" + permission)))
  14. && (getCmsTool().isDisplayTypesNotAssociatedWithJavaClasses() || type.getObjectClass() != null)
  15. && !(Draft.class.equals(type.getObjectClass()))
  16. && (!type.isDeprecated() || Query.fromType(type).hasMoreThan(0));
  17. }

代码示例来源:origin: perfectsense/dari

  1. keyName.append(field.getInternalName());
  2. Query<?> query = Query.fromType(parentType);
  3. Query.MappedKey key = query.mapEmbeddedKey(getEnvironment(), keyName.toString());
  4. ObjectIndex useIndex = null;

代码示例来源:origin: perfectsense/brightspot-cms

  1. @Override
  2. protected Query<?> createQuery(Directory directory) {
  3. return (itemType != null ? Query.fromType(itemType) : Query.fromAll())
  4. .and(page.siteItemsSearchPredicate())
  5. .and(directory.itemsPredicate(page.getSite()))
  6. .sortAscending(Directory.PATHS_FIELD);
  7. }
  8. });

代码示例来源:origin: perfectsense/brightspot-cms

  1. @Override
  2. protected Query<?> createQuery(Directory directory) {
  3. return (itemType != null ? Query.fromType(itemType) : Query.fromAll())
  4. .and(page.siteItemsPredicate())
  5. .and(directory.itemsPredicate(page.getSite()))
  6. .and("* matches ?", value)
  7. .and("cms.directory.paths != missing");
  8. }
  9. });

代码示例来源:origin: perfectsense/dari

  1. localObj = database.getEnvironment().getTypeByName(ObjectUtils.to(String.class, stateMap.get("internalName")));
  2. } else {
  3. localObj = Query.fromType(type).where(typeMapField + " = ?", ObjectUtils.to(String.class, stateMap.get(typeMapField))).first();

代码示例来源:origin: perfectsense/dari

  1. for (Object r : Query.fromType(objType).using(database).noCache().resolveToReferenceOnly().iterable(100)) {
  2. writer.write(ObjectUtils.toJson(((Recordable) r).getState().getSimpleValues(true)));
  3. writer.write('\n');
  4. for (Object r : Query.fromType(typeMapType).using(database).noCache().resolveToReferenceOnly().iterable(100)) {
  5. writer.write(ObjectUtils.toJson(((Recordable) r).getState().getSimpleValues(true)));
  6. writer.write('\n');
  7. for (Object ref : Query.fromType(entry.getValue()).noCache().using(database).where("_id = ?", referenceIds).selectAll()) {
  8. if (ref instanceof Recordable) {
  9. Recordable refr = (Recordable) ref;

代码示例来源:origin: perfectsense/dari

  1. for (ObjectType type : singletonType.findConcreteTypes()) {
  2. if (!Query
  3. .fromType(type)
  4. .where("_type = ?", type)
  5. .master()

代码示例来源:origin: perfectsense/dari

  1. Query<?> query = Query.fromType(type).noCache().master();

代码示例来源:origin: perfectsense/dari

  1. /**
  2. * Creates a query that can return all objects that reference this
  3. * index.
  4. */
  5. public Query<Object> createItemsQuery() {
  6. Query<Object> query;
  7. String declaringClass = getJavaDeclaringClassName();
  8. if (ObjectUtils.isBlank(declaringClass)) {
  9. query = Query.fromGroup(declaringClass);
  10. } else {
  11. ObjectStruct parent = getParent();
  12. if (parent instanceof ObjectType) {
  13. query = Query.fromType((ObjectType) parent);
  14. } else {
  15. query = Query.fromAll();
  16. }
  17. }
  18. query.resolveToReferenceOnly();
  19. query.fields(getField());
  20. return query;
  21. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public Query<?> toQuery() {
  2. State state = getState();
  3. Query<?> query = Query.fromType(getQueryType());
  4. Predicate predicate = query.getPredicate();
  5. for (ObjectField field : getIndexedFields()) {
  6. String name = field.getInternalName();
  7. Object value = state.get(FIELD_PREFIX + name);
  8. if (!ObjectUtils.isBlank(value)) {
  9. String type = field.getInternalItemType();
  10. String operator = (String) state.get(OPERATOR_PREFIX + name);
  11. if (operator == null) {
  12. operator = ObjectField.REFERENTIAL_TEXT_TYPE.equals(type) || ObjectField.TEXT_TYPE.equals(type) ? "matchesAll" : "equalsAny";
  13. }
  14. predicate = CompoundPredicate.combine(
  15. PredicateParser.AND_OPERATOR,
  16. predicate,
  17. PredicateParser.Static.parse(name + " " + operator + " ?", value));
  18. }
  19. }
  20. query.setPredicate(predicate);
  21. ObjectField sortField = getSortField();
  22. if (ObjectField.DATE_TYPE.equals(sortField.getInternalItemType())) {
  23. query.sortDescending(sortField.getInternalName());
  24. } else {
  25. query.sortAscending(sortField.getInternalName());
  26. }
  27. return query;
  28. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. || Draft.class.equals(type.getObjectClass())
  2. || (type.isDeprecated()
  3. && !Query.fromType(type).hasMoreThan(0))) {

代码示例来源:origin: perfectsense/dari

  1. query = Query.fromType(type);

代码示例来源:origin: perfectsense/dari

  1. Predicate resolveInvisiblePredicate = null;
  2. Query<Object> query = Query
  3. .fromType(type)
  4. .where(getJunctionField() + " = ?", state.getId());

代码示例来源:origin: perfectsense/brightspot-cms

  1. ObjectType type = typeTemplate.getType();
  2. com.psddev.cms.db.Template template = typeTemplate.getTemplate();
  3. State state = State.getInstance(Query.fromType(type).where("cms.template.default = ?", template).first());
  4. String permalink = null;

代码示例来源:origin: perfectsense/brightspot-cms

  1. object = Query.fromType(selectedType).where("_id = ?", objectId).resolveInvisible().first();
  2. object = Query.fromType(selectedType).resolveInvisible().first();

代码示例来源:origin: perfectsense/dari

  1. AsyncQueue<Object> queue = new AsyncQueue<Object>();
  2. Query<Object> query = Query
  3. .fromType(selectedType)
  4. .resolveToReferenceOnly();
  5. AsyncQueue<Object> queue = new AsyncQueue<Object>();
  6. Query<Object> query = Query
  7. .fromType(selectedType)
  8. .resolveToReferenceOnly();

代码示例来源:origin: perfectsense/brightspot-cms

  1. Query<?> query = (itemType != null ? Query.fromType(itemType) : Query.fromAll())
  2. .and(page.siteItemsPredicate())
  3. .and("* matches ?", value)
  4. valueQuery = Query.fromType(valueType);

代码示例来源:origin: perfectsense/dari

  1. AsyncQueue<Object> queue = new AsyncQueue<Object>();
  2. Database database = Database.Static.getDefault();
  3. Query<Object> query = Query.fromType(selectedType);

代码示例来源:origin: perfectsense/brightspot-cms

  1. ? Query.fromType(itemType)
  2. : Query.fromGroup(Content.SEARCHABLE_GROUP))
  3. .where(page.siteItemsSearchPredicate())

相关文章