-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "Added the code to store deleted items in panoply dw_d…
…eleted_items table"" (#7100) * Revert "Revert "Added the code to store deleted items in panoply dw_deleted_items table"" * Fixed the failures in test suite --------- Co-authored-by: Camelia Dumitru <[email protected]>
- Loading branch information
1 parent
2be3701
commit 6a07535
Showing
12 changed files
with
282 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
orcid-utils/src/main/java/org/orcid/utils/panoply/PanoplyDeletedItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.orcid.utils.panoply; | ||
|
||
public class PanoplyDeletedItem { | ||
private Long id; | ||
private String dwTable; | ||
private Long itemId; | ||
private String clientSourceId; | ||
private String orcid; | ||
|
||
public final String DW_ORG_AFFILIATION_RELATION = "dw_org_affiliation_relation"; | ||
public final String DW_WORK = "dw_work"; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
public void setId(Long id) { | ||
this.id = id; | ||
} | ||
public String getDwTable() { | ||
return dwTable; | ||
} | ||
public void setDwTable(String dwTable) { | ||
this.dwTable = dwTable; | ||
} | ||
public Long getItemId() { | ||
return itemId; | ||
} | ||
public void setItemId(Long itemId) { | ||
this.itemId = itemId; | ||
} | ||
public String getClientSourceId() { | ||
return clientSourceId; | ||
} | ||
public void setClientSourceId(String clientSourceId) { | ||
this.clientSourceId = clientSourceId; | ||
} | ||
public String getOrcid() { | ||
return orcid; | ||
} | ||
public void setOrcid(String orcid) { | ||
this.orcid = orcid; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "PanoplyDeletedItem{" + | ||
"id=" + id + | ||
", dwTable='" + dwTable + '\'' + | ||
", itemId='" + itemId + '\'' + | ||
", clientSourceId='" + clientSourceId + '\'' + | ||
", orcid='" + orcid + '\'' + | ||
'}'; | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
orcid-utils/src/main/java/org/orcid/utils/panoply/PanoplyRedshiftClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.orcid.utils.panoply; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
import org.springframework.stereotype.Repository; | ||
import org.springframework.stereotype.Service; | ||
|
||
|
||
import java.util.Date; | ||
|
||
import javax.annotation.Resource; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.orcid.utils.alerting.SlackManager; | ||
|
||
@Repository | ||
public class PanoplyRedshiftClient { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(PanoplyRedshiftClient.class); | ||
|
||
@Autowired | ||
@Qualifier("panoplyJdbcTemplate") | ||
private JdbcTemplate panoplyJdbcTemplate; | ||
|
||
|
||
public int addPanoplyDeletedItem(PanoplyDeletedItem item) { | ||
LOG.debug("Adding deleted item to panoply DB: " + item.toString()); | ||
String sql = "INSERT INTO dw_deleted_items (item_id, orcid, client_source_id, date_deleted, dw_table) VALUES (?, ?, ?, ?, ?)"; | ||
return panoplyJdbcTemplate.update(sql, item.getItemId(), item.getOrcid(), item.getClientSourceId(), new java.sql.Timestamp(new Date().getTime()), item.getDwTable()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters