Skip to content

Commit cf08091

Browse files
committed
Merge branch 'release/21.3.0'
2 parents 3278e37 + 5303f55 commit cf08091

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
We follow the CalVer (https://calver.org/) versioning scheme: YY.MINOR.MICRO.
44

5+
21.3.0 (07-19-2021)
6+
===================
7+
8+
Support OSF institution deactivation/reactivation
9+
510
21.2.5 (05-18-2021)
611
===================
712

src/main/java/io/cos/cas/osf/dao/JpaOsfDao.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,22 @@ public OsfTotp findOneTotpByOwnerId(final Integer ownerId) {
100100
public OsfInstitution findOneInstitutionById(final String id) {
101101
try {
102102
final TypedQuery<OsfInstitution> query = entityManager.createQuery(
103-
"select i from OsfInstitution i where i.institutionId = :id",
103+
"select i from OsfInstitution i where i.institutionId = :id and i.deleted = false and i.dateDeactivated is null",
104104
OsfInstitution.class
105105
);
106106
query.setParameter("id", id);
107107
return query.getSingleResult();
108108
} catch (final PersistenceException e) {
109109
return null;
110110
}
111-
112111
}
113112

114113
@Override
115114
public List<OsfInstitution> findAllInstitutions() {
116115
try {
117116
final TypedQuery<OsfInstitution> query = entityManager.createQuery(
118117
"select i from OsfInstitution i "
119-
+ "where (not i.delegationProtocol = '') and i.deleted = false",
118+
+ "where (not i.delegationProtocol = '') and i.deleted = false and i.dateDeactivated is null",
120119
OsfInstitution.class
121120
);
122121
return query.getResultList();

src/main/java/io/cos/cas/osf/model/OsfInstitution.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import javax.persistence.Column;
1010
import javax.persistence.Entity;
1111
import javax.persistence.Table;
12+
import javax.persistence.Temporal;
13+
import javax.persistence.TemporalType;
14+
import java.util.Date;
1215

1316
/**
1417
* This is {@link OsfInstitution}.
@@ -43,6 +46,10 @@ public class OsfInstitution extends AbstractOsfModel {
4346
@Column(name = "is_deleted")
4447
private Boolean deleted;
4548

49+
@Temporal(TemporalType.TIMESTAMP)
50+
@Column(name = "deactivated")
51+
private Date dateDeactivated;
52+
4653
public DelegationProtocol getDelegationProtocol() {
4754
try {
4855
return DelegationProtocol.getType(delegationProtocol);

0 commit comments

Comments
 (0)