本文整理汇总了Java中org.apache.isis.applib.query.QueryDefault类的典型用法代码示例。如果您正苦于以下问题:Java QueryDefault类的具体用法?Java QueryDefault怎么用?Java QueryDefault使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
QueryDefault类属于org.apache.isis.applib.query包,在下文中一共展示了QueryDefault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: query
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
private <T> Matcher<Query<T>> query(final Class<T> cls, final String queryName, final String param0, final Object arg0) {
return new TypeSafeMatcher<Query<T>>() {
@Override
protected boolean matchesSafely(final Query<T> item) {
if (!(item instanceof QueryDefault)) {
return false;
}
final QueryDefault queryDefault = (QueryDefault) item;
return queryDefault.getResultType() == cls &&
queryDefault.getQueryName().equals(queryName) &&
queryDefault.getArgumentsByParameterName().equals(ImmutableMap.of(param0, arg0));
}
@Override
public void describeTo(final Description description) {
description.appendText("query of " + cls.getName() + " using " + queryName);
}
};
}
示例2: firstMatch
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Action(
domainEvent = ActionDomainEvent.class,
semantics = SemanticsOf.SAFE
)
@ActionLayout(
contributed = Contributed.AS_ACTION,
cssClassFa = "fa-step-forward",
cssClassFaPosition = ActionLayout.CssClassFaPosition.RIGHT
)
public UserSetting $$() {
return firstMatch(
new QueryDefault<>(UserSettingJdo.class,
"findNext",
"user", current.getUser(),
"key", current.getKey()));
}
示例3: allMatches
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Action(
domainEvent = ActionDomainEvent.class,
semantics = SemanticsOf.SAFE
)
@ActionLayout(
contributed = Contributed.AS_ACTION,
cssClassFa = "fa-step-backward",
cssClassFaPosition = ActionLayout.CssClassFaPosition.LEFT
)
public UserSetting $$() {
// bit of a workaround; for some reason ORDER BY ... DESC seems to return in ascending order
final List<UserSettingJdo> settings = allMatches(
new QueryDefault<>(UserSettingJdo.class,
"findPrevious",
"user", current.getUser(),
"key", current.getKey()));
final int size = settings.size();
return size != 0? settings.get(size-1): null;
}
示例4: findByDocumentAndAttachedToAndRoleName
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Programmatic
public Paperclip findByDocumentAndAttachedToAndRoleName(
final DocumentAbstract<?> document,
final Object attachedTo,
final String roleName) {
if(document == null) {
return null;
}
if(attachedTo == null) {
return null;
}
if(roleName == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
if(bookmark == null) {
return null;
}
final String attachedToStr = bookmark.toString();
return repositoryService.firstMatch(
new QueryDefault<>(Paperclip.class,
"findByDocumentAndAttachedToAndRoleName",
"document", document,
"attachedToStr", attachedToStr,
"roleName", roleName));
}
示例5: findByDocumentAndAttachedTo
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Programmatic
public List<Paperclip> findByDocumentAndAttachedTo(
final DocumentAbstract<?> document,
final Object attachedTo) {
if(document == null) {
return null;
}
if(attachedTo == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
if(bookmark == null) {
return null;
}
final String attachedToStr = bookmark.toString();
return repositoryService.allMatches(
new QueryDefault<>(Paperclip.class,
"findByDocumentAndAttachedTo",
"document", document,
"attachedToStr", attachedToStr));
}
示例6: findByOwnerAndCommunicationChannelType
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Programmatic
public List<CommunicationChannelOwnerLink> findByOwnerAndCommunicationChannelType(
final CommunicationChannelOwner owner,
final CommunicationChannelType communicationChannelType) {
if(owner == null) {
return null;
}
if(communicationChannelType == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(owner);
if(bookmark == null) {
return null;
}
return container.allMatches(
new QueryDefault<>(CommunicationChannelOwnerLink.class,
"findByOwnerAndCommunicationChannelType",
"ownerObjectType", bookmark.getObjectType(),
"ownerIdentifier", bookmark.getIdentifier(),
"communicationChannelType", communicationChannelType));
}
示例7: findByCommunicationChannelAndPendingOrCreatedAtBetween
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Programmatic
public List<Communication> findByCommunicationChannelAndPendingOrCreatedAtBetween(
final CommunicationChannel communicationChannel,
final DateTime fromDateTime,
final DateTime toDateTime) {
final List<Communication> communications =
Lists.newArrayList(
repositoryService.allMatches(
new QueryDefault<>(Communication.class,
"findByCommunicationChannelAndPendingOrCreatedAtBetween",
"communicationChannel", communicationChannel,
"from", fromDateTime,
"to", toDateTime))
);
communications.sort(Communication.Orderings.createdAtDescending);
return communications;
}
示例8: findByObjectTypeAndNameAndApplicableToAtPath
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
/**
* Returns the most applicable {@link DocFragment} by atPath
*
* <p>
* for example, will match "/ITA/CAR" precedence over "/ITA" precedence over "/".
* </p>
*
* @param objectType - the (as per {@link DomainObject#objectType() objectType} of the object to be used to interpolate
* @param name
* @param atPath
*/
@Programmatic
public DocFragment findByObjectTypeAndNameAndApplicableToAtPath(
final String objectType,
final String name,
final String atPath) {
// workaround, the ORDER BY atPath DESC doesn't seem to be honoured, don't know why...
// we therefore do a client-side sort
final List<DocFragment> ts = repositoryService.allMatches(
new QueryDefault<>(
DocFragment.class,
"findByObjectTypeAndNameAndApplicableToAtPath",
"objectType", objectType,
"name", name,
"atPath", atPath));
Collections.sort(ts, (o1, o2) -> o2.getAtPath().length() - o1.getAtPath().length());
return ts.isEmpty() ? null : ts.get(0);
}
示例9: findBetween
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Programmatic
public List<Document> findBetween(final LocalDate startDate, final LocalDate endDateIfAny) {
final DateTime startDateTime = startDate.toDateTimeAtStartOfDay();
final QueryDefault<Document> query;
if (endDateIfAny != null) {
final DateTime endDateTime = endDateIfAny.plusDays(1).toDateTimeAtStartOfDay();
query = new QueryDefault<>(Document.class,
"findByCreatedAtBetween",
"startDateTime", startDateTime,
"endDateTime", endDateTime);
}
else {
query = new QueryDefault<>(Document.class,
"findByCreatedAtAfter",
"startDateTime", startDateTime);
}
return repositoryService.allMatches(query);
}
示例10: findByAttachedToAndRoleName
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
@Programmatic
public List<Paperclip> findByAttachedToAndRoleName(
final Object attachedTo,
final String roleName) {
if(attachedTo == null) {
return null;
}
if(roleName == null) {
return null;
}
final Bookmark bookmark = bookmarkService.bookmarkFor(attachedTo);
if(bookmark == null) {
return null;
}
final String attachedToStr = bookmark.toString();
return repositoryService.allMatches(
new QueryDefault<>(Paperclip.class,
"findByAttachedToAndRoleName",
"attachedToStr", attachedToStr,
"roleName", roleName));
}
示例11: findByName
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
public List<Employee> findByName(final String name) {
return repositoryService.allMatches(
new QueryDefault<>(
Employee.class,
"findByName",
"name", name));
}
示例12: findSkillsByName
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
public List<Skill> findSkillsByName(final String code) {
return repositoryService.allMatches(
new QueryDefault<>(
Skill.class,
"findByName",
"code", code));
}
示例13: findByName
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
public List<Project> findByName(final String name) {
return repositoryService.allMatches(
new QueryDefault<>(
Project.class,
"findByName",
"name", name));
}
示例14: findStates
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
public List<State> findStates(AlphaType alphaType) {
return repositoryService.allMatches(
new QueryDefault<>(
State.class,
"findByAlphaType",
"alphaType", alphaType));
}
示例15: findByName
import org.apache.isis.applib.query.QueryDefault; //导入依赖的package包/类
public List<SimpleObject> findByName(final String name) {
return repositoryService.allMatches(
new QueryDefault<>(
SimpleObject.class,
"findByName",
"name", name));
}