コード例 #1
0
  public void deleteArtists(long groupId) throws PortalException {
    List<Artist> artists = getArtists(groupId);

    for (Artist artist : artists) {
      artistLocalService.deleteArtist(artist.getArtistId());
    }
  }
コード例 #2
0
  @Override
  public void addEntryResources(Artist artist, String[] groupPermissions, String[] guestPermissions)
      throws PortalException {

    resourceLocalService.addModelResources(
        artist.getCompanyId(),
        artist.getGroupId(),
        artist.getUserId(),
        Artist.class.getName(),
        artist.getArtistId(),
        groupPermissions,
        guestPermissions);
  }
コード例 #3
0
  @Override
  public void addEntryResources(
      Artist artist, boolean addGroupPermissions, boolean addGuestPermissions)
      throws PortalException {

    resourceLocalService.addResources(
        artist.getCompanyId(),
        artist.getGroupId(),
        artist.getUserId(),
        Artist.class.getName(),
        artist.getArtistId(),
        false,
        addGroupPermissions,
        addGuestPermissions);
  }
コード例 #4
0
  public void updateAsset(
      long userId,
      Artist artist,
      long[] assetCategoryIds,
      String[] assetTagNames,
      long[] assetLinkEntryIds)
      throws PortalException {

    AssetEntry assetEntry =
        assetEntryLocalService.updateEntry(
            userId,
            artist.getGroupId(),
            artist.getCreateDate(),
            artist.getModifiedDate(),
            Artist.class.getName(),
            artist.getArtistId(),
            artist.getUuid(),
            0,
            assetCategoryIds,
            assetTagNames,
            true,
            null,
            null,
            null,
            ContentTypes.TEXT_HTML,
            artist.getName(),
            null,
            null,
            null,
            null,
            0,
            0,
            null,
            false);

    assetLinkLocalService.updateLinks(
        userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED);
  }
コード例 #5
0
  @Indexable(type = IndexableType.REINDEX)
  public Artist addArtist(
      long userId, String name, String bio, InputStream inputStream, ServiceContext serviceContext)
      throws PortalException {

    long groupId = serviceContext.getScopeGroupId();

    User user = userPersistence.findByPrimaryKey(userId);

    Date now = new Date();

    validate(name);

    long artistId = counterLocalService.increment();

    Artist artist = artistPersistence.create(artistId);

    artist.setUuid(serviceContext.getUuid());
    artist.setGroupId(groupId);
    artist.setCompanyId(user.getCompanyId());
    artist.setUserId(user.getUserId());
    artist.setUserName(user.getFullName());
    artist.setCreateDate(serviceContext.getCreateDate(now));
    artist.setModifiedDate(serviceContext.getModifiedDate(now));
    artist.setName(name);
    artist.setBio(bio);
    artist.setExpandoBridgeAttributes(serviceContext);

    artistPersistence.update(artist);

    if (inputStream != null) {
      PortletFileRepositoryUtil.addPortletFileEntry(
          groupId,
          userId,
          Artist.class.getName(),
          artist.getArtistId(),
          Constants.JUKEBOX_PORTLET_REPOSITORY,
          DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
          inputStream,
          String.valueOf(artist.getArtistId()),
          StringPool.BLANK,
          true);
    }

    // Resources

    if (serviceContext.isAddGroupPermissions() || serviceContext.isAddGuestPermissions()) {

      addEntryResources(
          artist, serviceContext.isAddGroupPermissions(), serviceContext.isAddGuestPermissions());
    } else {
      addEntryResources(
          artist, serviceContext.getGroupPermissions(), serviceContext.getGuestPermissions());
    }

    // Message boards

    mbMessageLocalService.addDiscussionMessage(
        userId,
        artist.getUserName(),
        groupId,
        Artist.class.getName(),
        artistId,
        WorkflowConstants.ACTION_PUBLISH);

    // Asset

    updateAsset(
        userId,
        artist,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames(),
        serviceContext.getAssetLinkEntryIds());

    return artist;
  }
コード例 #6
0
  @Indexable(type = IndexableType.REINDEX)
  public Artist updateArtist(
      long userId,
      long artistId,
      String name,
      String bio,
      InputStream inputStream,
      ServiceContext serviceContext)
      throws PortalException {

    // Event

    User user = userPersistence.findByPrimaryKey(userId);

    validate(name);

    Artist artist = artistPersistence.findByPrimaryKey(artistId);

    artist.setModifiedDate(serviceContext.getModifiedDate(null));
    artist.setName(name);
    artist.setBio(bio);
    artist.setExpandoBridgeAttributes(serviceContext);

    artistPersistence.update(artist);

    if (inputStream != null) {
      Repository repository =
          PortletFileRepositoryUtil.fetchPortletRepository(
              serviceContext.getScopeGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);

      if (repository != null) {
        try {
          PortletFileRepositoryUtil.deletePortletFileEntry(
              repository.getRepositoryId(),
              DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
              String.valueOf(artist.getArtistId()));
        } catch (Exception e) {
          if (_log.isDebugEnabled()) {
            _log.debug("Cannot delete artist image");
          }
        }
      }

      PortletFileRepositoryUtil.addPortletFileEntry(
          serviceContext.getScopeGroupId(),
          userId,
          Artist.class.getName(),
          artist.getArtistId(),
          Constants.JUKEBOX_PORTLET_REPOSITORY,
          DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
          inputStream,
          String.valueOf(artist.getArtistId()),
          StringPool.BLANK,
          true);
    }

    // Asset

    updateAsset(
        userId,
        artist,
        serviceContext.getAssetCategoryIds(),
        serviceContext.getAssetTagNames(),
        serviceContext.getAssetLinkEntryIds());

    return artist;
  }