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.hmmc.liferay.portlet.puch.service.persistence.TransaktionPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the transaktions where typ = ?. * * <p>//w ww . ja v a 2 s .c o m * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.graz.hmmc.liferay.portlet.puch.model.impl.TransaktionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param typ the typ * @param start the lower bound of the range of transaktions * @param end the upper bound of the range of transaktions (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching transaktions * @throws SystemException if a system exception occurred */ @Override public List<Transaktion> findByTyp(String typ, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYP; finderArgs = new Object[] { typ }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TYP; finderArgs = new Object[] { typ, start, end, orderByComparator }; } List<Transaktion> list = (List<Transaktion>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Transaktion transaktion : list) { if (!Validator.equals(typ, transaktion.getTyp())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_TRANSAKTION_WHERE); boolean bindTyp = false; if (typ == null) { query.append(_FINDER_COLUMN_TYP_TYP_1); } else if (typ.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_TYP_TYP_3); } else { bindTyp = true; query.append(_FINDER_COLUMN_TYP_TYP_2); } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(TransaktionModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindTyp) { qPos.add(typ); } if (!pagination) { list = (List<Transaktion>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Transaktion>(list); } else { list = (List<Transaktion>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.TransaktionPersistenceImpl.java
License:Open Source License
protected Transaktion getByTyp_PrevAndNext(Session session, Transaktion transaktion, String typ, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null;//from w ww.j ava2 s . com if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 6)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_TRANSAKTION_WHERE); boolean bindTyp = false; if (typ == null) { query.append(_FINDER_COLUMN_TYP_TYP_1); } else if (typ.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_TYP_TYP_3); } else { bindTyp = true; query.append(_FINDER_COLUMN_TYP_TYP_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(TransaktionModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (bindTyp) { qPos.add(typ); } if (orderByComparator != null) { Object[] values = orderByComparator.getOrderByConditionValues(transaktion); for (Object value : values) { qPos.add(value); } } List<Transaktion> list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.TransaktionPersistenceImpl.java
License:Open Source License
/** * Returns the number of transaktions where typ = ?. * * @param typ the typ//from w w w . ja va 2s. co m * @return the number of matching transaktions * @throws SystemException if a system exception occurred */ @Override public int countByTyp(String typ) throws SystemException { FinderPath finderPath = FINDER_PATH_COUNT_BY_TYP; Object[] finderArgs = new Object[] { typ }; Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_TRANSAKTION_WHERE); boolean bindTyp = false; if (typ == null) { query.append(_FINDER_COLUMN_TYP_TYP_1); } else if (typ.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_TYP_TYP_3); } else { bindTyp = true; query.append(_FINDER_COLUMN_TYP_TYP_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindTyp) { qPos.add(typ); } count = (Long) q.uniqueResult(); FinderCacheUtil.putResult(finderPath, finderArgs, count); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.TransaktionPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the transaktions where typ = ? and puchmuseumsobjectId = ?. * * <p>// w ww . j a v a 2 s.c o m * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link at.graz.hmmc.liferay.portlet.puch.model.impl.TransaktionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param typ the typ * @param puchmuseumsobjectId the puchmuseumsobject ID * @param start the lower bound of the range of transaktions * @param end the upper bound of the range of transaktions (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching transaktions * @throws SystemException if a system exception occurred */ @Override public List<Transaktion> findByTypAndObject(String typ, long puchmuseumsobjectId, int start, int end, OrderByComparator orderByComparator) throws SystemException { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_TYPANDOBJECT; finderArgs = new Object[] { typ, puchmuseumsobjectId }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_TYPANDOBJECT; finderArgs = new Object[] { typ, puchmuseumsobjectId, start, end, orderByComparator }; } List<Transaktion> list = (List<Transaktion>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (Transaktion transaktion : list) { if (!Validator.equals(typ, transaktion.getTyp()) || (puchmuseumsobjectId != transaktion.getPuchmuseumsobjectId())) { list = null; break; } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(4 + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_TRANSAKTION_WHERE); boolean bindTyp = false; if (typ == null) { query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_1); } else if (typ.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_3); } else { bindTyp = true; query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_2); } query.append(_FINDER_COLUMN_TYPANDOBJECT_PUCHMUSEUMSOBJECTID_2); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(TransaktionModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindTyp) { qPos.add(typ); } qPos.add(puchmuseumsobjectId); if (!pagination) { list = (List<Transaktion>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = new UnmodifiableList<Transaktion>(list); } else { list = (List<Transaktion>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.TransaktionPersistenceImpl.java
License:Open Source License
protected Transaktion getByTypAndObject_PrevAndNext(Session session, Transaktion transaktion, String typ, long puchmuseumsobjectId, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null;/* w w w. j a v a2s . co m*/ if (orderByComparator != null) { query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 6)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_TRANSAKTION_WHERE); boolean bindTyp = false; if (typ == null) { query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_1); } else if (typ.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_3); } else { bindTyp = true; query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_2); } query.append(_FINDER_COLUMN_TYPANDOBJECT_PUCHMUSEUMSOBJECTID_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(TransaktionModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (bindTyp) { qPos.add(typ); } qPos.add(puchmuseumsobjectId); if (orderByComparator != null) { Object[] values = orderByComparator.getOrderByConditionValues(transaktion); for (Object value : values) { qPos.add(value); } } List<Transaktion> list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } }
From source file:at.graz.hmmc.liferay.portlet.puch.service.persistence.TransaktionPersistenceImpl.java
License:Open Source License
/** * Returns the number of transaktions where typ = ? and puchmuseumsobjectId = ?. * * @param typ the typ//from ww w.ja v a 2 s. c o m * @param puchmuseumsobjectId the puchmuseumsobject ID * @return the number of matching transaktions * @throws SystemException if a system exception occurred */ @Override public int countByTypAndObject(String typ, long puchmuseumsobjectId) throws SystemException { FinderPath finderPath = FINDER_PATH_COUNT_BY_TYPANDOBJECT; Object[] finderArgs = new Object[] { typ, puchmuseumsobjectId }; Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_TRANSAKTION_WHERE); boolean bindTyp = false; if (typ == null) { query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_1); } else if (typ.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_3); } else { bindTyp = true; query.append(_FINDER_COLUMN_TYPANDOBJECT_TYP_2); } query.append(_FINDER_COLUMN_TYPANDOBJECT_PUCHMUSEUMSOBJECTID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindTyp) { qPos.add(typ); } qPos.add(puchmuseumsobjectId); count = (Long) q.uniqueResult(); FinderCacheUtil.putResult(finderPath, finderArgs, count); } catch (Exception e) { FinderCacheUtil.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:at.graz.meduni.bibbox.liferay.portlet.model.ApplicationInstanceClp.java
License:Open Source License
@Override public String getUserUuid() { try {// ww w.j a v a 2 s . c o m User user = UserLocalServiceUtil.getUserById(getUserId()); return user.getUuid(); } catch (PortalException pe) { return StringPool.BLANK; } }
From source file:at.graz.meduni.bibbox.liferay.portlet.model.impl.ApplicationInstanceCacheModel.java
License:Open Source License
@Override public ApplicationInstance toEntityModel() { ApplicationInstanceImpl applicationInstanceImpl = new ApplicationInstanceImpl(); applicationInstanceImpl.setApplicationInstanceId(applicationInstanceId); applicationInstanceImpl.setGroupId(groupId); applicationInstanceImpl.setCompanyId(companyId); applicationInstanceImpl.setUserId(userId); if (userName == null) { applicationInstanceImpl.setUserName(StringPool.BLANK); } else {//from w ww . ja va 2 s. c o m applicationInstanceImpl.setUserName(userName); } if (createDate == Long.MIN_VALUE) { applicationInstanceImpl.setCreateDate(null); } else { applicationInstanceImpl.setCreateDate(new Date(createDate)); } if (modifiedDate == Long.MIN_VALUE) { applicationInstanceImpl.setModifiedDate(null); } else { applicationInstanceImpl.setModifiedDate(new Date(modifiedDate)); } if (instanceId == null) { applicationInstanceImpl.setInstanceId(StringPool.BLANK); } else { applicationInstanceImpl.setInstanceId(instanceId); } if (name == null) { applicationInstanceImpl.setName(StringPool.BLANK); } else { applicationInstanceImpl.setName(name); } if (shortName == null) { applicationInstanceImpl.setShortName(StringPool.BLANK); } else { applicationInstanceImpl.setShortName(shortName); } if (folderName == null) { applicationInstanceImpl.setFolderName(StringPool.BLANK); } else { applicationInstanceImpl.setFolderName(folderName); } if (application == null) { applicationInstanceImpl.setApplication(StringPool.BLANK); } else { applicationInstanceImpl.setApplication(application); } if (version == null) { applicationInstanceImpl.setVersion(StringPool.BLANK); } else { applicationInstanceImpl.setVersion(version); } if (status == null) { applicationInstanceImpl.setStatus(StringPool.BLANK); } else { applicationInstanceImpl.setStatus(status); } applicationInstanceImpl.setDeleted(deleted); if (shortdescription == null) { applicationInstanceImpl.setShortdescription(StringPool.BLANK); } else { applicationInstanceImpl.setShortdescription(shortdescription); } if (description == null) { applicationInstanceImpl.setDescription(StringPool.BLANK); } else { applicationInstanceImpl.setDescription(description); } if (adminnode == null) { applicationInstanceImpl.setAdminnode(StringPool.BLANK); } else { applicationInstanceImpl.setAdminnode(adminnode); } if (maintenance == null) { applicationInstanceImpl.setMaintenance(StringPool.BLANK); } else { applicationInstanceImpl.setMaintenance(maintenance); } applicationInstanceImpl.setIsmaintenance(ismaintenance); if (installlog == null) { applicationInstanceImpl.setInstalllog(StringPool.BLANK); } else { applicationInstanceImpl.setInstalllog(installlog); } applicationInstanceImpl.setIsinstalling(isinstalling); applicationInstanceImpl.resetOriginalValues(); return applicationInstanceImpl; }
From source file:at.graz.meduni.bibbox.liferay.portlet.model.impl.ApplicationInstanceCacheModel.java
License:Open Source License
@Override public void writeExternal(ObjectOutput objectOutput) throws IOException { objectOutput.writeLong(applicationInstanceId); objectOutput.writeLong(groupId);//from ww w .ja va2s . c om objectOutput.writeLong(companyId); objectOutput.writeLong(userId); if (userName == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(userName); } objectOutput.writeLong(createDate); objectOutput.writeLong(modifiedDate); if (instanceId == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(instanceId); } if (name == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(name); } if (shortName == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(shortName); } if (folderName == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(folderName); } if (application == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(application); } if (version == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(version); } if (status == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(status); } objectOutput.writeBoolean(deleted); if (shortdescription == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(shortdescription); } if (description == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(description); } if (adminnode == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(adminnode); } if (maintenance == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(maintenance); } objectOutput.writeBoolean(ismaintenance); if (installlog == null) { objectOutput.writeUTF(StringPool.BLANK); } else { objectOutput.writeUTF(installlog); } objectOutput.writeBoolean(isinstalling); }
From source file:at.graz.meduni.bibbox.liferay.portlet.model.impl.ApplicationInstanceContainerCacheModel.java
License:Open Source License
@Override public ApplicationInstanceContainer toEntityModel() { ApplicationInstanceContainerImpl applicationInstanceContainerImpl = new ApplicationInstanceContainerImpl(); applicationInstanceContainerImpl.setApplicationInstanceContainerId(applicationInstanceContainerId); applicationInstanceContainerImpl.setGroupId(groupId); applicationInstanceContainerImpl.setCompanyId(companyId); applicationInstanceContainerImpl.setUserId(userId); if (userName == null) { applicationInstanceContainerImpl.setUserName(StringPool.BLANK); } else {/*w ww . j a v a 2s.com*/ applicationInstanceContainerImpl.setUserName(userName); } if (createDate == Long.MIN_VALUE) { applicationInstanceContainerImpl.setCreateDate(null); } else { applicationInstanceContainerImpl.setCreateDate(new Date(createDate)); } if (modifiedDate == Long.MIN_VALUE) { applicationInstanceContainerImpl.setModifiedDate(null); } else { applicationInstanceContainerImpl.setModifiedDate(new Date(modifiedDate)); } if (containerName == null) { applicationInstanceContainerImpl.setContainerName(StringPool.BLANK); } else { applicationInstanceContainerImpl.setContainerName(containerName); } applicationInstanceContainerImpl.setNeedrunning(needrunning); applicationInstanceContainerImpl.setRunning(running); applicationInstanceContainerImpl.setApplicationInstanceId(applicationInstanceId); applicationInstanceContainerImpl.resetOriginalValues(); return applicationInstanceContainerImpl; }