use of com.liferay.portlet.trash.model.TrashEntry in project liferay-ide by liferay.
the class AlbumModelImpl method getTrashEntry.
@Override
public TrashEntry getTrashEntry() throws PortalException, SystemException {
if (!isInTrash()) {
return null;
}
TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(), getTrashEntryClassPK());
if (trashEntry != null) {
return trashEntry;
}
TrashHandler trashHandler = getTrashHandler();
if (!Validator.isNull(trashHandler.getContainerModelClassName())) {
ContainerModel containerModel = trashHandler.getParentContainerModel(this);
while (containerModel != null) {
if (containerModel instanceof TrashedModel) {
TrashedModel trashedModel = (TrashedModel) containerModel;
return trashedModel.getTrashEntry();
}
trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName());
if (trashHandler == null) {
return null;
}
containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
}
}
return null;
}
use of com.liferay.portlet.trash.model.TrashEntry in project liferay-ide by liferay.
the class ArtistModelImpl method getTrashEntry.
@Override
public TrashEntry getTrashEntry() throws PortalException, SystemException {
if (!isInTrash()) {
return null;
}
TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(), getTrashEntryClassPK());
if (trashEntry != null) {
return trashEntry;
}
TrashHandler trashHandler = getTrashHandler();
if (!Validator.isNull(trashHandler.getContainerModelClassName())) {
ContainerModel containerModel = trashHandler.getParentContainerModel(this);
while (containerModel != null) {
if (containerModel instanceof TrashedModel) {
TrashedModel trashedModel = (TrashedModel) containerModel;
return trashedModel.getTrashEntry();
}
trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName());
if (trashHandler == null) {
return null;
}
containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
}
}
return null;
}
use of com.liferay.portlet.trash.model.TrashEntry in project liferay-ide by liferay.
the class SongClp method getTrashEntry.
@Override
public TrashEntry getTrashEntry() throws PortalException, SystemException {
if (!isInTrash()) {
return null;
}
TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(), getTrashEntryClassPK());
if (trashEntry != null) {
return trashEntry;
}
TrashHandler trashHandler = getTrashHandler();
if (!Validator.isNull(trashHandler.getContainerModelClassName())) {
ContainerModel containerModel = trashHandler.getParentContainerModel(this);
while (containerModel != null) {
if (containerModel instanceof TrashedModel) {
TrashedModel trashedModel = (TrashedModel) containerModel;
return trashedModel.getTrashEntry();
}
trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName());
if (trashHandler == null) {
return null;
}
containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
}
}
return null;
}
use of com.liferay.portlet.trash.model.TrashEntry in project liferay-ide by liferay.
the class AlbumClp method getTrashEntry.
@Override
public TrashEntry getTrashEntry() throws PortalException, SystemException {
if (!isInTrash()) {
return null;
}
TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(), getTrashEntryClassPK());
if (trashEntry != null) {
return trashEntry;
}
TrashHandler trashHandler = getTrashHandler();
if (!Validator.isNull(trashHandler.getContainerModelClassName())) {
ContainerModel containerModel = trashHandler.getParentContainerModel(this);
while (containerModel != null) {
if (containerModel instanceof TrashedModel) {
TrashedModel trashedModel = (TrashedModel) containerModel;
return trashedModel.getTrashEntry();
}
trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName());
if (trashHandler == null) {
return null;
}
containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
}
}
return null;
}
use of com.liferay.portlet.trash.model.TrashEntry in project liferay-ide by liferay.
the class AlbumLocalServiceImpl method restoreDependentsFromTrash.
protected void restoreDependentsFromTrash(List<Song> songs, long trashEntryId) throws PortalException, SystemException {
for (Song song : songs) {
// Song
TrashEntry trashEntry = trashEntryLocalService.fetchEntry(Song.class.getName(), song.getSongId());
if (trashEntry != null) {
continue;
}
TrashVersion trashVersion = trashVersionLocalService.fetchVersion(trashEntryId, Song.class.getName(), song.getSongId());
int oldStatus = WorkflowConstants.STATUS_APPROVED;
if (trashVersion != null) {
oldStatus = trashVersion.getStatus();
}
song.setStatus(oldStatus);
songPersistence.update(song);
if (trashVersion != null) {
trashVersionLocalService.deleteTrashVersion(trashVersion);
}
if (oldStatus == WorkflowConstants.STATUS_APPROVED) {
assetEntryLocalService.updateVisible(Song.class.getName(), song.getSongId(), true);
}
// Indexer
Indexer indexer = IndexerRegistryUtil.nullSafeGetIndexer(Song.class);
indexer.reindex(song);
}
}
Aggregations