Repository: ORCID/ORCID-Source
Pull request #7263: Add interstitial flag logic
Author: login: aromanovv
Created: 2025-03-26T13:59:51Z | Merged: 2025-03-27T01:02:09Z



Diff:
diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileInterstitialFlagManager.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileInterstitialFlagManager.java
new file mode 100644
index 00000000000..b49e0211d16
--- /dev/null
+++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/ProfileInterstitialFlagManager.java
@@ -0,0 +1,13 @@
+package org.orcid.core.manager.v3;
+
+import org.orcid.core.manager.v3.read_only.ProfileInterstitialFlagManagerReadOnly;
+import org.orcid.persistence.jpa.entities.ProfileInterstitialFlagEntity;
+
+/**
+ * 
+ * @author Andrej Romanov
+ * 
+ */
+public interface ProfileInterstitialFlagManager extends ProfileInterstitialFlagManagerReadOnly {
+    ProfileInterstitialFlagEntity addInterstitialFlag(String orcid, String interstitialName);
+}
diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileInterstitialFlagManagerImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileInterstitialFlagManagerImpl.java
new file mode 100644
index 00000000000..4bd6c1d1f05
--- /dev/null
+++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/impl/ProfileInterstitialFlagManagerImpl.java
@@ -0,0 +1,30 @@
+package org.orcid.core.manager.v3.impl;
+
+import org.orcid.core.manager.v3.ProfileInterstitialFlagManager;
+import org.orcid.core.manager.v3.read_only.impl.ProfileInterstitialFlagManagerReadOnlyImpl;
+import org.orcid.persistence.dao.ProfileInterstitialFlagDao;
+import org.orcid.persistence.jpa.entities.ProfileInterstitialFlagEntity;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+/**
+ * 
+ * @author Andrej Romanov
+ * 
+ */
+public class ProfileInterstitialFlagManagerImpl extends ProfileInterstitialFlagManagerReadOnlyImpl implements ProfileInterstitialFlagManager {
+    @Resource
+    protected ProfileInterstitialFlagDao profileInterstitialFlagDao;
+
+    @Transactional
+    public ProfileInterstitialFlagEntity addInterstitialFlag(String orcid, String interstitialName) {
+        if (orcid == null || orcid.isBlank()) {
+            throw new IllegalArgumentException("ORCID must not be empty");
+        }
+        if (interstitialName == null || interstitialName.isBlank()) {
+            throw new IllegalArgumentException("Interstitial flag must not be empty");
+        }
+        return profileInterstitialFlagDao.addInterstitialFlag(orcid, interstitialName);
+    }
+}
diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileInterstitialFlagManagerReadOnly.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileInterstitialFlagManagerReadOnly.java
new file mode 100644
index 00000000000..3d66a28f003
--- /dev/null
+++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/ProfileInterstitialFlagManagerReadOnly.java
@@ -0,0 +1,10 @@
+package org.orcid.core.manager.v3.read_only;
+
+/**
+ * 
+ * @author Andrej Romanov
+ * 
+ */
+public interface ProfileInterstitialFlagManagerReadOnly {
+    boolean hasInterstitialFlag(String orcid, String interstitialName);
+}
diff --git a/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileInterstitialFlagManagerReadOnlyImpl.java b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileInterstitialFlagManagerReadOnlyImpl.java
new file mode 100644
index 00000000000..dcdd5dfac7c
--- /dev/null
+++ b/orcid-core/src/main/java/org/orcid/core/manager/v3/read_only/impl/ProfileInterstitialFlagManagerReadOnlyImpl.java
@@ -0,0 +1,27 @@
+package org.orcid.core.manager.v3.read_only.impl;
+
+
+import org.orcid.core.manager.read_only.impl.ManagerReadOnlyBaseImpl;
+import org.orcid.core.manager.v3.read_only.ProfileInterstitialFlagManagerReadOnly;
+import org.orcid.persistence.dao.ProfileInterstitialFlagDao;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 
+ * @author Andrej Romanov
+ * 
+ */
+public class ProfileInterstitialFlagManagerReadOnlyImpl extends ManagerReadOnlyBaseImpl implements ProfileInterstitialFlagManagerReadOnly {
+    @Resource
+    protected ProfileInterstitialFlagDao profileInterstitialFlagDaoReadOnly;
+
+    public void setProfileInterstitialFlagDao(ProfileInterstitialFlagDao profileInterstitialFlagDaoReadOnly) {
+        this.profileInterstitialFlagDaoReadOnly = profileInterstitialFlagDaoReadOnly;
+    }
+
+    public boolean hasInterstitialFlag(String orcid, String interstitialName) {
+        return profileInterstitialFlagDaoReadOnly.hasInterstitialFlag(orcid, interstitialName);
+    };
+}
diff --git a/orcid-core/src/main/resources/orcid-core-context.xml b/orcid-core/src/main/resources/orcid-core-context.xml
index f6ee3c4e0db..04fb18b1acd 100644
--- a/orcid-core/src/main/resources/orcid-core-context.xml
+++ b/orcid-core/src/main/resources/orcid-core-context.xml
@@ -504,7 +504,7 @@
     </bean>
 
 	<bean id="profileEmailDomainManager" class="org.orcid.core.manager.v3.impl.ProfileEmailDomainManagerImpl">
-		<property name="profileEmailDomainDao" ref="profileEmailDomainDaoReadOnly" />
+		<property name="profileEmailDomainDao" ref="profileEmailDomainDao" />
 		<property name="profileLastModifiedAspect" ref="profileLastModifiedAspectReadOnly" />
 	</bean>
 
@@ -513,6 +513,16 @@
 		<property name="profileLastModifiedAspect" ref="profileLastModifiedAspectReadOnly" />
 	</bean>
 
+	<bean id="profileInterstitialFlagManager" class="org.orcid.core.manager.v3.impl.ProfileInterstitialFlagManagerImpl">
+		<property name="profileInterstitialFlagDao" ref="profileInterstitialFlagDao" />
+		<property name="profileLastModifiedAspect" ref="profileLastModifiedAspectReadOnly" />
+	</bean>
+
+	<bean id="profileInterstitialFlagManagerReadOnly" class="org.orcid.core.manager.v3.read_only.impl.ProfileInterstitialFlagManagerReadOnlyImpl">
+		<property name="profileInterstitialFlagDao" ref="profileInterstitialFlagDaoReadOnly" />
+		<property name="profileLastModifiedAspect" ref="profileLastModifiedAspectReadOnly" />
+	</bean>
+
 	<bean id="externalIdentifierManagerV3" class="org.orcid.core.manager.v3.impl.ExternalIdentifierManagerImpl">
         <property name="externalIdentifierDao" ref="externalIdentifierDao" />
         <property name="profileLastModifiedAspect" ref="profileLastModifiedAspect" />
diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileInterstitialFlagDao.java b/orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileInterstitialFlagDao.java
new file mode 100644
index 00000000000..b7c8380c826
--- /dev/null
+++ b/orcid-persistence/src/main/java/org/orcid/persistence/dao/ProfileInterstitialFlagDao.java
@@ -0,0 +1,12 @@
+package org.orcid.persistence.dao;
+
+import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
+import org.orcid.persistence.jpa.entities.ProfileInterstitialFlagEntity;
+
+import java.util.List;
+
+public interface ProfileInterstitialFlagDao extends GenericDao<ProfileInterstitialFlagEntity, Long> {
+    ProfileInterstitialFlagEntity addInterstitialFlag(String orcid, String interstitialName);
+
+    boolean hasInterstitialFlag(String orcid, String interstitialName);
+}
\ No newline at end of file
diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileInterstitialFlagDaoImpl.java b/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileInterstitialFlagDaoImpl.java
new file mode 100644
index 00000000000..dd28d681bbe
--- /dev/null
+++ b/orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileInterstitialFlagDaoImpl.java
@@ -0,0 +1,35 @@
+package org.orcid.persistence.dao.impl;
+
+import org.orcid.persistence.aop.UpdateProfileLastModifiedAndIndexingStatus;
+import org.orcid.persistence.dao.ProfileInterstitialFlagDao;
+import org.orcid.persistence.jpa.entities.ProfileInterstitialFlagEntity;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.Query;
+import java.math.BigInteger;
+
+public class ProfileInterstitialFlagDaoImpl extends GenericDaoImpl<ProfileInterstitialFlagEntity, Long> implements ProfileInterstitialFlagDao {
+
+    public ProfileInterstitialFlagDaoImpl() {
+        super(ProfileInterstitialFlagEntity.class);
+    }
+        
+    @Override
+    @Transactional
+    public ProfileInterstitialFlagEntity addInterstitialFlag(String orcid, String interstitialName) {
+        ProfileInterstitialFlagEntity e = new ProfileInterstitialFlagEntity();
+        e.setInterstitialName(interstitialName);
+        e.setOrcid(orcid);
+        entityManager.persist(e);
+        return e;
+    }
+
+    @Override
+    public boolean hasInterstitialFlag(String orcid, String interstitialName) {
+        Query query = entityManager.createNativeQuery("select count(*) from profile_interstitial_flag where orcid = :orcid and interstitial_name = :interstitialName");
+        query.setParameter("orcid", orcid);
+        query.setParameter("interstitialName", interstitialName);
+        long result = ((BigInteger)query.getSingleResult()).longValue();
+        return result > 0;
+    }
+}
diff --git a/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileInterstitialFlagEntity.java b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileInterstitialFlagEntity.java
new file mode 100644
index 00000000000..5c0ef0cc858
--- /dev/null
+++ b/orcid-persistence/src/main/java/org/orcid/persistence/jpa/entities/ProfileInterstitialFlagEntity.java
@@ -0,0 +1,61 @@
+package org.orcid.persistence.jpa.entities;
+
+import javax.persistence.*;
+import java.util.Objects;
+
+/**
+ *
+ * @author Andrej Romanov
+ *
+ */
+@Entity
+@Table(name = "profile_interstitial_flag")
+public class ProfileInterstitialFlagEntity extends BaseEntity<Long>  {
+    private static final long serialVersionUID = 1L;
+    private Long id;
+    private String orcid;
+    private String interstitialName;
+
+    @Id
+    @Column(name = "id")
+    @GeneratedValue(strategy = GenerationType.AUTO, generator = "profile_interstitial_flag_seq")
+    @SequenceGenerator(name = "profile_interstitial_flag_seq", sequenceName = "profile_interstitial_flag_seq", allocationSize = 1)
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    @Column(name = "orcid")
+    public String getOrcid() {
+        return orcid;
+    }
+
+    public void setOrcid(String orcid) {
+        this.orcid = orcid;
+    }
+
+    @Column(name = "interstitial_name")
+    public String getInterstitialName() {
+        return interstitialName;
+    }
+
+    public void setInterstitialName(String interstitialName) {
+        this.interstitialName = interstitialName;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (getClass() != obj.getClass())
+            return false;
+        ProfileInterstitialFlagEntity other = (ProfileInterstitialFlagEntity) obj;
+        return Objects.equals(interstitialName, other.interstitialName) && Objects.equals(orcid, other.orcid);
+    }
+
+}
diff --git a/orcid-persistence/src/main/resources/META-INF/persistence.xml b/orcid-persistence/src/main/resources/META-INF/persistence.xml
index dda9237067f..1a1cc1b847e 100644
--- a/orcid-persistence/src/main/resources/META-INF/persistence.xml
+++ b/orcid-persistence/src/main/resources/META-INF/persistence.xml
@@ -64,6 +64,7 @@
         <class>org.orcid.persistence.jpa.entities.EventStatsEntity</class>
         <class>org.orcid.persistence.jpa.entities.EmailDomainEntity</class>
         <class>org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity</class>
+        <class>org.orcid.persistence.jpa.entities.ProfileInterstitialFlagEntity</class>
 
         <!-- OAuth entities -->
         <class>org.orcid.persistence.jpa.entities.ClientDetailsEntity</class>
diff --git a/orcid-persistence/src/main/resources/db-master.xml b/orcid-persistence/src/main/resources/db-master.xml
index 50c255626c1..21a25ed1e4f 100644
--- a/orcid-persistence/src/main/resources/db-master.xml
+++ b/orcid-persistence/src/main/resources/db-master.xml
@@ -410,4 +410,5 @@
   <include file="/db/updates/add_generated_by_script_column_to_profile_email_domain.xml" />
   <include file="/db/updates/oauth2_authoriziation_code_detail_improvements.xml" />
   <include file="/db/updates/dw_profile_info_for_spam_check.xml" />
+  <include file="/db/updates/create_profile_interstitial_flag.xml" />
 </databaseChangeLog>
\ No newline at end of file
diff --git a/orcid-persistence/src/main/resources/db/updates/create_profile_interstitial_flag.xml b/orcid-persistence/src/main/resources/db/updates/create_profile_interstitial_flag.xml
new file mode 100644
index 00000000000..b3606c3efce
--- /dev/null
+++ b/orcid-persistence/src/main/resources/db/updates/create_profile_interstitial_flag.xml
@@ -0,0 +1,63 @@
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
+
+	<changeSet id="CREATE-PROFILE-INTERSTITIAL-FLAG-TABLE" author="Andrej Romanov">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<tableExists tableName="profile_interstitial_flag" />
+			</not>
+		</preConditions>	
+		<createTable tableName="profile_interstitial_flag">
+			<column name="id" type="bigint">
+				<constraints nullable="false" primaryKey="true"
+					primaryKeyName="profile_interstitial_flag_pkey" />
+			</column>
+			<column name="orcid" type="VARCHAR(255)">
+				<constraints nullable="false" />
+			</column>			
+			<column name="interstitial_name" type="VARCHAR(255)" />
+			<column name="date_created" type="TIMESTAMP WITH TIME ZONE" />			
+			<column name="last_modified" type="TIMESTAMP WITH TIME ZONE" />			
+		</createTable>
+		<addForeignKeyConstraint constraintName="profile_interstitial_flag_fk" baseTableName="profile_interstitial_flag" baseColumnNames="orcid" referencedTableName="profile" referencedColumnNames="orcid" />
+	</changeSet>
+	
+	<changeSet id="CREATE-PROFILE-INTERSTITIAL-FLAG-SEQUENCES" author="Andrej Romanov" dbms="postgresql">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<sequenceExists sequenceName="profile_interstitial_flag_seq"/>
+			</not>
+		</preConditions>
+        <createSequence sequenceName="profile_interstitial_flag_seq" startValue="1000" />
+    </changeSet>
+	
+	<changeSet id="CREATE-PROFILE-INTERSTITIAL-FLAG-AUTOCOLS" author="Andrej Romanov" dbms="hsqldb">
+        <addAutoIncrement tableName="profile_interstitial_flag" columnName="id" columnDataType="bigint"/>
+    </changeSet>
+	
+	<changeSet id="PROFILE-INTERSTITIAL-FLAG-ORCID-INDEX" author="Andrej Romanov">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<indexExists indexName="profile_interstitial_flag_orcid_index" tableName="profile_interstitial_flag" />
+			</not>
+		</preConditions>
+		<sql>create index profile_interstitial_flag_orcid_index on profile_interstitial_flag(orcid);</sql>
+	</changeSet>
+	
+	<changeSet id="GRANT-READ-PERMISSIONS-TO-ORCIDRO-ON-PROFILE-INTERSTITIAL-FLAG" author="Andrej Romanov" dbms="postgresql">
+		<preConditions>
+			<sqlCheck expectedResult="1">SELECT 1 FROM pg_roles WHERE rolname='orcidro'</sqlCheck>
+		</preConditions>
+		<sql>GRANT SELECT ON profile_interstitial_flag to orcidro;</sql>
+	</changeSet>
+
+	<changeSet id="ADD-ORCID-INDEX-ON-PROFILE-INTERSTITIAL-FLAG" author="Andrej Romanov">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<indexExists indexName="profile_interstitial_flag_orcid_index" tableName="profile_interstitial_flag" />
+			</not>
+		</preConditions>
+		<sql>create index profile_interstitial_flag_orcid_index on profile_interstitial_flag(orcid);</sql>
+	</changeSet>
+</databaseChangeLog>		
\ No newline at end of file
diff --git a/orcid-persistence/src/main/resources/orcid-persistence-context.xml b/orcid-persistence/src/main/resources/orcid-persistence-context.xml
index a96f17593f1..0786f2568e1 100644
--- a/orcid-persistence/src/main/resources/orcid-persistence-context.xml
+++ b/orcid-persistence/src/main/resources/orcid-persistence-context.xml
@@ -89,6 +89,12 @@
         <property name="entityManager" ref="entityManagerReadOnly" />
     </bean>
 
+    <bean id="profileInterstitialFlagDao" class="org.orcid.persistence.dao.impl.ProfileInterstitialFlagDaoImpl" />
+
+    <bean id="profileInterstitialFlagDaoReadOnly" class="org.orcid.persistence.dao.impl.ProfileInterstitialFlagDaoImpl">
+        <property name="entityManager" ref="entityManagerReadOnly" />
+    </bean>
+
     <bean id="researcherUrlDao" class="org.orcid.persistence.dao.impl.ResearcherUrlDaoImpl" />
     
     <bean id="researcherUrlDaoReadOnly" class="org.orcid.persistence.dao.impl.ResearcherUrlDaoImpl">
diff --git a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java
index f74d7f1cff4..e22d79f2e7b 100644
--- a/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java
+++ b/orcid-web/src/main/java/org/orcid/frontend/web/controllers/ManageProfileController.java
@@ -19,7 +19,6 @@
 import org.codehaus.jettison.json.JSONException;
 import org.codehaus.jettison.json.JSONObject;
 import org.jasypt.exceptions.EncryptionOperationNotPossibleException;
-import org.orcid.core.adapter.impl.MapperFacadeFactory;
 import org.orcid.core.constants.EmailConstants;
 import org.orcid.core.manager.AdminManager;
 import org.orcid.core.manager.EncryptionManager;
@@ -28,11 +27,7 @@
 import org.orcid.core.manager.TwoFactorAuthenticationManager;
 import org.orcid.core.manager.UserConnectionManager;
 import org.orcid.core.manager.v3.*;
-import org.orcid.core.manager.v3.read_only.ProfileEmailDomainManagerReadOnly;
-import org.orcid.core.manager.v3.read_only.EmailManagerReadOnly;
-import org.orcid.core.manager.v3.read_only.GivenPermissionToManagerReadOnly;
-import org.orcid.core.manager.v3.read_only.ProfileEntityManagerReadOnly;
-import org.orcid.core.manager.v3.read_only.RecordNameManagerReadOnly;
+import org.orcid.core.manager.v3.read_only.*;
 import org.orcid.core.togglz.Features;
 import org.orcid.core.utils.JsonUtils;
 import org.orcid.core.utils.v3.OrcidIdentifierUtils;
@@ -43,10 +38,7 @@
 import org.orcid.jaxb.model.v3.release.record.Biography;
 import org.orcid.jaxb.model.v3.release.record.Emails;
 import org.orcid.jaxb.model.v3.release.record.Name;
-import org.orcid.persistence.jpa.entities.EmailEntity;
-import org.orcid.persistence.jpa.entities.ProfileEmailDomainEntity;
-import org.orcid.persistence.jpa.entities.ProfileEntity;
-import org.orcid.persistence.jpa.entities.UserconnectionEntity;
+import org.orcid.persistence.jpa.entities.*;
 import org.orcid.pojo.AddEmail;
 import org.orcid.pojo.ApplicationSummary;
 import org.orcid.pojo.ChangePassword;
@@ -58,8 +50,6 @@
 import org.orcid.pojo.ajaxForm.*;
 import org.orcid.utils.OrcidStringUtils;
 import org.orcid.utils.alerting.SlackManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.stereotype.Controller;
 import org.springframework.validation.MapBindingResult;
 import org.springframework.validation.ObjectError;
@@ -70,7 +60,6 @@
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 /**
  * @author Declan Newman (declan) Date: 22/02/2012
@@ -139,6 +128,12 @@ public class ManageProfileController extends BaseWorkspaceController {
     @Resource(name = "notificationManagerV3")
     private NotificationManager notificationManager;
 
+    @Resource(name = "profileInterstitialFlagManagerReadOnly")
+    private ProfileInterstitialFlagManagerReadOnly profileInterstitialFlagManagerReadOnly;
+
+    @Resource(name = "profileInterstitialFlagManager")
+    private ProfileInterstitialFlagManager profileInterstitialFlagManager;
+
     @RequestMapping
     public ModelAndView manageProfile() {
         return new ModelAndView("manage");
@@ -1061,4 +1056,16 @@ private void verifyPrimaryEmailIfNeeded(String orcid) {
     public @ResponseBody EmailFrequencyOptions getEmailFrequencyOptions() {
         return emailManagerReadOnly.getEmailFrequencyOptions();
     }
+
+    @RequestMapping(value = "/hasInterstitialFlag/{interstitialName}")
+    public @ResponseBody Boolean hasInterstitialFlag(@PathVariable("interstitialName") String interstitialName) {
+        String orcid = getCurrentUserOrcid();
+        return profileInterstitialFlagManagerReadOnly.hasInterstitialFlag(orcid, interstitialName);
+    }
+
+    @RequestMapping(value = "/addInterstitialFlag", method = RequestMethod.POST)
+    public @ResponseBody ProfileInterstitialFlagEntity addInterstitialFlag(@RequestBody String interstitialName) {
+        String orcid = getCurrentUserOrcid();
+        return profileInterstitialFlagManager.addInterstitialFlag(orcid, interstitialName);
+    }
 }


Reviews:
user: login: amontenegro
body: @auumgn please also add a few unit tests 
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-03-26T19:44:01Z
user: login: amontenegro
state: APPROVED
author_association: MEMBER
submitted_at: 2025-03-27T01:02:00Z

Review comments:
diff_hunk: @@ -0,0 +1,36 @@
+package org.orcid.persistence.dao.impl;
+
+import org.orcid.persistence.aop.UpdateProfileLastModifiedAndIndexingStatus;
+import org.orcid.persistence.dao.ProfileInterstitialFlagDao;
+import org.orcid.persistence.jpa.entities.ProfileInterstitialFlagEntity;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.persistence.Query;
+import java.math.BigInteger;
+
+public class ProfileInterstitialFlagDaoImpl extends GenericDaoImpl<ProfileInterstitialFlagEntity, Long> implements ProfileInterstitialFlagDao {
+
+    public ProfileInterstitialFlagDaoImpl() {
+        super(ProfileInterstitialFlagEntity.class);
+    }
+        
+    @Override
+    @Transactional
+    @UpdateProfileLastModifiedAndIndexingStatus
path: orcid-persistence/src/main/java/org/orcid/persistence/dao/impl/ProfileInterstitialFlagDaoImpl.java
user: login: amontenegro
body: @auumgn why do you need to update the last modified and index the record?
created_at: 2025-03-26T19:42:26Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,55 @@
+<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
+
+	<changeSet id="CREATE-PROFILE-INTERSTITIAL-FLAG-TABLE" author="Andrej Romanov">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<tableExists tableName="profile_interstitial_flag" />
+			</not>
+		</preConditions>	
+		<createTable tableName="profile_interstitial_flag">
+			<column name="id" type="bigint">
+				<constraints nullable="false" primaryKey="true"
+					primaryKeyName="profile_interstitial_flag_pkey" />
+			</column>
+			<column name="orcid" type="VARCHAR(255)">
+				<constraints nullable="false" />
+			</column>			
+			<column name="interstitial_name" type="VARCHAR(255)" />
+			<column name="date_created" type="TIMESTAMP WITH TIME ZONE" />			
+			<column name="last_modified" type="TIMESTAMP WITH TIME ZONE" />			
+		</createTable>
+		<addForeignKeyConstraint constraintName="profile_interstitial_flag_fk" baseTableName="profile_interstitial_flag" baseColumnNames="orcid" referencedTableName="profile" referencedColumnNames="orcid" />
+	</changeSet>
+	
+	<changeSet id="CREATE-PROFILE-INTERSTITIAL-FLAG-SEQUENCES" author="Andrej Romanov" dbms="postgresql">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<sequenceExists sequenceName="profile_interstitial_flag_seq"/>
+			</not>
+		</preConditions>
+        <createSequence sequenceName="profile_interstitial_flag_seq" startValue="1000" />
+    </changeSet>
+	
+	<changeSet id="CREATE-PROFILE-INTERSTITIAL-FLAG-AUTOCOLS" author="Andrej Romanov" dbms="hsqldb">
+        <addAutoIncrement tableName="profile_interstitial_flag" columnName="id" columnDataType="bigint"/>
+    </changeSet>
+	
+	<changeSet id="PROFILE-INTERSTITIAL-FLAG-ORCID-INDEX" author="Andrej Romanov">
+		<preConditions onFail="MARK_RAN">
+			<not>
+				<indexExists indexName="profile_interstitial_flag_orcid_index" tableName="profile_interstitial_flag" />
+			</not>
+		</preConditions>
+		<sql>create index profile_interstitial_flag_orcid_index on profile_interstitial_flag(orcid);</sql>
+	</changeSet>
+	
+	<changeSet id="GRANT-READ-PERMISSIONS-TO-ORCIDRO-ON-PROFILE-INTERSTITIAL-FLAG" author="Andrej Romanov" dbms="postgresql">
+		<preConditions>
+			<sqlCheck expectedResult="1">SELECT 1 FROM pg_roles WHERE rolname='orcidro'</sqlCheck>
+		</preConditions>
+		<sql>GRANT SELECT ON profile_interstitial_flag to orcidro;</sql>
+	</changeSet>
+	
path: orcid-persistence/src/main/resources/db/updates/create_profile_interstitial_flag.xml
user: login: amontenegro
body: @auumgn add an index on the orcid column, so it will be faster to search by orcid id.
created_at: 2025-03-26T19:43:24Z
author_association: MEMBER

PR comments:
user: login: aromanovv
created_at: 2025-03-26T14:00:41Z
body: ![](https://github.trello.services/images/mini-trello-icon.png) [Create an interstitial flag in the db so we know which interstitials have been shown to which users.](https://trello.com/c/CdNFAdLe/9706-create-an-interstitial-flag-in-the-db-so-we-know-which-interstitials-have-been-shown-to-which-users)
author_association: CONTRIBUTOR
user: login: raminvafaei
created_at: 2025-03-28T11:15:20Z
body: -
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:15:38Z
body: thanks
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:15:48Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:01Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:06Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:10Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:19Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:23Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:25Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:27Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:29Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:31Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:33Z
body: .
author_association: NONE
user: login: raminvafaei
created_at: 2025-03-28T11:16:35Z
body: .
author_association: NONE