forked from alliance-genome/agr_chipmunk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Code for Schema to Release Migration
- Loading branch information
Showing
3 changed files
with
58 additions
and
12 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/main/java/org/alliancegenome/agr_submission/dao/ReleaseVersionDAO.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 |
---|---|---|
@@ -1,15 +1,35 @@ | ||
package org.alliancegenome.agr_submission.dao; | ||
|
||
import java.util.List; | ||
import java.util.TreeSet; | ||
|
||
import javax.enterprise.context.ApplicationScoped; | ||
|
||
import org.alliancegenome.agr_submission.BaseSQLDAO; | ||
import org.alliancegenome.agr_submission.entities.ReleaseVersion; | ||
|
||
import lombok.extern.log4j.Log4j2; | ||
|
||
@Log4j2 | ||
@ApplicationScoped | ||
public class ReleaseVersionDAO extends BaseSQLDAO<ReleaseVersion> { | ||
|
||
public ReleaseVersionDAO() { | ||
super(ReleaseVersion.class); | ||
} | ||
|
||
public ReleaseVersion getByName(String releaseVersion) { | ||
return findByField("releaseVersion", releaseVersion); | ||
} | ||
|
||
public ReleaseVersion getCurrentReleaseVersion() { | ||
List<ReleaseVersion> versions = findAll(); | ||
TreeSet<String> set = new TreeSet<>(); | ||
for(ReleaseVersion rv: versions) { | ||
set.add(rv.getReleaseVersion()); | ||
} | ||
log.debug("Return most current Release Version: " + set.pollFirst()); | ||
return getByName(set.pollLast()); | ||
} | ||
|
||
} |
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