List of usage examples for com.liferay.portal.kernel.util StringPool BLANK
String BLANK
To view the source code for com.liferay.portal.kernel.util StringPool BLANK.
Click Source Link
From source file:at.graz.meduni.bibbox.liferay.portlet.service.persistence.impl.ApplicationInstancePersistenceImpl.java
License:Open Source License
protected ApplicationInstance getByFolderName_PrevAndNext(Session session, ApplicationInstance applicationInstance, String folderName, OrderByComparator<ApplicationInstance> orderByComparator, boolean previous) { StringBundler query = null;/*from ww w . j a va 2s. c om*/ if (orderByComparator != null) { query = new StringBundler(4 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_APPLICATIONINSTANCE_WHERE); boolean bindFolderName = false; if (folderName == null) { query.append(_FINDER_COLUMN_FOLDERNAME_FOLDERNAME_1); } else if (folderName.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_FOLDERNAME_FOLDERNAME_3); } else { bindFolderName = true; query.append(_FINDER_COLUMN_FOLDERNAME_FOLDERNAME_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(ApplicationInstanceModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (bindFolderName) { qPos.add(folderName); } if (orderByComparator != null) { Object[] values = orderByComparator.getOrderByConditionValues(applicationInstance); for (Object value : values) { qPos.add(value); } } List<ApplicationInstance> list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } }
From source file:at.graz.meduni.bibbox.liferay.portlet.service.persistence.impl.ApplicationInstancePersistenceImpl.java
License:Open Source License
/** * Returns the number of application instances where folderName = ?. * * @param folderName the folder name//w w w .j a v a 2 s . c o m * @return the number of matching application instances */ @Override public int countByFolderName(String folderName) { FinderPath finderPath = FINDER_PATH_COUNT_BY_FOLDERNAME; Object[] finderArgs = new Object[] { folderName }; Long count = (Long) finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_APPLICATIONINSTANCE_WHERE); boolean bindFolderName = false; if (folderName == null) { query.append(_FINDER_COLUMN_FOLDERNAME_FOLDERNAME_1); } else if (folderName.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_FOLDERNAME_FOLDERNAME_3); } else { bindFolderName = true; query.append(_FINDER_COLUMN_FOLDERNAME_FOLDERNAME_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindFolderName) { qPos.add(folderName); } count = (Long) q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:at.graz.meduni.bibbox.liferay.portlet.service.persistence.impl.ApplicationInstancePersistenceImpl.java
License:Open Source License
/** * Returns the application instance where instanceId = ? or returns <code>null</code> if it could not be found, optionally using the finder cache. * * @param instanceId the instance ID/*from ww w . ja v a 2 s . c om*/ * @param retrieveFromCache whether to retrieve from the finder cache * @return the matching application instance, or <code>null</code> if a matching application instance could not be found */ @Override public ApplicationInstance fetchByInstanceId(String instanceId, boolean retrieveFromCache) { Object[] finderArgs = new Object[] { instanceId }; Object result = null; if (retrieveFromCache) { result = finderCache.getResult(FINDER_PATH_FETCH_BY_INSTANCEID, finderArgs, this); } if (result instanceof ApplicationInstance) { ApplicationInstance applicationInstance = (ApplicationInstance) result; if (!Objects.equals(instanceId, applicationInstance.getInstanceId())) { result = null; } } if (result == null) { StringBundler query = new StringBundler(3); query.append(_SQL_SELECT_APPLICATIONINSTANCE_WHERE); boolean bindInstanceId = false; if (instanceId == null) { query.append(_FINDER_COLUMN_INSTANCEID_INSTANCEID_1); } else if (instanceId.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_INSTANCEID_INSTANCEID_3); } else { bindInstanceId = true; query.append(_FINDER_COLUMN_INSTANCEID_INSTANCEID_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindInstanceId) { qPos.add(instanceId); } List<ApplicationInstance> list = q.list(); if (list.isEmpty()) { finderCache.putResult(FINDER_PATH_FETCH_BY_INSTANCEID, finderArgs, list); } else { if ((list.size() > 1) && _log.isWarnEnabled()) { _log.warn( "ApplicationInstancePersistenceImpl.fetchByInstanceId(String, boolean) with parameters (" + StringUtil.merge(finderArgs) + ") yields a result set with more than 1 result. This violates the logical unique restriction. There is no order guarantee on which result is returned by this finder."); } ApplicationInstance applicationInstance = list.get(0); result = applicationInstance; cacheResult(applicationInstance); if ((applicationInstance.getInstanceId() == null) || !applicationInstance.getInstanceId().equals(instanceId)) { finderCache.putResult(FINDER_PATH_FETCH_BY_INSTANCEID, finderArgs, applicationInstance); } } } catch (Exception e) { finderCache.removeResult(FINDER_PATH_FETCH_BY_INSTANCEID, finderArgs); throw processException(e); } finally { closeSession(session); } } if (result instanceof List<?>) { return null; } else { return (ApplicationInstance) result; } }
From source file:at.graz.meduni.bibbox.liferay.portlet.service.persistence.impl.ApplicationInstancePersistenceImpl.java
License:Open Source License
/** * Returns the number of application instances where instanceId = ?. * * @param instanceId the instance ID/* www.j a v a 2 s .co m*/ * @return the number of matching application instances */ @Override public int countByInstanceId(String instanceId) { FinderPath finderPath = FINDER_PATH_COUNT_BY_INSTANCEID; Object[] finderArgs = new Object[] { instanceId }; Long count = (Long) finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_APPLICATIONINSTANCE_WHERE); boolean bindInstanceId = false; if (instanceId == null) { query.append(_FINDER_COLUMN_INSTANCEID_INSTANCEID_1); } else if (instanceId.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_INSTANCEID_INSTANCEID_3); } else { bindInstanceId = true; query.append(_FINDER_COLUMN_INSTANCEID_INSTANCEID_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindInstanceId) { qPos.add(instanceId); } count = (Long) q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:at.graz.meduni.liferay.api.model.impl.rdconnectCacheModel.java
License:Open Source License
@Override public rdconnect toEntityModel() { rdconnectImpl rdconnectImpl = new rdconnectImpl(); rdconnectImpl.setIdcardapilogId(idcardapilogId); rdconnectImpl.setUserId(userId);/*from w w w . j ava2 s. c o m*/ if (ipaddress == null) { rdconnectImpl.setIpaddress(StringPool.BLANK); } else { rdconnectImpl.setIpaddress(ipaddress); } if (accessDate == Long.MIN_VALUE) { rdconnectImpl.setAccessDate(null); } else { rdconnectImpl.setAccessDate(new Date(accessDate)); } if (requestparameter == null) { rdconnectImpl.setRequestparameter(StringPool.BLANK); } else { rdconnectImpl.setRequestparameter(requestparameter); } rdconnectImpl.resetOriginalValues(); return rdconnectImpl; }
From source file:at.graz.meduni.liferay.api.model.impl.rdconnectCacheModel.java
License:Open Source License
@Override public void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeLong(idcardapilogId); objectOutput.writeLong(userId);//from www . ja va 2s . c om if (ipaddress == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(ipaddress); } objectOutput.writeLong(accessDate); if (requestparameter == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(requestparameter); } }
From source file:at.graz.meduni.liferay.api.model.impl.rdconnectModelImpl.java
License:Open Source License
@JSON @Override//from w w w. j a va2 s.c o m public String getIpaddress() { if (_ipaddress == null) { return StringPool.BLANK; } else { return _ipaddress; } }
From source file:at.graz.meduni.liferay.api.model.impl.rdconnectModelImpl.java
License:Open Source License
@JSON @Override/* w w w .j a va 2 s . c o m*/ public String getRequestparameter() { if (_requestparameter == null) { return StringPool.BLANK; } else { return _requestparameter; } }
From source file:at.graz.meduni.liferay.model.impl.DictionaryCacheModel.java
License:Open Source License
@Override public Dictionary toEntityModel() { DictionaryImpl dictionaryImpl = new DictionaryImpl(); dictionaryImpl.setDictionary_id(dictionary_id); if (synonym == null) { dictionaryImpl.setSynonym(StringPool.BLANK); } else {/* www . ja v a 2 s .c o m*/ dictionaryImpl.setSynonym(synonym); } dictionaryImpl.setBefore_synonym(before_synonym); dictionaryImpl.setAfter_synonym(after_synonym); dictionaryImpl.setForeword(foreword); dictionaryImpl.setEnding(ending); dictionaryImpl.setSentence(sentence); dictionaryImpl.setIscode(iscode); if (pattern == null) { dictionaryImpl.setPattern(StringPool.BLANK); } else { dictionaryImpl.setPattern(pattern); } if (code_typ == null) { dictionaryImpl.setCode_typ(StringPool.BLANK); } else { dictionaryImpl.setCode_typ(code_typ); } if (code_value == null) { dictionaryImpl.setCode_value(StringPool.BLANK); } else { dictionaryImpl.setCode_value(code_value); } dictionaryImpl.setRoot(root); dictionaryImpl.setNegation(negation); dictionaryImpl.setOccur(occur); if (disease_ids == null) { dictionaryImpl.setDisease_ids(StringPool.BLANK); } else { dictionaryImpl.setDisease_ids(disease_ids); } dictionaryImpl.setDirty(dirty); dictionaryImpl.setPriority(priority); dictionaryImpl.setDisease_ids_count(disease_ids_count); dictionaryImpl.setPriority_mode(priority_mode); dictionaryImpl.resetOriginalValues(); return dictionaryImpl; }
From source file:at.graz.meduni.liferay.model.impl.DictionaryCacheModel.java
License:Open Source License
@Override public void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeLong(dictionary_id); if (synonym == null) { objectOutput.writeUTF(StringPool.BLANK); } else {//w w w . ja va2 s . co m objectOutput.writeUTF(synonym); } objectOutput.writeInt(before_synonym); objectOutput.writeInt(after_synonym); objectOutput.writeBoolean(foreword); objectOutput.writeBoolean(ending); objectOutput.writeBoolean(sentence); objectOutput.writeBoolean(iscode); if (pattern == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(pattern); } if (code_typ == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(code_typ); } if (code_value == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(code_value); } objectOutput.writeBoolean(root); objectOutput.writeBoolean(negation); objectOutput.writeBoolean(occur); if (disease_ids == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(disease_ids); } objectOutput.writeBoolean(dirty); objectOutput.writeInt(priority); objectOutput.writeInt(disease_ids_count); objectOutput.writeBoolean(priority_mode); }