|
|
|
|
@ -4,7 +4,9 @@ import org.leolo.nrdatad.model.CORPUS;
|
|
|
|
|
|
|
|
|
|
import java.sql.SQLException; |
|
|
|
|
import java.util.Collection; |
|
|
|
|
import java.util.HashSet; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
public abstract class CORPUSDao extends BaseDao{ |
|
|
|
|
|
|
|
|
|
@ -12,11 +14,97 @@ public abstract class CORPUSDao extends BaseDao{
|
|
|
|
|
super(manager); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public class QueryBuilder{ |
|
|
|
|
public static class QueryBuilder{ |
|
|
|
|
private Set<String> stanox = new HashSet<>(); |
|
|
|
|
private Set<String> uicCode = new HashSet<>(); |
|
|
|
|
private Set<String> crsCode = new HashSet<>(); |
|
|
|
|
private Set<String> tiplocCode = new HashSet<>(); |
|
|
|
|
private Set<String> nlcCode = new HashSet<>(); |
|
|
|
|
private Set<String> description = new HashSet<>(); |
|
|
|
|
SearchMode searchMode = SearchMode.MATCH_ALL_GROUP; |
|
|
|
|
|
|
|
|
|
public void setSearchMode(SearchMode searchMode) { |
|
|
|
|
this.searchMode = searchMode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addStanox(String stanox){ |
|
|
|
|
this.stanox.add(stanox); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addUicCode(String uicCode){ |
|
|
|
|
this.uicCode.add(uicCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addCrsCode(String crsCode){ |
|
|
|
|
this.crsCode.add(crsCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addTiplocCode(String tiplocCode){ |
|
|
|
|
this.tiplocCode.add(tiplocCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addNlcCode(String nlcCode){ |
|
|
|
|
this.nlcCode.add(nlcCode); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void addDescription(String description){ |
|
|
|
|
this.description.add(description); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Query build(){ |
|
|
|
|
return new Query(stanox, uicCode, crsCode, tiplocCode, nlcCode, description, searchMode); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class Query{ |
|
|
|
|
private Set<String> stanox = new HashSet<>(); |
|
|
|
|
private Set<String> uicCode = new HashSet<>(); |
|
|
|
|
private Set<String> crsCode = new HashSet<>(); |
|
|
|
|
private Set<String> tiplocCode = new HashSet<>(); |
|
|
|
|
private Set<String> nlcCode = new HashSet<>(); |
|
|
|
|
private Set<String> description = new HashSet<>(); |
|
|
|
|
SearchMode searchMode = SearchMode.MATCH_ALL_GROUP; |
|
|
|
|
|
|
|
|
|
private Query(Set<String> stanox, Set<String> uicCode, Set<String> crsCode, Set<String> tiplocCode, Set<String> nlcCode, Set<String> description, SearchMode searchMode) { |
|
|
|
|
this.stanox = stanox; |
|
|
|
|
this.uicCode = uicCode; |
|
|
|
|
this.crsCode = crsCode; |
|
|
|
|
this.tiplocCode = tiplocCode; |
|
|
|
|
this.nlcCode = nlcCode; |
|
|
|
|
this.description = description; |
|
|
|
|
this.searchMode = searchMode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Set<String> getStanox() { |
|
|
|
|
return stanox; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Set<String> getUicCode() { |
|
|
|
|
return uicCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Set<String> getCrsCode() { |
|
|
|
|
return crsCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Set<String> getTiplocCode() { |
|
|
|
|
return tiplocCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Set<String> getNlcCode() { |
|
|
|
|
return nlcCode; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected Set<String> getDescription() { |
|
|
|
|
return description; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected SearchMode getSearchMode() { |
|
|
|
|
return searchMode; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public abstract Collection<CORPUS> executeQuery(QueryBuilder query) throws SQLException; |
|
|
|
|
public abstract Collection<CORPUS> executeQuery(Query query) throws SQLException; |
|
|
|
|
|
|
|
|
|
public abstract void add(CORPUS corpus) throws SQLException; |
|
|
|
|
|
|
|
|
|
|