本文整理汇总了Java中org.hibernate.type.BooleanType类的典型用法代码示例。如果您正苦于以下问题:Java BooleanType类的具体用法?Java BooleanType怎么用?Java BooleanType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BooleanType类属于org.hibernate.type包,在下文中一共展示了BooleanType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: get
import org.hibernate.type.BooleanType; //导入依赖的package包/类
protected Object get(Class clazz, String id) {
if (clazz.equals(String.class) || clazz.equals(StringType.class)) return id;
if (clazz.equals(Character.class) || clazz.equals(CharacterType.class)) return (id == null || id.isEmpty() ? null : id.charAt(0));
if (clazz.equals(Byte.class) || clazz.equals(ByteType.class)) return Byte.valueOf(id);
if (clazz.equals(Short.class) || clazz.equals(ShortType.class)) return Short.valueOf(id);
if (clazz.equals(Integer.class) || clazz.equals(IntegerType.class)) return Integer.valueOf(id);
if (clazz.equals(Long.class) || clazz.equals(LongType.class)) return Long.valueOf(id);
if (clazz.equals(Float.class) || clazz.equals(FloatType.class)) return Float.valueOf(id);
if (clazz.equals(Double.class) || clazz.equals(DoubleType.class)) return Double.valueOf(id);
if (clazz.equals(Boolean.class) || clazz.equals(BooleanType.class)) return Boolean.valueOf(id);
Map<String, Entity> entities = iEntities.get(clazz.getName());
if (entities != null) {
Entity entity = entities.get(id);
if (entity != null) return entity.getObject();
}
for (Map.Entry<String, Map<String, Entity>> entry: iEntities.entrySet()) {
Entity o = entry.getValue().get(id);
if (o != null && clazz.isInstance(o.getObject())) return o.getObject();
}
if (clazz.equals(Session.class))
return ((Entity)iEntities.get(Session.class.getName()).values().iterator().next()).getObject();
if (clazz.equals(Student.class))
return checkUnknown(clazz, id, iStudents.get(id));
if (iIsClone)
return checkUnknown(clazz, id,
iHibSession.get(clazz, clazz.equals(ItypeDesc.class) ? (Serializable) Integer.valueOf(id) : (Serializable) Long.valueOf(id)));
return checkUnknown(clazz, id, null);
}
示例2: getPendingConnection
import org.hibernate.type.BooleanType; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public ProfileFriend getPendingConnection(final String userId, final String friendId) {
if(userId == null || friendId == null){
throw new IllegalArgumentException("Null Argument in getPendingConnection");
}
HibernateCallback<ProfileFriend> hcb = session -> {
Query q = session.getNamedQuery(QUERY_GET_FRIEND_REQUEST);
q.setParameter(USER_UUID, userId, StringType.INSTANCE);
q.setParameter(FRIEND_UUID, friendId, StringType.INSTANCE);
q.setParameter(CONFIRMED, false, BooleanType.INSTANCE);
q.setMaxResults(1);
return (ProfileFriend) q.uniqueResult();
};
return getHibernateTemplate().execute(hcb);
}
示例3: addScalars
import org.hibernate.type.BooleanType; //导入依赖的package包/类
private void addScalars(SQLQuery query)
{
query.addScalar("URI", StringType.INSTANCE);
query.addScalar("foundTimestamp", LongType.INSTANCE);
query.addScalar("canonicalTag", StringType.INSTANCE);
query.addScalar("httpStatusCode", IntegerType.INSTANCE);
query.addScalar("lastCrawledTimestamp", LongType.INSTANCE);
query.addScalar("contentHashcode", StringType.INSTANCE);
query.addScalar("backgroundId", ShortType.INSTANCE);
query.addScalar("qualityScore", ShortType.INSTANCE);
query.addScalar("spamScore", ShortType.INSTANCE);
query.addScalar("readingLevel", ShortType.INSTANCE);
query.addScalar("varietyTopicScore", ShortType.INSTANCE);
query.addScalar("adScripts", ShortType.INSTANCE);
query.addScalar("relevantImages", BooleanType.INSTANCE);
query.addScalar("responseTime", IntegerType.INSTANCE);
query.addScalar("pageSize", IntegerType.INSTANCE);
query.addScalar("pageRank", DoubleType.INSTANCE);
query.addScalar("qwLocale", StringType.INSTANCE);
query.addScalar("onPageText", StringType.INSTANCE);
query.addScalar("title", StringType.INSTANCE);
query.addScalar("metaDescription", StringType.INSTANCE);
query.addScalar("topicKeyword", StringType.INSTANCE);
query.addScalar("robotsIndex", BooleanType.INSTANCE);
query.addScalar("duplicateTitle", BooleanType.INSTANCE);
query.addScalar("duplicateMetaDescription", BooleanType.INSTANCE);
query.addScalar("duplicateContent", BooleanType.INSTANCE);
query.addScalar("trailingSlashIssue", BooleanType.INSTANCE);
query.addScalar("timeout", BooleanType.INSTANCE);
query.addScalar("pagination", BooleanType.INSTANCE);
query.addScalar("dcPrimary", BooleanType.INSTANCE);
}
示例4: getAreaControlPermissionByRoleAndType
import org.hibernate.type.BooleanType; //导入依赖的package包/类
public ControlPermissions getAreaControlPermissionByRoleAndType(final String roleId, final String typeId, final boolean defaultValue) {
log.debug("getAreaControlPermissionByRole executing for current user: " + getCurrentUser());
final Area area = areaManager.getAreaByContextIdAndTypeId(typeId);
if (area == null) {
return null;
}
HibernateCallback<ControlPermissions> hcb = session -> {
Query q = session.getNamedQuery(QUERY_CP_BY_ROLE);
q.setParameter("roleId", roleId, StringType.INSTANCE);
q.setParameter("areaId", area.getId().toString(), StringType.INSTANCE);
q.setParameter("defaultValue", defaultValue, BooleanType.INSTANCE);
return (ControlPermissions) q.uniqueResult();
};
return getHibernateTemplate().execute(hcb);
}
示例5: getControlPermissionByKeyValue
import org.hibernate.type.BooleanType; //导入依赖的package包/类
private ControlPermissions getControlPermissionByKeyValue(final String roleId, final String key, final String value, final boolean defaultValue) {
log.debug("getAreaControlPermissionByRole executing for current user: " + getCurrentUser());
HibernateCallback<ControlPermissions> hcb = session -> {
String queryString = "forumId".equals(key) ? QUERY_CP_BY_FORUM : QUERY_CP_BY_TOPIC;
Query q = session.getNamedQuery(queryString);
q.setParameter("roleId", roleId, StringType.INSTANCE);
q.setParameter(key, value, StringType.INSTANCE);
q.setParameter("defaultValue", defaultValue, BooleanType.INSTANCE);
return (ControlPermissions) q.uniqueResult();
};
return getHibernateTemplate().execute(hcb);
}
示例6: getMessagePermissionByKeyValue
import org.hibernate.type.BooleanType; //导入依赖的package包/类
private MessagePermissions getMessagePermissionByKeyValue(final String roleId, final String key, final String value, final boolean defaultValue) {
log.debug("getAreaMessagePermissionByRole executing for current user: " + getCurrentUser());
HibernateCallback<MessagePermissions> hcb = session -> {
String queryString = "forumId".equals(key) ? QUERY_MP_BY_FORUM : QUERY_MP_BY_TOPIC;
Query q = session.getNamedQuery(queryString);
q.setParameter("roleId", roleId, StringType.INSTANCE);
q.setParameter(key, value, StringType.INSTANCE);
q.setParameter("defaultValue", defaultValue, BooleanType.INSTANCE);
return (MessagePermissions) q.uniqueResult();
};
return getHibernateTemplate().execute(hcb);
}
示例7: getAreaMessagePermissionByRoleAndType
import org.hibernate.type.BooleanType; //导入依赖的package包/类
public MessagePermissions getAreaMessagePermissionByRoleAndType(final String roleId, final String typeId, final boolean defaultValue) {
log.debug("getAreaMessagePermissionByRole executing for current user: " + getCurrentUser());
final Area area = areaManager.getAreaByContextIdAndTypeId(typeId);
if (area == null) {
return null;
}
HibernateCallback<MessagePermissions> hcb = session -> {
Query q = session.getNamedQuery(QUERY_MP_BY_ROLE);
q.setParameter("roleId", roleId, StringType.INSTANCE);
q.setParameter("areaId", area.getId().toString(), StringType.INSTANCE);
q.setParameter("defaultValue", Boolean.valueOf(defaultValue), BooleanType.INSTANCE);
return (MessagePermissions) q.uniqueResult();
};
return getHibernateTemplate().execute(hcb);
}
示例8: buildSqlRestriction
import org.hibernate.type.BooleanType; //导入依赖的package包/类
private Criterion buildSqlRestriction(String sqlRestriction, Object value) {
try {
String result = sqlRestriction;
int first = result.indexOf("@");
List<Object> values = new ArrayList<Object>();
List<Type> types = new ArrayList<Type>();
while (first != -1) {
String parameter = result.substring(first);
int second = parameter.indexOf("@", 1);
if (second == -1) {
LOG.warn("There are a sql restrictoion not well formed, the sql restriction is: '{}' for bean class {} ",
sqlRestriction, beanClass.getName());
break;
}
parameter = parameter.substring(0, second + 1);
String parameterWithoutRim = parameter.substring(1, parameter.length() - 1);
Map<String, Object> mvelContext = new HashMap<String, Object>();
mvelContext.put("source", value);
Object parameterValue = MVEL.eval(parameterWithoutRim, mvelContext);
// TODO Make more types
if (String.class.isAssignableFrom(parameterValue.getClass())) {
values.add(parameterValue);
types.add(StringType.INSTANCE);
} else if (Boolean.class.isAssignableFrom(parameterValue.getClass())) {
values.add(parameterValue);
types.add(BooleanType.INSTANCE);
} else {
throw new UnsupportedOperationException();
}
result = result.substring(0, first) + "? " + result.substring(second + first + 1);
first = result.indexOf("@");
}
Type[] t = new Type[types.size()];
return Restrictions.sqlRestriction(result, values.toArray(), types.toArray(t));
} catch (CompileException ex) {
LOG.warn(String.format("Compiling validation expression '%s' of class '%s' has thrown an error: %s", sqlRestriction,
beanClass.toString(), ex.getMessage()), ex);
return Restrictions.sqlRestriction("0=1");
}
}
示例9: getReturnType
import org.hibernate.type.BooleanType; //导入依赖的package包/类
@Override
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException{
return new BooleanType();
}
示例10: getUserOpenTextAttemptsForTablesorter
import org.hibernate.type.BooleanType; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
/**
* Gets the details about an open text entry. Either sessionUid or toolContentId must be supplied - if sessionUid is
* supplied
* then it will be restricted to that session. Due to the large number of fields needed, a DTO will be returned.
*
* Will return List<OpenTextAnswerDTO>
*/
public List<OpenTextAnswerDTO> getUserOpenTextAttemptsForTablesorter(Long sessionUid, Long toolContentId, int page,
int size, int sorting, String searchStringVote, String searchStringUsername, IUserManagementService userManagementService) {
String sortingOrder;
switch (sorting) {
case VoteAppConstants.SORT_BY_NAME_ASC:
sortingOrder = "user.fullname ASC";
break;
case VoteAppConstants.SORT_BY_NAME_DESC:
sortingOrder = "user.fullname DESC";
break;
case VoteAppConstants.SORT_BY_DATE_ASC:
sortingOrder = "attempt.attempt_time ASC";
break;
case VoteAppConstants.SORT_BY_DATE_DESC:
sortingOrder = "attempt.attempt_time DESC";
break;
case VoteAppConstants.SORT_BY_ENTRY_ASC:
sortingOrder = "attempt.userEntry ASC";
break;
case VoteAppConstants.SORT_BY_ENTRY_DESC:
sortingOrder = "attempt.userEntry DESC";
break;
case VoteAppConstants.SORT_BY_VISIBLE_ASC:
sortingOrder = "attempt.visible ASC";
break;
case VoteAppConstants.SORT_BY_VISIBLE_DESC:
sortingOrder = "attempt.visible DESC";
break;
default:
sortingOrder = "user.uid";
}
String[] portraitStrings = userManagementService.getPortraitSQL("user.user_id");
// Basic select for the user records
StringBuilder queryText = new StringBuilder(FIND_USER_OPEN_TEXT_SELECT)
.append(portraitStrings[0])
.append(FIND_USER_OPEN_TEXT_FROM);
if (sessionUid != null) {
queryText.append(FIND_USER_OPEN_TEXT_SESSION_UID_ADD);
} else {
queryText.append(FIND_USER_OPEN_TEXT_CONTENT_UID_ADD);
}
queryText.append(portraitStrings[1]);
// If filtering by name/entry add a where clause
buildCombinedSearch(searchStringVote, searchStringUsername, queryText);
// Now specify the sort based on the switch statement above.
queryText.append(" ORDER BY " + sortingOrder);
SQLQuery query = getSession().createSQLQuery(queryText.toString());
query.addScalar("userUid", LongType.INSTANCE).addScalar("login", StringType.INSTANCE)
.addScalar("fullName", StringType.INSTANCE).addScalar("userEntryUid", LongType.INSTANCE)
.addScalar("userEntry", StringType.INSTANCE).addScalar("attemptTime", TimestampType.INSTANCE)
.addScalar("visible", BooleanType.INSTANCE).addScalar("portraitId", LongType.INSTANCE)
.setFirstResult(page * size).setMaxResults(size)
.setResultTransformer(Transformers.aliasToBean(OpenTextAnswerDTO.class));
if (sessionUid != null) {
query.setLong("sessionUid", sessionUid);
} else {
query.setLong("toolContentId", toolContentId);
}
return query.list();
}
示例11: getReturnType
import org.hibernate.type.BooleanType; //导入依赖的package包/类
@Override
public Type getReturnType(final Type firstArgumentType, final Mapping mapping) throws QueryException {
return new BooleanType();
}
示例12: getReturnType
import org.hibernate.type.BooleanType; //导入依赖的package包/类
@Override
public Type getReturnType(Type firstArgumentType, Mapping mapping) {
return new BooleanType();
}
示例13: getTypeInternal
import org.hibernate.type.BooleanType; //导入依赖的package包/类
public BooleanType getTypeInternal() {
return ( BooleanType ) getDataType();
}
示例14: getReturnType
import org.hibernate.type.BooleanType; //导入依赖的package包/类
@Override
public Type getReturnType(Type firstArgumentType, Mapping mapping) throws QueryException {
return BooleanType.INSTANCE;
}
示例15: addScalars
import org.hibernate.type.BooleanType; //导入依赖的package包/类
protected void addScalars(SQLQuery query)
{
query.addScalar("id", StringType.INSTANCE);
query.addScalar("parentId", StringType.INSTANCE);
query.addScalar("partitionkey", IntegerType.INSTANCE);
query.addScalar("URLName", StringType.INSTANCE);
query.addScalar("canonicalTag", StringType.INSTANCE);
query.addScalar("canonicalTagHashcode", StringType.INSTANCE);
query.addScalar("firstFoundAnchorTextToThisURL", StringType.INSTANCE);
query.addScalar("contentHashcode", StringType.INSTANCE);
query.addScalar("depthFromDomainRoot", IntegerType.INSTANCE);
query.addScalar("externalLink", BooleanType.INSTANCE);
query.addScalar("externalHostName", StringType.INSTANCE);
query.addScalar("externalLinksOnThisPage", IntegerType.INSTANCE);
query.addScalar("externalLinksDifferentDomainsOnThisPage", IntegerType.INSTANCE);
query.addScalar("foundAtURL", StringType.INSTANCE);
query.addScalar("foundTimestamp", LongType.INSTANCE);
query.addScalar("h1", StringType.INSTANCE);
query.addScalar("h2", StringType.INSTANCE);
query.addScalar("h3", StringType.INSTANCE);
query.addScalar("httpStatusCode", IntegerType.INSTANCE);
query.addScalar("internalLinksOnThisPage", IntegerType.INSTANCE);
query.addScalar("followLinksToThisPage", LongType.INSTANCE);
query.addScalar("nofollowLinksToThisPage", LongType.INSTANCE);
query.addScalar("metaDescription", StringType.INSTANCE);
query.addScalar("metaRobotsFollow", BooleanType.INSTANCE);
query.addScalar("metaRobotsIndex", BooleanType.INSTANCE);
query.addScalar("pageSize", IntegerType.INSTANCE);
query.addScalar("redirectedToURL", StringType.INSTANCE);
query.addScalar("responseTime", IntegerType.INSTANCE);
query.addScalar("timeout", BooleanType.INSTANCE);
query.addScalar("title", StringType.INSTANCE);
query.addScalar("duplicateContent", BooleanType.INSTANCE);
query.addScalar("duplicateMetaDescription", BooleanType.INSTANCE);
query.addScalar("duplicateTitle", BooleanType.INSTANCE);
query.addScalar("duplicateH1", BooleanType.INSTANCE);
query.addScalar("canonicalTagIssue", BooleanType.INSTANCE);
query.addScalar("headlinesNotInRightOrder", BooleanType.INSTANCE);
query.addScalar("relNofollow", BooleanType.INSTANCE);
query.addScalar("qualityScore", ShortType.INSTANCE);
query.addScalar("facebookLikes", IntegerType.INSTANCE);
query.addScalar("facebookShares", IntegerType.INSTANCE);
query.addScalar("differentURLSameAnchor", BooleanType.INSTANCE);
query.addScalar("googleAnalyticsCodeFound", BooleanType.INSTANCE);
query.addScalar("newPrice", IntegerType.INSTANCE);
query.addScalar("oldPrice", IntegerType.INSTANCE);
query.addScalar("color", StringType.INSTANCE);
query.addScalar("readingLevel", ShortType.INSTANCE);
query.addScalar("varietyTopicScore", ShortType.INSTANCE);
query.addScalar("onPageText", StringType.INSTANCE);
query.addScalar("qwLocale", ShortType.INSTANCE);
query.addScalar("relevantImages", BooleanType.INSTANCE);
query.addScalar("adScripts", ShortType.INSTANCE);
query.addScalar("normalizedText", StringType.INSTANCE);
query.addScalar("pageRank", DoubleType.INSTANCE);
query.addScalar("trailingSlashIssue", BooleanType.INSTANCE);
query.addScalar("gzipIssue", BooleanType.INSTANCE);
query.addScalar("externalLinkPower", ShortType.INSTANCE);
query.addScalar("spamScore", ShortType.INSTANCE);
query.addScalar("backgroundId", ShortType.INSTANCE);
query.addScalar("pagination", BooleanType.INSTANCE);
query.addScalar("dcPrimary", BooleanType.INSTANCE);
query.addScalar("keywordOrientationShortTerm", BooleanType.INSTANCE);
query.addScalar("keywordOrientationTwoTerms", BooleanType.INSTANCE);
query.addScalar("topicKeywordOneTerm", StringType.INSTANCE);
query.addScalar("topicKeywordTwoTerms", StringType.INSTANCE);
query.addScalar("topicKeywordThreeTerms", StringType.INSTANCE);
query.addScalar("normalizedTopicKeywordOneTerm", StringType.INSTANCE);
query.addScalar("normalizedTopicKeywordTwoTerms", StringType.INSTANCE);
query.addScalar("normalizedTopicKeywordThreeTerms", StringType.INSTANCE);
query.addScalar("topicKeywordOneTermWeight", ShortType.INSTANCE);
query.addScalar("topicKeywordTwoTermsWeight", ShortType.INSTANCE);
query.addScalar("topicKeywordThreeTermsWeight", ShortType.INSTANCE);
query.addScalar("changeCode", IntegerType.INSTANCE);
query.addScalar("overwriteFlag", BooleanType.INSTANCE);
query.addScalar("protocolRecord", BooleanType.INSTANCE);
query.addScalar("relevantOnPageText", StringType.INSTANCE);
}