/**
   * Creates a new profile entity relationship between the provided work and the given profile.
   *
   * @param orcid The profile id
   * @param workId The work id
   * @param visibility The work visibility
   * @return true if the profile work relationship was created
   */
  @Override
  @Transactional
  public boolean addProfileWork(
      String orcid, long workId, Visibility visibility, String sourceOrcid) {
    Query query =
        entityManager.createNativeQuery(
            "INSERT INTO profile_work(orcid, work_id, date_created, last_modified, added_to_profile_date, visibility, source_id) values(:orcid, :workId, now(), now(), now(), :visibility, :sourceId)");
    query.setParameter("orcid", orcid);
    query.setParameter("workId", workId);
    query.setParameter("visibility", visibility.name());
    query.setParameter("sourceId", sourceOrcid);

    return query.executeUpdate() > 0 ? true : false;
  }
示例#2
0
 @Override
 @Transactional
 public void addEmail(
     String orcid,
     String email,
     Visibility visibility,
     String sourceOrcid,
     boolean isVerified,
     boolean isCurrent) {
   Query query =
       entityManager.createNativeQuery(
           "INSERT INTO email (date_created, last_modified, orcid, email, is_primary, is_verified, is_current, visibility, source_id) VALUES (now(), now(), :orcid, :email, false, :isVerified, :isCurrent, :visibility, :sourceOrcid)");
   query.setParameter("orcid", orcid);
   query.setParameter("email", email);
   query.setParameter("visibility", visibility.name());
   query.setParameter("sourceOrcid", sourceOrcid);
   query.setParameter("isVerified", isVerified);
   query.setParameter("isCurrent", isCurrent);
   query.executeUpdate();
 }