Search in sources :

Example 1 with ContainerModel

use of com.liferay.portal.model.ContainerModel in project liferay-ide by liferay.

the class JukeBoxBaseTrashHandler method getParentContainerModels.

@Override
public List<ContainerModel> getParentContainerModels(long classPK) throws PortalException, SystemException {
    List<ContainerModel> containerModels = new ArrayList<ContainerModel>();
    ContainerModel containerModel = getParentContainerModel(classPK);
    if (containerModel == null) {
        return containerModels;
    }
    containerModels.add(containerModel);
    while (containerModel.getParentContainerModelId() > 0) {
        containerModel = getContainerModel(containerModel.getParentContainerModelId());
        if (containerModel == null) {
            break;
        }
        containerModels.add(containerModel);
    }
    return containerModels;
}
Also used : ArrayList(java.util.ArrayList) ContainerModel(com.liferay.portal.model.ContainerModel)

Example 2 with ContainerModel

use of com.liferay.portal.model.ContainerModel in project liferay-ide by liferay.

the class ArtistClp 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 3 with ContainerModel

use of com.liferay.portal.model.ContainerModel in project liferay-ide by liferay.

the class SongModelImpl 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 4 with ContainerModel

use of com.liferay.portal.model.ContainerModel 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 5 with ContainerModel

use of com.liferay.portal.model.ContainerModel 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)

Aggregations

ContainerModel (com.liferay.portal.model.ContainerModel)7 TrashHandler (com.liferay.portal.kernel.trash.TrashHandler)6 TrashedModel (com.liferay.portal.model.TrashedModel)6 TrashEntry (com.liferay.portlet.trash.model.TrashEntry)6 ArrayList (java.util.ArrayList)1