Search in sources :

Example 6 with TrashHandler

use of com.liferay.portal.kernel.trash.TrashHandler 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;
}
Also used : TrashEntry(com.liferay.portlet.trash.model.TrashEntry) TrashHandler(com.liferay.portal.kernel.trash.TrashHandler) TrashedModel(com.liferay.portal.model.TrashedModel) ContainerModel(com.liferay.portal.model.ContainerModel)

Example 7 with TrashHandler

use of com.liferay.portal.kernel.trash.TrashHandler 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;
}
Also used : TrashEntry(com.liferay.portlet.trash.model.TrashEntry) TrashHandler(com.liferay.portal.kernel.trash.TrashHandler) TrashedModel(com.liferay.portal.model.TrashedModel) ContainerModel(com.liferay.portal.model.ContainerModel)

Example 8 with TrashHandler

use of com.liferay.portal.kernel.trash.TrashHandler 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;
}
Also used : TrashEntry(com.liferay.portlet.trash.model.TrashEntry) TrashHandler(com.liferay.portal.kernel.trash.TrashHandler) TrashedModel(com.liferay.portal.model.TrashedModel) ContainerModel(com.liferay.portal.model.ContainerModel)

Example 9 with TrashHandler

use of com.liferay.portal.kernel.trash.TrashHandler 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;
}
Also used : TrashEntry(com.liferay.portlet.trash.model.TrashEntry) TrashHandler(com.liferay.portal.kernel.trash.TrashHandler) TrashedModel(com.liferay.portal.model.TrashedModel) ContainerModel(com.liferay.portal.model.ContainerModel)

Example 10 with TrashHandler

use of com.liferay.portal.kernel.trash.TrashHandler in project liferay-ide by liferay.

the class SongTrashHandler method getTrashContainedModelTrashRenderers.

@Override
public List<TrashRenderer> getTrashContainedModelTrashRenderers(long classPK, int start, int end) throws PortalException, SystemException {
    List<TrashRenderer> trashRenderers = new ArrayList<TrashRenderer>();
    List<Song> songs = SongLocalServiceUtil.getSongsByAlbumId(classPK, start, end);
    for (Song song : songs) {
        TrashHandler trashHandler = TrashHandlerRegistryUtil.getTrashHandler(Song.class.getName());
        TrashRenderer trashRenderer = trashHandler.getTrashRenderer(song.getSongId());
        trashRenderers.add(trashRenderer);
    }
    return trashRenderers;
}
Also used : Song(org.liferay.jukebox.model.Song) TrashRenderer(com.liferay.portal.kernel.trash.TrashRenderer) TrashHandler(com.liferay.portal.kernel.trash.TrashHandler) ArrayList(java.util.ArrayList)

Aggregations

TrashHandler (com.liferay.portal.kernel.trash.TrashHandler)10 ContainerModel (com.liferay.portal.model.ContainerModel)6 TrashedModel (com.liferay.portal.model.TrashedModel)6 TrashEntry (com.liferay.portlet.trash.model.TrashEntry)6 TrashRenderer (com.liferay.portal.kernel.trash.TrashRenderer)2 ArrayList (java.util.ArrayList)2 Song (org.liferay.jukebox.model.Song)2 BaseTrashHandler (com.liferay.portal.kernel.trash.BaseTrashHandler)1 Album (org.liferay.jukebox.model.Album)1 Artist (org.liferay.jukebox.model.Artist)1