Commit d954818b authored by François-Xavier Lebastard's avatar François-Xavier Lebastard
Browse files

Merge remote-tracking branch 'origin/develop' into feature/gestion_des_ecrans

parents aec886c4 e6ed832c
module.exports = {
'{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,vue,java}': ['prettier --write'],
'{,src/**/,webpack/}*.{md,json,html,js,ts,tsx,css,scss,vue}': ['prettier --write'],
};
......@@ -55,7 +55,7 @@ entity Screen {
*/
reference String unique required
description TextBlob
displayCondition TextBlob,
nextScreenExpression TextBlob,
items TextBlob required
}
......
......@@ -21,6 +21,7 @@ import tech.jhipster.config.JHipsterConstants;
@SpringBootApplication
@EnableConfigurationProperties({ LiquibaseProperties.class, ApplicationProperties.class })
public class OrientactiveApp {
private static final Logger log = LoggerFactory.getLogger(OrientactiveApp.class);
private final Environment env;
......
......@@ -20,6 +20,7 @@ import tech.jhipster.config.JHipsterConstants;
*/
@Aspect
public class LoggingAspect {
private final Environment env;
public LoggingAspect(Environment env) {
......
......@@ -11,6 +11,7 @@ import org.springframework.core.io.Resource;
*/
@ConfigurationProperties(prefix = "application", ignoreUnknownFields = false)
public class ApplicationProperties {
/**
* Fichier de base de données GeoIP.
*/
......
......@@ -18,6 +18,7 @@ import tech.jhipster.async.ExceptionHandlingAsyncTaskExecutor;
@EnableAsync
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
private final TaskExecutionProperties taskExecutionProperties;
......
......@@ -18,6 +18,7 @@ import tech.jhipster.config.cache.PrefixedKeyGenerator;
@Configuration
@EnableCaching
public class CacheConfiguration {
private GitProperties gitProperties;
private BuildProperties buildProperties;
private final javax.cache.configuration.Configuration<Object, Object> jcacheConfiguration;
......
......@@ -19,6 +19,7 @@ import tech.jhipster.config.liquibase.SpringLiquibaseUtil;
@Configuration
public class LiquibaseConfiguration {
private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class);
private final Environment env;
......
......@@ -23,8 +23,7 @@ public class LoggingConfiguration {
@Value("${server.port}") String serverPort,
JHipsterProperties jHipsterProperties,
ObjectMapper mapper
)
throws JsonProcessingException {
) throws JsonProcessingException {
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
Map<String, String> map = new HashMap<>();
......
......@@ -22,6 +22,7 @@ import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport;
@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true)
@Import(SecurityProblemSupport.class)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
private final TokenProvider tokenProvider;
private final CorsFilter corsFilter;
......
......@@ -13,6 +13,7 @@ import tech.jhipster.config.JHipsterProperties;
@Configuration
@Profile({ JHipsterConstants.SPRING_PROFILE_PRODUCTION })
public class StaticResourcesWebConfiguration implements WebMvcConfigurer {
protected static final String[] RESOURCE_LOCATIONS = new String[] {
"classpath:/static/app/",
"classpath:/static/content/",
......
......@@ -29,6 +29,7 @@ import tech.jhipster.config.JHipsterProperties;
*/
@Configuration
public class WebConfigurer implements ServletContextInitializer, WebServerFactoryCustomizer<WebServerFactory> {
private final Logger log = LoggerFactory.getLogger(WebConfigurer.class);
private final Environment env;
......
......@@ -19,6 +19,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@CreatedBy
......
......@@ -31,6 +31,7 @@ import org.hibernate.annotations.Type;
@Table(name = "answer")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Answer implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......
......@@ -18,6 +18,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@Table(name = "jhi_authority")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Authority implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
......
......@@ -19,6 +19,7 @@ import org.hibernate.annotations.Type;
@Table(name = "form")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Form implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......
package com.unantes.orientactive.domain;
import com.unantes.orientactive.validation.CheckExpression;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Type;
/**
* Une expression qui permet de calcul l'écran suivant d'un écran.
* Un écran peut posséder plusieurs expressions. Elles sont évaluées successivement.
* La premiere, dont l'{@link #expression} est vérifiée, est choisie.
*/
@Entity
@Table(name = "next_screen_expression")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class NextScreenExpression implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
private Long id;
@NotNull
@Column(name = "next_screen_reference", nullable = false)
private String nextScreenReference;
@NotNull
@Lob
@CheckExpression
@Type(type = "org.hibernate.type.TextType")
@Column(name = "expression", nullable = false)
private String expression;
/**
* L'écran associé à cette expression de calcul d'écran suivant.
*/
@ManyToOne
private Screen screen;
public Long getId() {
return id;
}
public void setId(final Long id) {
this.id = id;
}
public String getNextScreenReference() {
return nextScreenReference;
}
public void setNextScreenReference(final String nextScreenReference) {
this.nextScreenReference = nextScreenReference;
}
public String getExpression() {
return expression;
}
public void setExpression(final String expression) {
this.expression = expression;
}
public Screen getScreen() {
return screen;
}
public void setScreen(final Screen screen) {
this.screen = screen;
}
@Override
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final NextScreenExpression that = (NextScreenExpression) o;
return new EqualsBuilder()
.append(id, that.id)
.append(nextScreenReference, that.nextScreenReference)
.append(expression, that.expression)
.append(screen, that.screen)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(id).append(nextScreenReference).append(expression).append(screen).toHashCode();
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("nextScreenReference", nextScreenReference)
.append("expression", expression)
.append("screen", screen)
.toString();
}
}
......@@ -2,11 +2,25 @@ package com.unantes.orientactive.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.unantes.orientactive.converter.bean.Item;
import com.unantes.orientactive.validation.CheckExpression;
import com.unantes.orientactive.validation.CheckJson;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.apache.commons.collections4.CollectionUtils;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Type;
......@@ -45,11 +59,19 @@ public class Screen implements Serializable {
@Column(name = "description")
private String description;
@Lob
@CheckExpression
@Type(type = "org.hibernate.type.TextType")
@Column(name = "display_condition")
private String displayCondition;
/**
* La référence de l'écran suivant par défaut. Utilisé si aucune {@link #nextScreenExpressions} n'est vérifiée.
* Si cette référence est vide, {@link #next} est utilisé.
*/
@Column(name = "default_next_screen_reference")
private String defaultNextScreenReference;
/**
* La liste des expressions à évaluer pour déterminer l'écran suivant.
*/
@OneToMany(mappedBy = "screen", cascade = CascadeType.ALL, orphanRemoval = true)
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
private List<NextScreenExpression> nextScreenExpressions = new ArrayList<>();
@Lob
@CheckJson(isList = true, javaType = Item.class)
......@@ -129,17 +151,49 @@ public class Screen implements Serializable {
this.description = description;
}
public String getDisplayCondition() {
return this.displayCondition;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getDefaultNextScreenReference() {
return defaultNextScreenReference;
}
public Screen displayCondition(String displayCondition) {
this.displayCondition = displayCondition;
public void setDefaultNextScreenReference(final String defaultNextScreenReference) {
this.defaultNextScreenReference = defaultNextScreenReference;
}
public Screen defaultNextScreenReference(final String defaultNextScreenReference) {
setDefaultNextScreenReference(defaultNextScreenReference);
return this;
}
public void setDisplayCondition(String displayCondition) {
this.displayCondition = displayCondition;
public List<NextScreenExpression> getNextScreenExpressions() {
return nextScreenExpressions;
}
public Screen addNextScreenExpression(NextScreenExpression nextScreenExpression) {
this.nextScreenExpressions.add(nextScreenExpression);
nextScreenExpression.setScreen(this);
return this;
}
public Screen removeNextScreenExpression(NextScreenExpression nextScreenExpression) {
this.nextScreenExpressions.remove(nextScreenExpression);
nextScreenExpression.setScreen(null);
return this;
}
public void setNextScreenExpressions(final List<NextScreenExpression> nextScreenExpressions) {
nextScreenExpressions(nextScreenExpressions);
}
public Screen nextScreenExpressions(final List<NextScreenExpression> aNextScreenExpressions) {
nextScreenExpressions.forEach(this::removeNextScreenExpression);
if (CollectionUtils.isNotEmpty(aNextScreenExpressions)) {
aNextScreenExpressions.forEach(this::addNextScreenExpression);
}
return this;
}
public String getItems() {
......@@ -230,13 +284,6 @@ public class Screen implements Serializable {
// prettier-ignore
@Override
public String toString() {
return "Screen{" +
"id=" + getId() +
", name='" + getName() + "'" +
", reference='" + getReference() + "'" +
", description='" + getDescription() + "'" +
", displayCondition='" + getDisplayCondition() + "'" +
", items='" + getItems() + "'" +
"}";
return "Screen{" + "id=" + getId() + ", name='" + getName() + "'" + ", reference='" + getReference() + "'" + ", description='" + getDescription() + "'" + ", nextScreenExpressions='" + getNextScreenExpressions() + "'" + ", items='" + getItems() + "'" + "}";
}
}
......@@ -24,6 +24,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@Table(name = "jhi_user")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class User extends AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......
......@@ -16,6 +16,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
@Table(name = "user_action")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class UserAction implements Serializable {
private static final long serialVersionUID = 1L;
@Id
......
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