result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_CERTIFICATEIDANDVERBANDOBJECT,
finderArgs, this);
}
if (result instanceof LFCertificateTincanStatement) {
LFCertificateTincanStatement lfCertificateTincanStatement = (LFCertificateTincanStatement) result;
if (!Validator.equals(certificateID,
lfCertificateTincanStatement.getCertificateID()) ||
!Validator.equals(verb,
lfCertificateTincanStatement.getVerb()) ||
!Validator.equals(object,
lfCertificateTincanStatement.getObject())) {
result = null;
}
}
if (result == null) {
StringBundler query = new StringBundler(5);
query.append(_SQL_SELECT_LFCERTIFICATETINCANSTATEMENT_WHERE);
if (certificateID == null) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_CERTIFICATEID_NULL_2);
} else {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_CERTIFICATEID_2);
}
boolean bindVerb = false;
if (verb == null) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_VERB_1);
} else if (verb.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_VERB_3);
} else {
bindVerb = true;
if (verb.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_VERB_3);
} else {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_VERB_2);
}
}
boolean bindObject = false;
if (object == null) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_OBJECT_1);
} else if (object.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_OBJECT_3);
} else {
bindObject = true;
if (object.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_OBJECT_3);
} else {
query.append(_FINDER_COLUMN_CERTIFICATEIDANDVERBANDOBJECT_OBJECT_2);
}
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (certificateID != null) {
qPos.add(certificateID.longValue());
}
if (bindVerb) {
if (verb != null) {
qPos.add(verb);
}
}
if (bindObject) {
if (object != null) {
qPos.add(object);
}
}
List<LFCertificateTincanStatement> list = q.list();
if (list.isEmpty()) {
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CERTIFICATEIDANDVERBANDOBJECT,
finderArgs, list);
} else {
if ((list.size() > 1) && _log.isWarnEnabled()) {
_log.warn(
"LFCertificateTincanStatementPersistenceImpl.fetchByCertificateIDAndVerbAndObject(Long, String, 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.");
}
LFCertificateTincanStatement lfCertificateTincanStatement = list.get(0);
result = lfCertificateTincanStatement;
cacheResult(lfCertificateTincanStatement);
if ((lfCertificateTincanStatement.getCertificateID() != certificateID) ||
(lfCertificateTincanStatement.getVerb() == null) ||
!lfCertificateTincanStatement.getVerb().equals(verb) ||
(lfCertificateTincanStatement.getObject() == null) ||
!lfCertificateTincanStatement.getObject()
.equals(object)) {
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_CERTIFICATEIDANDVERBANDOBJECT,
finderArgs, lfCertificateTincanStatement);
}
}