本文整理汇总了Java中com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil类的典型用法代码示例。如果您正苦于以下问题:Java DynamicQueryFactoryUtil类的具体用法?Java DynamicQueryFactoryUtil怎么用?Java DynamicQueryFactoryUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DynamicQueryFactoryUtil类属于com.liferay.portal.kernel.dao.orm包,在下文中一共展示了DynamicQueryFactoryUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newDynamicQuery
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
public DynamicQuery newDynamicQuery(String alias) {
try {
Class<?> modelImplClass = getLiferayModelImplClass();
String className = modelImplClass.getName();
className = className.replace("ModelImpl", "Impl");
Class<?> clazz = getClassLoader().loadClass(className);
return DynamicQueryFactoryUtil.forClass(clazz, alias);
}
catch (ClassNotFoundException cnfe) {
throw new RuntimeException(cnfe);
}
}
示例2: getCorrectionsDoneByUserInP2PActivity
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<P2pActivityCorrections> getCorrectionsDoneByUserInP2PActivity(long actId, long userId) throws SystemException{
List<P2pActivityCorrections> res = new ArrayList<P2pActivityCorrections>();
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivityCorrections.class, classLoader)
.add(PropertyFactoryUtil.forName("actId").eq(actId))
.add(PropertyFactoryUtil.forName("userId").eq(userId))
.add(PropertyFactoryUtil.forName("date").isNotNull());
List<P2pActivityCorrections> list = (List<P2pActivityCorrections>)p2pActivityCorrectionsPersistence.findWithDynamicQuery(consulta);
if(list!=null){
return list;
}
return res;
}
示例3: getRelAppIds
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的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;
}
示例4: getListModuleResultByModuleAndUser
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
/**
* No deber�a haber nunca m�s de un result para el mismo usuario y modulo.
* Se hace para eliminar los duplicados.
* @param moduleId
* @param userId
* @return La lista de todos los moduleresult del usuario
* @throws SystemException
*/
public List<ModuleResult> getListModuleResultByModuleAndUser(long moduleId, long userId) throws SystemException {
List<ModuleResult> res = new ArrayList<ModuleResult>();
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(ModuleResult.class, classLoader)
.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
.add(PropertyFactoryUtil.forName("userId").eq(userId));
List<ModuleResult> results = moduleResultPersistence.findWithDynamicQuery(consulta);
if(results!=null && !results.isEmpty()){
res = results;
}
return res;
}
示例5: getByModuleIdUserId
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getByModuleIdUserId(long moduleId,long userId){
List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
.setProjection(ProjectionFactoryUtil.property("actId"));
DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
.add(PropertyFactoryUtil.forName("userId").eq(userId))
.add(PropertyFactoryUtil.forName("actId").in(dq2));
try {
results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
} catch (SystemException e) {
e.printStackTrace();
}
log.debug("::getByModuleId:"+results.size());
return results;
}
示例6: getUsersByLearningActivity
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public List<User> getUsersByLearningActivity(long actId) throws SystemException, PortalException
{
List<User> users = new ArrayList<User>();
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(LearningActivityTry.class, classLoader)
.add(PropertyFactoryUtil.forName("actId").eq(new Long(actId)));
List<LearningActivityTry> activities = (List<LearningActivityTry>)learningActivityTryPersistence.findWithDynamicQuery(consulta);
for(LearningActivityTry activity:activities){
Long uId = activity.getUserId();
User u = UserLocalServiceUtil.getUserById(uId.longValue());
if(u!=null && !users.contains(u))
users.add(u);
}
return users;
}
示例7: getMostClickedApplications
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的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;
}
示例8: getLastLearningActivityTryByActivityAndUser
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public LearningActivityTry getLastLearningActivityTryByActivityAndUser(long actId,long userId) throws SystemException, PortalException
{
DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(LearningActivityTry.class, (ClassLoader)PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(),
"portletClassLoader"))
.add(PropertyFactoryUtil.forName("actId").eq(new Long(actId)))
.add(PropertyFactoryUtil.forName("userId").eq(new Long(userId)))
.addOrder(PropertyFactoryUtil.forName("endDate").desc());
List<LearningActivityTry> activities = (List<LearningActivityTry>)learningActivityTryPersistence.findWithDynamicQuery(consulta);
for(LearningActivityTry activity:activities){
//Necesitamos la primera, que est� ordenada por la �ltima realizada.
return activity;
}
return null;
}
示例9: countMandatoryByModuleIdUserIdPassed
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
public int countMandatoryByModuleIdUserIdPassed(long moduleId,long userId){
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
.add(PropertyFactoryUtil.forName("moduleId").eq(moduleId))
.add(PropertyFactoryUtil.forName("weightinmodule").gt(0L))
.setProjection(ProjectionFactoryUtil.property("actId"));
DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
.add(PropertyFactoryUtil.forName("userId").eq(userId))
.add(PropertyFactoryUtil.forName("passed").eq(true))
.add(PropertyFactoryUtil.forName("actId").in(dq2));
try {
return (int) LearningActivityResultLocalServiceUtil.dynamicQueryCount(dq);
} catch (SystemException e) {
e.printStackTrace();
}
return 0;
}
示例10: areAllCorrectionsDoneByUserInP2PActivity
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
/**
* Para saber si el usuario ya ha realizado todas las correcciones que se indica en el extracontent.
*/
@SuppressWarnings("unchecked")
public boolean areAllCorrectionsDoneByUserInP2PActivity(long actId, long userId) throws SystemException{
boolean res = false;
// Obtener las validaciones que tiene que tener la actividad.
int numAsigns = 3;
String validations = LearningActivityLocalServiceUtil.getExtraContentValue(actId, "validaciones");
try {numAsigns = Integer.valueOf(validations);} catch (Exception e) {}
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery consulta = DynamicQueryFactoryUtil.forClass(P2pActivityCorrections.class, classLoader)
.add(PropertyFactoryUtil.forName("actId").eq(actId))
.add(PropertyFactoryUtil.forName("userId").eq(userId))
.add(PropertyFactoryUtil.forName("date").isNotNull());
List<P2pActivityCorrections> list = (List<P2pActivityCorrections>)p2pActivityCorrectionsPersistence.findWithDynamicQuery(consulta);
if(list!=null){
return list.size() >= numAsigns;
}
return res;
}
示例11: getMandatoryByGroupIdUserId
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getMandatoryByGroupIdUserId(long groupId,long userId){
List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
.add(PropertyFactoryUtil.forName("groupId").eq(groupId))
.add(PropertyFactoryUtil.forName("weightinmodule").gt(0L))
.setProjection(ProjectionFactoryUtil.property("actId"));
DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
.add(PropertyFactoryUtil.forName("userId").eq(userId))
.add(PropertyFactoryUtil.forName("actId").in(dq2));
try {
results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
} catch (SystemException e) {
e.printStackTrace();
}
log.debug("::getByModuleIdPassed:"+results.size());
return results;
}
示例12: getByGroupIdUserId
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
public List<LearningActivityResult> getByGroupIdUserId(long groupId,long userId){
List<LearningActivityResult> results = new ArrayList<LearningActivityResult>();
ClassLoader classLoader = (ClassLoader) PortletBeanLocatorUtil.locate(ClpSerializer.getServletContextName(), "portletClassLoader");
DynamicQuery dq2 = DynamicQueryFactoryUtil.forClass(LearningActivity.class, classLoader)
.add(PropertyFactoryUtil.forName("groupId").eq(groupId))
.setProjection(ProjectionFactoryUtil.property("actId"));
DynamicQuery dq = DynamicQueryFactoryUtil.forClass(LearningActivityResult.class, classLoader)
.add(PropertyFactoryUtil.forName("userId").eq(userId))
.add(PropertyFactoryUtil.forName("actId").in(dq2));
try {
results = (List<LearningActivityResult>)learningActivityResultPersistence.findWithDynamicQuery(dq);
} catch (SystemException e) {
e.printStackTrace();
}
log.debug("::getByModuleId:"+results.size());
return results;
}
示例13: dynamicQuery
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
@Override
public DynamicQuery dynamicQuery() {
Class<?> clazz = getClass();
return DynamicQueryFactoryUtil.forClass(Region.class,
clazz.getClassLoader());
}
示例14: dynamicQuery
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
@Override
public DynamicQuery dynamicQuery() {
Class<?> clazz = getClass();
return DynamicQueryFactoryUtil.forClass(Country.class,
clazz.getClassLoader());
}
示例15: dynamicQuery
import com.liferay.portal.kernel.dao.orm.DynamicQueryFactoryUtil; //导入依赖的package包/类
@Override
public DynamicQuery dynamicQuery() {
Class<?> clazz = getClass();
return DynamicQueryFactoryUtil.forClass(Foo.class,
clazz.getClassLoader());
}