本文整理汇总了Java中com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil.and方法的典型用法代码示例。如果您正苦于以下问题:Java RestrictionsFactoryUtil.and方法的具体用法?Java RestrictionsFactoryUtil.and怎么用?Java RestrictionsFactoryUtil.and使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil
的用法示例。
在下文中一共展示了RestrictionsFactoryUtil.and方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findByclassName_classPK_filterByActions
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的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);
}
示例2: getAddress
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
@Override
public AHAddr getAddress(final String street, final String number,
final long regionId) {
AHAddr result = null;
try {
final DynamicQuery dyQuery = DynamicQueryFactoryUtil
.forClass(AHAddr.class);
final Criterion term1 = RestrictionsFactoryUtil.ilike("street",
street);
final Criterion term2 = RestrictionsFactoryUtil
.eq("number", number);
final Criterion term3 = RestrictionsFactoryUtil.eq("regionId",
regionId);
final Criterion allTerms = RestrictionsFactoryUtil.and(term3,
RestrictionsFactoryUtil.and(term1, term2));
dyQuery.add(allTerms);
final List addrs = this.dynamicQuery(dyQuery);
if (addrs.size() > 0) {
for (final Object addr : addrs) {
if (addr instanceof AHAddr) {
result = (AHAddr) addr;
break;
}
}
}
} catch (final Throwable t) {
m_objLog.error(t);
}
return result;
}
示例3: getRegion
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
@Override
public AHRegion getRegion(final String city, final String country,
final String zip) {
AHRegion result = null;
try {
final DynamicQuery dyQuery = DynamicQueryFactoryUtil
.forClass(AHRegion.class);
final Criterion term1 = RestrictionsFactoryUtil.ilike(
"primaryKey.city", city);
final Criterion term2 = RestrictionsFactoryUtil.ilike(
"primaryKey.country", country);
final Criterion term3 = RestrictionsFactoryUtil.eq(
"primaryKey.zip", zip);
final Criterion allTerms = RestrictionsFactoryUtil.and(term3,
RestrictionsFactoryUtil.and(term1, term2));
dyQuery.add(allTerms);
final List regions = this.dynamicQuery(dyQuery);
if (regions.size() > 0) {
for (final Object region : regions) {
if (region instanceof AHRegion) {
result = (AHRegion) region;
break;
}
}
}
} catch (final SystemException e) {
m_objLog.error(e);
}
return result;
}
示例4: getLoggingsByMissingEntitlements
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public List<Logging> getLoggingsByMissingEntitlements() {
List<Logging> resultList = new ArrayList<Logging>();
List<Logging> tmpApplications = new ArrayList<Logging>();
try {
List <Entitlement> allEntitlements = EntitlementLocalServiceUtil.getEntitlements(10154);
for (Entitlement entitlement : allEntitlements) {
String entitlementIdString = String.valueOf(entitlement.getEntitlementId());
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Logging.class);
ProjectionList projectionList = ProjectionFactoryUtil.projectionList();
projectionList.add(ProjectionFactoryUtil.sum("passel"));
dynamicQuery.setProjection(projectionList);
// only one category
Criterion criterion = RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", entitlementIdString));
// categoryId at the beginning
criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", entitlementIdString + ";" + StringPool.PERCENT)));
// categoryId at the end
criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", StringPool.PERCENT + ";" + entitlementIdString)));
// categoryId in the middle
criterion = RestrictionsFactoryUtil.and(criterion, RestrictionsFactoryUtil.not(RestrictionsFactoryUtil.like("entitlementIDString", StringPool.PERCENT + ";" + entitlementIdString + ";" + StringPool.PERCENT)));
dynamicQuery.add(criterion);
Order defaultOrder = OrderFactoryUtil.desc("passel");
dynamicQuery.addOrder(defaultOrder);
List<Long> result = dynamicQuery(dynamicQuery);
if (result.size() > 0) {
if (result.get(0) != null) {
Logging log = new LoggingImpl();
log.setEntitlementIDString(entitlement.getEntitlementName());
long _p = result.get(0);
log.setPassel(_p);
tmpApplications.add(log);
} else {
continue;
}
}
}
resultList.addAll(tmpApplications);
OrderByComparator orderByComparator = CustomComparatorUtil.getLoggingOrderByComparator("passel", "desc");
Collections.sort(resultList, orderByComparator);
} catch (Exception e) {
_log.info("Exception: " + e.getMessage());
e.printStackTrace();
}
return resultList;
}
示例5: alreadyAreRelated
import com.liferay.portal.kernel.dao.orm.RestrictionsFactoryUtil; //导入方法依赖的package包/类
public boolean alreadyAreRelated(long appId1, long appId2) throws SystemException {
/*
boolean areRelated = false;
List<RelatedApplications> relatedApplicationsList = relatedApplicationsPersistence.findBya(appId1);
for (RelatedApplications relatedApps: relatedApplicationsList) {
if (relatedApps.getApplicationId2() == appId2) {
return true;
}
}
relatedApplicationsList = relatedApplicationsPersistence.findBya2(appId1);
for (RelatedApplications relatedApps: relatedApplicationsList) {
if (relatedApps.getApplicationId() == appId2) {
return true;
}
}
return areRelated;
*/
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(RelatedApplications.class);
Criterion criterionOr = null;
Criterion criterionAnd1 = null;
Criterion criterionAnd2 = null;
criterionAnd1 = RestrictionsFactoryUtil.eq("applicationId", appId1);
criterionAnd1 = RestrictionsFactoryUtil.and(criterionAnd1, RestrictionsFactoryUtil.eq("applicationId2", appId2));
criterionAnd2 = RestrictionsFactoryUtil.eq("applicationId", appId2);
criterionAnd2 = RestrictionsFactoryUtil.and(criterionAnd2, RestrictionsFactoryUtil.eq("applicationId2", appId1));
criterionOr = RestrictionsFactoryUtil.or(criterionAnd1, criterionAnd2);
dynamicQuery.add(criterionOr);
List<RelatedApplications> relatedApplications = dynamicQuery(dynamicQuery);
if (relatedApplications.size() == 0) {
return false;
}
if (relatedApplications.size() == 1) {
return true;
}
if (relatedApplications.size() > 1) {
_log.info("too many related entries for appId1: " + appId1 + " and appId2: " + appId2) ;
throw new SystemException("too many related entries for appId1: " + appId1 + " and appId2: " + appId2);
}
return false;
}