示例#1
0
  @Override
  public void deleteTag(AssetTag tag) throws PortalException, SystemException {

    // Entries

    List<AssetEntry> entries = assetTagPersistence.getAssetEntries(tag.getTagId());

    // Tag

    assetTagPersistence.remove(tag);

    // Resources

    resourceLocalService.deleteResource(
        tag.getCompanyId(),
        AssetTag.class.getName(),
        ResourceConstants.SCOPE_INDIVIDUAL,
        tag.getTagId());

    // Properties

    assetTagPropertyLocalService.deleteTagProperties(tag.getTagId());

    // Indexer

    assetEntryLocalService.reindex(entries);
  }
  public static JSONObject toJSONObject(AssetTag model) {
    JSONObject jsonObject = JSONFactoryUtil.createJSONObject();

    jsonObject.put("tagId", model.getTagId());
    jsonObject.put("groupId", model.getGroupId());
    jsonObject.put("companyId", model.getCompanyId());
    jsonObject.put("userId", model.getUserId());
    jsonObject.put("userName", model.getUserName());

    Date createDate = model.getCreateDate();

    String createDateJSON = StringPool.BLANK;

    if (createDate != null) {
      createDateJSON = String.valueOf(createDate.getTime());
    }

    jsonObject.put("createDate", createDateJSON);

    Date modifiedDate = model.getModifiedDate();

    String modifiedDateJSON = StringPool.BLANK;

    if (modifiedDate != null) {
      modifiedDateJSON = String.valueOf(modifiedDate.getTime());
    }

    jsonObject.put("modifiedDate", modifiedDateJSON);
    jsonObject.put("name", model.getName());
    jsonObject.put("assetCount", model.getAssetCount());

    return jsonObject;
  }
示例#3
0
  @Override
  public void addTagResources(AssetTag tag, String[] groupPermissions, String[] guestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addModelResources(
        tag.getCompanyId(),
        tag.getGroupId(),
        tag.getUserId(),
        AssetTag.class.getName(),
        tag.getTagId(),
        groupPermissions,
        guestPermissions);
  }
示例#4
0
  @Override
  public void addTagResources(
      AssetTag tag, boolean addGroupPermissions, boolean addGuestPermissions)
      throws PortalException, SystemException {

    resourceLocalService.addResources(
        tag.getCompanyId(),
        tag.getGroupId(),
        tag.getUserId(),
        AssetTag.class.getName(),
        tag.getTagId(),
        false,
        addGroupPermissions,
        addGuestPermissions);
  }