Skip to content

Commit

Permalink
Merge branch 'release/21.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
cslzchen committed Jul 20, 2021
2 parents 3278e37 + 5303f55 commit cf08091
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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

21.3.0 (07-19-2021)
===================

Support OSF institution deactivation/reactivation

21.2.5 (05-18-2021)
===================

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/io/cos/cas/osf/dao/JpaOsfDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,22 @@ public OsfTotp findOneTotpByOwnerId(final Integer ownerId) {
public OsfInstitution findOneInstitutionById(final String id) {
try {
final TypedQuery<OsfInstitution> query = entityManager.createQuery(
"select i from OsfInstitution i where i.institutionId = :id",
"select i from OsfInstitution i where i.institutionId = :id and i.deleted = false and i.dateDeactivated is null",
OsfInstitution.class
);
query.setParameter("id", id);
return query.getSingleResult();
} catch (final PersistenceException e) {
return null;
}

}

@Override
public List<OsfInstitution> findAllInstitutions() {
try {
final TypedQuery<OsfInstitution> query = entityManager.createQuery(
"select i from OsfInstitution i "
+ "where (not i.delegationProtocol = '') and i.deleted = false",
+ "where (not i.delegationProtocol = '') and i.deleted = false and i.dateDeactivated is null",
OsfInstitution.class
);
return query.getResultList();
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/io/cos/cas/osf/model/OsfInstitution.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

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

@Temporal(TemporalType.TIMESTAMP)
@Column(name = "deactivated")
private Date dateDeactivated;

public DelegationProtocol getDelegationProtocol() {
try {
return DelegationProtocol.getType(delegationProtocol);
Expand Down

0 comments on commit cf08091

Please sign in to comment.