List of usage examples for org.hibernate.type StandardBasicTypes STRING
StringType STRING
To view the source code for org.hibernate.type StandardBasicTypes STRING.
Click Source Link
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.ConfigSettingRepositoryHibernate.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/*from ww w .j ava 2 s.c o m*/ @Cacheable("persistent") public String getSetting(String key) { String sql = "SELECT * FROM config_setting WHERE name = '" + key + "' AND profile_id = '" + getConfigSettingProfileName() + "'"; Query query = getSession().createSQLQuery(sql).addScalar("value", StandardBasicTypes.STRING); List<String> results = query.list(); String value = null; if (results != null && results.size() > 0) { value = results.get(0); } return value; }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.ConfigSettingRepositoryHibernate.java
License:Open Source License
@SuppressWarnings("unchecked") @Override/* ww w. j a va2 s. co m*/ public String getConfigSetting(String organizationName) { String sql = "SELECT * FROM config_setting WHERE name='" + organizationName + "'"; Query query = getSession().createSQLQuery(sql).addScalar("value", StandardBasicTypes.STRING); List<String> results = query.list(); String value = null; if (results != null && results.size() > 0) { value = results.get(0); } return value; }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.content.ContentRepositoryHibernate.java
License:Open Source License
@SuppressWarnings("unchecked") @Override//from w ww . j a va2s . c o m public List<Object[]> getUserContentTagList(String gooruUid, Integer limit, Integer offset) { String sql = "select count(1) as count, t.label as label , ct.tag_gooru_oid as tagGooruOid from tags t inner join content c on (t.content_id = c.content_id) inner join content_tag_assoc ct on (c.gooru_oid= ct.tag_gooru_oid) where associated_uid = '" + gooruUid + "' group by ct.tag_gooru_oid"; Query query = getSession().createSQLQuery(sql).addScalar("count", StandardBasicTypes.INTEGER) .addScalar("label", StandardBasicTypes.STRING).addScalar("tagGooruOid", StandardBasicTypes.STRING); query.setFirstResult(offset); query.setMaxResults(limit != null ? (limit > MAX_LIMIT ? MAX_LIMIT : limit) : LIMIT); return query.list(); }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.content.ContentRepositoryHibernate.java
License:Open Source License
@SuppressWarnings("unchecked") @Override//from www. ja va 2 s .c o m public List<Object[]> getResourceContentTagList(String gooruOid, Integer limit, Integer offset) { String sql = "select count(1) as count, t.label as label , ct.tag_gooru_oid as tagGooruOid from tags t inner join content c on (t.content_id = c.content_id) inner join content_tag_assoc ct on (c.gooru_oid= ct.tag_gooru_oid) where content_gooru_oid = '" + gooruOid + "' group by ct.tag_gooru_oid"; Query query = getSession().createSQLQuery(sql).addScalar("count", StandardBasicTypes.INTEGER) .addScalar("label", StandardBasicTypes.STRING).addScalar("tagGooruOid", StandardBasicTypes.STRING); query.setFirstResult(offset); query.setMaxResults(limit != null ? (limit > MAX_LIMIT ? MAX_LIMIT : limit) : LIMIT); return query.list(); }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.FeedbackRepositoryHibernate.java
License:Open Source License
@Override public Map<String, Object> getContentFlags(Integer limit, Integer offset, String feedbackCategory, String type, String status, String reportedFlagType, String startDate, String endDate, String searchQuery, String description, String reportQuery) { String sql = ""; String statusType = ""; String flagType = ""; if (status != null) { if (status.contains(",")) { status = status.replace(",", "','"); }/* w ww. j a va2s . c o m*/ statusType = " and cs.value in ('" + status + "') "; } if (reportedFlagType != null) { if (reportedFlagType.contains(",")) { reportedFlagType = reportedFlagType.replace(",", "','"); } flagType = " and ft.value in ('" + reportedFlagType + "') "; } if (type.equalsIgnoreCase("collection")) { sql = "select title,concat(r.folder,r.thumbnail) as thumbnail,r.has_frame_breaker as hasFrameBreaker, r.media_type as mediaType, cl.goals as description, gooru_oid as gooruOid, cl.collection_type as category , CONVERT_TZ(c.created_on,@@session.time_zone,'US/Pacific') as createdOn, cs.value as value, group_concat(ft.value) as reportedFlag, c.user_uid as userUid, fp.value as product,group_concat(f.feedback_uid) as reportId, f.creator_uid as reportCreator,CONVERT_TZ(f.created_date,@@session.time_zone,'US/Pacific') as reportCreatedOn, f.feedback_text as reportDescription, f.notes as notes,url as url, f.context_path as browserUrl, 'temp' as scount,c.sharing as sharing,group_concat(u.username) as reporterName, ru.username as resourceCreatorName, f.last_modified_on as lastModifiedOn from content c inner join feedback f inner join custom_table_value cs on f.assoc_gooru_oid = c.gooru_oid and cs.custom_table_value_id = c.status_type inner join custom_table_value fp on f.product_id = fp.custom_table_value_id inner join custom_table_value ft on ft.custom_table_value_id = f.feedback_type_id inner join collection cl on cl.content_id = c.content_id inner join resource r on c.content_id = r.content_id inner join custom_table_value ss on f.feedback_category_id = ss.custom_table_value_id inner join custom_table ctab on ctab.custom_table_id = ft.custom_table_id inner join user u on u.gooru_uid = f.creator_uid inner join user ru on ru.gooru_uid = c.user_uid where ctab.name = '" + feedbackCategory + "' and cs.value is not null and cl.collection_type in ('collection', 'quiz')" + flagType + statusType + ""; } else { sql = "select title ,concat(r.folder,r.thumbnail) as thumbnail,r.has_frame_breaker as hasFrameBreaker , r.media_type as mediaType, r.description, gooru_oid as gooruOid, r.category as category , CONVERT_TZ(c.created_on,@@session.time_zone,'US/Pacific') as createdOn, cs.value as value, group_concat(ft.value) as reportedFlag, c.user_uid as userUid, fp.value as product, group_concat(f.feedback_uid) as reportId, f.creator_uid as reportCreator,CONVERT_TZ(f.created_date,@@session.time_zone,'US/Pacific') as reportCreatedOn, f.feedback_text as reportDescription,f.notes as notes, url as url, f.context_path as browserUrl,(select concat(count(distinct(ct.gooru_oid)) , '!#' , group_concat(distinct(ct.gooru_oid)), '~' ,group_concat(rc.title)) from collection_item ci inner join resource ri on ci.resource_content_id = ri.content_id inner join resource as rc on (rc.content_id = ci.collection_content_id) inner join content as ct on (ci.collection_content_id = ct.content_id) where ri.content_id = r.content_id) as scount, c.sharing as sharing,group_concat(u.username) as reporterName, ru.username as resourceCreatorName, f.last_modified_on as lastModifiedOn from content c inner join feedback f inner join custom_table_value cs on f.assoc_gooru_oid = c.gooru_oid and cs.custom_table_value_id = c.status_type inner join custom_table_value fp on f.product_id = fp.custom_table_value_id inner join custom_table_value ft on ft.custom_table_value_id = f.feedback_type_id inner join resource r on r.content_id = c.content_id inner join custom_table_value ss on f.feedback_category_id = ss.custom_table_value_id inner join custom_table ctab on ctab.custom_table_id = ft.custom_table_id inner join user u on u.gooru_uid = f.creator_uid inner join user ru on ru.gooru_uid = c.user_uid where ctab.name = '" + feedbackCategory + "' and cs.value is not null and r.type_name in ('resource/url','ppt/pptx', 'video/youtube', 'animation/swf', 'animation/kmz','textbook/scribd', 'assessment-question') " + statusType + "" + flagType + " "; } if (startDate != null && endDate != null) { sql += "and DATE(f.created_date) BETWEEN '" + startDate + "' and '" + endDate + "'"; } else if (startDate != null) { sql += " and DATE(f.created_date) = '" + startDate + "'"; } else if (endDate != null) { sql += " and DATE(f.created_date) = '" + endDate + "'"; } if (searchQuery != null) { sql += " and gooru_oid = '" + searchQuery + "' or title = '" + searchQuery + "' or f.feedback_text = '" + searchQuery + "' or f.notes = '" + searchQuery + "'"; } if (description != null && type.equalsIgnoreCase("collection")) { sql += " and cl.goals = '" + description + "'"; } else if (description != null && type.equalsIgnoreCase("resource")) { sql += " and r.description = '" + description + "'"; } if (reportQuery != null) { sql += " and f.creator_uid = '" + reportQuery + "' or u.username = '" + reportQuery + "'"; } sql += " group by f.creator_uid, f.assoc_gooru_oid order by f.created_date desc"; Query query = getSession().createSQLQuery(sql).addScalar("title", StandardBasicTypes.STRING) .addScalar("description", StandardBasicTypes.STRING) .addScalar("gooruOid", StandardBasicTypes.STRING).addScalar("category", StandardBasicTypes.STRING) .addScalar("createdOn", StandardBasicTypes.STRING).addScalar("value", StandardBasicTypes.STRING) .addScalar("reportedFlag", StandardBasicTypes.STRING) .addScalar("userUid", StandardBasicTypes.STRING).addScalar("product", StandardBasicTypes.STRING) .addScalar("reportId", StandardBasicTypes.STRING) .addScalar("reportCreator", StandardBasicTypes.STRING) .addScalar("reportCreatedOn", StandardBasicTypes.STRING) .addScalar("reportDescription", StandardBasicTypes.STRING) .addScalar("url", StandardBasicTypes.STRING).addScalar("browserUrl", StandardBasicTypes.STRING) .addScalar("scount", StandardBasicTypes.STRING).addScalar("sharing", StandardBasicTypes.STRING) .addScalar("notes", StandardBasicTypes.STRING).addScalar("reporterName", StandardBasicTypes.STRING) .addScalar("resourceCreatorName", StandardBasicTypes.STRING) .addScalar("thumbnail", StandardBasicTypes.STRING) .addScalar("hasFrameBreaker", StandardBasicTypes.BOOLEAN) .addScalar("mediaType", StandardBasicTypes.STRING) .addScalar("lastModifiedOn", StandardBasicTypes.STRING); query.setFirstResult(offset); query.setMaxResults(limit != null ? (limit > MAX_LIMIT ? MAX_LIMIT : limit) : LIMIT); return getFlags(query.list(), sql, type); }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.FeedbackRepositoryHibernate.java
License:Open Source License
@Override public Map<Object, Object> getUserFeedbackAverage(String assocUserUid, String feedbackCategory) { Query query = getSession().createSQLQuery(GET_USER_FEEDBACK_AVERAGE) .addScalar("count", StandardBasicTypes.INTEGER).addScalar("name", StandardBasicTypes.STRING) .setParameter("assocUserUid", assocUserUid).setParameter("feedbackCategory", feedbackCategory); return getFeedbackAverage(query.list()); }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.FeedbackRepositoryHibernate.java
License:Open Source License
@Override public Map<Object, Object> getContentFeedbackAverage(String assocGooruOid, String feedbackCategory) { Query query = getSession().createSQLQuery(GET_CONTENT_FEEDBACK_AVERAGE) .addScalar("count", StandardBasicTypes.INTEGER).addScalar("name", StandardBasicTypes.STRING) .setParameter("assocGooruOid", assocGooruOid).setParameter("feedbackCategory", feedbackCategory); return getFeedbackAverage(query.list()); }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.FeedbackRepositoryHibernate.java
License:Open Source License
@Override public List<Map<Object, Object>> getContentFeedbackAggregate(String assocGooruOid, String feedbackCategory, Boolean flag) {//w w w . jav a 2 s . co m String sql = ""; if (flag) { sql = "select count(1) as count, t.value as name,cc.gooru_oid as collectionId from collection_item ci inner join collection cn on (ci.collection_content_id = cn.content_id) inner join content rc on (rc.content_id = ci.resource_content_id) inner join feedback f on (rc.gooru_oid = f.assoc_gooru_oid) inner join content cc on cc.content_id = cn.content_id inner join custom_table_value c on c.custom_table_value_id = f.feedback_category_id inner join custom_table_value t on t.custom_table_value_id = f.feedback_type_id inner join task_resource_assoc tc on tc.resource_content_id = ci.collection_content_id inner join content ct on ct.content_id = tc.task_content_id where ct.gooru_oid =:assocGooruOid and c.key_value =:feedbackCategory group by f.feedback_type_id,cc.gooru_oid"; } else { sql = "select count(1) as count, t.value as name,cc.gooru_oid as collectionId from collection_item ci inner join collection cn on (ci.collection_content_id = cn.content_id) inner join content rc on (rc.content_id = ci.resource_content_id) inner join feedback f on (rc.gooru_oid = f.assoc_gooru_oid) inner join content cc on cc.content_id = cn.content_id inner join custom_table_value c on c.custom_table_value_id = f.feedback_category_id inner join custom_table_value t on t.custom_table_value_id = f.feedback_type_id where cc.gooru_oid =:assocGooruOid and c.key_value =:feedbackCategory and cn.collection_type in ('collection', 'quiz') group by f.feedback_type_id"; } Query query = getSession().createSQLQuery(sql).addScalar("count", StandardBasicTypes.INTEGER) .addScalar("name", StandardBasicTypes.STRING).addScalar("collectionId", StandardBasicTypes.STRING) .setParameter("assocGooruOid", assocGooruOid).setParameter("feedbackCategory", feedbackCategory); return getFeedbackAggregate(query.list()); }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.OrganizationSettingRepositoryHibernate.java
License:Open Source License
@Override @Cacheable("persistent") public Map<String, String> getOrganizationSettings(String organizationUid) { Map<String, String> settings = new HashMap<String, String>(); Query query = getSessionReadOnly().createSQLQuery(GET_ORGAIZATION_SETTINGS) .addScalar(NAME, StandardBasicTypes.STRING).addScalar(VALUE, StandardBasicTypes.STRING); query.setParameter(ORG_UID_PARAM, organizationUid); List<Object[]> results = query.list(); for (Object[] object : results) { settings.put((String) object[0], (String) object[1]); }/*from w w w . ja v a 2s . co m*/ return settings; }
From source file:org.ednovo.gooru.infrastructure.persistence.hibernate.OrganizationSettingRepositoryHibernate.java
License:Open Source License
@Override @Cacheable("persistent") public Map<String, String> getOrganizationExpireTime(String name) { Map<String, String> settings = new HashMap<String, String>(); Query query = getSessionReadOnly().createSQLQuery(GET_ORGANIZATION_EXPIRE_TIME) .addScalar("organization_uid", StandardBasicTypes.STRING) .addScalar(VALUE, StandardBasicTypes.STRING); query.setParameter(NAME, name);//www. j a v a2 s.c o m List<Object[]> results = query.list(); for (Object[] object : results) { settings.put((String) object[0], (String) object[1]); } return settings; }