diff --git a/.gitignore b/.gitignore index aeed7bd980..77a5eb8e35 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ hs_err_pid* bower_components/ node_modules/ dist/ +dist-tz/ #IntelliJ files *.iml diff --git a/.gradletasknamecache b/.gradletasknamecache deleted file mode 100644 index 8b731f7d0a..0000000000 --- a/.gradletasknamecache +++ /dev/null @@ -1,105 +0,0 @@ -bootRun -assemble -bootRepackage -build -buildDependents -buildNeeded -classes -clean -jar -testClasses -init -wrapper -javadoc -buildEnvironment -components -dependencies -dependencyInsight -dependencyManagement -dependentComponents -help -model -projects -properties -tasks -cleanEclipse -cleanIdea -eclipse -idea -check -test -allOpenDataStorageTask -cleanEclipseClasspath -cleanEclipseJdt -cleanEclipseProject -cleanIdeaModule -cleanIdeaProject -cleanIdeaWorkspace -compileJava -compileKotlin -compileTestJava -compileTestKotlin -eclipseClasspath -eclipseJdt -eclipseProject -findMainClass -ideaModule -ideaProject -ideaWorkspace -install -processResources -processTestResources -Pattern: -Pattern: -Pattern: -bootRun -assemble -bootRepackage -build -buildDependents -buildNeeded -classes -clean -jar -testClasses -init -wrapper -javadoc -buildEnvironment -components -dependencies -dependencyInsight -dependencyManagement -dependentComponents -help -model -projects -properties -tasks -cleanEclipse -cleanIdea -eclipse -idea -check -test -allOpenDataStorageTask -cleanEclipseClasspath -cleanEclipseJdt -cleanEclipseProject -cleanIdeaModule -cleanIdeaProject -cleanIdeaWorkspace -compileJava -compileKotlin -compileTestJava -compileTestKotlin -eclipseClasspath -eclipseJdt -eclipseProject -findMainClass -ideaModule -ideaProject -ideaWorkspace -install -processResources -processTestResources diff --git a/build.gradle b/build.gradle index 905543e886..708c9f2d91 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,7 @@ buildscript { classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}") + classpath('com.taktik.gradle:gradle-plugin-docker-java:1.0.1') } } @@ -21,6 +22,7 @@ apply plugin: 'kotlin-spring' apply plugin: 'eclipse' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' +apply plugin: 'docker-java' configure(allprojects) { apply plugin: 'propdeps' @@ -31,7 +33,7 @@ configure(allprojects) { group = 'org.taktik.icure' -version = '4.0.3-SNAPSHOT' +version = '1.0.15' sourceCompatibility = 1.8 compileKotlin { kotlinOptions { @@ -39,6 +41,15 @@ compileKotlin { jvmTarget = "1.8" } } + + +compileJava { + options.fork = true + options.forkOptions.with { + memoryMaximumSize = "2048m" + } +} + compileTestKotlin { kotlinOptions { freeCompilerArgs = ["-Xjsr305=strict"] @@ -200,14 +211,11 @@ dependencies { compile group: 'com.ibm.icu', name: 'icu4j', version: '57.1' compile name: 'probatron4j-custom-0.7.4' compile name: 'ehvalidator-service-core-2.1.1' - /*compile name: 'safe-common-global-2.2.4' - compile name: 'safe-common-sea-light-2.2.4' - compile name: 'safe-connector-common-3.4.1' - compile name: 'safe-connector-mapper-3.4.1' - compile name: 'safe-connector-technical-3.4.1' - compile name: 'safe-connector-validation-3.4.1' - compile name: 'safe-connector-vitalink-3.4.1' - compile name: 'safe-connector-xsltutils-3.4.1'*/ + + //Cloud version + compile group: 'com.hazelcast', name: 'hazelcast', version: '3.8.6' + compile group: 'com.hazelcast', name: 'hazelcast-spring', version: '3.8.6' + compile group: 'org.springframework.session', name: 'spring-session', version: '1.3.3.RELEASE' // Runtime runtime group: 'org.javassist', name: 'javassist', version: '3.18.1-GA' @@ -215,8 +223,52 @@ dependencies { testCompile('org.springframework.boot:spring-boot-starter-test') } +task installWebResourcesDependencies(type: Exec) { + group 'build' + description 'Package web resources' + + workingDir "$projectDir/web/icure-ht" + commandLine "npm", "install" + commandLine "bower", "install" +} + + +task packageHtWebResources(type: Exec) { + group 'build' + description 'Package web resources' + + workingDir "$projectDir/web/icure-ht" + commandLine "node_modules/.bin/webpack", "--config", "webpack.config.js" +} + +task packageTzWebResources(type: Exec) { + group 'build' + description 'Package web resources' + + workingDir "$projectDir/web/icure-ht" + commandLine "node_modules/.bin/webpack", "--config", "webpack.config.tz.js" +} + +packageHtWebResources.dependsOn(installWebResourcesDependencies) +packageTzWebResources.dependsOn(installWebResourcesDependencies) + +task copyHtWebResources(type: Copy) { + from "$projectDir/web/icure-ht/dist" + into "${buildDir}/resources/main/static/ht" +} + +task copyTzWebResources(type: Copy) { + from "$projectDir/web/icure-ht/dist-tz" + into "${buildDir}/resources/main/static/tz" +} + +copyHtWebResources.dependsOn(packageHtWebResources) +copyTzWebResources.dependsOn(packageTzWebResources) compileJava.dependsOn(processResources) +bootRepackage.dependsOn(copyHtWebResources) +bootRepackage.dependsOn(copyTzWebResources) + // Setup resolution strategy configurations.all { resolutionStrategy { diff --git a/src/main/java/org/taktik/icure/dao/UserDAO.java b/src/main/java/org/taktik/icure/dao/UserDAO.java index e8c21e457d..739c4cc87f 100644 --- a/src/main/java/org/taktik/icure/dao/UserDAO.java +++ b/src/main/java/org/taktik/icure/dao/UserDAO.java @@ -37,9 +37,15 @@ public interface UserDAO extends GenericDAO { User getOnFallback(String userId); + User findOnFallback(String userId); + User getUserOnUserDb(String userId, String groupId); + User findUserOnUserDb(String userId, String groupId); + List getUsersOnDb(String groupId); void evictFromCache(String groupId, List userIds); + + User saveOnFallback(User user); } \ No newline at end of file diff --git a/src/main/java/org/taktik/icure/dao/impl/UserDAOImpl.java b/src/main/java/org/taktik/icure/dao/impl/UserDAOImpl.java index 3780bcbf18..b9d3e504b7 100644 --- a/src/main/java/org/taktik/icure/dao/impl/UserDAOImpl.java +++ b/src/main/java/org/taktik/icure/dao/impl/UserDAOImpl.java @@ -95,11 +95,21 @@ public User getOnFallback(String userId) { return ((CouchDbICureConnector) db).getFallbackConnector().get(User.class,userId); } + @Override + public User findOnFallback(String userId) { + return ((CouchDbICureConnector) db).getFallbackConnector().find(User.class,userId); + } + @Override public User getUserOnUserDb(String userId, String groupId) { return ((CouchDbICureConnector) db).getCouchDbICureConnector(groupId).get(User.class,userId); } + @Override + public User findUserOnUserDb(String userId, String groupId) { + return ((CouchDbICureConnector) db).getCouchDbICureConnector(groupId).find(User.class,userId); + } + @Override public List getUsersOnDb(String groupId) { return ((CouchDbICureConnector) db).getCouchDbICureConnector(groupId).queryView(createQuery("all").includeDocs(true), User.class); @@ -116,6 +126,11 @@ public void evictFromCache(String groupId, List userIds) { super.evictFromCache(groupId,ALL_ENTITIES_CACHE_KEY); } + @Override + public User saveOnFallback(User user) { + ((CouchDbICureConnector) db).getFallbackConnector().update(user); + return user; + } @Override protected User save(Boolean newEntity, User entity) { diff --git a/src/main/java/org/taktik/icure/dao/migration/InsurancesParentsMigration.java b/src/main/java/org/taktik/icure/dao/migration/InsurancesParentsMigration.java deleted file mode 100644 index 95afef2000..0000000000 --- a/src/main/java/org/taktik/icure/dao/migration/InsurancesParentsMigration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2018 Taktik SA - * - * This file is part of iCureBackend. - * - * iCureBackend is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * iCureBackend 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 - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with iCureBackend. If not, see . - */ - -package org.taktik.icure.dao.migration; - - -import org.ektorp.DocumentNotFoundException; -import org.ektorp.support.CouchDbRepositorySupport; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Repository; -import org.taktik.icure.dao.FormDAO; -import org.taktik.icure.dao.InsuranceDAO; -import org.taktik.icure.dao.impl.ektorp.CouchDbICureConnector; -import org.taktik.icure.db.PaginatedList; -import org.taktik.icure.db.PaginationOffset; -import org.taktik.icure.entities.Form; -import org.taktik.icure.entities.Insurance; -import org.taktik.icure.entities.base.StoredDocument; - -import java.util.Arrays; -import java.util.LinkedList; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -@Repository("insurancesParentsMigration") -public class InsurancesParentsMigration extends CouchDbRepositorySupport implements DbMigration { - - InsuranceDAO insuranceDAO; - - @Autowired - protected InsurancesParentsMigration(@SuppressWarnings("SpringJavaAutowiringInspection") @Qualifier("couchdbBase") CouchDbICureConnector couchdb) { - super(MigrationStub.class, couchdb, false); - } - - @Override - public boolean hasBeenApplied() { - try { - this.get(this.getClass().getCanonicalName()); - return true; - } catch (DocumentNotFoundException ignored) {} - return false; - } - - @Override - public void apply() { - List parents = Stream.of("100", "200", "300", "400", "500", "600", "900").map(c -> insuranceDAO.listByCode(c).iterator().next()).filter(Objects::nonNull).collect(Collectors.toList()); - - List all = insuranceDAO.getAll(); - all.forEach(i->i.setParent(i.getCode().equals("306")?i.getId():parents.stream().filter(p->p.getCode().startsWith(i.getCode().substring(0,1))).findAny().map(Insurance::getId).orElse(null))); - insuranceDAO.save(all); - - this.update(new MigrationStub(this.getClass().getCanonicalName())); - } - - @Autowired - public void setInsuranceDAO(InsuranceDAO insuranceDAO) { - this.insuranceDAO = insuranceDAO; - } -} diff --git a/src/main/java/org/taktik/icure/entities/Document.java b/src/main/java/org/taktik/icure/entities/Document.java index dbe4579dd0..8947b47269 100644 --- a/src/main/java/org/taktik/icure/entities/Document.java +++ b/src/main/java/org/taktik/icure/entities/Document.java @@ -20,14 +20,13 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.taktik.icure.entities.base.StoredICureDocument; -import org.taktik.icure.entities.embed.Delegation; import org.taktik.icure.entities.embed.DocumentStatus; import org.taktik.icure.entities.embed.DocumentType; import java.io.Serializable; -import java.util.*; +import java.util.HashSet; +import java.util.Set; @JsonInclude(JsonInclude.Include.NON_NULL) public class Document extends StoredICureDocument implements Serializable { diff --git a/src/main/java/org/taktik/icure/entities/Message.java b/src/main/java/org/taktik/icure/entities/Message.java index ece8f38656..fd277c0ef0 100644 --- a/src/main/java/org/taktik/icure/entities/Message.java +++ b/src/main/java/org/taktik/icure/entities/Message.java @@ -68,14 +68,30 @@ public class Message extends StoredICureDocument implements Serializable { private String formId; private Integer status; private String recipientsType; - private Set recipients = new HashSet<>(); - private Set toAddresses = new HashSet<>(); + private Set recipients = new HashSet<>(); //The id of the hcp whose the message is addressed to + private Set toAddresses = new HashSet<>(); //The address of the recipient of the message. Format is of an email address with extra domains defined for mycarenet and ehealth: (efact.mycarenet.be/eattest.mycarenet.be/chapter4.mycarenet.be/ehbox.ehealth.fgov.be) private Long received; private Long sent; private Map metas = new HashMap<>(); - private String transportGuid; //Usually unique number that identifies a message in a conversation + + /* + CHAP4IN: ${Mycarenet message ref} + CHAP4OUT: ${Mycarenet message ref} + EFACT:BATCH:${iCure batch ref} + EFACT:IN: ${Mycarenet message ref} + EFACT:OUT: ${Mycarenet message ref} + GMD:IN: ${Mycarenet message ref} + INBOX: ${Ehealth box message ref} + SENTBOX: ${Ehealth box message ref} + BININBOX: ${Ehealth box message ref} + BINSENTBOX: ${Ehealth box message ref} + REPORT:IN: ${iCure ref} + REPORT:OUT: ${iCure ref} + */ + + private String transportGuid; //Each message should have a transportGuid: see above for formats private String remark; private String conversationGuid; diff --git a/src/main/kotlin/org/taktik/icure/config/DefaultRedirectWebMvcConfig.kt b/src/main/kotlin/org/taktik/icure/config/DefaultRedirectWebMvcConfig.kt new file mode 100644 index 0000000000..b70cd354e3 --- /dev/null +++ b/src/main/kotlin/org/taktik/icure/config/DefaultRedirectWebMvcConfig.kt @@ -0,0 +1,22 @@ +package org.taktik.icure.config + +import org.springframework.context.annotation.Bean +import org.springframework.context.annotation.Configuration +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter + +@Configuration +class DefaultRedirectWebMvcConfig { + @Bean + fun forwardToIndex(): WebMvcConfigurerAdapter { + return object : WebMvcConfigurerAdapter() { + override fun addViewControllers(registry: ViewControllerRegistry) { + // forward requests to /admin and /user to their index.html + registry.addRedirectViewController("/ht", "/ht/") + registry.addViewController("/ht/").setViewName("forward:/ht/index.html") + registry.addRedirectViewController("/tz", "/tz/") + registry.addViewController("/tz/").setViewName("forward:/tz/index.html") + } + } + } +} diff --git a/src/main/kotlin/org/taktik/icure/config/SecurityConfig.kt b/src/main/kotlin/org/taktik/icure/config/SecurityConfig.kt index c246e26aa9..df266d3d4b 100644 --- a/src/main/kotlin/org/taktik/icure/config/SecurityConfig.kt +++ b/src/main/kotlin/org/taktik/icure/config/SecurityConfig.kt @@ -109,13 +109,10 @@ class SecurityConfigAdapter(private val daoAuthenticationProvider: CustomAuthent .antMatchers("/api/css/**").permitAll() .antMatchers("/api/**").hasRole("USER") - .antMatchers("/admin/bower_components/**").permitAll() - .antMatchers("/admin/images/**").permitAll() - .antMatchers("/admin/styles/**").permitAll() - .antMatchers("/admin/logon.html").permitAll() - .antMatchers("/admin/**").hasRole("USER") - + .antMatchers("/ht").permitAll() + .antMatchers("/tz").permitAll() .antMatchers("/ht/**").permitAll() + .antMatchers("/tz/**").permitAll() .antMatchers("/ping.json").permitAll() diff --git a/submodules/Ektorp b/submodules/Ektorp index d77b7778ff..b575407b08 160000 --- a/submodules/Ektorp +++ b/submodules/Ektorp @@ -1 +1 @@ -Subproject commit d77b7778ffe26b9402493d2f1dcff8cebd352d46 +Subproject commit b575407b08f7e0fc79a4f5696d20d84f6944e4a2 diff --git a/web/icure-ht/app/index.tz.ejs b/web/icure-ht/app/index.tz.ejs new file mode 100644 index 0000000000..005127c233 --- /dev/null +++ b/web/icure-ht/app/index.tz.ejs @@ -0,0 +1,207 @@ + + + + + + + Topaze + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+
+
+ + diff --git a/web/icure-ht/app/src/app-theme-tz.html b/web/icure-ht/app/src/app-theme-tz.html new file mode 100644 index 0000000000..73d7f0f513 --- /dev/null +++ b/web/icure-ht/app/src/app-theme-tz.html @@ -0,0 +1,48 @@ + + + + + + + diff --git a/web/icure-ht/app/src/elements/dynamic-form/dynamically-loaded-form.html b/web/icure-ht/app/src/elements/dynamic-form/dynamically-loaded-form.html index f7c346ddbc..eca68cfa9f 100644 --- a/web/icure-ht/app/src/elements/dynamic-form/dynamically-loaded-form.html +++ b/web/icure-ht/app/src/elements/dynamic-form/dynamically-loaded-form.html @@ -41,9 +41,9 @@ data-provider="[[dataProvider]]" i18n="[[i18n]]" language="[[language]]" resources="[[resources]]" data-map="[[dataMap]]" title="[[form.template.name]]" read-only="[[_isNotInCurrentContact(currentContact, contact)]]" show-title="true" health-elements="[[healthElements]]">
- + - +