本文整理汇总了Java中com.liferay.portal.kernel.dao.orm.Criterion类的典型用法代码示例。如果您正苦于以下问题:Java Criterion类的具体用法?Java Criterion怎么用?Java Criterion使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Criterion类属于com.liferay.portal.kernel.dao.orm包,在下文中一共展示了Criterion类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: executeDynamicQuery
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public static List<?> executeDynamicQuery(
Service service, Criterion criterion, Projection projection,
List<Order> orders)
throws Exception {
DynamicQuery query = service.newDynamicQuery();
if (projection != null) {
query.setProjection(projection);
}
if (orders != null) {
for (Order order : orders) {
query.addOrder(order);
}
}
if (criterion != null) {
query.add(criterion);
}
return service.executeDynamicQuery(query);
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:24,代码来源:ModelUtil.java
示例2: count
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@Override
public long count(Criterion criterion) {
try {
List<?> list = executeDynamicQuery(
criterion, ProjectionFactoryUtil.rowCount());
if (list != null) {
return (Long)list.get(0);
}
}
catch (Exception e) {
_log.error(
"Error executing count for " + getName() + ": " +
e.getMessage());
}
return -1;
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:19,代码来源:ModelWrapper.java
示例3: getFilteredModel
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@Override
public Model getFilteredModel(Criterion criterion, String nameSuffix) {
if (criterion == null) {
return this;
}
if (count(criterion)==-1) {
return null;
}
ModelWrapper modelWrapper = new ModelWrapper(this);
modelWrapper.setCriterion(criterion);
if (Validator.isNotNull(nameSuffix)) {
modelWrapper.setNameSuffix(nameSuffix);
}
return modelWrapper;
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:20,代码来源:ModelImpl.java
示例4: getMostUsedSearchStringNotNull
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public List<Logging> getMostUsedSearchStringNotNull() {
try {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
Criterion criterion = RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("searchString", "null"));
dynamicQuery.add(criterion);
Order defaultOrder = OrderFactoryUtil.desc("passel");
dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery);
} catch (SystemException e) {
e.printStackTrace();
}
return null;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:18,代码来源:LoggingLocalServiceImpl.java
示例5: getMostViewdApplications
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public List<Application> getMostViewdApplications() {
try {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
Criterion criterion = RestrictionsFactoryUtil.gt("detailsViewed", new Long(0));
dynamicQuery.add(criterion);
Order defaultOrder = OrderFactoryUtil.desc("detailsViewed");
dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery);
} catch (SystemException e) {
e.printStackTrace();
}
return null;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:18,代码来源:ApplicationLocalServiceImpl.java
示例6: getMostClickedApplications
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public List<Application> getMostClickedApplications() {
try {
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
Criterion criterion = RestrictionsFactoryUtil.gt("linkClicked", new Long(0));
dynamicQuery.add(criterion);
Order defaultOrder = OrderFactoryUtil.desc("linkClicked");
dynamicQuery.addOrder(defaultOrder);
return dynamicQuery(dynamicQuery);
} catch (SystemException e) {
e.printStackTrace();
}
return null;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:18,代码来源:ApplicationLocalServiceImpl.java
示例7: getRelAppIds
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public List<Long> getRelAppIds(long appId) throws SystemException {
List<Long> result = new ArrayList<Long>();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RelatedApplications.class);
Criterion criterionOr = null;
criterionOr = RestrictionsFactoryUtil.or(RestrictionsFactoryUtil.eq("applicationId", appId), RestrictionsFactoryUtil.eq("applicationId2", appId));
dynamicQuery.add(criterionOr);
List<RelatedApplications> relatedApplicationsList = dynamicQuery(dynamicQuery);
for (RelatedApplications relatedApplications: relatedApplicationsList) {
if (relatedApplications.getApplicationId() == appId && !result.contains(relatedApplications.getApplicationId2() )) {
result.add(relatedApplications.getApplicationId2());
}
if (relatedApplications.getApplicationId2() == appId && !result.contains(relatedApplications.getApplicationId() )) {
result.add(relatedApplications.getApplicationId());
}
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:22,代码来源:RelatedApplicationsLocalServiceImpl.java
示例8: getPreviusModule
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public Module getPreviusModule(Module theModule) throws SystemException {
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq=DynamicQueryFactoryUtil.forClass(Module.class, classLoader);
Criterion criterion=PropertyFactoryUtil.forName("ordern").lt(theModule.getOrdern());
dq.add(criterion);
criterion=PropertyFactoryUtil.forName("groupId").eq(theModule.getGroupId());
dq.add(criterion);
Order createOrder=OrderFactoryUtil.getOrderFactory().desc("ordern");
dq.addOrder(createOrder);
@SuppressWarnings("unchecked")
List<Module> modulesp=(List<Module>)moduleLocalService.dynamicQuery(dq,0,1);
if(modulesp!=null&& modulesp.size()>0)
{
return modulesp.get(0);
}
else
{
return null;
}
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:ModuleLocalServiceImpl.java
示例9: getNextModule
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public Module getNextModule(Module theModule) throws SystemException {
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq=DynamicQueryFactoryUtil.forClass(Module.class, classLoader);
Criterion criterion=PropertyFactoryUtil.forName("ordern").gt(theModule.getOrdern());
dq.add(criterion);
criterion=PropertyFactoryUtil.forName("groupId").eq(theModule.getGroupId());
dq.add(criterion);
Order createOrder=OrderFactoryUtil.getOrderFactory().asc("ordern");
dq.addOrder(createOrder);
@SuppressWarnings("unchecked")
List<Module> modulesp=(List<Module>)moduleLocalService.dynamicQuery(dq,0,1);
if(modulesp!=null&& modulesp.size()>0)
{
return modulesp.get(0);
}
else
{
return null;
}
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:22,代码来源:ModuleLocalServiceImpl.java
示例10: findByclassName_classPK_filterByActions
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<AuditEntry> findByclassName_classPK_filterByActions(String className, long classPK, List<String> actions)
throws SystemException
{
DynamicQuery dq = auditEntryLocalService.dynamicQuery();
Criterion criterion=PropertyFactoryUtil.forName("classname").eq(className);
if(classPK>0)
{
criterion=RestrictionsFactoryUtil.and(criterion, PropertyFactoryUtil.forName("classPK").eq(classPK));
}
Criterion criterionAux = criterion;
for (int i=0; i<actions.size(); i++) {
if(i==0){
criterion = RestrictionsFactoryUtil.and(criterion, PropertyFactoryUtil.forName("action").eq(actions.get(i)));
}else{
Criterion criterionAnd = RestrictionsFactoryUtil.and(criterionAux , PropertyFactoryUtil.forName("action").eq(actions.get(i)));
criterion = RestrictionsFactoryUtil.or(criterion, criterionAnd);
}
}
dq.add(criterion);
return auditEntryLocalService.dynamicQuery(dq);
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:24,代码来源:AuditEntryLocalServiceImpl.java
示例11: getDataWithDuplicatesWithCache
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public Map<Long, List<Data>> getDataWithDuplicatesWithCache(
Map<String, Map<Long, List<Data>>> queryCache, Model relatedModel,
List<String> relatedAttributes, List<String> mappingsRelated,
Criterion relatedCriterion)
throws Exception {
Map<Long, List<Data>> relatedMap;
String attributes = Arrays.toString(relatedAttributes.toArray());
String cacheKey =
relatedModel.getName() + "_" + attributes + "_key_" +
mappingsRelated.get(0);
relatedMap = queryCache.get(cacheKey);
if (relatedMap == null) {
synchronized(relatedModel) {
relatedMap = queryCache.get(cacheKey);
if (relatedMap == null) {
relatedMap = Query.getDataWithDuplicates(
relatedModel, relatedAttributes.toArray(new String[0]),
mappingsRelated.get(0), relatedCriterion);
queryCache.put(cacheKey, relatedMap);
}
}
}
return relatedMap;
}
开发者ID:jorgediaz-lr,项目名称:staging-checker,代码行数:33,代码来源:StagingCheckerQueryHelper.java
示例12: getAttributeRangeCriterion
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
protected Criterion getAttributeRangeCriterion(
Model model, String attribute, Object value, boolean isStartValue) {
if (!model.hasAttribute(attribute)) {
return RestrictionsFactoryUtil.disjunction();
}
Property property = model.getProperty(attribute);
if (isStartValue) {
return property.ge(value);
}
return property.lt(value);
}
开发者ID:jorgediaz-lr,项目名称:staging-checker,代码行数:16,代码来源:StagingCheckerModelFactory.java
示例13: generateSQLCriterion
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public static Criterion generateSQLCriterion(String sql) {
if (Validator.isNull(sql)) {
return null;
}
sql = PortalUtil.transformSQL(sql);
return RestrictionsFactoryUtil.sqlRestriction(sql);
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:10,代码来源:ModelUtil.java
示例14: addCriterion
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public void addCriterion(Criterion criterion) {
if (serviceWrapper == null) {
serviceWrapper = new ServiceWrapper(model.getService());
}
serviceWrapper.addCriterion(criterion);
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:8,代码来源:ModelWrapper.java
示例15: executeDynamicQuery
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@Override
public List<?> executeDynamicQuery(Criterion criterion, Order order)
throws Exception {
List<Order> orders = Collections.singletonList(order);
return executeDynamicQuery(criterion, null, orders);
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:9,代码来源:ModelWrapper.java
示例16: getFilteredModel
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@Override
public Model getFilteredModel(Criterion criterion, String nameSuffix) {
if (serviceWrapper != null) {
criterion = ModelUtil.generateConjunctionCriterion(
criterion, serviceWrapper.getCriterion());
}
return model.getFilteredModel(criterion, nameSuffix);
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:10,代码来源:ModelWrapper.java
示例17: setCriterion
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public void setCriterion(Criterion criterion) {
if (count(criterion)==-1) {
throw new IllegalArgumentException();
}
if (serviceWrapper == null) {
serviceWrapper = new ServiceWrapper(model.getService());
}
serviceWrapper.setCriterion(criterion);
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:12,代码来源:ModelWrapper.java
示例18: getAttributeCriterion
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@Override
public <T> Criterion getAttributeCriterion(String attribute, List<T> list) {
if (!this.hasAttribute(attribute) || Validator.isNull(list)) {
return null;
}
Property property = getProperty(attribute);
if (list.size() == 1) {
return property.eq(list.get(0));
}
int maxNumClauses = MAX_NUMBER_OF_CLAUSES;
if (list.size() <= maxNumClauses) {
return property.in(list);
}
Disjunction disjunction = RestrictionsFactoryUtil.disjunction();
int numberOfDisjuntions =
((list.size() + maxNumClauses - 1) / maxNumClauses);
for (int i = 0; i<numberOfDisjuntions; i++) {
int start = i * maxNumClauses;
int end = Math.min(start + maxNumClauses, list.size());
List<T> subList = list.subList(start, end);
disjunction.add(property.in(subList));
}
return disjunction;
}
开发者ID:jorgediaz-lr,项目名称:servicebuilder-reflection,代码行数:35,代码来源:ModelImpl.java
示例19: getLiferayData
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
@Override
public Map<Long, Data> getLiferayData(Model model, List<Long> groupIds)
throws Exception {
if (indexAllVersions) {
return super.getLiferayData(model, groupIds);
}
Criterion criterion = model.getAttributeCriterion("groupId", groupIds);
Collection<String> attributesToQuery =
ConfigurationUtil.getModelAttributesToQuery(model);
String[] attributesToQueryArr = attributesToQuery.toArray(
new String[0]);
Map<Long, Data> dataMap = new HashMap<Long, Data>();
Criterion criterionStatusApproved = ModelUtil.generateSQLCriterion(
"status=" + WorkflowConstants.STATUS_APPROVED + " or status=" +
WorkflowConstants.STATUS_IN_TRASH);
addMissingJournalArticles(
model, attributesToQueryArr, criterion, criterionStatusApproved,
dataMap);
Criterion criterionStatusNotApproved = ModelUtil.generateSQLCriterion(
"status<>" + WorkflowConstants.STATUS_APPROVED + " or status<>" +
WorkflowConstants.STATUS_IN_TRASH);
addMissingJournalArticles(
model, attributesToQueryArr, criterion, criterionStatusNotApproved,
dataMap);
return dataMap;
}
开发者ID:jorgediaz-lr,项目名称:index-checker,代码行数:37,代码来源:JournalArticleQueryHelper.java
示例20: avgResult
import com.liferay.portal.kernel.dao.orm.Criterion; //导入依赖的package包/类
public Double avgResult(long actId) throws SystemException
{
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq=DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader);
Criterion criterion=PropertyFactoryUtil.forName("actId").eq(actId);
dq.add(criterion);
criterion=PropertyFactoryUtil.forName("endDate").isNotNull();
dq.add(criterion);
dq.setProjection(ProjectionFactoryUtil.avg("result"));
return (Double)(learningActivityResultPersistence.findWithDynamicQuery(dq).get(0));
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:12,代码来源:LearningActivityResultLocalServiceImpl.java
注:本文中的com.liferay.portal.kernel.dao.orm.Criterion类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论