本文整理了Java中com.psddev.dari.db.Query.fromType
方法的一些代码示例,展示了Query.fromType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.fromType
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:fromType
[英]Queries over objects of types that are compatible with the given type.
[中]查询与给定类型兼容的类型的对象。
代码示例来源:origin: perfectsense/dari
/** @deprecated Use {@link #fromType} instead. */
@Deprecated
public static Query<Object> from(UUID typeId) {
return fromType(ObjectType.getInstance(typeId));
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Generates a {@code Predicate<ObjectType>} to filter {@link ObjectType}s against CMS display criteria
* and optionally check the specified type-level permission against the current
* {@link ToolUser}'s permissions.
* @param permissions A List of the type-level permissions to be checked. If {@code null},
* type permission will not be checked.
* @return a new {@code Predicate<ObjectType>}
*/
public java.util.function.Predicate<ObjectType> createTypeDisplayPredicate(Collection<String> permissions) {
return (ObjectType type) ->
type.isConcrete()
&& !Modification.class.isAssignableFrom(type.getObjectClass())
&& (ObjectUtils.isBlank(permissions) || permissions.stream().allMatch((String permission) -> hasPermission("type/" + type.getId() + "/" + permission)))
&& (getCmsTool().isDisplayTypesNotAssociatedWithJavaClasses() || type.getObjectClass() != null)
&& !(Draft.class.equals(type.getObjectClass()))
&& (!type.isDeprecated() || Query.fromType(type).hasMoreThan(0));
}
代码示例来源:origin: perfectsense/dari
keyName.append(field.getInternalName());
Query<?> query = Query.fromType(parentType);
Query.MappedKey key = query.mapEmbeddedKey(getEnvironment(), keyName.toString());
ObjectIndex useIndex = null;
代码示例来源:origin: perfectsense/brightspot-cms
@Override
protected Query<?> createQuery(Directory directory) {
return (itemType != null ? Query.fromType(itemType) : Query.fromAll())
.and(page.siteItemsSearchPredicate())
.and(directory.itemsPredicate(page.getSite()))
.sortAscending(Directory.PATHS_FIELD);
}
});
代码示例来源:origin: perfectsense/brightspot-cms
@Override
protected Query<?> createQuery(Directory directory) {
return (itemType != null ? Query.fromType(itemType) : Query.fromAll())
.and(page.siteItemsPredicate())
.and(directory.itemsPredicate(page.getSite()))
.and("* matches ?", value)
.and("cms.directory.paths != missing");
}
});
代码示例来源:origin: perfectsense/dari
localObj = database.getEnvironment().getTypeByName(ObjectUtils.to(String.class, stateMap.get("internalName")));
} else {
localObj = Query.fromType(type).where(typeMapField + " = ?", ObjectUtils.to(String.class, stateMap.get(typeMapField))).first();
代码示例来源:origin: perfectsense/dari
for (Object r : Query.fromType(objType).using(database).noCache().resolveToReferenceOnly().iterable(100)) {
writer.write(ObjectUtils.toJson(((Recordable) r).getState().getSimpleValues(true)));
writer.write('\n');
for (Object r : Query.fromType(typeMapType).using(database).noCache().resolveToReferenceOnly().iterable(100)) {
writer.write(ObjectUtils.toJson(((Recordable) r).getState().getSimpleValues(true)));
writer.write('\n');
for (Object ref : Query.fromType(entry.getValue()).noCache().using(database).where("_id = ?", referenceIds).selectAll()) {
if (ref instanceof Recordable) {
Recordable refr = (Recordable) ref;
代码示例来源:origin: perfectsense/dari
for (ObjectType type : singletonType.findConcreteTypes()) {
if (!Query
.fromType(type)
.where("_type = ?", type)
.master()
代码示例来源:origin: perfectsense/dari
Query<?> query = Query.fromType(type).noCache().master();
代码示例来源:origin: perfectsense/dari
/**
* Creates a query that can return all objects that reference this
* index.
*/
public Query<Object> createItemsQuery() {
Query<Object> query;
String declaringClass = getJavaDeclaringClassName();
if (ObjectUtils.isBlank(declaringClass)) {
query = Query.fromGroup(declaringClass);
} else {
ObjectStruct parent = getParent();
if (parent instanceof ObjectType) {
query = Query.fromType((ObjectType) parent);
} else {
query = Query.fromAll();
}
}
query.resolveToReferenceOnly();
query.fields(getField());
return query;
}
代码示例来源:origin: perfectsense/brightspot-cms
public Query<?> toQuery() {
State state = getState();
Query<?> query = Query.fromType(getQueryType());
Predicate predicate = query.getPredicate();
for (ObjectField field : getIndexedFields()) {
String name = field.getInternalName();
Object value = state.get(FIELD_PREFIX + name);
if (!ObjectUtils.isBlank(value)) {
String type = field.getInternalItemType();
String operator = (String) state.get(OPERATOR_PREFIX + name);
if (operator == null) {
operator = ObjectField.REFERENTIAL_TEXT_TYPE.equals(type) || ObjectField.TEXT_TYPE.equals(type) ? "matchesAll" : "equalsAny";
}
predicate = CompoundPredicate.combine(
PredicateParser.AND_OPERATOR,
predicate,
PredicateParser.Static.parse(name + " " + operator + " ?", value));
}
}
query.setPredicate(predicate);
ObjectField sortField = getSortField();
if (ObjectField.DATE_TYPE.equals(sortField.getInternalItemType())) {
query.sortDescending(sortField.getInternalName());
} else {
query.sortAscending(sortField.getInternalName());
}
return query;
}
代码示例来源:origin: perfectsense/brightspot-cms
|| Draft.class.equals(type.getObjectClass())
|| (type.isDeprecated()
&& !Query.fromType(type).hasMoreThan(0))) {
代码示例来源:origin: perfectsense/dari
query = Query.fromType(type);
代码示例来源:origin: perfectsense/dari
Predicate resolveInvisiblePredicate = null;
Query<Object> query = Query
.fromType(type)
.where(getJunctionField() + " = ?", state.getId());
代码示例来源:origin: perfectsense/brightspot-cms
ObjectType type = typeTemplate.getType();
com.psddev.cms.db.Template template = typeTemplate.getTemplate();
State state = State.getInstance(Query.fromType(type).where("cms.template.default = ?", template).first());
String permalink = null;
代码示例来源:origin: perfectsense/brightspot-cms
object = Query.fromType(selectedType).where("_id = ?", objectId).resolveInvisible().first();
object = Query.fromType(selectedType).resolveInvisible().first();
代码示例来源:origin: perfectsense/dari
AsyncQueue<Object> queue = new AsyncQueue<Object>();
Query<Object> query = Query
.fromType(selectedType)
.resolveToReferenceOnly();
AsyncQueue<Object> queue = new AsyncQueue<Object>();
Query<Object> query = Query
.fromType(selectedType)
.resolveToReferenceOnly();
代码示例来源:origin: perfectsense/brightspot-cms
Query<?> query = (itemType != null ? Query.fromType(itemType) : Query.fromAll())
.and(page.siteItemsPredicate())
.and("* matches ?", value)
valueQuery = Query.fromType(valueType);
代码示例来源:origin: perfectsense/dari
AsyncQueue<Object> queue = new AsyncQueue<Object>();
Database database = Database.Static.getDefault();
Query<Object> query = Query.fromType(selectedType);
代码示例来源:origin: perfectsense/brightspot-cms
? Query.fromType(itemType)
: Query.fromGroup(Content.SEARCHABLE_GROUP))
.where(page.siteItemsSearchPredicate())
内容来源于网络,如有侵权,请联系作者删除!