Skip to content
Snippets Groups Projects
Commit d7217413 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Observation form Beta 2

parent 25d9d2df
Branches
Tags
No related merge requests found
Showing
with 1517 additions and 40 deletions
...@@ -49,6 +49,7 @@ public class VIPSLogicApplication extends Application ...@@ -49,6 +49,7 @@ public class VIPSLogicApplication extends Application
resources.add(no.nibio.vips.logic.service.VIPSMobileService.class); resources.add(no.nibio.vips.logic.service.VIPSMobileService.class);
resources.add(no.nibio.vips.logic.modules.barleynetblotch.BarleyNetBlotchModelService.class); resources.add(no.nibio.vips.logic.modules.barleynetblotch.BarleyNetBlotchModelService.class);
resources.add(no.nibio.vips.logic.modules.roughage.RoughageService.class); resources.add(no.nibio.vips.logic.modules.roughage.RoughageService.class);
resources.add(no.nibio.vips.observationdata.ObservationDataService.class);
//resources.add(no.nibio.vips.logic.service.JacksonConfig.class); //resources.add(no.nibio.vips.logic.service.JacksonConfig.class);
//resources.add(no.nibio.vips.coremanager.service.ManagerResourceImpl.class); //resources.add(no.nibio.vips.coremanager.service.ManagerResourceImpl.class);
} }
...@@ -65,6 +66,7 @@ public class VIPSLogicApplication extends Application ...@@ -65,6 +66,7 @@ public class VIPSLogicApplication extends Application
resources.add(no.nibio.vips.logic.service.JacksonConfig.class); resources.add(no.nibio.vips.logic.service.JacksonConfig.class);
resources.add(no.nibio.vips.logic.service.LogicService.class); resources.add(no.nibio.vips.logic.service.LogicService.class);
resources.add(no.nibio.vips.logic.service.VIPSMobileService.class); resources.add(no.nibio.vips.logic.service.VIPSMobileService.class);
resources.add(no.nibio.vips.observationdata.ObservationDataService.class);
} }
} }
\ No newline at end of file
...@@ -34,6 +34,7 @@ import no.nibio.vips.logic.entity.VipsLogicRole; ...@@ -34,6 +34,7 @@ import no.nibio.vips.logic.entity.VipsLogicRole;
import no.nibio.vips.logic.entity.VipsLogicUser; import no.nibio.vips.logic.entity.VipsLogicUser;
import no.nibio.vips.logic.i18n.SessionLocaleUtil; import no.nibio.vips.logic.i18n.SessionLocaleUtil;
import no.nibio.vips.logic.util.SessionControllerGetter; import no.nibio.vips.logic.util.SessionControllerGetter;
import no.nibio.vips.logic.util.SystemTime;
import no.nibio.vips.util.ExceptionUtil; import no.nibio.vips.util.ExceptionUtil;
import no.nibio.vips.util.ServletUtil; import no.nibio.vips.util.ServletUtil;
import no.nibio.web.forms.FormValidation; import no.nibio.web.forms.FormValidation;
...@@ -88,6 +89,10 @@ public class ObservationController extends HttpServlet { ...@@ -88,6 +89,10 @@ public class ObservationController extends HttpServlet {
// Hierarchy categories // Hierarchy categories
request.setAttribute("hierarchyCategories", SessionControllerGetter.getOrganismBean().getHierarchyCategoryNames(SessionLocaleUtil.getCurrentLocale(request))); request.setAttribute("hierarchyCategories", SessionControllerGetter.getOrganismBean().getHierarchyCategoryNames(SessionLocaleUtil.getCurrentLocale(request)));
request.setAttribute("observationMethods", em.createNamedQuery("ObservationMethod.findAll", ObservationMethod.class).getResultList()); request.setAttribute("observationMethods", em.createNamedQuery("ObservationMethod.findAll", ObservationMethod.class).getResultList());
if(SessionControllerGetter.getUserBean().authorizeUser(user, VipsLogicRole.OBSERVATION_AUTHORITY, VipsLogicRole.SUPERUSER))
{
request.setAttribute("statusTypeIds", em.createNamedQuery("ObservationStatusType.findAll").getResultList());
}
request.getRequestDispatcher("/observationForm.ftl").forward(request, response); request.getRequestDispatcher("/observationForm.ftl").forward(request, response);
} }
catch(NullPointerException | NumberFormatException ex) catch(NullPointerException | NumberFormatException ex)
...@@ -120,6 +125,10 @@ public class ObservationController extends HttpServlet { ...@@ -120,6 +125,10 @@ public class ObservationController extends HttpServlet {
// Hierarchy categories // Hierarchy categories
request.setAttribute("hierarchyCategories", SessionControllerGetter.getOrganismBean().getHierarchyCategoryNames(SessionLocaleUtil.getCurrentLocale(request))); request.setAttribute("hierarchyCategories", SessionControllerGetter.getOrganismBean().getHierarchyCategoryNames(SessionLocaleUtil.getCurrentLocale(request)));
request.setAttribute("observationMethods", em.createNamedQuery("ObservationMethod.findAll", ObservationMethod.class).getResultList()); request.setAttribute("observationMethods", em.createNamedQuery("ObservationMethod.findAll", ObservationMethod.class).getResultList());
if(SessionControllerGetter.getUserBean().authorizeUser(user, VipsLogicRole.OBSERVATION_AUTHORITY, VipsLogicRole.SUPERUSER))
{
request.setAttribute("statusTypeIds", em.createNamedQuery("ObservationStatusType.findAll").getResultList());
}
if(request.getParameter("messageKey") != null) if(request.getParameter("messageKey") != null)
{ {
request.setAttribute("messageKey",request.getParameter("messageKey")); request.setAttribute("messageKey",request.getParameter("messageKey"));
...@@ -150,12 +159,37 @@ public class ObservationController extends HttpServlet { ...@@ -150,12 +159,37 @@ public class ObservationController extends HttpServlet {
if(formValidation.isValid()) if(formValidation.isValid())
{ {
// Storing observation // Storing observation
observation.setOrganism(em.find(Organism.class, formValidation.getFormField("organismId").getValueAsInteger()));
observation.setDenominator(formValidation.getFormField("denominator").getValueAsInteger()); // Only new observations can set the organism
observation.setObservationMethodId(em.find(ObservationMethod.class, formValidation.getFormField("observationMethodId").getWebValue())); if(observationId <= 0)
{
observation.setOrganism(em.find(Organism.class, formValidation.getFormField("organismId").getValueAsInteger()));
}
//observation.setDenominator(formValidation.getFormField("denominator").getValueAsInteger());
//observation.setObservationMethodId(em.find(ObservationMethod.class, formValidation.getFormField("observationMethodId").getWebValue()));
observation.setTimeOfObservation(formValidation.getFormField("timeOfObservation").getValueAsTimestamp()); observation.setTimeOfObservation(formValidation.getFormField("timeOfObservation").getValueAsTimestamp());
observation.setObservedValue(formValidation.getFormField("observedValue").getValueAsDouble()); //observation.setObservedValue(formValidation.getFormField("observedValue").getValueAsDouble());
observation.setUserId(user.getUserId()); observation.setUserId(user.getUserId());
observation.setObservationHeading(formValidation.getFormField("observationHeading").getWebValue());
observation.setObservationText(formValidation.getFormField("observationText").getWebValue());
observation.setObservationData(formValidation.getFormField("observationData").getWebValue());
// Storing approval status
if(SessionControllerGetter.getUserBean().authorizeUser(user, VipsLogicRole.OBSERVATION_AUTHORITY, VipsLogicRole.SUPERUSER))
{
Integer statusTypeId = formValidation.getFormField("statusTypeId").getValueAsInteger();
if(
observation.getStatusTypeId() == null
|| ! observation.getStatusTypeId().equals(statusTypeId)
)
{
observation.setStatusChangedByUserId(user.getUserId());
observation.setStatusChangedTime(SystemTime.getSystemTime());
}
observation.setStatusTypeId(statusTypeId);
observation.setStatusRemarks(formValidation.getFormField("statusRemarks").getWebValue());
}
//observation.setLocation(formValidation.getFormField("location").getValueAsPointWGS84()); //observation.setLocation(formValidation.getFormField("location").getValueAsPointWGS84());
//System.out.println(formValidation.getFormField("geoInfo").getWebValue()); //System.out.println(formValidation.getFormField("geoInfo").getWebValue());
observation.setGeoinfo(formValidation.getFormField("geoInfo").getWebValue()); observation.setGeoinfo(formValidation.getFormField("geoInfo").getWebValue());
......
...@@ -37,25 +37,29 @@ import javax.persistence.Transient; ...@@ -37,25 +37,29 @@ import javax.persistence.Transient;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.vividsolutions.jts.geom.Geometry;
import java.util.List; import java.util.List;
import javax.validation.constraints.Size;
import no.nibio.vips.logic.util.GISUtil; import no.nibio.vips.logic.util.GISUtil;
import no.nibio.vips.logic.util.StringJsonUserType;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.hibernate.annotations.TypeDefs;
/** /**
* @copyright 2014 <a href="http://www.nibio.no/">NIBIO</a> * @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no> * @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/ */
@Entity @Entity
@Table(name = "observation") @Table(name = "observation")
@XmlRootElement @XmlRootElement
@TypeDefs( {@TypeDef( name= "StringJsonObject", typeClass = StringJsonUserType.class)})
@NamedQueries({ @NamedQueries({
@NamedQuery(name = "Observation.findAll", query = "SELECT o FROM Observation o"), @NamedQuery(name = "Observation.findAll", query = "SELECT o FROM Observation o"),
@NamedQuery(name = "Observation.findByObservationId", query = "SELECT o FROM Observation o WHERE o.observationId = :observationId"), @NamedQuery(name = "Observation.findByObservationId", query = "SELECT o FROM Observation o WHERE o.observationId = :observationId"),
@NamedQuery(name = "Observation.findByUserId", query = "SELECT o FROM Observation o WHERE o.userId IN(:userId)"), @NamedQuery(name = "Observation.findByUserId", query = "SELECT o FROM Observation o WHERE o.userId IN(:userId)"),
@NamedQuery(name = "Observation.findByOrganism", query = "SELECT o FROM Observation o WHERE o.organism = :organism"), @NamedQuery(name = "Observation.findByOrganism", query = "SELECT o FROM Observation o WHERE o.organism = :organism"),
@NamedQuery(name = "Observation.findByTimeOfObservation", query = "SELECT o FROM Observation o WHERE o.timeOfObservation = :timeOfObservation"), @NamedQuery(name = "Observation.findByTimeOfObservation", query = "SELECT o FROM Observation o WHERE o.timeOfObservation = :timeOfObservation")
@NamedQuery(name = "Observation.findByObservedValue", query = "SELECT o FROM Observation o WHERE o.observedValue = :observedValue"), })
@NamedQuery(name = "Observation.findByDenominator", query = "SELECT o FROM Observation o WHERE o.denominator = :denominator")})
public class Observation implements Serializable, no.nibio.vips.observation.Observation { public class Observation implements Serializable, no.nibio.vips.observation.Observation {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -63,11 +67,18 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -63,11 +67,18 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
private Date timeOfObservation; private Date timeOfObservation;
private Organism organism; private Organism organism;
private Integer userId; private Integer userId;
//private Point location;
private List<Gis> geoinfo; private List<Gis> geoinfo;
private Double observedValue; //private Double observedValue;
private Integer denominator; //private Integer denominator;
private ObservationMethod observationMethodId; //private ObservationMethod observationMethodId;
private String observationHeading;
private String observationText;
private Integer statusTypeId;
private Integer statusChangedByUserId;
private Date statusChangedTime;
private String statusRemarks;
private String observationData;
private Boolean isQuantified;
private GISUtil GISUtil; private GISUtil GISUtil;
...@@ -79,11 +90,11 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -79,11 +90,11 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
this.observationId = observationId; this.observationId = observationId;
} }
public Observation(Integer observationId, Date timeOfObservation, Double registeredValue) { /*public Observation(Integer observationId, Date timeOfObservation, Double registeredValue) {
this.observationId = observationId; this.observationId = observationId;
this.timeOfObservation = timeOfObservation; this.timeOfObservation = timeOfObservation;
this.observedValue = registeredValue; this.observedValue = registeredValue;
} }*/
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
...@@ -154,7 +165,7 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -154,7 +165,7 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
return this.location.getCoordinate(); return this.location.getCoordinate();
}*/ }*/
@NotNull /*@NotNull
@Basic(optional = false) @Basic(optional = false)
@Column(name = "observed_value") @Column(name = "observed_value")
@Override @Override
...@@ -174,8 +185,9 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -174,8 +185,9 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
public void setDenominator(Integer denominator) { public void setDenominator(Integer denominator) {
this.denominator = denominator; this.denominator = denominator;
} }*/
/*
@JoinColumn(name = "observation_method_id", referencedColumnName = "observation_method_id") @JoinColumn(name = "observation_method_id", referencedColumnName = "observation_method_id")
@ManyToOne @ManyToOne
public ObservationMethod getObservationMethodId() { public ObservationMethod getObservationMethodId() {
...@@ -185,7 +197,7 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -185,7 +197,7 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
public void setObservationMethodId(ObservationMethod observationMethodId) { public void setObservationMethodId(ObservationMethod observationMethodId) {
this.observationMethodId = observationMethodId; this.observationMethodId = observationMethodId;
} }
*/
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
...@@ -268,4 +280,129 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse ...@@ -268,4 +280,129 @@ public class Observation implements Serializable, no.nibio.vips.observation.Obse
return this.getOrganism().getLatinName(); return this.getOrganism().getLatinName();
} }
/**
* @return the observationHeading
*/
@Column(name = "observation_heading")
@Size(max = 1023)
public String getObservationHeading() {
return observationHeading;
}
/**
* @param observationHeading the observationHeading to set
*/
public void setObservationHeading(String observationHeading) {
this.observationHeading = observationHeading;
}
/**
* @return the observationText
*/
@Column(name = "observation_text")
@Size(max = 2147483647)
public String getObservationText() {
return observationText;
}
/**
* @param observationText the observationText to set
*/
public void setObservationText(String observationText) {
this.observationText = observationText;
}
/**
* @return the statusTypeId
*/
@Column(name = "status_type_id")
public Integer getStatusTypeId() {
return statusTypeId;
}
/**
* @param statusTypeId the statusTypeId to set
*/
public void setStatusTypeId(Integer statusTypeId) {
this.statusTypeId = statusTypeId;
}
/**
* @return the statusChangedByUserId
*/
@Column(name = "status_changed_by_user_id")
public Integer getStatusChangedByUserId() {
return statusChangedByUserId;
}
/**
* @param statusChangedByUserId the statusChangedByUserId to set
*/
public void setStatusChangedByUserId(Integer statusChangedByUserId) {
this.statusChangedByUserId = statusChangedByUserId;
}
/**
* @return the statusChangedTime
*/
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "status_changed_time")
public Date getStatusChangedTime() {
return statusChangedTime;
}
/**
* @param statusChangedTime the statusChangedTime to set
*/
public void setStatusChangedTime(Date statusChangedTime) {
this.statusChangedTime = statusChangedTime;
}
/**
* @return the statusRemarks
*/
@Column(name = "status_remarks")
@Size(max = 2147483647)
public String getStatusRemarks() {
return statusRemarks;
}
/**
* @param statusRemarks the statusRemarks to set
*/
public void setStatusRemarks(String statusRemarks) {
this.statusRemarks = statusRemarks;
}
/**
* @return the observationData
*/
@Type(type = "StringJsonObject")
@Column(name = "observation_data")
public String getObservationData() {
return observationData;
}
/**
* @param observationData the observationData to set
*/
public void setObservationData(String observationData) {
this.observationData = observationData;
}
/**
* @return the isQuantified
*/
@Column(name = "is_quantified")
public Boolean getIsQuantified() {
return isQuantified;
}
/**
* @param isQuantified the isQuantified to set
*/
public void setIsQuantified(Boolean isQuantified) {
this.isQuantified = isQuantified;
}
} }
...@@ -53,8 +53,7 @@ public class ObservationMethod implements Serializable { ...@@ -53,8 +53,7 @@ public class ObservationMethod implements Serializable {
@Size(min = 1, max = 63) @Size(min = 1, max = 63)
@Column(name = "observation_method_id") @Column(name = "observation_method_id")
private String observationMethodId; private String observationMethodId;
@OneToMany(mappedBy = "observationMethodId")
private Set<Observation> observationSet;
public ObservationMethod() { public ObservationMethod() {
} }
...@@ -71,16 +70,6 @@ public class ObservationMethod implements Serializable { ...@@ -71,16 +70,6 @@ public class ObservationMethod implements Serializable {
this.observationMethodId = observationMethodId; this.observationMethodId = observationMethodId;
} }
@XmlTransient
@JsonIgnore
public Set<Observation> getObservationSet() {
return observationSet;
}
public void setObservationSet(Set<Observation> observationSet) {
this.observationSet = observationSet;
}
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
......
/*
* Copyright (c) 2016 NIBIO <http://www.nibio.no/>.
*
* This file is part of VIPSLogic.
* VIPSLogic is free software: you can redistribute it and/or modify
* it under the terms of the NIBIO Open Source License as published by
* NIBIO, either version 1 of the License, or (at your option) any
* later version.
*
* VIPSLogic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* NIBIO Open Source License for more details.
*
* You should have received a copy of the NIBIO Open Source License
* along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
*
*/
package no.nibio.vips.logic.entity;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
@Entity
@Table(name = "observation_status_type")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "ObservationStatusType.findAll", query = "SELECT o FROM ObservationStatusType o"),
@NamedQuery(name = "ObservationStatusType.findByStatusTypeId", query = "SELECT o FROM ObservationStatusType o WHERE o.statusTypeId = :statusTypeId"),
@NamedQuery(name = "ObservationStatusType.findByStatusTitle", query = "SELECT o FROM ObservationStatusType o WHERE o.statusTitle = :statusTitle")})
public class ObservationStatusType implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@NotNull
@Column(name = "status_type_id")
private Integer statusTypeId;
@Size(max = 63)
@Column(name = "status_title")
private String statusTitle;
public ObservationStatusType() {
}
public ObservationStatusType(Integer statusTypeId) {
this.statusTypeId = statusTypeId;
}
public Integer getStatusTypeId() {
return statusTypeId;
}
public void setStatusTypeId(Integer statusTypeId) {
this.statusTypeId = statusTypeId;
}
public String getStatusTitle() {
return statusTitle;
}
public void setStatusTitle(String statusTitle) {
this.statusTitle = statusTitle;
}
@Override
public int hashCode() {
int hash = 0;
hash += (statusTypeId != null ? statusTypeId.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof ObservationStatusType)) {
return false;
}
ObservationStatusType other = (ObservationStatusType) object;
if ((this.statusTypeId == null && other.statusTypeId != null) || (this.statusTypeId != null && !this.statusTypeId.equals(other.statusTypeId))) {
return false;
}
return true;
}
@Override
public String toString() {
return "no.nibio.vips.logic.entity.ObservationStatusType[ statusTypeId=" + statusTypeId + " ]";
}
}
...@@ -49,6 +49,7 @@ public class VipsLogicRole implements Serializable { ...@@ -49,6 +49,7 @@ public class VipsLogicRole implements Serializable {
public static Integer SUPERUSER = 1; public static Integer SUPERUSER = 1;
public static Integer ORGANIZATION_ADMINISTRATOR = 2; public static Integer ORGANIZATION_ADMINISTRATOR = 2;
public static Integer OBSERVER = 3; public static Integer OBSERVER = 3;
public static Integer OBSERVATION_AUTHORITY = 4;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@Id @Id
......
...@@ -275,6 +275,17 @@ public class VipsLogicUser implements Serializable { ...@@ -275,6 +275,17 @@ public class VipsLogicUser implements Serializable {
} }
return false; return false;
} }
@JsonIgnore
@Transient
public boolean isObservationAuthority(){
for (VipsLogicRole role : this.getVipsLogicRoles()) {
if (role.getVipsLogicRoleId().equals(VipsLogicRole.OBSERVATION_AUTHORITY)) {
return true;
}
}
return false;
}
@JsonIgnore @JsonIgnore
public boolean hasRole(Integer... roles) { public boolean hasRole(Integer... roles) {
......
...@@ -222,8 +222,7 @@ public class BarleyNetBlotchModelService { ...@@ -222,8 +222,7 @@ public class BarleyNetBlotchModelService {
{ {
ObservationImpl observation = new ObservationImpl(); ObservationImpl observation = new ObservationImpl();
observation.setName("Pyrenophora teres"); observation.setName("Pyrenophora teres");
observation.setObservedValue(observationValue); observation.setObservationData("{\"percentInfectedLeaves\": " + observationValue + "}");
observation.setDenominator(100);
observation.setTimeOfObservation(observationDate); observation.setTimeOfObservation(observationDate);
config.setConfigParameter("observation", observation); config.setConfigParameter("observation", observation);
} }
......
/*
* Copyright (c) 2016 NIBIO <http://www.nibio.no/>.
*
* This file is part of VIPSLogic.
* VIPSLogic is free software: you can redistribute it and/or modify
* it under the terms of the NIBIO Open Source License as published by
* NIBIO, either version 1 of the License, or (at your option) any
* later version.
*
* VIPSLogic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* NIBIO Open Source License for more details.
*
* You should have received a copy of the NIBIO Open Source License
* along with VIPSLogic. If not, see <http://www.nibio.no/licenses/>.
*
*/
package no.nibio.vips.observationdata;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
/**
* @copyright 2016 <a href="http://www.nibio.no/">NIBIO</a>
* @author Tor-Einar Skog <tor-einar.skog@nibio.no>
*/
@Path("rest/observationdata")
public class ObservationDataService {
@GET
@Path("schema/{organizationId}/{organismId}")
@Produces("application/json;charset=UTF-8")
public Response getSchema(){
// Try to find schema for given organism/organization
// If not found, return standard nominator/denominator (unit) form
return Response.ok().entity(this.getStandardSchema()).build();
}
@GET
@Path("model/{organizationId}/{organismId}")
@Produces("application/json;charset=UTF-8")
public Response getModel(){
// Try to find schema for given organism/organization
// If not found, return standard nominator/denominator (unit) form
return Response.ok().entity(this.getStandardModel()).build();
}
private String getStandardSchema(){
return "{"
+ "\"number\":{\"title\":\"Number\"},"
+ "\"unit\":{\"title\":\"Unit\"}"
+ "}";
}
private String getStandardModel(){
return "{"
+ "\"number\":0,"
+ "\"unit\":\"Number\""
+ "}";
}
}
...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk ...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk
task_SendForecastEventNotificationsTask_name=Send forecast event notifications task_SendForecastEventNotificationsTask_name=Send forecast event notifications
task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications
preferredLocale=Preferred locale preferredLocale=Preferred locale
VIPSLogicTitle=Administration system
indexText=VIPSLogic is the common administration system for VIPS. This is where you configure users, weather stations and forecasts, and where you report observations and write messages, and more. Use the top menu to get started.
observationHeading=Observation heading
observationText=Observation text
statusTypeId=Status
statusRemarks=Status remarks
vipsLogicRole_4=Observation authority
statusTypeIdTitle_1=Pending
statusTypeIdTitle_2=Rejected
statusTypeIdTitle_3=Approved
...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk ...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk
task_SendForecastEventNotificationsTask_name=Send forecast event notifications task_SendForecastEventNotificationsTask_name=Send forecast event notifications
task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications
preferredLocale=Preferred locale preferredLocale=Preferred locale
VIPSLogicTitle=VIPS administration system
indexText=VIPSLogic is the common administration system for VIPS. This is where you configure users, weather stations and forecasts, and where you report observations and write messages, and more.
observationHeading=Observation heading
observationText=Observation text
statusTypeId=Status
statusRemarks=Status remarks
vipsLogicRole_4=Observation authority
statusTypeIdTitle_1=Pending
statusTypeIdTitle_2=Rejected
statusTypeIdTitle_3=Approved
...@@ -310,3 +310,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk ...@@ -310,3 +310,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk
task_SendForecastEventNotificationsTask_name=Send forecast event notifications task_SendForecastEventNotificationsTask_name=Send forecast event notifications
task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications
preferredLocale=Preferred locale preferredLocale=Preferred locale
VIPSLogicTitle=VIPS administration system
indexText=VIPSLogic is the common administration system for VIPS. This is where you configure users, weather stations and forecasts, and where you report observations and write messages, and more.
observationHeading=Observation heading
observationText=Observation text
statusTypeId=Status
statusRemarks=Status remarks
vipsLogicRole_4=Observation authority
statusTypeIdTitle_1=Pending
statusTypeIdTitle_2=Rejected
statusTypeIdTitle_3=Approved
...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Melding om moderat infeksjonsrisiko ...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Melding om moderat infeksjonsrisiko
task_SendForecastEventNotificationsTask_name=Send meldinger om endringer i varsel task_SendForecastEventNotificationsTask_name=Send meldinger om endringer i varsel
task_SendForecastEventNotificationsTask_description=Ser om varsler har endret set til GUL eller R\u00d8D status. I tilfelle s\u00f8kes abonnenter opp og meldinger blir distribuert. task_SendForecastEventNotificationsTask_description=Ser om varsler har endret set til GUL eller R\u00d8D status. I tilfelle s\u00f8kes abonnenter opp og meldinger blir distribuert.
preferredLocale=Foretrukket spr\u00e5k preferredLocale=Foretrukket spr\u00e5k
VIPSLogicTitle=Administrasjonssystem
indexText=VIPSLogic er felles administrasjonssystem for VIPS. Her konfigurerer du brukere, m\u00e5lestasjoner og varsler, og her registrerer du observasjoner og skriver meldinger, med mere. Bruk menyen i toppen for \u00e5 komme i gang.
observationHeading=Observasjons-overskrift
observationText=Observasjonstekst
statusTypeId=Status
statusRemarks=Merknader til status
vipsLogicRole_4=Observasjonsgodkjenner
statusTypeIdTitle_1=Venter p\u00e5 godkjenning
statusTypeIdTitle_2=Avvist
statusTypeIdTitle_3=Godkjent
...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk ...@@ -311,3 +311,13 @@ forecastNotificationMessageHeadingTpl_2=Notification of moderate infection risk
task_SendForecastEventNotificationsTask_name=Send forecast event notifications task_SendForecastEventNotificationsTask_name=Send forecast event notifications
task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications task_SendForecastEventNotificationsTask_description=Checks to see if there has been changes in forecasts to YELLOW or RED status. If so, finds subscribers to such events and sends notifications
preferredLocale=Preferred locale preferredLocale=Preferred locale
VIPSLogicTitle=VIPS administration system
indexText=VIPSLogic is the common administration system for VIPS. This is where you configure users, weather stations and forecasts, and where you report observations and write messages, and more.
observationHeading=Observation heading
observationText=Observation text
statusTypeId=Status
statusRemarks=Status remarks
vipsLogicRole_4=Observation authority
statusTypeIdTitle_1=Pending
statusTypeIdTitle_2=Rejected
statusTypeIdTitle_3=Approved
This diff is collapsed.
...@@ -24,9 +24,68 @@ ...@@ -24,9 +24,68 @@
Main stylesheet of the VIPSLogic web app. Cusomizes the bootstrap.css Main stylesheet of the VIPSLogic web app. Cusomizes the bootstrap.css
*/ */
body {
font-family: 'Source Sans Pro', sans-serif;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6
{
font-family: 'Source Sans Pro', sans-serif;
}
h1 {
font-size: 250%;
line-height: 100%;
/*font-family: "Bitter", Arial, Helvetica, sans-serif;*/
font-weight: 400;
font-style: normal;
width: 100%;
color: rgba(33, 37, 35, 1);
/*padding: 15px 0px 10px 0px;*/
}
p {
font-size: 16px;
line-height: 130%;
color: rgba(86, 91, 89, 1);
/*font-family: "Roboto", Arial, Helvetica, sans-serif;*/
font-weight: 300;
font-style: normal;
text-transform: none;
width: 100%;
}
a, a:hover {
color: #008136;
text-decoration: underline;
}
.navbar{
background-color: #fff;
border: 0px none;
border-radius: 0px;
color: #222222 !important;
margin-bottom: 0px;
padding-top: 15px;
min-height: 80px;
}
.navbar-brand{ .navbar-brand{
padding-top: 6px; padding-top: 0px;
padding-bottom: 6px; padding-bottom: 0px;
text-decoration: none;
color: #222222 !important;
font-weight: bold;
font-size: large;
}
#siteTitle {
margin-left: 0px;
padding-left: 0px;
padding-top: 23px;
font-size: 1.2em;
font-weight: normal;
line-height: 130%;
} }
fieldset { fieldset {
...@@ -37,10 +96,131 @@ fieldset { ...@@ -37,10 +96,131 @@ fieldset {
margin-bottom: 15px; margin-bottom: 15px;
} }
.navbar-nav li a {
color: #222222 !important;
font-weight: normal !important;
font-size: large;
padding-top: 23px;
}
.navbar-default .navbar-nav>.active>a,
.navbar-default .navbar-nav>.active>a:hover,
.navbar-default .navbar-nav>.active>a:focus {
background-color: white;
}
.dropdown-header {
font-size: 160%;
color: white;
background-color: #B6B8B5
}
.dropdown-menu {
border-radius: 0px;
padding: 0px;
border: 0px none;
background-color: #dddddd !important;
z-index: 101;
}
.dropdown-menu li a, li.divider {
color: white;
font-weight: normal !important;
font-size: medium !important;
/*border-top: 1px solid #B6B8B5;*/
}
.dropdown-menu li a:hover {
color: #295B40;
font-weight: normal;
/**background-color: #31AB6E;*/
background-color: #aaaaaa;
}
.navbar-nav li a:hover {
color: #444444 !important;
font-weight: bold !important;
}
.navbar-nav li a.currentLink {
/*color: #f7f6f2 !important;*/
font-weight: bold !important;
height: 65px;
border-bottom: 4px solid #008136;
}
.navbar-nav .dropdown a .caret{
border-top-color: #222222 !important;
}
.nav a
{
text-decoration: none;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:hover, .navbar-default .navbar-nav>.open>a:focus{
background-color: transparent;
border-bottom: 0px none;
}
.navbar-toggle {
margin-top: 48px;
}
a.dropdown-toggle{
height: 65px;
}
fieldset#modelSpecificFields{ fieldset#modelSpecificFields{
display: none; display: none;
} }
footer {
padding: 30px 35px 35px 35px;
/*border-top: 4px solid #9f9f9f;*/
background-color: #fff;
}
footer p {
color: #222222 !important;
line-height: 14px;
margin-bottom: 10px;
}
footer p, footer a,footer a:visited{
/*color: white;*/
font-size: 12px;
}
footer a:hover {
color: rgba(49, 171, 110, 1);
}
table.table {
border-collapse: collapse;
}
table.table > tbody > tr > td {
background-color: white;
border-bottom: 3px solid #d9e6e4;
}
.table thead>tr>th {
border-bottom: 3px solid #d9e6e4;
}
.singleBlockContainer {
margin-bottom: 15px;
margin-top: 15px;
padding: 15px;
background-color: white !important;
}
legend { legend {
width: auto; /* Or auto */ width: auto; /* Or auto */
padding: 0 10px; /* To give a bit of padding on the left and right */ padding: 0 10px; /* To give a bit of padding on the left and right */
......
...@@ -45,20 +45,37 @@ ...@@ -45,20 +45,37 @@
"nullValue" : "{\"type\":\"FeatureCollection\",\"features\":[]}" "nullValue" : "{\"type\":\"FeatureCollection\",\"features\":[]}"
}, },
{ {
"name" : "observedValue", "name" : "observationData",
"dataType" : "DOUBLE", "dataType" : "STRING",
"fieldType" : "HIDDEN",
"required" : false
},
{
"name" : "observationMethodId",
"dataType" : "STRING",
"fieldType" : "SELECT_SINGLE",
"required" : true "required" : true
}, },
{ {
"name" : "denominator", "name" : "observationHeading",
"dataType" : "INTEGER", "dataType" : "STRING",
"required" : false "required" : false
}, },
{ {
"name" : "observationMethodId", "name" : "observationText",
"dataType" : "STRING", "dataType" : "STRING",
"required" : false
},
{
"name" : "statusTypeId",
"dataType" : "INTEGER",
"fieldType" : "SELECT_SINGLE", "fieldType" : "SELECT_SINGLE",
"required" : true "required" : false
},
{
"name" : "statusRemarks",
"dataType" : "STRING",
"required" : false
} }
] ]
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="225.7"
height="121.8"
id="svg3097"
version="1.1"
inkscape:version="0.48.4 r9939"
sodipodi:docname="logo.svg">
<defs
id="defs3099" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="0.48462403"
inkscape:cx="372.04724"
inkscape:cy="526.18109"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1393"
inkscape:window-height="657"
inkscape:window-x="1657"
inkscape:window-y="244"
inkscape:window-maximized="0"
inkscape:snap-page="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata3102">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-930.56218)">
<path
inkscape:connector-curvature="0"
class="st6"
d="M 150.8,1001.5622"
id="path26"
style="fill:#3d8052;fill-opacity:1" />
<path
inkscape:connector-curvature="0"
class="st4"
d="m 225.7,1011.5622 c 0,11.5 -3.6,20 -14.6,20 -6,0 -53.2,0.1 -53.2,0.1 0,0 -0.1,0 -0.1,-2 0,-7.1 6.4,-13.3 13.7,-13.3 7.1,0 12.7,0 24.5,-0.1 6.2,0 9.1,0.2 12.2,0.1 4.5,-0.2 4.2,-2.5 4.2,-5.2 0,-2.9 -0.8,-4.5 -4.6,-4.8 -5.9,-0.4 -32.9,-1.1 -39.6,-1.5 -9.9,-0.5 -10.9,-8.00002 -10.9,-20.10002 0,-12.8 6.7,-18.5 16.7,-18.7 4.6,-0.1 24.8,0 28.8,0 10,0 17.3,4.8 17.3,12.3 0,3 0,2.5 0,2.5 0,0 -44,-0.2 -45.1,-0.2 -3.5,0.2 -4.1,2.5 -4,5 0.2,4 1.5,4.2 6.7,4.5 5.8,0.4 26,0.9 35.7,1.3 9.2,0.6 12.3,8.80002 12.3,20.10002 z"
id="path28"
style="fill:#3d8052;fill-opacity:1" />
<g
transform="translate(-1,930.56218)"
id="g30"
style="fill:#3d8052;fill-opacity:1">
<g
id="g32"
style="fill:#3d8052;fill-opacity:1">
<path
inkscape:connector-curvature="0"
class="st4"
d="M 79.1,55.5 C 73.4,55.5 68.7,51.9 67,46.9 L 46.4,73.7 c 0,0 -17.1,-25.8 -19.3,-28.9 -2.9,-4.1 -8.4,-9.3 -18.1,-9.3 -3.1,0 -8,0 -8,0 l 45.6,65.8 25.7,-34.5 0,34.6 c 0,0 0.2,0 2.9,0 5.8,0 13.1,-6.4 13.2,-13.2 0,-6.4 0,-36.6 0,-36.6 -2.3,2.3 -5.6,3.9 -9.3,3.9 z"
id="path34"
style="fill:#3d8052;fill-opacity:1" />
<path
inkscape:connector-curvature="0"
class="st4"
d="m 132.9,35.9 c -10.7,0 -28.1,0 -37.6,-0.1 L 121.8,0.1 c 0,0 -4.8,-0.1 -9.4,-0.1 -5.5,0 -12.4,2.3 -15.9,6.8 -2.6,3.3 -17.4,24 -17.4,24 0,0 0,0 0,0 7,0 12.7,5.5 12.7,12.3 0,2.7 -0.9,5.2 -2.4,7.2 4.2,0 18,0 28.9,0 22.5,0 21.9,3.6 22,17.8 0.1,14.2 0.6,17.8 -21,17.8 -8,0 -17.4,0 -23.8,0 l -0.1,16.4 v 19.5 c 0,0 0,0 2,0 6.5,0 13.5,-6.1 13.5,-11.8 0,-2.6 -0.1,-8.9 -0.1,-8.9 8.8,0 18.2,0 24,0 16.5,0.1 21.6,-7.5 21.7,-33.1 0.2,-19.2 -7.3,-32.1 -23.6,-32.1 z"
id="path36"
style="fill:#3d8052;fill-opacity:1" />
</g>
</g>
</g>
</svg>
This diff is collapsed.
// Metawidget 4.2 minified
//
// This file is dual licensed under both the LGPL
// (http://www.gnu.org/licenses/lgpl-2.1.html) and the EPL
// (http://www.eclipse.org/org/documents/epl-v10.php). As a
// recipient of Metawidget, you may choose to receive it under either
// the LGPL or the EPL.
//
// Commercial licenses are also available. See http://metawidget.org
// for details.
//
// Author: Richard Kennard (http://kennardconsulting.com)
var metawidget=metawidget||{};(function(){var b=["$compile","$parse",function(c,d){return{restrict:"E",scope:{ngModel:"=",readOnly:"=",config:"=",ngShow:"=",ngHide:"=",configs:"&"},transclude:true,compile:function(g,f,e){return function(r,k,p){var q=new metawidget.angular.AngularMetawidget(k,p,e,r,c,d);var j=undefined;m();var o=r.$watch("config",function(t,s){if(t!==s){q.configure(t);m()}});var h=r.$watch("ngModel",function(s){if(s!==j&&typeof(s)==="object"){q.invalidateInspection();m()}});var i=r.$watch("readOnly",function(s){if(s!==q.readOnly){m()}});var n=r.$watch("ngShow",function(t,s){if(t!==s){m()}});var l=r.$watch("ngHide",function(t,s){if(t!==s){m()}});k.on("$destroy",function(){o();h();i();n();l()});function m(){if(r.$eval("ngShow")===false||r.$eval("ngHide")===true){return}j=r.$eval("ngModel");q.path=p.ngModel;q.toInspect=r.$parent.$eval(metawidget.util.splitPath(q.path).type);q.readOnly=r.$eval("readOnly");q.buildWidgets()}}}}}];var a=angular.module("metawidget",[]);a.directive("metawidget",b);a.directive("mwMetawidget",b);metawidget.angular=metawidget.angular||{};metawidget.angular.AngularMetawidget=function(g,d,c,h,f,i){if(!(this instanceof metawidget.angular.AngularMetawidget)){throw new Error("Constructor called as a function")}var e=new metawidget.Pipeline(g[0]);e._superLayoutWidget=e.layoutWidget;e.layoutWidget=function(n,k,m,l,o){e._superLayoutWidget.call(this,n,k,m,l,o);if(n.overridden===undefined){f(n)(h.$parent)}};var j=undefined;this.invalidateInspection=function(){j=undefined};e.inspector=new metawidget.inspector.PropertyTypeInspector();e.inspectionResultProcessors=[new metawidget.angular.inspectionresultprocessor.AngularInspectionResultProcessor(h.$parent)];e.widgetBuilder=new metawidget.widgetbuilder.CompositeWidgetBuilder([new metawidget.widgetbuilder.OverriddenWidgetBuilder(),new metawidget.widgetbuilder.ReadOnlyWidgetBuilder(),new metawidget.widgetbuilder.HtmlWidgetBuilder()]);e.widgetProcessors=[new metawidget.widgetprocessor.IdProcessor(),new metawidget.widgetprocessor.PlaceholderAttributeProcessor(),new metawidget.widgetprocessor.DisabledAttributeProcessor(),new metawidget.angular.widgetprocessor.AngularWidgetProcessor(i,h.$parent)];
e.layout=new metawidget.layout.HeadingTagLayoutDecorator(new metawidget.layout.TableLayout());this.configure=function(k){e.configure(k);this.invalidateInspection()};this.configure(h.$eval("config"));this.configure(h.configs());this.inspect=function(m,k,l){return e.inspect(m,k,l,this)};this.clearWidgets=function(){var k=angular.element(this.getElement());if(k.empty!==undefined){k.empty()}else{k.html("")}};this.buildWidgets=function(o){var k=c(h.$parent,function(p){return p});this.overriddenNodes=[];for(var l=0;l<k.length;l++){var n=k[l];if(n.nodeType===1&&(n.tagName!=="SPAN"||n.attributes.length>1)){this.overriddenNodes.push(n)}}if(o!==undefined){j=o}else{if(j===undefined){if(arguments.length>0){throw new Error("Calling buildWidgets( undefined ) may cause infinite loop. Check your argument, or pass no arguments instead")}var m=metawidget.util.splitPath(this.path);j=e.inspect(this.toInspect,m.type,m.names,this)}}g.children().remove();e.buildWidgets(j,this)};this.onEndBuild=function(){while(this.overriddenNodes.length>0){var l=this.overriddenNodes[0];this.overriddenNodes.splice(0,1);if(l.tagName==="FACET"){continue}var o={};var q,m;m=l.attributes.length;for(q=0;q<m;q++){var n=l.attributes[q];var p=d.$normalize(n.name).toLowerCase();if(p==="ngbind"||p==="ngmodel"){var r=metawidget.util.splitPath(n.value);var s=h.$parent.$eval(r.type);o=e.inspect(s,r.type,r.names,this);break}}if(o===undefined){o={section:""}}if(l.tagName==="STUB"){m=l.attributes.length;for(q=0;q<m;q++){var k=l.attributes[q];o[k.nodeName]=k.nodeValue}}e.layoutWidget(l,"property",o,e.element,this)}};this.getElement=function(){return e.element};this.buildNestedMetawidget=function(k,l){var n=metawidget.util.createElement(this,"metawidget");n.setAttribute("ng-model",metawidget.util.appendPath(k,this));if(metawidget.util.isTrueOrTrueString(k.readOnly)){n.setAttribute("read-only","true")}else{if(d.readOnly!==undefined){n.setAttribute("read-only",d.readOnly)}}h.$parent._nestedMetawidgetConfigId=h.$parent._nestedMetawidgetConfigId||0;
var o="_metawidgetConfig"+h.$parent._nestedMetawidgetConfigId++;h.$parent[o]=e;if(l!==undefined){var m="_metawidgetConfig"+h.$parent._nestedMetawidgetConfigId++;h.$parent[m]=l;n.setAttribute("configs","["+o+","+m+"]")}else{n.setAttribute("config",o)}return n}};metawidget.angular.inspectionresultprocessor=metawidget.angular.inspectionresultprocessor||{};metawidget.angular.inspectionresultprocessor.AngularInspectionResultProcessor=function(c){if(!(this instanceof metawidget.angular.inspectionresultprocessor.AngularInspectionResultProcessor)){throw new Error("Constructor called as a function")}this.processInspectionResult=function(f,i){function d(m,k){if(m!==k){for(var j=0,l=i._angularInspectionResultProcessor.length;j<l;j++){i._angularInspectionResultProcessor[j]()}i.invalidateInspection();i.buildWidgets()}}i._angularInspectionResultProcessor=i._angularInspectionResultProcessor||[];for(var e in f){var h=f[e];if(h instanceof Object){this.processInspectionResult(h,i);continue}if(h===undefined||h===null||h.slice===undefined){continue}if(h.length<4||h.slice(0,2)!=="{{"||h.slice(h.length-2,h.length)!=="}}"){continue}h=h.slice(2,h.length-2);f[e]=c.$eval(h)+"";var g=c.$watch(h,d);i._angularInspectionResultProcessor.push(g)}return f}};metawidget.angular.widgetprocessor=metawidget.angular.widgetprocessor||{};metawidget.angular.widgetprocessor.AngularWidgetProcessor=function(f,e){if(!(this instanceof metawidget.angular.widgetprocessor.AngularWidgetProcessor)){throw new Error("Constructor called as a function")}this.processWidget=function(k,p,j,o){var m=o.path;if(p!=="entity"){m=metawidget.util.appendPathWithName(m,j)}if(k.tagName==="OUTPUT"){if(!k.hasAttribute("ng-bind")){if(metawidget.util.isTrueOrTrueString(j.masked)){e.$parent.mwMaskedOutput=d;k.setAttribute("ng-bind","mwMaskedOutput("+m+")")}else{if(j.type==="array"){k.setAttribute("ng-bind",m+".join(', ')")}else{if(j.enumTitles!==undefined){e.$parent.mwLookupEnumTitle=e.$parent.mwLookupEnumTitle||{};e.$parent.mwLookupEnumTitle[m]=function(q){return metawidget.util.lookupEnumTitle(q,j["enum"],j.enumTitles)
};k.setAttribute("ng-bind",'mwLookupEnumTitle["'+m+'"]('+m+")")}else{if(j.type==="date"){k.setAttribute("ng-bind",m+"|date")}else{k.setAttribute("ng-bind",m)}}}}}}else{if(k.tagName==="INPUT"&&k.getAttribute("type")==="submit"){k.removeAttribute("ng-click")}else{if(k.tagName==="INPUT"&&k.getAttribute("type")==="button"){k.setAttribute("ng-click",m+"()")}else{if(j["enum"]!==undefined&&(j.type==="array"||j.componentType!==undefined)&&k.tagName==="DIV"){for(var l=0,i=k.childNodes.length;l<i;l++){var n=k.childNodes[l];if(n.tagName==="LABEL"&&n.childNodes.length===2){var h=n.childNodes[0];if(h.tagName==="INPUT"){if(h.getAttribute("type")==="radio"){h.setAttribute("ng-model",m);if(h.value===true||h.value==="true"){h.setAttribute("ng-value","true")}else{if(h.value===false||h.value==="false"){h.setAttribute("ng-value","false")}}}else{if(h.getAttribute("type")==="checkbox"){h.setAttribute("ng-checked",m+".indexOf('"+h.value+"')>=0");e.mwUpdateSelection=g;h.setAttribute("ng-click","mwUpdateSelection($event,'"+m+"')")}}}}}}else{if(k.tagName==="SELECT"){k.setAttribute("ng-model",m);if(j.type==="boolean"||j.type==="integer"||j.type==="number"){k.setAttribute("ng-change","mwChangeAsType('"+j.type+"','"+m+"')");e.mwChangeAsType=c;for(var l=0,i=k.childNodes.length;l<i;l++){var h=k.childNodes[l];if(h.tagName==="OPTION"&&h.value!==""){h.setAttribute("ng-selected",m+"=="+h.value)}}}}else{if(k.tagName==="INPUT"||k.tagName==="TEXTAREA"){k.setAttribute("ng-model",m)}}}}}}if(!metawidget.util.isTrueOrTrueString(j.readOnly)){if(j.required!==undefined){k.setAttribute("ng-required",j.required)}if(j.minLength!==undefined){k.setAttribute("ng-minlength",j.minLength)}if(j.maxLength!==undefined){k.setAttribute("ng-maxlength",j.maxLength)}}return k};function g(h,l){var j=e.$eval(l);if(j===undefined){j=[];f(l).assign(e,j)}var k=h.target;var i=j.indexOf(k.value);if(k.checked===true){if(i===-1){j.push(k.value)}return}if(i!==-1){j.splice(i,1)}}function d(h){if(h===undefined){return}return metawidget.util.fillString("*",h.length)
}function c(h,j){var i=f(j);if(h==="boolean"){i.assign(e,i(e)==="true");return}if(h==="integer"){i.assign(e,parseInt(i(e)));return}if(h==="number"){i.assign(e,parseFloat(i(e)));return}}}})();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment