result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_ACTIVITYIDANDPROFILEID,
finderArgs, this);
}
if (result instanceof LFTincanActProfile) {
LFTincanActProfile lfTincanActProfile = (LFTincanActProfile) result;
if (!Validator.equals(activityId, lfTincanActProfile.getActivityId()) ||
!Validator.equals(profileId,
lfTincanActProfile.getProfileId())) {
result = null;
}
}
if (result == null) {
StringBundler query = new StringBundler(4);
query.append(_SQL_SELECT_LFTINCANACTPROFILE_WHERE);
boolean bindActivityId = false;
if (activityId == null) {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_ACTIVITYID_1);
} else if (activityId.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_ACTIVITYID_3);
} else {
bindActivityId = true;
if (activityId.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_ACTIVITYID_3);
} else {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_ACTIVITYID_2);
}
}
boolean bindProfileId = false;
if (profileId == null) {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_PROFILEID_1);
} else if (profileId.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_PROFILEID_3);
} else {
bindProfileId = true;
if (profileId.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_PROFILEID_3);
} else {
query.append(_FINDER_COLUMN_ACTIVITYIDANDPROFILEID_PROFILEID_2);
}
}
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindActivityId) {
if (activityId != null) {
qPos.add(activityId);
}
}
if (bindProfileId) {
if (profileId != null) {
qPos.add(profileId);
}
}
List<LFTincanActProfile> list = q.list();
if (list.isEmpty()) {
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ACTIVITYIDANDPROFILEID,
finderArgs, list);
} else {
if ((list.size() > 1) && _log.isWarnEnabled()) {
_log.warn(
"LFTincanActProfilePersistenceImpl.fetchByActivityIdAndProfileId(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.");
}
LFTincanActProfile lfTincanActProfile = list.get(0);
result = lfTincanActProfile;
cacheResult(lfTincanActProfile);
if ((lfTincanActProfile.getActivityId() == null) ||
!lfTincanActProfile.getActivityId()
.equals(activityId) ||
(lfTincanActProfile.getProfileId() == null) ||
!lfTincanActProfile.getProfileId().equals(profileId)) {
FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_ACTIVITYIDANDPROFILEID,
finderArgs, lfTincanActProfile);
}
}
} catch (Exception e) {