Example usage for com.liferay.portal.kernel.model ResourceConstants SCOPE_INDIVIDUAL

List of usage examples for com.liferay.portal.kernel.model ResourceConstants SCOPE_INDIVIDUAL

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.model ResourceConstants SCOPE_INDIVIDUAL.

Prototype

int SCOPE_INDIVIDUAL

To view the source code for com.liferay.portal.kernel.model ResourceConstants SCOPE_INDIVIDUAL.

Click Source Link

Usage

From source file:ca.efendi.datafeeds.service.impl.CJProductLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override/*from www. j  a  v  a2 s  .c om*/
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public CJProduct deleteEntry(CJProduct entry) throws PortalException {

    // Entry

    cjProductPersistence.remove(entry);

    // Resources

    resourceLocalService.deleteResource(entry.getCompanyId(), CJProduct.class.getName(),
            ResourceConstants.SCOPE_INDIVIDUAL, entry.getProductId());

    // imageLocalService.deleteImage(entry.getSmallImageId());

    subscriptionLocalService.deleteSubscriptions(entry.getCompanyId(), CJProduct.class.getName(),
            entry.getProductId());

    //blogsStatsUserLocalService.updateStatsUser(
    //        entry.getGroupId(), entry.getUserId(), entry.getDisplayDate());

    assetEntryLocalService.deleteEntry(CJProduct.class.getName(), entry.getProductId());

    //        long coverImageFileEntryId = entry.getCoverImageFileEntryId();
    //
    //        if (coverImageFileEntryId != 0) {
    //            PortletFileRepositoryUtil.deletePortletFileEntry(
    //                    coverImageFileEntryId);
    //        }

    //        long smallImageFileEntryId = entry.getSmallImageFileEntryId();
    //
    //        if (smallImageFileEntryId != 0) {
    //            PortletFileRepositoryUtil.deletePortletFileEntry(
    //                    smallImageFileEntryId);
    //        }

    //deleteDiscussion(entry);
    //expandoRowLocalService.deleteRows(entry.getEntryId());

    // Ratings

    ratingsStatsLocalService.deleteStats(CJProduct.class.getName(), entry.getProductId());

    trashEntryLocalService.deleteEntry(CJProduct.class.getName(), entry.getProductId());

    // Workflow

    workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), entry.getGroupId(),
            CJProduct.class.getName(), entry.getProductId());

    return entry;
}

From source file:ch.inofix.contact.service.impl.ContactLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override/* www  .j av  a2 s  .  co  m*/
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public Contact deleteContact(Contact contact) throws PortalException {

    // Contact

    contactPersistence.remove(contact);

    // Resource

    resourceLocalService.deleteResource(contact.getCompanyId(), Contact.class.getName(),
            ResourceConstants.SCOPE_INDIVIDUAL, contact.getContactId());

    // Asset

    assetEntryLocalService.deleteEntry(Contact.class.getName(), contact.getContactId());

    return contact;
}

From source file:ch.inofix.referencemanager.service.impl.BibliographyLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override//  www .  j a  va 2  s.c o  m
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public Bibliography deleteBibliography(Bibliography bibliography) throws PortalException {

    // Bibliography

    bibliographyPersistence.remove(bibliography);

    // Resources

    resourceLocalService.deleteResource(bibliography.getCompanyId(), Bibliography.class.getName(),
            ResourceConstants.SCOPE_INDIVIDUAL, bibliography.getBibliographyId());

    // Subscriptions

    subscriptionLocalService.deleteSubscriptions(bibliography.getCompanyId(), Bibliography.class.getName(),
            bibliography.getBibliographyId());

    // Asset

    assetEntryLocalService.deleteEntry(Bibliography.class.getName(), bibliography.getBibliographyId());

    // BibRefRelation

    bibRefRelationLocalService.deleteByBibliographyId(bibliography.getBibliographyId());

    // Comment

    // TODO
    // deleteDiscussion(bibliography);

    // Expando

    expandoRowLocalService.deleteRows(bibliography.getBibliographyId());

    // Ratings

    ratingsStatsLocalService.deleteStats(Bibliography.class.getName(), bibliography.getBibliographyId());

    // Trash

    trashEntryLocalService.deleteEntry(Bibliography.class.getName(), bibliography.getBibliographyId());

    // Workflow

    // TODO: do we need workflow support?
    // workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(
    // bibliography.getCompanyId(), bibliography.getGroupId(),
    // Bibliography.class.getName(), bibliography.getBibliographyId());

    return bibliography;
}

From source file:ch.inofix.referencemanager.service.impl.ReferenceLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override/*from w w  w.  j ava2s .c o  m*/
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public Reference deleteReference(Reference reference) throws PortalException {

    // Reference

    referencePersistence.remove(reference);

    // Resources

    resourceLocalService.deleteResource(reference.getCompanyId(), Reference.class.getName(),
            ResourceConstants.SCOPE_INDIVIDUAL, reference.getReferenceId());

    // Subscriptions

    subscriptionLocalService.deleteSubscriptions(reference.getCompanyId(), Reference.class.getName(),
            reference.getReferenceId());

    // Asset

    assetEntryLocalService.deleteEntry(Reference.class.getName(), reference.getReferenceId());

    // Comment

    // TODO
    // deleteDiscussion(reference);

    // Expando

    expandoRowLocalService.deleteRows(reference.getReferenceId());

    // Ratings

    ratingsStatsLocalService.deleteStats(Reference.class.getName(), reference.getReferenceId());

    // Trash

    trashEntryLocalService.deleteEntry(Reference.class.getName(), reference.getReferenceId());

    // Workflow

    // TODO: do we need workflow support?
    // workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(
    // reference.getCompanyId(), reference.getGroupId(),
    // Reference.class.getName(), reference.getReferenceId());

    return reference;
}

From source file:ch.inofix.timetracker.service.impl.TaskRecordLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override//w w  w  .  j a v a 2 s  .  co  m
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public TaskRecord deleteTaskRecord(TaskRecord taskRecord) throws PortalException {

    // TaskRecord

    taskRecordPersistence.remove(taskRecord);

    // Resources

    resourceLocalService.deleteResource(taskRecord.getCompanyId(), TaskRecord.class.getName(),
            ResourceConstants.SCOPE_INDIVIDUAL, taskRecord.getTaskRecordId());

    // Asset

    assetEntryLocalService.deleteEntry(TaskRecord.class.getName(), taskRecord.getTaskRecordId());

    // Workflow

    // TODO: add workflow support
    // workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(
    // taskRecord.getCompanyId(), taskRecord.getGroupId(),
    // TaskRecord.class.getName(), taskRecord.getTaskRecordId());

    return taskRecord;
}

From source file:com.liferay.announcements.web.internal.upgrade.v1_0_2.UpgradePermission.java

License:Open Source License

protected void upgradeResourcePermission(String name) throws Exception {
    StringBundler sb1 = new StringBundler(4);

    sb1.append("select resourceActionId, bitwiseValue from ");
    sb1.append("ResourceAction where actionId = 'ADD_ENTRY' and name = '");
    sb1.append(name);/*from w  ww .jav a  2  s. c o  m*/
    sb1.append("'");

    StringBundler sb2 = new StringBundler(5);

    sb2.append("select resourcePermissionId, companyId, scope, primKey, ");
    sb2.append("primKeyId, roleId, actionIds from ResourcePermission ");
    sb2.append("where name = '");
    sb2.append(name);
    sb2.append("'");

    try (PreparedStatement ps1 = connection.prepareStatement(sb1.toString());
            ResultSet rs1 = ps1.executeQuery()) {

        if (!rs1.next()) {
            if (!_ignoreMissingAddEntryResourceAction) {
                _log.error(StringBundler.concat("Unable to upgrade ADD_ENTRY action, ", "ResourceAction for ",
                        name, " is not initialized"));
            }

            return;
        }

        long resourceActionId = rs1.getLong("resourceActionId");
        long bitwiseValue = rs1.getLong("bitwiseValue");

        try (PreparedStatement ps2 = connection.prepareStatement(sb2.toString());
                ResultSet rs = ps2.executeQuery()) {

            while (rs.next()) {
                long resourcePermissionId = rs.getLong("resourcePermissionId");
                long companyId = rs.getLong("companyId");
                int scope = rs.getInt("scope");
                String primKey = rs.getString("primKey");
                long primKeyId = rs.getLong("primKeyId");
                long roleId = rs.getLong("roleId");
                long actionIds = rs.getLong("actionIds");

                if ((bitwiseValue & actionIds) == 0) {
                    continue;
                }

                updateResourcePermission(resourcePermissionId, actionIds - bitwiseValue);

                if (scope == ResourceConstants.SCOPE_INDIVIDUAL) {
                    if (primKey.contains("_LAYOUT_")) {
                        primKey = String.valueOf(companyId);
                        primKeyId = companyId;
                        scope = ResourceConstants.SCOPE_COMPANY;
                    } else {
                        continue;
                    }
                }

                addAnnouncementsAdminViewResourcePermission(companyId, scope, primKey, primKeyId, roleId);
            }
        }

        deleteResourceAction(resourceActionId);
    }
}

From source file:com.liferay.asset.display.template.service.impl.AssetDisplayTemplateLocalServiceImpl.java

License:Open Source License

@Override
public AssetDisplayTemplate deleteAssetDisplayTemplate(AssetDisplayTemplate assetDisplayTemplate)
        throws PortalException {

    // Asset display template

    assetDisplayTemplatePersistence.remove(assetDisplayTemplate);

    // Dynamic data mapping template

    _ddmTemplateLocalService.deleteDDMTemplate(assetDisplayTemplate.getDDMTemplateId());

    // Resources/*from w w w . j  a  v a2  s .  c om*/

    resourceLocalService.deleteResource(assetDisplayTemplate.getCompanyId(),
            AssetDisplayTemplate.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,
            assetDisplayTemplate.getAssetDisplayTemplateId());

    return assetDisplayTemplate;
}

From source file:com.liferay.blogs.service.impl.BlogsEntryLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override//from w  w w.ja va  2  s  . c om
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public BlogsEntry deleteEntry(BlogsEntry entry) throws PortalException {

    // Entry

    blogsEntryPersistence.remove(entry);

    // Resources

    resourceLocalService.deleteResource(entry.getCompanyId(), BlogsEntry.class.getName(),
            ResourceConstants.SCOPE_INDIVIDUAL, entry.getEntryId());

    // Image

    imageLocalService.deleteImage(entry.getSmallImageId());

    // Subscriptions

    subscriptionLocalService.deleteSubscriptions(entry.getCompanyId(), BlogsEntry.class.getName(),
            entry.getEntryId());

    // Statistics

    blogsStatsUserLocalService.updateStatsUser(entry.getGroupId(), entry.getUserId(), entry.getDisplayDate());

    // Asset

    assetEntryLocalService.deleteEntry(BlogsEntry.class.getName(), entry.getEntryId());

    // Attachments

    long coverImageFileEntryId = entry.getCoverImageFileEntryId();

    if (coverImageFileEntryId != 0) {
        PortletFileRepositoryUtil.deletePortletFileEntry(coverImageFileEntryId);
    }

    long smallImageFileEntryId = entry.getSmallImageFileEntryId();

    if (smallImageFileEntryId != 0) {
        PortletFileRepositoryUtil.deletePortletFileEntry(smallImageFileEntryId);
    }

    // Comment

    deleteDiscussion(entry);

    // Expando

    expandoRowLocalService.deleteRows(entry.getEntryId());

    // Ratings

    ratingsStatsLocalService.deleteStats(BlogsEntry.class.getName(), entry.getEntryId());

    // Trash

    trashEntryLocalService.deleteEntry(BlogsEntry.class.getName(), entry.getEntryId());

    // Workflow

    workflowInstanceLinkLocalService.deleteWorkflowInstanceLinks(entry.getCompanyId(), entry.getGroupId(),
            BlogsEntry.class.getName(), entry.getEntryId());

    return entry;
}

From source file:com.liferay.book.service.impl.BookLocalServiceImpl.java

License:Open Source License

public Book deleteBook(long bookId) throws SystemException, PortalException {
    Book book = bookPersistence.fetchByPrimaryKey(bookId);

    resourceLocalService.deleteResource(book, ResourceConstants.SCOPE_INDIVIDUAL);

    return bookPersistence.remove(bookId);
}

From source file:com.liferay.bookmarks.service.impl.BookmarksEntryLocalServiceImpl.java

License:Open Source License

@Indexable(type = IndexableType.DELETE)
@Override//from w  ww .j  a  v a2  s  .c  om
@SystemEvent(type = SystemEventConstants.TYPE_DELETE)
public BookmarksEntry deleteEntry(BookmarksEntry entry) throws PortalException {

    // Entry

    bookmarksEntryPersistence.remove(entry);

    // Resources

    resourceLocalService.deleteResource(entry, ResourceConstants.SCOPE_INDIVIDUAL);

    // Asset

    assetEntryLocalService.deleteEntry(BookmarksEntry.class.getName(), entry.getEntryId());

    // Expando

    expandoRowLocalService.deleteRows(entry.getEntryId());

    // Ratings

    ratingsStatsLocalService.deleteStats(BookmarksEntry.class.getName(), entry.getEntryId());

    // Subscriptions

    subscriptionLocalService.deleteSubscriptions(entry.getCompanyId(), BookmarksEntry.class.getName(),
            entry.getEntryId());

    // Trash

    if (entry.isInTrashExplicitly()) {
        trashEntryLocalService.deleteEntry(BookmarksEntry.class.getName(), entry.getEntryId());
    } else {
        trashVersionLocalService.deleteTrashVersion(BookmarksEntry.class.getName(), entry.getEntryId());
    }

    return entry;
}