Example usage for com.liferay.portal.kernel.util StringPool BLANK

List of usage examples for com.liferay.portal.kernel.util StringPool BLANK

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool BLANK.

Prototype

String BLANK

To view the source code for com.liferay.portal.kernel.util StringPool BLANK.

Click Source Link

Usage

From source file:at.graz.meduni.liferay.portlet.bibbox.service.service.persistence.InvitationPersistenceImpl.java

License:Open Source License

protected Invitation getByFilter_PrevAndNext(Session session, Invitation invitation, String filter,
        OrderByComparator orderByComparator, boolean previous) {
    StringBundler query = null;//from  w  ww.j av  a2 s . c  o m

    if (orderByComparator != null) {
        query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 6));
    } else {
        query = new StringBundler(3);
    }

    query.append(_SQL_SELECT_INVITATION_WHERE);

    boolean bindFilter = false;

    if (filter == null) {
        query.append(_FINDER_COLUMN_FILTER_FILTER_1);
    } else if (filter.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_FILTER_FILTER_3);
    } else {
        bindFilter = true;

        query.append(_FINDER_COLUMN_FILTER_FILTER_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(InvitationModelImpl.ORDER_BY_JPQL);
    }

    String sql = query.toString();

    Query q = session.createQuery(sql);

    q.setFirstResult(0);
    q.setMaxResults(2);

    QueryPos qPos = QueryPos.getInstance(q);

    if (bindFilter) {
        qPos.add(filter);
    }

    if (orderByComparator != null) {
        Object[] values = orderByComparator.getOrderByConditionValues(invitation);

        for (Object value : values) {
            qPos.add(value);
        }
    }

    List<Invitation> list = q.list();

    if (list.size() == 2) {
        return list.get(1);
    } else {
        return null;
    }
}

From source file:at.graz.meduni.liferay.portlet.bibbox.service.service.persistence.InvitationPersistenceImpl.java

License:Open Source License

/**
 * Returns the number of invitations where filter = &#63;.
 *
 * @param filter the filter/*  ww  w  .  j  a  v  a  2s .  c  o  m*/
 * @return the number of matching invitations
 * @throws SystemException if a system exception occurred
 */
@Override
public int countByFilter(String filter) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_FILTER;

    Object[] finderArgs = new Object[] { filter };

    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);

    if (count == null) {
        StringBundler query = new StringBundler(2);

        query.append(_SQL_COUNT_INVITATION_WHERE);

        boolean bindFilter = false;

        if (filter == null) {
            query.append(_FINDER_COLUMN_FILTER_FILTER_1);
        } else if (filter.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_FILTER_FILTER_3);
        } else {
            bindFilter = true;

            query.append(_FINDER_COLUMN_FILTER_FILTER_2);
        }

        String sql = query.toString();

        Session session = null;

        try {
            session = openSession();

            Query q = session.createQuery(sql);

            QueryPos qPos = QueryPos.getInstance(q);

            if (bindFilter) {
                qPos.add(filter);
            }

            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.liferay.portlet.saat.model.impl.DictionaryCacheModel.java

License:Open Source License

@Override
public Dictionary toEntityModel() {
    DictionaryImpl dictionaryImpl = new DictionaryImpl();

    dictionaryImpl.setDictionaryId(dictionaryId);

    if (synonym == null) {
        dictionaryImpl.setSynonym(StringPool.BLANK);
    } else {//from   w w  w  .j a va2s .  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.portlet.saat.model.impl.DictionaryCacheModel.java

License:Open Source License

@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
    objectOutput.writeLong(dictionaryId);

    if (synonym == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {//w w  w .j  av  a  2 s .c  o  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);
}

From source file:at.graz.meduni.liferay.portlet.saat.model.impl.ICD10CacheModel.java

License:Open Source License

@Override
public ICD10 toEntityModel() {
    ICD10Impl icd10Impl = new ICD10Impl();

    icd10Impl.setIcd10Id(icd10Id);/*from   ww w  . j  a v  a  2 s.c o m*/

    if (code == null) {
        icd10Impl.setCode(StringPool.BLANK);
    } else {
        icd10Impl.setCode(code);
    }

    if (description == null) {
        icd10Impl.setDescription(StringPool.BLANK);
    } else {
        icd10Impl.setDescription(description);
    }

    if (INKLUSIVA == null) {
        icd10Impl.setINKLUSIVA(StringPool.BLANK);
    } else {
        icd10Impl.setINKLUSIVA(INKLUSIVA);
    }

    if (EXKLUSIVA == null) {
        icd10Impl.setEXKLUSIVA(StringPool.BLANK);
    } else {
        icd10Impl.setEXKLUSIVA(EXKLUSIVA);
    }

    if (TYPE == null) {
        icd10Impl.setTYPE(StringPool.BLANK);
    } else {
        icd10Impl.setTYPE(TYPE);
    }

    icd10Impl.setUSED(USED);

    if (FROM_CODE == null) {
        icd10Impl.setFROM_CODE(StringPool.BLANK);
    } else {
        icd10Impl.setFROM_CODE(FROM_CODE);
    }

    if (TO_CODE == null) {
        icd10Impl.setTO_CODE(StringPool.BLANK);
    } else {
        icd10Impl.setTO_CODE(TO_CODE);
    }

    icd10Impl.resetOriginalValues();

    return icd10Impl;
}

From source file:at.graz.meduni.liferay.portlet.saat.model.impl.ICD10CacheModel.java

License:Open Source License

@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
    objectOutput.writeLong(icd10Id);//from  ww w.  j a va  2s  .  c  o  m

    if (code == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(code);
    }

    if (description == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(description);
    }

    if (INKLUSIVA == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(INKLUSIVA);
    }

    if (EXKLUSIVA == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(EXKLUSIVA);
    }

    if (TYPE == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(TYPE);
    }

    objectOutput.writeDouble(USED);

    if (FROM_CODE == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(FROM_CODE);
    }

    if (TO_CODE == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(TO_CODE);
    }
}

From source file:at.graz.meduni.liferay.portlet.saat.model.impl.ICDO3CacheModel.java

License:Open Source License

@Override
public ICDO3 toEntityModel() {
    ICDO3Impl icdo3Impl = new ICDO3Impl();

    icdo3Impl.setIcdo3Id(icdo3Id);/*w w  w  .ja v  a2 s.  com*/

    if (code == null) {
        icdo3Impl.setCode(StringPool.BLANK);
    } else {
        icdo3Impl.setCode(code);
    }

    icdo3Impl.setTerm(term);
    icdo3Impl.setSui(sui);

    if (typ == null) {
        icdo3Impl.setTyp(StringPool.BLANK);
    } else {
        icdo3Impl.setTyp(typ);
    }

    if (use == null) {
        icdo3Impl.setUse(StringPool.BLANK);
    } else {
        icdo3Impl.setUse(use);
    }

    if (description == null) {
        icdo3Impl.setDescription(StringPool.BLANK);
    } else {
        icdo3Impl.setDescription(description);
    }

    if (localisation == null) {
        icdo3Impl.setLocalisation(StringPool.BLANK);
    } else {
        icdo3Impl.setLocalisation(localisation);
    }

    if (link == null) {
        icdo3Impl.setLink(StringPool.BLANK);
    } else {
        icdo3Impl.setLink(link);
    }

    if (exklusiva == null) {
        icdo3Impl.setExklusiva(StringPool.BLANK);
    } else {
        icdo3Impl.setExklusiva(exklusiva);
    }

    if (hint == null) {
        icdo3Impl.setHint(StringPool.BLANK);
    } else {
        icdo3Impl.setHint(hint);
    }

    icdo3Impl.resetOriginalValues();

    return icdo3Impl;
}

From source file:at.graz.meduni.liferay.portlet.saat.model.impl.ICDO3CacheModel.java

License:Open Source License

@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
    objectOutput.writeLong(icdo3Id);/* ww w  .  j  a v  a  2  s .  c  o  m*/

    if (code == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(code);
    }

    objectOutput.writeInt(term);
    objectOutput.writeInt(sui);

    if (typ == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(typ);
    }

    if (use == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(use);
    }

    if (description == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(description);
    }

    if (localisation == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(localisation);
    }

    if (link == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(link);
    }

    if (exklusiva == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(exklusiva);
    }

    if (hint == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(hint);
    }
}

From source file:at.graz.meduni.liferay.portlet.saat.model.impl.SCGCacheModel.java

License:Open Source License

@Override
public SCG toEntityModel() {
    SCGImpl scgImpl = new SCGImpl();

    scgImpl.setScgId(scgId);//  ww w. ja  va 2 s . co m

    if (code == null) {
        scgImpl.setCode(StringPool.BLANK);
    } else {
        scgImpl.setCode(code);
    }

    if (description == null) {
        scgImpl.setDescription(StringPool.BLANK);
    } else {
        scgImpl.setDescription(description);
    }

    scgImpl.resetOriginalValues();

    return scgImpl;
}

From source file:at.graz.meduni.liferay.portlet.saat.model.impl.SCGCacheModel.java

License:Open Source License

@Override
public void writeExternal(ObjectOutput objectOutput) throws IOException {
    objectOutput.writeLong(scgId);/*from  www  .j  a  va  2 s .co  m*/

    if (code == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(code);
    }

    if (description == null) {
        objectOutput.writeUTF(StringPool.BLANK);
    } else {
        objectOutput.writeUTF(description);
    }
}