Commit 100f26c1 authored by Matija Obreza's avatar Matija Obreza

Addressed #22, added FaoInstitute#current and #vCode with updated

processing in InstituteUpdater
Default taskExecutor now defaults to CALLER_RUNS policy instead of
REJECT
parent 1812a2bf
......@@ -48,7 +48,7 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@org.hibernate.annotations.Table(appliesTo = "faoinstitute", indexes = { @Index(columnNames = { "code" }, name = "code_FAOINSTITUTE") })
@Indexed
@ClassBridge(name = "body", boost = @Boost(1.3f), impl = FaoInstituteBridge.class)
@JsonSerialize(using=FaoInstituteSerializer.class)
@JsonSerialize(using = FaoInstituteSerializer.class)
public class FaoInstitute extends BusinessModel implements GeoReferencedEntity, AclAwareModel, EntityId {
/**
......@@ -56,7 +56,7 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity,
*/
private static final long serialVersionUID = -8773002513838748431L;
@Column(unique = true, nullable = false, length = 8)
@Column(unique = true, nullable = false, length = 10)
@Field(store = Store.NO)
private String code;
......@@ -76,6 +76,11 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity,
@Column(length = 50)
private String acronym;
@Column(length = 10)
private String vCode;
private boolean current;
@ManyToOne(cascade = {}, optional = true)
@JoinColumn(name = "countryId")
private Country country;
......@@ -227,4 +232,20 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity,
public void setUniqueAcceNumbs(boolean uniqueAcceNumbs) {
this.uniqueAcceNumbs = uniqueAcceNumbs;
}
public String getvCode() {
return vCode;
}
public void setvCode(String vCode) {
this.vCode = vCode;
}
public boolean isCurrent() {
return current;
}
public void setCurrent(boolean current) {
this.current = current;
}
}
......@@ -34,7 +34,7 @@ public interface FaoInstituteRepository extends JpaRepository<FaoInstitute, Long
@Query("select distinct(type) from FaoInstitute")
List<String> findTypes();
@Query("from FaoInstitute fi where fi.country = ?1 and fi.pgrActivity=true")
@Query("from FaoInstitute fi where fi.country = ?1 and fi.current=true and fi.pgrActivity=true")
List<FaoInstitute> listByCountry(Country country, Sort sort);
@Query("from FaoInstitute fi where fi.country = ?1 and fi.accessionCount > 0")
......
......@@ -217,14 +217,15 @@ public class InstituteUpdater {
final String longitude = line[15];
final String elevation = line[16];
// final String updatedOn = line[17];
// final String vInstCode = line[18];
// V_INSTCODE === New instcode?
final String vInstCode = line[18];
if (faoInstitute.getCode() == null) {
faoInstitute.setCode(instCode);
}
faoInstitute.setAcronym(acronym);
faoInstitute.setFullName(fullName);
LOG.info("Updating: " + fullName);
LOG.info("Updating: " + instCode + " " + fullName);
faoInstitute.setPgrActivity(pgrActivity);
faoInstitute.setMaintainsCollection(maintColl);
faoInstitute.setEmail(email);
......@@ -236,6 +237,8 @@ public class InstituteUpdater {
faoInstitute.setLongitude(lon);
Double elev = parseDoubleIgnore0(elevation, 1);
faoInstitute.setElevation(elev);
faoInstitute.setvCode(vInstCode);
faoInstitute.setCurrent(vInstCode == null || StringUtils.equals(instCode, vInstCode));
// Update institute country if null or when not matching the
// code
......
......@@ -148,6 +148,8 @@ faoInstitute.accessions.at=Accessions at {0}
faoInstitutes.viewAll=View all registered institutes
faoInstitutes.viewActiveOnly=View institutes with accessions in Genesys
faoInstitute.no-accessions-registered=Please get in touch with us if you can facilitate in providing data from this institiute.
faoInstitute.institute-not-current=This record is archived.
faoInstitute.view-current-institute=Navigate to {0}.
faoInstitute.country=Country
faoInstitute.code=WIEWS Code
faoInstitute.email=Contact email
......
......@@ -30,9 +30,9 @@
<context:component-scan base-package="org.genesys2.server.scheduler"/>
<task:executor id="taskExecutor"
pool-size="${executor.core.pool.size}-${executor.max.pool.size}"
queue-capacity="${executor.queue.capacity}"/>
<task:executor id="taskExecutor" rejection-policy="CALLER_RUNS"
pool-size="${executor.core.pool.size}-${executor.max.pool.size}"
queue-capacity="${executor.queue.capacity}" />
<task:scheduler id="taskScheduler" pool-size="${scheduler.max.pool.size}"/>
......
......@@ -13,7 +13,14 @@
<small><c:out value="${faoInstitute.code}" /></small>
</h1>
<c:if test="${countByInstitute eq 0}">
<c:if test="${not faoInstitute.current}">
<div class="alert alert-warning">
<spring:message code="faoInstitute.institute-not-current" />
<a href="<c:url value="/wiews/${faoInstitute.vCode.toLowerCase()}" />"><spring:message code="faoInstitute.view-current-institute" arguments="${faoInstitute.vCode}" /></a>
</div>
</c:if>
<c:if test="${faoInstitute.current and countByInstitute eq 0}">
<div class="alert alert-info">
<spring:message code="faoInstitute.no-accessions-registered" />
</div>
......@@ -28,9 +35,8 @@
<c:if test="${datasetCount gt 0}">
<a href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}/datasets" />"><spring:message code="view.datasets" /></a>
</c:if>
</div>
<div class="">
<security:authorize access="hasRole('ADMINISTRATOR') or hasPermission(#faoInstitute, 'ADMINISTRATION')">
<a href="<c:url value="/acl/${faoInstitute.class.name}/${faoInstitute.id}/permissions"><c:param name="back">/wiews/${faoInstitute.code.toLowerCase()}</c:param></c:url>" class="close"> <spring:message code="edit-acl" /></a>
......
......@@ -31,7 +31,7 @@
<ul class="funny-list">
<c:forEach items="${pagedData.content}" var="faoInstitute" varStatus="status">
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'}"><a class="show pull-left" href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a>
<li class="clearfix ${status.count % 2 == 0 ? 'even' : 'odd'} ${faoInstitute.current ? '' : 'not-current'}"><a class="show pull-left" href="<c:url value="/wiews/${faoInstitute.code.toLowerCase()}" />"><b><c:out value="${faoInstitute.code}" /></b> <c:out value="${faoInstitute.fullName}" /></a>
<div class="pull-right"><spring:message code="faoInstitute.accessionCount" arguments="${faoInstitute.accessionCount}" /></div></li>
</c:forEach>
</ul>
......
......@@ -1249,6 +1249,12 @@ ul.funny-list {
background-color: #f3f2ee;
}
ul.funny-list > li.not-current * {
text-decoration: line-through;
opacity:0.5;
}
.main-col table tr.acn .sel {
background-image:url('../images/icon_row_select.png');
background-repeat:no-repeat;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment