/**
   * Updates the link in the database or adds it if it does not yet exist. Also notifies the
   * appropriate model listeners.
   *
   * @param link the link
   * @param merge whether to merge the link with the current session. See {@link
   *     com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session,
   *     com.liferay.portal.model.BaseModel, boolean)} for an explanation.
   * @return the link that was updated
   * @throws SystemException if a system exception occurred
   */
  @Indexable(type = IndexableType.REINDEX)
  public Link updateLink(Link link, boolean merge) throws SystemException {
    link.setNew(false);

    return linkPersistence.update(link, merge);
  }
 public Link addLink(Link link) throws SystemException {
   _log.debug("addLink");
   long linkId = CounterLocalServiceUtil.increment(Link.class.getName());
   Link model = linkPersistence.create(linkId);
   model.setUserId(link.getUserId());
   model.setCompanyId(link.getCompanyId());
   model.setCreateDate(new Date());
   model.setModifiedDate(new Date());
   model.setApplicationId(link.getApplicationId());
   model.setDisplayName(link.getDisplayName());
   model.setType(link.getType());
   model.setUrl(link.getUrl());
   return linkPersistence.update(model, true);
 }
  /**
   * Adds the link to the database. Also notifies the appropriate model listeners.
   *
   * @param link the link
   * @return the link that was added
   * @throws SystemException if a system exception occurred
   */
  @Indexable(type = IndexableType.REINDEX)
  public Link addLink(Link link) throws SystemException {
    link.setNew(true);

    return linkPersistence.update(link, false);
  }
 public Link updateLink(Link link) throws SystemException {
   Link model = linkPersistence.fetchByPrimaryKey(link.getLinkId());
   model.setUserId(link.getUserId());
   model.setCompanyId(link.getCompanyId());
   model.setApplicationId(link.getApplicationId());
   model.setDisplayName(link.getDisplayName());
   model.setType(link.getType());
   model.setUrl(link.getUrl());
   model.setModifiedDate(new Date());
   return linkPersistence.update(model, true);
 }