use of com.liferay.roster.model.impl.ClubModelImpl in project liferay-ide by liferay.
the class ClubPersistenceImpl method updateImpl.
@Override
public Club updateImpl(Club club) {
club = toUnwrappedModel(club);
boolean isNew = club.isNew();
ClubModelImpl clubModelImpl = (ClubModelImpl) club;
if (Validator.isNull(club.getUuid())) {
String uuid = PortalUUIDUtil.generate();
club.setUuid(uuid);
}
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
Date now = new Date();
if (isNew && (club.getCreateDate() == null)) {
if (serviceContext == null) {
club.setCreateDate(now);
} else {
club.setCreateDate(serviceContext.getCreateDate(now));
}
}
if (!clubModelImpl.hasSetModifiedDate()) {
if (serviceContext == null) {
club.setModifiedDate(now);
} else {
club.setModifiedDate(serviceContext.getModifiedDate(now));
}
}
Session session = null;
try {
session = openSession();
if (club.isNew()) {
session.save(club);
club.setNew(false);
} else {
club = (Club) session.merge(club);
}
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
if (isNew || !ClubModelImpl.COLUMN_BITMASK_ENABLED) {
finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
} else {
if ((clubModelImpl.getColumnBitmask() & FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
Object[] args = new Object[] { clubModelImpl.getOriginalUuid() };
finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
args = new Object[] { clubModelImpl.getUuid() };
finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID, args);
}
}
entityCache.putResult(ClubModelImpl.ENTITY_CACHE_ENABLED, ClubImpl.class, club.getPrimaryKey(), club, false);
club.resetOriginalValues();
return club;
}
Aggregations