From d2847ad2df6f452947158e16d38c98da5cd5953b Mon Sep 17 00:00:00 2001 From: ivelina-yordanova <56301327+ivelina-yordanova@users.noreply.github.com> Date: Mon, 10 Feb 2020 12:54:48 +0000 Subject: [PATCH 01/72] [CHR-1066] - snowowlFork to Artifactory (#2) * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * [CHR-1066] * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * CHR-1066 * chr-1066 - add cache and test if javadoc in path * chr-1066 - print out some debug info * chr-1066 -fix copy/paste mistake * chr-1066 - print debug info * chr-1066 - print debug info * chr-1066 - yet another print debug info * chr-1066 - yet another print debug info * chr-1066 - extract var to control use of local artifacts * chr-1066 - extract var to control use of local artifacts * chr-1066 - extract var to control use of local artifacts * chr-1066 - print stuff * chr-1066 - change npm config, errors and skips next lines * chr-1066 - nes * chr-1066 - .. * chr-1066 - remove debug * chr-1066 - put env vars in docker and in the bash env * chr-1066 - put env vars in job as well, print debug * chr-1066 - yet another try to change path.. print debug * chr-1066 - yet another try to change path.. print debug * chr-1066 - I am doing stupid things now...fixing copy/paste error * chr-1066 - still not set...their documentation lies ... * chr-1066 - still not set completely... * chr-1066 - remove the debug echoed info Co-authored-by: Matteo Casu --- .circleci/config.yml | 58 + .circleci/settings.xml | 18 + .mvn/wrapper/MavenWrapperDownloader.java | 117 + .mvn/wrapper/maven-wrapper.jar | Bin 0 -> 50710 bytes .mvn/wrapper/maven-wrapper.properties | 2 + .../pom.xml | 540 ++--- mvnw | 310 +++ mvnw.cmd | 182 ++ pom.xml | 1892 +++++++++-------- settings.xml | 26 +- 10 files changed, 1933 insertions(+), 1212 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 .circleci/settings.xml create mode 100644 .mvn/wrapper/MavenWrapperDownloader.java create mode 100644 .mvn/wrapper/maven-wrapper.jar create mode 100644 .mvn/wrapper/maven-wrapper.properties create mode 100755 mvnw create mode 100644 mvnw.cmd diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000000..28de92ce705 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,58 @@ +version: 2 +workflows: + version: 2 + flow: + jobs: + - deploy: + context: babylon + filters: + branches: + only: + - 7.x +env: &env + working_directory: ~/project + resource_class: large + docker: + - image: docker:17.03.0-ce-git + environment: + JAVA_HOME: /usr/lib/jvm/java-11-openjdk + environment: + JAVA_HOME: /usr/lib/jvm/java-11-openjdk + +jobs: + deploy: + <<: *env + steps: + - checkout + - setup_remote_docker + - restore_cache: + keys: + - snow-owl-mvn-cache-{{ checksum "pom.xml" }} + - snow-owl-mvn-cache- + paths: + - "~/.m2" + - "/root/.m2" + - run: + name: Build prerequisites + command: | + echo "${ARTIFACTORY_URL}" | sha512sum + echo "${ARTIFACTORY_USER_RW}" | sha512sum + echo "${ARTIFACTORY_PWD_RW}" | sha512sum + echo "$CIRCLE_SHA1" > .commit-keyId + docker --version + docker login -u "$DOCKER_USER" -p "$DOCKER_PASS" quay.io + apk add --no-cache make=4.2.1-r0 nodejs openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community + npm config set unsafe-perm true + npm install -g npm + - save_cache: + key: snow-owl-mvn-cache-{{ checksum "pom.xml" }} + paths: + - "~/.m2" + - "/root/.m2" + - run: + name: Build and deploy + command: | + echo 'export PATH=$JAVA_HOME/bin:$PATH' >> $BASH_ENV + source $BASH_ENV + ./mvnw -s .circleci/settings.xml deploy -DskipTests -Dtycho.localArtifacts=$LOCAL_ARTIFACTS + diff --git a/.circleci/settings.xml b/.circleci/settings.xml new file mode 100644 index 00000000000..232b744684e --- /dev/null +++ b/.circleci/settings.xml @@ -0,0 +1,18 @@ + + + + artifactory-releases + ${env.ARTIFACTORY_USER_RW} + ${env.ARTIFACTORY_PWD_RW} + + + artifactory-snapshots + ${env.ARTIFACTORY_USER_RW} + ${env.ARTIFACTORY_PWD_RW} + + + + \ No newline at end of file diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 00000000000..b901097f2db --- /dev/null +++ b/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,117 @@ +/* + * Copyright 2007-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import java.net.*; +import java.io.*; +import java.nio.channels.*; +import java.util.Properties; + +public class MavenWrapperDownloader { + + private static final String WRAPPER_VERSION = "0.5.6"; + /** + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. + */ + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; + + /** + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to + * use instead of the default one. + */ + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = + ".mvn/wrapper/maven-wrapper.properties"; + + /** + * Path where the maven-wrapper.jar will be saved to. + */ + private static final String MAVEN_WRAPPER_JAR_PATH = + ".mvn/wrapper/maven-wrapper.jar"; + + /** + * Name of the property which should be used to override the default download url for the wrapper. + */ + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; + + public static void main(String args[]) { + System.out.println("- Downloader started"); + File baseDirectory = new File(args[0]); + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); + + // If the maven-wrapper.properties exists, read it and check if it contains a custom + // wrapperUrl parameter. + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); + String url = DEFAULT_DOWNLOAD_URL; + if(mavenWrapperPropertyFile.exists()) { + FileInputStream mavenWrapperPropertyFileInputStream = null; + try { + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); + Properties mavenWrapperProperties = new Properties(); + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); + } catch (IOException e) { + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); + } finally { + try { + if(mavenWrapperPropertyFileInputStream != null) { + mavenWrapperPropertyFileInputStream.close(); + } + } catch (IOException e) { + // Ignore ... + } + } + } + System.out.println("- Downloading from: " + url); + + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); + if(!outputFile.getParentFile().exists()) { + if(!outputFile.getParentFile().mkdirs()) { + System.out.println( + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); + } + } + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); + try { + downloadFileFromURL(url, outputFile); + System.out.println("Done"); + System.exit(0); + } catch (Throwable e) { + System.out.println("- Error downloading"); + e.printStackTrace(); + System.exit(1); + } + } + + private static void downloadFileFromURL(String urlString, File destination) throws Exception { + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { + String username = System.getenv("MVNW_USERNAME"); + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(username, password); + } + }); + } + URL website = new URL(urlString); + ReadableByteChannel rbc; + rbc = Channels.newChannel(website.openStream()); + FileOutputStream fos = new FileOutputStream(destination); + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); + fos.close(); + rbc.close(); + } + +} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..2cc7d4a55c0cd0092912bf49ae38b3a9e3fd0054 GIT binary patch literal 50710 zcmbTd1CVCTmM+|7+wQV$+qP}n>auOywyU~q+qUhh+uxis_~*a##hm*_WW?9E7Pb7N%LRFiwbEGCJ0XP=%-6oeT$XZcYgtzC2~q zk(K08IQL8oTl}>>+hE5YRgXTB@fZ4TH9>7=79e`%%tw*SQUa9~$xKD5rS!;ZG@ocK zQdcH}JX?W|0_Afv?y`-NgLum62B&WSD$-w;O6G0Sm;SMX65z)l%m1e-g8Q$QTI;(Q z+x$xth4KFvH@Bs6(zn!iF#nenk^Y^ce;XIItAoCsow38eq?Y-Auh!1in#Rt-_D>H^ z=EjbclGGGa6VnaMGmMLj`x3NcwA43Jb(0gzl;RUIRAUDcR1~99l2SAPkVhoRMMtN} zXvC<tOmX83grD8GSo_Lo?%lNfhD#EBgPo z*nf@ppMC#B!T)Ae0RG$mlJWmGl7CkuU~B8-==5i;rS;8i6rJ=PoQxf446XDX9g|c> zU64ePyMlsI^V5Jq5A+BPe#e73+kpc_r1tv#B)~EZ;7^67F0*QiYfrk0uVW;Qb=NsG zN>gsuCwvb?s-KQIppEaeXtEMdc9dy6Dfduz-tMTms+i01{eD9JE&h?Kht*$eOl#&L zJdM_-vXs(V#$Ed;5wyNWJdPNh+Z$+;$|%qR(t`4W@kDhd*{(7-33BOS6L$UPDeE_53j${QfKN-0v-HG z(QfyvFNbwPK%^!eIo4ac1;b>c0vyf9}Xby@YY!lkz-UvNp zwj#Gg|4B~?n?G^{;(W;|{SNoJbHTMpQJ*Wq5b{l9c8(%?Kd^1?H1om1de0Da9M;Q=n zUfn{f87iVb^>Exl*nZ0hs(Yt>&V9$Pg`zX`AI%`+0SWQ4Zc(8lUDcTluS z5a_KerZWe}a-MF9#Cd^fi!y3%@RFmg&~YnYZ6<=L`UJ0v={zr)>$A;x#MCHZy1st7 ztT+N07NR+vOwSV2pvWuN1%lO!K#Pj0Fr>Q~R40{bwdL%u9i`DSM4RdtEH#cW)6}+I-eE< z&tZs+(Ogu(H_;$a$!7w`MH0r%h&@KM+<>gJL@O~2K2?VrSYUBbhCn#yy?P)uF3qWU z0o09mIik+kvzV6w>vEZy@&Mr)SgxPzUiDA&%07m17udz9usD82afQEps3$pe!7fUf z0eiidkJ)m3qhOjVHC_M(RYCBO%CZKZXFb8}s0-+}@CIn&EF(rRWUX2g^yZCvl0bI} zbP;1S)iXnRC&}5-Tl(hASKqdSnO?ASGJ*MIhOXIblmEudj(M|W!+I3eDc}7t`^mtg z)PKlaXe(OH+q-)qcQ8a@!llRrpGI8DsjhoKvw9T;TEH&?s=LH0w$EzI>%u;oD@x83 zJL7+ncjI9nn!TlS_KYu5vn%f*@qa5F;| zEFxY&B?g=IVlaF3XNm_03PA)=3|{n-UCgJoTr;|;1AU9|kPE_if8!Zvb}0q$5okF$ zHaJdmO&gg!9oN|M{!qGE=tb|3pVQ8PbL$}e;NgXz<6ZEggI}wO@aBP**2Wo=yN#ZC z4G$m^yaM9g=|&!^ft8jOLuzc3Psca*;7`;gnHm}tS0%f4{|VGEwu45KptfNmwxlE~ z^=r30gi@?cOm8kAz!EylA4G~7kbEiRlRIzwrb~{_2(x^$-?|#e6Bi_**(vyr_~9Of z!n>Gqf+Qwiu!xhi9f53=PM3`3tNF}pCOiPU|H4;pzjcsqbwg*{{kyrTxk<;mx~(;; z1NMrpaQ`57yn34>Jo3b|HROE(UNcQash!0p2-!Cz;{IRv#Vp5!3o$P8!%SgV~k&Hnqhp`5eLjTcy93cK!3Hm-$`@yGnaE=?;*2uSpiZTs_dDd51U%i z{|Zd9ou-;laGS_x=O}a+ zB||za<795A?_~Q=r=coQ+ZK@@ zId~hWQL<%)fI_WDIX#=(WNl!Dm$a&ROfLTd&B$vatq!M-2Jcs;N2vps$b6P1(N}=oI3<3luMTmC|0*{ zm1w8bt7vgX($!0@V0A}XIK)w!AzUn7vH=pZEp0RU0p?}ch2XC-7r#LK&vyc2=-#Q2 z^L%8)JbbcZ%g0Du;|8=q8B>X=mIQirpE=&Ox{TiuNDnOPd-FLI^KfEF729!!0x#Es z@>3ursjFSpu%C-8WL^Zw!7a0O-#cnf`HjI+AjVCFitK}GXO`ME&on|^=~Zc}^LBp9 zj=-vlN;Uc;IDjtK38l7}5xxQF&sRtfn4^TNtnzXv4M{r&ek*(eNbIu!u$>Ed%` z5x7+&)2P&4>0J`N&ZP8$vcR+@FS0126s6+Jx_{{`3ZrIMwaJo6jdrRwE$>IU_JTZ} z(||hyyQ)4Z1@wSlT94(-QKqkAatMmkT7pCycEB1U8KQbFX&?%|4$yyxCtm3=W`$4fiG0WU3yI@c zx{wfmkZAYE_5M%4{J-ygbpH|(|GD$2f$3o_Vti#&zfSGZMQ5_f3xt6~+{RX=$H8at z?GFG1Tmp}}lmm-R->ve*Iv+XJ@58p|1_jRvfEgz$XozU8#iJS})UM6VNI!3RUU!{5 zXB(+Eqd-E;cHQ>)`h0(HO_zLmzR3Tu-UGp;08YntWwMY-9i^w_u#wR?JxR2bky5j9 z3Sl-dQQU$xrO0xa&>vsiK`QN<$Yd%YXXM7*WOhnRdSFt5$aJux8QceC?lA0_if|s> ze{ad*opH_kb%M&~(~&UcX0nFGq^MqjxW?HJIP462v9XG>j(5Gat_)#SiNfahq2Mz2 zU`4uV8m$S~o9(W>mu*=h%Gs(Wz+%>h;R9Sg)jZ$q8vT1HxX3iQnh6&2rJ1u|j>^Qf`A76K%_ubL`Zu?h4`b=IyL>1!=*%!_K)=XC z6d}4R5L+sI50Q4P3upXQ3Z!~1ZXLlh!^UNcK6#QpYt-YC=^H=EPg3)z*wXo*024Q4b2sBCG4I# zlTFFY=kQ>xvR+LsuDUAk)q%5pEcqr(O_|^spjhtpb1#aC& zghXzGkGDC_XDa%t(X`E+kvKQ4zrQ*uuQoj>7@@ykWvF332)RO?%AA&Fsn&MNzmFa$ zWk&&^=NNjxLjrli_8ESU)}U|N{%j&TQmvY~lk!~Jh}*=^INA~&QB9em!in_X%Rl1&Kd~Z(u z9mra#<@vZQlOY+JYUwCrgoea4C8^(xv4ceCXcejq84TQ#sF~IU2V}LKc~Xlr_P=ry zl&Hh0exdCbVd^NPCqNNlxM3vA13EI8XvZ1H9#bT7y*U8Y{H8nwGpOR!e!!}*g;mJ#}T{ekSb}5zIPmye*If(}}_=PcuAW#yidAa^9-`<8Gr0 z)Fz=NiZ{)HAvw{Pl5uu)?)&i&Us$Cx4gE}cIJ}B4Xz~-q7)R_%owbP!z_V2=Aq%Rj z{V;7#kV1dNT9-6R+H}}(ED*_!F=~uz>&nR3gb^Ce%+0s#u|vWl<~JD3MvS0T9thdF zioIG3c#Sdsv;LdtRv3ml7%o$6LTVL>(H`^@TNg`2KPIk*8-IB}X!MT0`hN9Ddf7yN z?J=GxPL!uJ7lqwowsl?iRrh@#5C$%E&h~Z>XQcvFC*5%0RN-Opq|=IwX(dq(*sjs+ zqy99+v~m|6T#zR*e1AVxZ8djd5>eIeCi(b8sUk)OGjAsKSOg^-ugwl2WSL@d#?mdl zib0v*{u-?cq}dDGyZ%$XRY=UkQwt2oGu`zQneZh$=^! zj;!pCBWQNtvAcwcWIBM2y9!*W|8LmQy$H~5BEx)78J`4Z0(FJO2P^!YyQU{*Al+fs z){!4JvT1iLrJ8aU3k0t|P}{RN)_^v%$$r;+p0DY7N8CXzmS*HB*=?qaaF9D@#_$SN zSz{moAK<*RH->%r7xX~9gVW$l7?b|_SYI)gcjf0VAUJ%FcQP(TpBs; zg$25D!Ry_`8xpS_OJdeo$qh#7U+cepZ??TII7_%AXsT$B z=e)Bx#v%J0j``00Zk5hsvv6%T^*xGNx%KN-=pocSoqE5_R)OK%-Pbu^1MNzfds)mL zxz^F4lDKV9D&lEY;I+A)ui{TznB*CE$=9(wgE{m}`^<--OzV-5V4X2w9j(_!+jpTr zJvD*y6;39&T+==$F&tsRKM_lqa1HC}aGL0o`%c9mO=fts?36@8MGm7Vi{Y z^<7m$(EtdSr#22<(rm_(l_(`j!*Pu~Y>>xc>I9M#DJYDJNHO&4=HM%YLIp?;iR&$m z#_$ZWYLfGLt5FJZhr3jpYb`*%9S!zCG6ivNHYzNHcI%khtgHBliM^Ou}ZVD7ehU9 zS+W@AV=?Ro!=%AJ>Kcy9aU3%VX3|XM_K0A+ZaknKDyIS3S-Hw1C7&BSW5)sqj5Ye_ z4OSW7Yu-;bCyYKHFUk}<*<(@TH?YZPHr~~Iy%9@GR2Yd}J2!N9K&CN7Eq{Ka!jdu; zQNB*Y;i(7)OxZK%IHGt#Rt?z`I|A{q_BmoF!f^G}XVeTbe1Wnzh%1g>j}>DqFf;Rp zz7>xIs12@Ke0gr+4-!pmFP84vCIaTjqFNg{V`5}Rdt~xE^I;Bxp4)|cs8=f)1YwHz zqI`G~s2~qqDV+h02b`PQpUE#^^Aq8l%y2|ByQeXSADg5*qMprEAE3WFg0Q39`O+i1 z!J@iV!`Y~C$wJ!5Z+j5$i<1`+@)tBG$JL=!*uk=2k;T<@{|s1$YL079FvK%mPhyHV zP8^KGZnp`(hVMZ;s=n~3r2y;LTwcJwoBW-(ndU-$03{RD zh+Qn$ja_Z^OuMf3Ub|JTY74s&Am*(n{J3~@#OJNYuEVVJd9*H%)oFoRBkySGm`hx! zT3tG|+aAkXcx-2Apy)h^BkOyFTWQVeZ%e2@;*0DtlG9I3Et=PKaPt&K zw?WI7S;P)TWED7aSH$3hL@Qde?H#tzo^<(o_sv_2ci<7M?F$|oCFWc?7@KBj-;N$P zB;q!8@bW-WJY9do&y|6~mEruZAVe$!?{)N9rZZxD-|oltkhW9~nR8bLBGXw<632!l z*TYQn^NnUy%Ds}$f^=yQ+BM-a5X4^GHF=%PDrRfm_uqC zh{sKwIu|O0&jWb27;wzg4w5uA@TO_j(1X?8E>5Zfma|Ly7Bklq|s z9)H`zoAGY3n-+&JPrT!>u^qg9Evx4y@GI4$n-Uk_5wttU1_t?6><>}cZ-U+&+~JE) zPlDbO_j;MoxdLzMd~Ew|1o^a5q_1R*JZ=#XXMzg?6Zy!^hop}qoLQlJ{(%!KYt`MK z8umEN@Z4w!2=q_oe=;QttPCQy3Nm4F@x>@v4sz_jo{4m*0r%J(w1cSo;D_hQtJs7W z><$QrmG^+<$4{d2bgGo&3-FV}avg9zI|Rr(k{wTyl3!M1q+a zD9W{pCd%il*j&Ft z5H$nENf>>k$;SONGW`qo6`&qKs*T z2^RS)pXk9b@(_Fw1bkb)-oqK|v}r$L!W&aXA>IpcdNZ_vWE#XO8X`#Yp1+?RshVcd zknG%rPd*4ECEI0wD#@d+3NbHKxl}n^Sgkx==Iu%}HvNliOqVBqG?P2va zQ;kRJ$J6j;+wP9cS za#m;#GUT!qAV%+rdWolk+)6kkz4@Yh5LXP+LSvo9_T+MmiaP-eq6_k;)i6_@WSJ zlT@wK$zqHu<83U2V*yJ|XJU4farT#pAA&@qu)(PO^8PxEmPD4;Txpio+2)#!9 z>&=i7*#tc0`?!==vk>s7V+PL#S1;PwSY?NIXN2=Gu89x(cToFm))7L;< z+bhAbVD*bD=}iU`+PU+SBobTQ%S!=VL!>q$rfWsaaV}Smz>lO9JXT#`CcH_mRCSf4%YQAw`$^yY z3Y*^Nzk_g$xn7a_NO(2Eb*I=^;4f!Ra#Oo~LLjlcjke*k*o$~U#0ZXOQ5@HQ&T46l z7504MUgZkz2gNP1QFN8Y?nSEnEai^Rgyvl}xZfMUV6QrJcXp;jKGqB=D*tj{8(_pV zqyB*DK$2lgYGejmJUW)*s_Cv65sFf&pb(Yz8oWgDtQ0~k^0-wdF|tj}MOXaN@ydF8 zNr={U?=;&Z?wr^VC+`)S2xl}QFagy;$mG=TUs7Vi2wws5zEke4hTa2)>O0U?$WYsZ z<8bN2bB_N4AWd%+kncgknZ&}bM~eDtj#C5uRkp21hWW5gxWvc6b*4+dn<{c?w9Rmf zIVZKsPl{W2vQAlYO3yh}-{Os=YBnL8?uN5(RqfQ=-1cOiUnJu>KcLA*tQK3FU`_bM zM^T28w;nAj5EdAXFi&Kk1Nnl2)D!M{@+D-}bIEe+Lc4{s;YJc-{F#``iS2uk;2!Zp zF9#myUmO!wCeJIoi^A+T^e~20c+c2C}XltaR!|U-HfDA=^xF97ev}$l6#oY z&-&T{egB)&aV$3_aVA51XGiU07$s9vubh_kQG?F$FycvS6|IO!6q zq^>9|3U^*!X_C~SxX&pqUkUjz%!j=VlXDo$!2VLH!rKj@61mDpSr~7B2yy{>X~_nc zRI+7g2V&k zd**H++P9dg!-AOs3;GM`(g<+GRV$+&DdMVpUxY9I1@uK28$az=6oaa+PutlO9?6#? zf-OsgT>^@8KK>ggkUQRPPgC7zjKFR5spqQb3ojCHzj^(UH~v+!y*`Smv)VpVoPwa6 zWG18WJaPKMi*F6Zdk*kU^`i~NNTfn3BkJniC`yN98L-Awd)Z&mY? zprBW$!qL-OL7h@O#kvYnLsfff@kDIegt~?{-*5A7JrA;#TmTe?jICJqhub-G@e??D zqiV#g{)M!kW1-4SDel7TO{;@*h2=_76g3NUD@|c*WO#>MfYq6_YVUP+&8e4|%4T`w zXzhmVNziAHazWO2qXcaOu@R1MrPP{t)`N)}-1&~mq=ZH=w=;-E$IOk=y$dOls{6sRR`I5>|X zpq~XYW4sd;J^6OwOf**J>a7u$S>WTFPRkjY;BfVgQst)u4aMLR1|6%)CB^18XCz+r ztkYQ}G43j~Q&1em(_EkMv0|WEiKu;z2zhb(L%$F&xWwzOmk;VLBYAZ8lOCziNoPw1 zv2BOyXA`A8z^WH!nXhKXM`t0;6D*-uGds3TYGrm8SPnJJOQ^fJU#}@aIy@MYWz**H zvkp?7I5PE{$$|~{-ZaFxr6ZolP^nL##mHOErB^AqJqn^hFA=)HWj!m3WDaHW$C)i^ z9@6G$SzB=>jbe>4kqr#sF7#K}W*Cg-5y6kun3u&0L7BpXF9=#7IN8FOjWrWwUBZiU zT_se3ih-GBKx+Uw0N|CwP3D@-C=5(9T#BH@M`F2!Goiqx+Js5xC92|Sy0%WWWp={$(am!#l~f^W_oz78HX<0X#7 zp)p1u~M*o9W@O8P{0Qkg@Wa# z2{Heb&oX^CQSZWSFBXKOfE|tsAm#^U-WkDnU;IowZ`Ok4!mwHwH=s|AqZ^YD4!5!@ zPxJj+Bd-q6w_YG`z_+r;S86zwXb+EO&qogOq8h-Ect5(M2+>(O7n7)^dP*ws_3U6v zVsh)sk^@*c>)3EML|0<-YROho{lz@Nd4;R9gL{9|64xVL`n!m$-Jjrx?-Bacp!=^5 z1^T^eB{_)Y<9)y{-4Rz@9_>;_7h;5D+@QcbF4Wv7hu)s0&==&6u)33 zHRj+&Woq-vDvjwJCYES@$C4{$?f$Ibi4G()UeN11rgjF+^;YE^5nYprYoJNoudNj= zm1pXSeG64dcWHObUetodRn1Fw|1nI$D9z}dVEYT0lQnsf_E1x2vBLql7NrHH!n&Sq z6lc*mvU=WS6=v9Lrl}&zRiu_6u;6g%_DU{9b+R z#YHqX7`m9eydf?KlKu6Sb%j$%_jmydig`B*TN`cZL-g!R)iE?+Q5oOqBFKhx z%MW>BC^(F_JuG(ayE(MT{S3eI{cKiwOtPwLc0XO*{*|(JOx;uQOfq@lp_^cZo=FZj z4#}@e@dJ>Bn%2`2_WPeSN7si^{U#H=7N4o%Dq3NdGybrZgEU$oSm$hC)uNDC_M9xc zGzwh5Sg?mpBIE8lT2XsqTt3j3?We8}3bzLBTQd639vyg^$0#1epq8snlDJP2(BF)K zSx30RM+{f+b$g{9usIL8H!hCO117Xgv}ttPJm9wVRjPk;ePH@zxv%j9k5`TzdXLeT zFgFX`V7cYIcBls5WN0Pf6SMBN+;CrQ(|EsFd*xtwr#$R{Z9FP`OWtyNsq#mCgZ7+P z^Yn$haBJ)r96{ZJd8vlMl?IBxrgh=fdq_NF!1{jARCVz>jNdC)H^wfy?R94#MPdUjcYX>#wEx+LB#P-#4S-%YH>t-j+w zOFTI8gX$ard6fAh&g=u&56%3^-6E2tpk*wx3HSCQ+t7+*iOs zPk5ysqE}i*cQocFvA68xHfL|iX(C4h*67@3|5Qwle(8wT&!&{8*{f%0(5gH+m>$tq zp;AqrP7?XTEooYG1Dzfxc>W%*CyL16q|fQ0_jp%%Bk^k!i#Nbi(N9&T>#M{gez_Ws zYK=l}adalV(nH}I_!hNeb;tQFk3BHX7N}}R8%pek^E`X}%ou=cx8InPU1EE0|Hen- zyw8MoJqB5=)Z%JXlrdTXAE)eqLAdVE-=>wGHrkRet}>3Yu^lt$Kzu%$3#(ioY}@Gu zjk3BZuQH&~7H+C*uX^4}F*|P89JX;Hg2U!pt>rDi(n(Qe-c}tzb0#6_ItoR0->LSt zR~UT<-|@TO%O`M+_e_J4wx7^)5_%%u+J=yF_S#2Xd?C;Ss3N7KY^#-vx+|;bJX&8r zD?|MetfhdC;^2WG`7MCgs>TKKN=^=!x&Q~BzmQio_^l~LboTNT=I zC5pme^P@ER``p$2md9>4!K#vV-Fc1an7pl>_|&>aqP}+zqR?+~Z;f2^`a+-!Te%V? z;H2SbF>jP^GE(R1@%C==XQ@J=G9lKX+Z<@5}PO(EYkJh=GCv#)Nj{DkWJM2}F&oAZ6xu8&g7pn1ps2U5srwQ7CAK zN&*~@t{`31lUf`O;2w^)M3B@o)_mbRu{-`PrfNpF!R^q>yTR&ETS7^-b2*{-tZAZz zw@q5x9B5V8Qd7dZ!Ai$9hk%Q!wqbE1F1c96&zwBBaRW}(^axoPpN^4Aw}&a5dMe+*Gomky_l^54*rzXro$ z>LL)U5Ry>~FJi=*{JDc)_**c)-&faPz`6v`YU3HQa}pLtb5K)u%K+BOqXP0)rj5Au$zB zW1?vr?mDv7Fsxtsr+S6ucp2l#(4dnr9sD*v+@*>g#M4b|U?~s93>Pg{{a5|rm2xfI z`>E}?9S@|IoUX{Q1zjm5YJT|3S>&09D}|2~BiMo=z4YEjXlWh)V&qs;*C{`UMxp$9 zX)QB?G$fPD6z5_pNs>Jeh{^&U^)Wbr?2D6-q?)`*1k@!UvwQgl8eG$r+)NnFoT)L6 zg7lEh+E6J17krfYJCSjWzm67hEth24pomhz71|Qodn#oAILN)*Vwu2qpJirG)4Wnv}9GWOFrQg%Je+gNrPl8mw7ykE8{ z=|B4+uwC&bpp%eFcRU6{mxRV32VeH8XxX>v$du<$(DfinaaWxP<+Y97Z#n#U~V zVEu-GoPD=9$}P;xv+S~Ob#mmi$JQmE;Iz4(){y*9pFyW-jjgdk#oG$fl4o9E8bo|L zWjo4l%n51@Kz-n%zeSCD`uB?T%FVk+KBI}=ve zvlcS#wt`U6wrJo}6I6Rwb=1GzZfwE=I&Ne@p7*pH84XShXYJRgvK)UjQL%R9Zbm(m zxzTQsLTON$WO7vM)*vl%Pc0JH7WhP;$z@j=y#avW4X8iqy6mEYr@-}PW?H)xfP6fQ z&tI$F{NNct4rRMSHhaelo<5kTYq+(?pY)Ieh8*sa83EQfMrFupMM@nfEV@EmdHUv9 z35uzIrIuo4#WnF^_jcpC@uNNaYTQ~uZWOE6P@LFT^1@$o&q+9Qr8YR+ObBkpP9=F+$s5+B!mX2~T zAuQ6RenX?O{IlLMl1%)OK{S7oL}X%;!XUxU~xJN8xk z`xywS*naF(J#?vOpB(K=o~lE;m$zhgPWDB@=p#dQIW>xe_p1OLoWInJRKbEuoncf; zmS1!u-ycc1qWnDg5Nk2D)BY%jmOwCLC+Ny>`f&UxFowIsHnOXfR^S;&F(KXd{ODlm z$6#1ccqt-HIH9)|@fHnrKudu!6B$_R{fbCIkSIb#aUN|3RM>zuO>dpMbROZ`^hvS@ z$FU-;e4W}!ubzKrU@R*dW*($tFZ>}dd*4_mv)#O>X{U@zSzQt*83l9mI zI$8O<5AIDx`wo0}f2fsPC_l>ONx_`E7kdXu{YIZbp1$(^oBAH({T~&oQ&1{X951QW zmhHUxd)t%GQ9#ak5fTjk-cahWC;>^Rg7(`TVlvy0W@Y!Jc%QL3Ozu# zDPIqBCy&T2PWBj+d-JA-pxZlM=9ja2ce|3B(^VCF+a*MMp`(rH>Rt6W1$;r{n1(VK zLs>UtkT43LR2G$AOYHVailiqk7naz2yZGLo*xQs!T9VN5Q>eE(w zw$4&)&6xIV$IO^>1N-jrEUg>O8G4^@y+-hQv6@OmF@gy^nL_n1P1-Rtyy$Bl;|VcV zF=p*&41-qI5gG9UhKmmnjs932!6hceXa#-qfK;3d*a{)BrwNFeKU|ge?N!;zk+kB! zMD_uHJR#%b54c2tr~uGPLTRLg$`fupo}cRJeTwK;~}A>(Acy4k-Xk&Aa1&eWYS1ULWUj@fhBiWY$pdfy+F z@G{OG{*v*mYtH3OdUjwEr6%_ZPZ3P{@rfbNPQG!BZ7lRyC^xlMpWH`@YRar`tr}d> z#wz87t?#2FsH-jM6m{U=gp6WPrZ%*w0bFm(T#7m#v^;f%Z!kCeB5oiF`W33W5Srdt zdU?YeOdPG@98H7NpI{(uN{FJdu14r(URPH^F6tOpXuhU7T9a{3G3_#Ldfx_nT(Hec zo<1dyhsVsTw;ZkVcJ_0-h-T3G1W@q)_Q30LNv)W?FbMH+XJ* zy=$@39Op|kZv`Rt>X`zg&at(?PO^I=X8d9&myFEx#S`dYTg1W+iE?vt#b47QwoHI9 zNP+|3WjtXo{u}VG(lLUaW0&@yD|O?4TS4dfJI`HC-^q;M(b3r2;7|FONXphw-%7~* z&;2!X17|05+kZOpQ3~3!Nb>O94b&ZSs%p)TK)n3m=4eiblVtSx@KNFgBY_xV6ts;NF;GcGxMP8OKV^h6LmSb2E#Qnw ze!6Mnz7>lE9u{AgQ~8u2zM8CYD5US8dMDX-5iMlgpE9m*s+Lh~A#P1er*rF}GHV3h z=`STo?kIXw8I<`W0^*@mB1$}pj60R{aJ7>C2m=oghKyxMbFNq#EVLgP0cH3q7H z%0?L93-z6|+jiN|@v>ix?tRBU(v-4RV`}cQH*fp|)vd3)8i9hJ3hkuh^8dz{F5-~_ zUUr1T3cP%cCaTooM8dj|4*M=e6flH0&8ve32Q)0dyisl))XkZ7Wg~N}6y`+Qi2l+e zUd#F!nJp{#KIjbQdI`%oZ`?h=5G^kZ_uN`<(`3;a!~EMsWV|j-o>c?x#;zR2ktiB! z);5rrHl?GPtr6-o!tYd|uK;Vbsp4P{v_4??=^a>>U4_aUXPWQ$FPLE4PK$T^3Gkf$ zHo&9$U&G`d(Os6xt1r?sg14n)G8HNyWa^q8#nf0lbr4A-Fi;q6t-`pAx1T*$eKM*$ z|CX|gDrk#&1}>5H+`EjV$9Bm)Njw&7-ZR{1!CJTaXuP!$Pcg69`{w5BRHysB$(tWUes@@6aM69kb|Lx$%BRY^-o6bjH#0!7b;5~{6J+jKxU!Kmi# zndh@+?}WKSRY2gZ?Q`{(Uj|kb1%VWmRryOH0T)f3cKtG4oIF=F7RaRnH0Rc_&372={_3lRNsr95%ZO{IX{p@YJ^EI%+gvvKes5cY+PE@unghjdY5#9A!G z70u6}?zmd?v+{`vCu-53_v5@z)X{oPC@P)iA3jK$`r zSA2a7&!^zmUiZ82R2=1cumBQwOJUPz5Ay`RLfY(EiwKkrx%@YN^^XuET;tE zmr-6~I7j!R!KrHu5CWGSChO6deaLWa*9LLJbcAJsFd%Dy>a!>J`N)Z&oiU4OEP-!Ti^_!p}O?7`}i7Lsf$-gBkuY*`Zb z7=!nTT;5z$_5$=J=Ko+Cp|Q0J=%oFr>hBgnL3!tvFoLNhf#D0O=X^h+x08iB;@8pXdRHxX}6R4k@i6%vmsQwu^5z zk1ip`#^N)^#Lg#HOW3sPI33xqFB4#bOPVnY%d6prwxf;Y-w9{ky4{O6&94Ra8VN@K zb-lY;&`HtxW@sF!doT5T$2&lIvJpbKGMuDAFM#!QPXW87>}=Q4J3JeXlwHys?!1^#37q_k?N@+u&Ns20pEoBeZC*np;i;M{2C0Z4_br2gsh6eL z#8`#sn41+$iD?^GL%5?cbRcaa-Nx0vE(D=*WY%rXy3B%gNz0l?#noGJGP728RMY#q z=2&aJf@DcR?QbMmN)ItUe+VM_U!ryqA@1VVt$^*xYt~-qvW!J4Tp<-3>jT=7Zow5M z8mSKp0v4b%a8bxFr>3MwZHSWD73D@+$5?nZAqGM#>H@`)mIeC#->B)P8T$zh-Pxnc z8)~Zx?TWF4(YfKuF3WN_ckpCe5;x4V4AA3(i$pm|78{%!q?|~*eH0f=?j6i)n~Hso zmTo>vqEtB)`%hP55INf7HM@taH)v`Fw40Ayc*R!T?O{ziUpYmP)AH`euTK!zg9*6Z z!>M=$3pd0!&TzU=hc_@@^Yd3eUQpX4-33}b{?~5t5lgW=ldJ@dUAH%`l5US1y_`40 zs(X`Qk}vvMDYYq+@Rm+~IyCX;iD~pMgq^KY)T*aBz@DYEB={PxA>)mI6tM*sx-DmGQHEaHwRrAmNjO!ZLHO4b;;5mf@zzlPhkP($JeZGE7 z?^XN}Gf_feGoG~BjUgVa*)O`>lX=$BSR2)uD<9 z>o^|nb1^oVDhQbfW>>!;8-7<}nL6L^V*4pB=>wwW+RXAeRvKED(n1;R`A6v$6gy0I(;Vf?!4;&sgn7F%LpM}6PQ?0%2Z@b{It<(G1CZ|>913E0nR2r^Pa*Bp z@tFGi*CQ~@Yc-?{cwu1 zsilf=k^+Qs>&WZG(3WDixisHpR>`+ihiRwkL(3T|=xsoNP*@XX3BU8hr57l3k;pni zI``=3Nl4xh4oDj<%>Q1zYXHr%Xg_xrK3Nq?vKX3|^Hb(Bj+lONTz>4yhU-UdXt2>j z<>S4NB&!iE+ao{0Tx^N*^|EZU;0kJkx@zh}S^P{ieQjGl468CbC`SWnwLRYYiStXm zOxt~Rb3D{dz=nHMcY)#r^kF8|q8KZHVb9FCX2m^X*(|L9FZg!5a7((!J8%MjT$#Fs)M1Pb zq6hBGp%O1A+&%2>l0mpaIzbo&jc^!oN^3zxap3V2dNj3x<=TwZ&0eKX5PIso9j1;e zwUg+C&}FJ`k(M|%%}p=6RPUq4sT3-Y;k-<68ciZ~_j|bt>&9ZLHNVrp#+pk}XvM{8 z`?k}o-!if>hVlCP9j%&WI2V`5SW)BCeR5>MQhF)po=p~AYN%cNa_BbV6EEh_kk^@a zD>4&>uCGCUmyA-c)%DIcF4R6!>?6T~Mj_m{Hpq`*(wj>foHL;;%;?(((YOxGt)Bhx zuS+K{{CUsaC++%}S6~CJ=|vr(iIs-je)e9uJEU8ZJAz)w166q)R^2XI?@E2vUQ!R% zn@dxS!JcOimXkWJBz8Y?2JKQr>`~SmE2F2SL38$SyR1^yqj8_mkBp)o$@+3BQ~Mid z9U$XVqxX3P=XCKj0*W>}L0~Em`(vG<>srF8+*kPrw z20{z(=^w+ybdGe~Oo_i|hYJ@kZl*(9sHw#Chi&OIc?w`nBODp?ia$uF%Hs(X>xm?j zqZQ`Ybf@g#wli`!-al~3GWiE$K+LCe=Ndi!#CVjzUZ z!sD2O*;d28zkl))m)YN7HDi^z5IuNo3^w(zy8 zszJG#mp#Cj)Q@E@r-=NP2FVxxEAeOI2e=|KshybNB6HgE^(r>HD{*}S}mO>LuRGJT{*tfTzw_#+er-0${}%YPe@CMJ1Ng#j#)i)SnY@ss3gL;g zg2D~#Kpdfu#G;q1qz_TwSz1VJT(b3zby$Vk&;Y#1(A)|xj`_?i5YQ;TR%jice5E;0 zYHg;`zS5{S*9xI6o^j>rE8Ua*XhIw{_-*&@(R|C(am8__>+Ws&Q^ymy*X4~hR2b5r zm^p3sw}yv=tdyncy_Ui7{BQS732et~Z_@{-IhHDXAV`(Wlay<#hb>%H%WDi+K$862nA@BDtM#UCKMu+kM`!JHyWSi?&)A7_ z3{cyNG%a~nnH_!+;g&JxEMAmh-Z}rC!o7>OVzW&PoMyTA_g{hqXG)SLraA^OP**<7 zjWbr7z!o2n3hnx7A=2O=WL;`@9N{vQIM@&|G-ljrPvIuJHYtss0Er0fT5cMXNUf1B z7FAwBDixt0X7C3S)mPe5g`YtME23wAnbU)+AtV}z+e8G;0BP=bI;?(#|Ep!vVfDbK zvx+|CKF>yt0hWQ3drchU#XBU+HiuG*V^snFAPUp-5<#R&BUAzoB!aZ+e*KIxa26V}s6?nBK(U-7REa573wg-jqCg>H8~>O{ z*C0JL-?X-k_y%hpUFL?I>0WV{oV`Nb)nZbJG01R~AG>flIJf)3O*oB2i8~;!P?Wo_ z0|QEB*fifiL6E6%>tlAYHm2cjTFE@*<);#>689Z6S#BySQ@VTMhf9vYQyLeDg1*F} zjq>i1*x>5|CGKN{l9br3kB0EHY|k4{%^t7-uhjd#NVipUZa=EUuE5kS1_~qYX?>hJ z$}!jc9$O$>J&wnu0SgfYods^z?J4X;X7c77Me0kS-dO_VUQ39T(Kv(Y#s}Qqz-0AH z^?WRL(4RzpkD+T5FG_0NyPq-a-B7A5LHOCqwObRJi&oRi(<;OuIN7SV5PeHU$<@Zh zPozEV`dYmu0Z&Tqd>t>8JVde9#Pt+l95iHe$4Xwfy1AhI zDM4XJ;bBTTvRFtW>E+GzkN)9k!hA5z;xUOL2 zq4}zn-DP{qc^i|Y%rvi|^5k-*8;JZ~9a;>-+q_EOX+p1Wz;>i7c}M6Nv`^NY&{J-> z`(mzDJDM}QPu5i44**2Qbo(XzZ-ZDu%6vm8w@DUarqXj41VqP~ zs&4Y8F^Waik3y1fQo`bVUH;b=!^QrWb)3Gl=QVKr+6sxc=ygauUG|cm?|X=;Q)kQ8 zM(xrICifa2p``I7>g2R~?a{hmw@{!NS5`VhH8+;cV(F>B94M*S;5#O`YzZH1Z%yD? zZ61w(M`#aS-*~Fj;x|J!KM|^o;MI#Xkh0ULJcA?o4u~f%Z^16ViA27FxU5GM*rKq( z7cS~MrZ=f>_OWx8j#-Q3%!aEU2hVuTu(7`TQk-Bi6*!<}0WQi;_FpO;fhpL4`DcWp zGOw9vx0N~6#}lz(r+dxIGZM3ah-8qrqMmeRh%{z@dbUD2w15*_4P?I~UZr^anP}DB zU9CCrNiy9I3~d#&!$DX9e?A});BjBtQ7oGAyoI$8YQrkLBIH@2;lt4E^)|d6Jwj}z z&2_E}Y;H#6I4<10d_&P0{4|EUacwFHauvrjAnAm6yeR#}f}Rk27CN)vhgRqEyPMMS7zvunj2?`f;%?alsJ+-K+IzjJx>h8 zu~m_y$!J5RWAh|C<6+uiCNsOKu)E72M3xKK(a9Okw3e_*O&}7llNV!=P87VM2DkAk zci!YXS2&=P0}Hx|wwSc9JP%m8dMJA*q&VFB0yMI@5vWoAGraygwn){R+Cj6B1a2Px z5)u(K5{+;z2n*_XD!+Auv#LJEM)(~Hx{$Yb^ldQmcYF2zNH1V30*)CN_|1$v2|`LnFUT$%-tO0Eg|c5$BB~yDfzS zcOXJ$wpzVK0MfTjBJ0b$r#_OvAJ3WRt+YOLlJPYMx~qp>^$$$h#bc|`g0pF-Ao43? z>*A+8lx>}L{p(Tni2Vvk)dtzg$hUKjSjXRagj)$h#8=KV>5s)J4vGtRn5kP|AXIz! zPgbbVxW{2o4s-UM;c#We8P&mPN|DW7_uLF!a|^0S=wr6Esx9Z$2|c1?GaupU6$tb| zY_KU`(_29O_%k(;>^|6*pZURH3`@%EuKS;Ns z1lujmf;r{qAN&Q0&m{wJSZ8MeE7RM5+Sq;ul_ z`+ADrd_Um+G37js6tKsArNB}n{p*zTUxQr>3@wA;{EUbjNjlNd6$Mx zg0|MyU)v`sa~tEY5$en7^PkC=S<2@!nEdG6L=h(vT__0F=S8Y&eM=hal#7eM(o^Lu z2?^;05&|CNliYrq6gUv;|i!(W{0N)LWd*@{2q*u)}u*> z7MQgk6t9OqqXMln?zoMAJcc zMKaof_Up})q#DzdF?w^%tTI7STI^@8=Wk#enR*)&%8yje>+tKvUYbW8UAPg55xb70 zEn5&Ba~NmOJlgI#iS8W3-@N%>V!#z-ZRwfPO1)dQdQkaHsiqG|~we2ALqG7Ruup(DqSOft2RFg_X%3w?6VqvV1uzX_@F(diNVp z4{I|}35=11u$;?|JFBEE*gb;T`dy+8gWJ9~pNsecrO`t#V9jW-6mnfO@ff9od}b(3s4>p0i30gbGIv~1@a^F2kl7YO;DxmF3? zWi-RoXhzRJV0&XE@ACc?+@6?)LQ2XNm4KfalMtsc%4!Fn0rl zpHTrHwR>t>7W?t!Yc{*-^xN%9P0cs0kr=`?bQ5T*oOo&VRRu+1chM!qj%2I!@+1XF z4GWJ=7ix9;Wa@xoZ0RP`NCWw0*8247Y4jIZ>GEW7zuoCFXl6xIvz$ezsWgKdVMBH> z{o!A7f;R-@eK9Vj7R40xx)T<2$?F2E<>Jy3F;;=Yt}WE59J!1WN367 zA^6pu_zLoZIf*x031CcwotS{L8bJE(<_F%j_KJ2P_IusaZXwN$&^t716W{M6X2r_~ zaiMwdISX7Y&Qi&Uh0upS3TyEIXNDICQlT5fHXC`aji-c{U(J@qh-mWl-uMN|T&435 z5)a1dvB|oe%b2mefc=Vpm0C%IUYYh7HI*;3UdgNIz}R##(#{(_>82|zB0L*1i4B5j-xi9O4x10rs_J6*gdRBX=@VJ+==sWb&_Qc6tSOowM{BX@(zawtjl zdU!F4OYw2@Tk1L^%~JCwb|e#3CC>srRHQ*(N%!7$Mu_sKh@|*XtR>)BmWw!;8-mq7 zBBnbjwx8Kyv|hd*`5}84flTHR1Y@@uqjG`UG+jN_YK&RYTt7DVwfEDXDW4U+iO{>K zw1hr{_XE*S*K9TzzUlJH2rh^hUm2v7_XjwTuYap|>zeEDY$HOq3X4Tz^X}E9z)x4F zs+T?Ed+Hj<#jY-`Va~fT2C$=qFT-5q$@p9~0{G&eeL~tiIAHXA!f6C(rAlS^)&k<- zXU|ZVs}XQ>s5iONo~t!XXZgtaP$Iau;JT%h)>}v54yut~pykaNye4axEK#5@?TSsQ zE;Jvf9I$GVb|S`7$pG)4vgo9NXsKr?u=F!GnA%VS2z$@Z(!MR9?EPcAqi5ft)Iz6sNl`%kj+_H-X`R<>BFrBW=fSlD|{`D%@Rcbu2?%>t7i34k?Ujb)2@J-`j#4 zLK<69qcUuniIan-$A1+fR=?@+thwDIXtF1Tks@Br-xY zfB+zblrR(ke`U;6U~-;p1Kg8Lh6v~LjW@9l2P6s+?$2!ZRPX`(ZkRGe7~q(4&gEi<$ch`5kQ?*1=GSqkeV z{SA1EaW_A!t{@^UY2D^YO0(H@+kFVzZaAh0_`A`f(}G~EP~?B|%gtxu&g%^x{EYSz zk+T;_c@d;+n@$<>V%P=nk36?L!}?*=vK4>nJSm+1%a}9UlmTJTrfX4{Lb7smNQn@T zw9p2%(Zjl^bWGo1;DuMHN(djsEm)P8mEC2sL@KyPjwD@d%QnZ$ zMJ3cnn!_!iP{MzWk%PI&D?m?C(y2d|2VChluN^yHya(b`h>~GkI1y;}O_E57zOs!{ zt2C@M$^PR2U#(dZmA-sNreB@z-yb0Bf7j*yONhZG=onhx>t4)RB`r6&TP$n zgmN*)eCqvgriBO-abHQ8ECN0bw?z5Bxpx z=jF@?zFdVn?@gD5egM4o$m`}lV(CWrOKKq(sv*`mNcHcvw&Xryfw<{ch{O&qc#WCTXX6=#{MV@q#iHYba!OUY+MGeNTjP%Fj!WgM&`&RlI^=AWTOqy-o zHo9YFt!gQ*p7{Fl86>#-JLZo(b^O`LdFK~OsZBRR@6P?ad^Ujbqm_j^XycM4ZHFyg ziUbIFW#2tj`65~#2V!4z7DM8Z;fG0|APaQ{a2VNYpNotB7eZ5kp+tPDz&Lqs0j%Y4tA*URpcfi z_M(FD=fRGdqf430j}1z`O0I=;tLu81bwJXdYiN7_&a-?ly|-j*+=--XGvCq#32Gh(=|qj5F?kmihk{%M&$}udW5)DHK zF_>}5R8&&API}o0osZJRL3n~>76nUZ&L&iy^s>PMnNcYZ|9*1$v-bzbT3rpWsJ+y{ zPrg>5Zlery96Um?lc6L|)}&{992{_$J&=4%nRp9BAC6!IB=A&=tF>r8S*O-=!G(_( zwXbX_rGZgeiK*&n5E;f=k{ktyA1(;x_kiMEt0*gpp_4&(twlS2e5C?NoD{n>X2AT# zY@Zp?#!b1zNq96MQqeO*M1MMBin5v#RH52&Xd~DO6-BZLnA6xO1$sou(YJ1Dlc{WF zVa%2DyYm`V#81jP@70IJ;DX@y*iUt$MLm)ByAD$eUuji|5{ptFYq(q)mE(5bOpxjM z^Q`AHWq44SG3`_LxC9fwR)XRVIp=B%<(-lOC3jI#bb@dK(*vjom!=t|#<@dZql%>O z15y^{4tQoeW9Lu%G&V$90x6F)xN6y_oIn;!Q zs)8jT$;&;u%Y>=T3hg34A-+Y*na=|glcStr5D;&5*t5*DmD~x;zQAV5{}Ya`?RRGa zT*t9@$a~!co;pD^!J5bo?lDOWFx%)Y=-fJ+PDGc0>;=q=s?P4aHForSB+)v0WY2JH z?*`O;RHum6j%#LG)Vu#ciO#+jRC3!>T(9fr+XE7T2B7Z|0nR5jw@WG)kDDzTJ=o4~ zUpeyt7}_nd`t}j9BKqryOha{34erm)RmST)_9Aw)@ zHbiyg5n&E{_CQR@h<}34d7WM{s{%5wdty1l+KX8*?+-YkNK2Be*6&jc>@{Fd;Ps|| z26LqdI3#9le?;}risDq$K5G3yoqK}C^@-8z^wj%tdgw-6@F#Ju{Sg7+y)L?)U$ez> zoOaP$UFZ?y5BiFycir*pnaAaY+|%1%8&|(@VB)zweR%?IidwJyK5J!STzw&2RFx zZV@qeaCB01Hu#U9|1#=Msc8Pgz5P*4Lrp!Q+~(G!OiNR{qa7|r^H?FC6gVhkk3y7=uW#Sh;&>78bZ}aK*C#NH$9rX@M3f{nckYI+5QG?Aj1DM)@~z_ zw!UAD@gedTlePB*%4+55naJ8ak_;))#S;4ji!LOqY5VRI){GMwHR~}6t4g>5C_#U# ztYC!tjKjrKvRy=GAsJVK++~$|+s!w9z3H4G^mACv=EErXNSmH7qN}%PKcN|8%9=i)qS5+$L zu&ya~HW%RMVJi4T^pv?>mw*Gf<)-7gf#Qj|e#w2|v4#t!%Jk{&xlf;$_?jW*n!Pyx zkG$<18kiLOAUPuFfyu-EfWX%4jYnjBYc~~*9JEz6oa)_R|8wjZA|RNrAp%}14L7fW zi7A5Wym*K+V8pkqqO-X#3ft{0qs?KVt^)?kS>AicmeO&q+~J~ zp0YJ_P~_a8j= zsAs~G=8F=M{4GZL{|B__UorX@MRNQLn?*_gym4aW(~+i13knnk1P=khoC-ViMZk+x zLW(l}oAg1H`dU+Fv**;qw|ANDSRs>cGqL!Yw^`; zv;{E&8CNJcc)GHzTYM}f&NPw<6j{C3gaeelU#y!M)w-utYEHOCCJo|Vgp7K6C_$14 zqIrLUB0bsgz^D%V%fbo2f9#yb#CntTX?55Xy|Kps&Xek*4_r=KDZ z+`TQuv|$l}MWLzA5Ay6Cvsa^7xvwXpy?`w(6vx4XJ zWuf1bVSb#U8{xlY4+wlZ$9jjPk)X_;NFMqdgq>m&W=!KtP+6NL57`AMljW+es zzqjUjgz;V*kktJI?!NOg^s_)ph45>4UDA!Vo0hn>KZ+h-3=?Y3*R=#!fOX zP$Y~+14$f66ix?UWB_6r#fMcC^~X4R-<&OD1CSDNuX~y^YwJ>sW0j`T<2+3F9>cLo z#!j57$ll2K9(%$4>eA7(>FJX5e)pR5&EZK!IMQzOfik#FU*o*LGz~7u(8}XzIQRy- z!U7AlMTIe|DgQFmc%cHy_9^{o`eD%ja_L>ckU6$O4*U**o5uR7`FzqkU8k4gxtI=o z^P^oGFPm5jwZMI{;nH}$?p@uV8FT4r=|#GziKXK07bHJLtK}X%I0TON$uj(iJ`SY^ zc$b2CoxCQ>7LH@nxcdW&_C#fMYBtTxcg46dL{vf%EFCZ~eErMvZq&Z%Lhumnkn^4A zsx$ay(FnN7kYah}tZ@0?-0Niroa~13`?hVi6`ndno`G+E8;$<6^gsE-K3)TxyoJ4M zb6pj5=I8^FD5H@`^V#Qb2^0cx7wUz&cruA5g>6>qR5)O^t1(-qqP&1g=qvY#s&{bx zq8Hc%LsbK1*%n|Y=FfojpE;w~)G0-X4i*K3{o|J7`krhIOd*c*$y{WIKz2n2*EXEH zT{oml3Th5k*vkswuFXdGDlcLj15Nec5pFfZ*0?XHaF_lVuiB%Pv&p7z)%38}%$Gup zVTa~C8=cw%6BKn_|4E?bPNW4PT7}jZQLhDJhvf4z;~L)506IE0 zX!tWXX(QOQPRj-p80QG79t8T2^az4Zp2hOHziQlvT!|H)jv{Ixodabzv6lBj)6WRB z{)Kg@$~~(7$-az?lw$4@L%I&DI0Lo)PEJJziWP33a3azb?jyXt1v0N>2kxwA6b%l> zZqRpAo)Npi&loWbjFWtEV)783BbeIAhqyuc+~>i7aQ8shIXt)bjCWT6$~ro^>99G} z2XfmT0(|l!)XJb^E!#3z4oEGIsL(xd; zYX1`1I(cG|u#4R4T&C|m*9KB1`UzKvho5R@1eYtUL9B72{i(ir&ls8g!pD ztR|25xGaF!4z5M+U@@lQf(12?xGy`!|3E}7pI$k`jOIFjiDr{tqf0va&3pOn6Pu)% z@xtG2zjYuJXrV)DUrIF*y<1O1<$#54kZ#2;=X51J^F#0nZ0(;S$OZDt_U2bx{RZ=Q zMMdd$fH|!s{ zXq#l;{`xfV`gp&C>A`WrQU?d{!Ey5(1u*VLJt>i27aZ-^&2IIk=zP5p+{$q(K?2(b z8?9h)kvj9SF!Dr zoyF}?V|9;6abHxWk2cEvGs$-}Pg}D+ZzgkaN&$Snp%;5m%zh1E#?Wac-}x?BYlGN#U#Mek*}kek#I9XaHt?mz3*fDrRTQ#&#~xyeqJk1QJ~E$7qsw6 z?sV;|?*=-{M<1+hXoj?@-$y+(^BJ1H~wQ9G8C0#^aEAyhDduNX@haoa=PuPp zYsGv8UBfQaRHgBgLjmP^eh>fLMeh{8ic)?xz?#3kX-D#Z{;W#cd_`9OMFIaJg-=t`_3*!YDgtNQ2+QUEAJB9M{~AvT$H`E)IKmCR21H532+ata8_i_MR@ z2Xj<3w<`isF~Ah$W{|9;51ub*f4#9ziKrOR&jM{x7I_7()O@`F*5o$KtZ?fxU~g`t zUovNEVKYn$U~VX8eR)qb`7;D8pn*Pp$(otYTqL)5KH$lUS-jf}PGBjy$weoceAcPp z&5ZYB$r&P$MN{0H0AxCe4Qmd3T%M*5d4i%#!nmBCN-WU-4m4Tjxn-%j3HagwTxCZ9 z)j5vO-C7%s%D!&UfO>bi2oXiCw<-w{vVTK^rVbv#W=WjdADJy8$khnU!`ZWCIU`># zyjc^1W~pcu>@lDZ{zr6gv%)2X4n27~Ve+cQqcND%0?IFSP4sH#yIaXXYAq^z3|cg` z`I3$m%jra>e2W-=DiD@84T!cb%||k)nPmEE09NC%@PS_OLhkrX*U!cgD*;;&gIaA(DyVT4QD+q_xu z>r`tg{hiGY&DvD-)B*h+YEd+Zn)WylQl}<4>(_NlsKXCRV;a)Rcw!wtelM2_rWX`j zTh5A|i6=2BA(iMCnj_fob@*eA;V?oa4Z1kRBGaU07O70fb6-qmA$Hg$ps@^ka1=RO zTbE_2#)1bndC3VuK@e!Sftxq4=Uux}fDxXE#Q5_x=E1h>T5`DPHz zbH<_OjWx$wy7=%0!mo*qH*7N4tySm+R0~(rbus`7;+wGh;C0O%x~fEMkt!eV>U$`i z5>Q(o z=t$gPjgGh0&I7KY#k50V7DJRX<%^X z>6+ebc9efB3@eE2Tr){;?_w`vhgF>`-GDY(YkR{9RH(MiCnyRtd!LxXJ75z+?2 zGi@m^+2hKJ5sB1@Xi@s_@p_Kwbc<*LQ_`mr^Y%j}(sV_$`J(?_FWP)4NW*BIL~sR>t6 zM;qTJZ~GoY36&{h-Pf}L#y2UtR}>ZaI%A6VkU>vG4~}9^i$5WP2Tj?Cc}5oQxe2=q z8BeLa$hwCg_psjZyC2+?yX4*hJ58Wu^w9}}7X*+i5Rjqu5^@GzXiw#SUir1G1`jY% zOL=GE_ENYxhcyUrEt9XlMNP6kx6h&%6^u3@zB8KUCAa18T(R2J`%JjWZ z!{7cXaEW+Qu*iJPu+m>QqW}Lo$4Z+!I)0JNzZ&_M%=|B1yejFRM04bGAvu{=lNPd+ zJRI^DRQ(?FcVUD+bgEcAi@o(msqys9RTCG#)TjI!9~3-dc`>gW;HSJuQvH~d`MQs86R$|SKXHh zqS9Qy)u;T`>>a!$LuaE2keJV%;8g)tr&Nnc;EkvA-RanHXsy)D@XN0a>h}z2j81R; zsUNJf&g&rKpuD0WD@=dDrPHdBoK42WoBU|nMo17o(5^;M|dB4?|FsAGVrSyWcI`+FVw^vTVC`y}f(BwJl zrw3Sp151^9=}B})6@H*i4-dIN_o^br+BkcLa^H56|^2XsT0dESw2 zMX>(KqNl=x2K5=zIKg}2JpGAZu{I_IO}0$EQ5P{4zol**PCt3F4`GX}2@vr8#Y)~J zKb)gJeHcFnR@4SSh%b;c%J`l=W*40UPjF#q{<}ywv-=vHRFmDjv)NtmC zQx9qm)d%0zH&qG7AFa3VAU1S^(n8VFTC~Hb+HjYMjX8r#&_0MzlNR*mnLH5hi}`@{ zK$8qiDDvS_(L9_2vHgzEQ${DYSE;DqB!g*jhJghE&=LTnbgl&Xepo<*uRtV{2wDHN z)l;Kg$TA>Y|K8Lc&LjWGj<+bp4Hiye_@BfU(y#nF{fpR&|Ltbye?e^j0}8JC4#xi% zv29ZR%8%hk=3ZDvO-@1u8KmQ@6p%E|dlHuy#H1&MiC<*$YdLkHmR#F3ae;bKd;@*i z2_VfELG=B}JMLCO-6UQy^>RDE%K4b>c%9ki`f~Z2Qu8hO7C#t%Aeg8E%+}6P7Twtg z-)dj(w}_zFK&86KR@q9MHicUAucLVshUdmz_2@32(V`y3`&Kf8Q2I)+!n0mR=rrDU zXvv^$ho;yh*kNqJ#r1}b0|i|xRUF6;lhx$M*uG3SNLUTC@|htC z-=fsw^F%$qqz4%QdjBrS+ov}Qv!z00E+JWas>p?z@=t!WWU3K*?Z(0meTuTOC7OTx zU|kFLE0bLZ+WGcL$u4E}5dB0g`h|uwv3=H6f+{5z9oLv-=Q45+n~V4WwgO=CabjM% zBAN+RjM65(-}>Q2V#i1Na@a0`08g&y;W#@sBiX6Tpy8r}*+{RnyGUT`?XeHSqo#|J z^ww~c;ou|iyzpErDtlVU=`8N7JSu>4M z_pr9=tX0edVn9B}YFO2y(88j#S{w%E8vVOpAboK*27a7e4Ekjt0)hIX99*1oE;vex z7#%jhY=bPijA=Ce@9rRO(Vl_vnd00!^TAc<+wVvRM9{;hP*rqEL_(RzfK$er_^SN; z)1a8vo8~Dr5?;0X0J62Cusw$A*c^Sx1)dom`-)Pl7hsW4i(r*^Mw`z5K>!2ixB_mu z*Ddqjh}zceRFdmuX1akM1$3>G=#~|y?eYv(e-`Qy?bRHIq=fMaN~fB zUa6I8Rt=)jnplP>yuS+P&PxeWpJ#1$F`iqRl|jF$WL_aZFZl@kLo&d$VJtu&w?Q0O zzuXK>6gmygq(yXJy0C1SL}T8AplK|AGNUOhzlGeK_oo|haD@)5PxF}rV+5`-w{Aag zus45t=FU*{LguJ11Sr-28EZkq;!mJO7AQGih1L4rEyUmp>B!%X0YemsrV3QFvlgt* z5kwlPzaiJ+kZ^PMd-RRbl(Y?F*m`4*UIhIuf#8q>H_M=fM*L_Op-<_r zBZagV=4B|EW+KTja?srADTZXCd3Yv%^Chfpi)cg{ED${SI>InNpRj5!euKv?=Xn92 zsS&FH(*w`qLIy$doc>RE&A5R?u zzkl1sxX|{*fLpXvIW>9d<$ePROttn3oc6R!sN{&Y+>Jr@yeQN$sFR z;w6A<2-0%UA?c8Qf;sX7>>uKRBv3Ni)E9pI{uVzX|6Bb0U)`lhLE3hK58ivfRs1}d zNjlGK0hdq0qjV@q1qI%ZFMLgcpWSY~mB^LK)4GZ^h_@H+3?dAe_a~k*;9P_d7%NEFP6+ zgV(oGr*?W(ql?6SQ~`lUsjLb%MbfC4V$)1E0Y_b|OIYxz4?O|!kRb?BGrgiH5+(>s zoqM}v*;OBfg-D1l`M6T6{K`LG+0dJ1)!??G5g(2*vlNkm%Q(MPABT$r13q?|+kL4- zf)Mi5r$sn;u41aK(K#!m+goyd$c!KPl~-&-({j#D4^7hQkV3W|&>l_b!}!z?4($OA z5IrkfuT#F&S1(`?modY&I40%gtroig{YMvF{K{>5u^I51k8RriGd${z)=5k2tG zM|&Bp5kDTfb#vfuTTd?)a=>bX=lokw^y9+2LS?kwHQIWI~pYgy7 zb?A-RKVm_vM5!9?C%qYdfRAw& zAU7`up~%g=p@}pg#b7E)BFYx3g%(J36Nw(Dij!b>cMl@CSNbrW!DBDbTD4OXk!G4x zi}JBKc8HBYx$J~31PXH+4^x|UxK~(<@I;^3pWN$E=sYma@JP|8YL`L(zI6Y#c%Q{6 z*APf`DU$S4pr#_!60BH$FGViP14iJmbrzSrOkR;f3YZa{#E7Wpd@^4E-zH8EgPc-# zKWFPvh%WbqU_%ZEt`=Q?odKHc7@SUmY{GK`?40VuL~o)bS|is$Hn=<=KGHOsEC5tB zFb|q}gGlL97NUf$G$>^1b^3E18PZ~Pm9kX%*ftnolljiEt@2#F2R5ah$zbXd%V_Ev zyDd{1o_uuoBga$fB@Fw!V5F3jIr=a-ykqrK?WWZ#a(bglI_-8pq74RK*KfQ z0~Dzus7_l;pMJYf>Bk`)`S8gF!To-BdMnVw5M-pyu+aCiC5dwNH|6fgRsIKZcF&)g zr}1|?VOp}I3)IR@m1&HX1~#wsS!4iYqES zK}4J{Ei>;e3>LB#Oly>EZkW14^@YmpbgxCDi#0RgdM${&wxR+LiX}B+iRioOB0(pDKpVEI;ND?wNx>%e|m{RsqR_{(nmQ z3ZS}@t!p4a(BKx_-CYwrcyJ5u1TO9bcXti$8sy>xcLKqKCc#~UOZYD{llKTSFEjJ~ zyNWt>tLU}*>^`TvPxtP%F`ZJQw@W0^>x;!^@?k_)9#bF$j0)S3;mH-IR5y82l|%=F z2lR8zhP?XNP-ucZZ6A+o$xOyF!w;RaLHGh57GZ|TCXhJqY~GCh)aXEV$1O&$c}La1 zjuJxkY9SM4av^Hb;i7efiYaMwI%jGy`3NdY)+mcJhF(3XEiSlU3c|jMBi|;m-c?~T z+x0_@;SxcoY=(6xNgO$bBt~Pj8`-<1S|;Bsjrzw3@zSjt^JC3X3*$HI79i~!$RmTz zsblZsLYs7L$|=1CB$8qS!tXrWs!F@BVuh?kN(PvE5Av-*r^iYu+L^j^m9JG^#=m>@ z=1soa)H*w6KzoR$B8mBCXoU;f5^bVuwQ3~2LKg!yxomG1#XPmn(?YH@E~_ED+W6mxs%x{%Z<$pW`~ON1~2XjP5v(0{C{+6Dm$00tsd3w=f=ZENy zOgb-=f}|Hb*LQ$YdWg<(u7x3`PKF)B7ZfZ6;1FrNM63 z?O6tE%EiU@6%rVuwIQjvGtOofZBGZT1Sh(xLIYt9c4VI8`!=UJd2BfLjdRI#SbVAX ziT(f*RI^T!IL5Ac>ql7uduF#nuCRJ1)2bdvAyMxp-5^Ww5p#X{rb5)(X|fEhDHHW{ zw(Lfc$g;+Q`B0AiPGtmK%*aWfQQ$d!*U<|-@n2HZvCWSiw^I>#vh+LyC;aaVWGbmkENr z&kl*8o^_FW$T?rDYLO1Pyi%>@&kJKQoH2E0F`HjcN}Zlnx1ddoDA>G4Xu_jyp6vuT zPvC}pT&Owx+qB`zUeR|4G;OH(<<^_bzkjln0k40t`PQxc$7h(T8Ya~X+9gDc8Z9{Z z&y0RAU}#_kQGrM;__MK9vwIwK^aoqFhk~dK!ARf1zJqHMxF2?7-8|~yoO@_~Ed;_wvT%Vs{9RK$6uUQ|&@#6vyBsFK9eZW1Ft#D2)VpQRwpR(;x^ zdoTgMqfF9iBl%{`QDv7B0~8{8`8k`C4@cbZAXBu00v#kYl!#_Wug{)2PwD5cNp?K^ z9+|d-4z|gZ!L{57>!Ogfbzchm>J1)Y%?NThxIS8frAw@z>Zb9v%3_3~F@<=LG%r*U zaTov}{{^z~SeX!qgSYow`_5)ij*QtGp4lvF`aIGQ>@3ZTkDmsl#@^5*NGjOuu82}o zzLF~Q9SW+mP=>88%eSA1W4_W7-Q>rdq^?t=m6}^tDPaBRGFLg%ak93W!kOp#EO{6& zP%}Iff5HZQ9VW$~+9r=|Quj#z*=YwcnssS~9|ub2>v|u1JXP47vZ1&L1O%Z1DsOrDfSIMHU{VT>&>H=9}G3i@2rP+rx@eU@uE8rJNec zij~#FmuEBj03F1~ct@C@$>y)zB+tVyjV3*n`mtAhIM0$58vM9jOQC}JJOem|EpwqeMuYPxu3sv}oMS?S#o6GGK@8PN59)m&K4Dc&X% z(;XL_kKeYkafzS3Wn5DD>Yiw{LACy_#jY4op(>9q>>-*9@C0M+=b#bknAWZ37^(Ij zq>H%<@>o4a#6NydoF{_M4i4zB_KG)#PSye9bk0Ou8h%1Dtl7Q_y#7*n%g)?m>xF~( zjqvOwC;*qvN_3(*a+w2|ao0D?@okOvg8JskUw(l7n`0fncglavwKd?~l_ryKJ^Ky! zKCHkIC-o7%fFvPa$)YNh022lakMar^dgL=t#@XLyNHHw!b?%WlM)R@^!)I!smZL@k zBi=6wE5)2v&!UNV(&)oOYW(6Qa!nUjDKKBf-~Da=#^HE4(@mWk)LPvhyN3i4goB$3K8iV7uh zsv+a?#c4&NWeK(3AH;ETrMOIFgu{_@%XRwCZ;L=^8Ts)hix4Pf3yJRQ<8xb^CkdmC z?c_gB)XmRsk`9ch#tx4*hO=#qS7={~Vb4*tTf<5P%*-XMfUUYkI9T1cEF;ObfxxI-yNuA=I$dCtz3ey znVkctYD*`fUuZ(57+^B*R=Q}~{1z#2!ca?)+YsRQb+lt^LmEvZt_`=j^wqig+wz@n@ z`LIMQJT3bxMzuKg8EGBU+Q-6cs5(@5W?N>JpZL{$9VF)veF`L5%DSYTNQEypW%6$u zm_~}T{HeHj1bAlKl8ii92l9~$dm=UM21kLemA&b$;^!wB7#IKWGnF$TVq!!lBlG4 z{?Rjz?P(uvid+|i$VH?`-C&Gcb3{(~Vpg`w+O);Wk1|Mrjxrht0GfRUnZqz2MhrXa zqgVC9nemD5)H$to=~hp)c=l9?#~Z_7i~=U-`FZxb-|TR9@YCxx;Zjo-WpMNOn2)z) zFPGGVl%3N$f`gp$gPnWC+f4(rmts%fidpo^BJx72zAd7|*Xi{2VXmbOm)1`w^tm9% znM=0Fg4bDxH5PxPEm{P3#A(mxqlM7SIARP?|2&+c7qmU8kP&iApzL|F>Dz)Ixp_`O zP%xrP1M6@oYhgo$ZWwrAsYLa4 z|I;DAvJxno9HkQrhLPQk-8}=De{9U3U%)dJ$955?_AOms!9gia%)0E$Mp}$+0er@< zq7J&_SzvShM?e%V?_zUu{niL@gt5UFOjFJUJ}L?$f%eU%jUSoujr{^O=?=^{19`ON zlRIy8Uo_nqcPa6@yyz`CM?pMJ^^SN^Fqtt`GQ8Q#W4kE7`V9^LT}j#pMChl!j#g#J zr-=CCaV%xyFeQ9SK+mG(cTwW*)xa(eK;_Z(jy)woZp~> zA(4}-&VH+TEeLzPTqw&FOoK(ZjD~m{KW05fiGLe@E3Z2`rLukIDahE*`u!ubU)9`o zn^-lyht#E#-dt~S>}4y$-mSbR8{T@}22cn^refuQ08NjLOv?JiEWjyOnzk<^R5%gO zhUH_B{oz~u#IYwVnUg8?3P*#DqD8#X;%q%HY**=I>>-S|!X*-!x1{^l#OnR56O>iD zc;i;KS+t$koh)E3)w0OjWJl_aW2;xF=9D9Kr>)(5}4FqUbk# zI#$N8o0w;IChL49m9CJTzoC!|u{Ljd%ECgBOf$}&jA^$(V#P#~)`&g`H8E{uv52pp zwto`xUL-L&WTAVREEm$0g_gYPL(^vHq(*t1WCH_6alhkeW&GCZ3hL)|{O-jiFOBrF z!EW=Jej|dqQitT6!B-7&io2K)WIm~Q)v@yq%U|VpV+I?{y0@Yd%n8~-NuuM*pM~KA z85YB};IS~M(c<}4Hxx>qRK0cdl&e?t253N%vefkgds>Ubn8X}j6Vpgs>a#nFq$osY z1ZRwLqFv=+BTb=i%D2Wv>_yE0z}+niZ4?rE|*a3d7^kndWGwnFqt+iZ(7+aln<}jzbAQ(#Z2SS}3S$%Bd}^ zc9ghB%O)Z_mTZMRC&H#)I#fiLuIkGa^`4e~9oM5zKPx?zjkC&Xy0~r{;S?FS%c7w< zWbMpzc(xSw?9tGxG~_l}Acq}zjt5ClaB7-!vzqnlrX;}$#+PyQ9oU)_DfePh2E1<7 ztok6g6K^k^DuHR*iJ?jw?bs_whk|bx`dxu^nC6#e{1*m~z1eq7m}Cf$*^Eua(oi_I zAL+3opNhJteu&mWQ@kQWPucmiP)4|nFG`b2tpC;h{-PI@`+h?9v=9mn|0R-n8#t=+Z*FD(c5 zjj79Jxkgck*DV=wpFgRZuwr%}KTm+dx?RT@aUHJdaX-ODh~gByS?WGx&czAkvkg;x zrf92l8$Or_zOwJVwh>5rB`Q5_5}ef6DjS*$x30nZbuO3dijS*wvNEqTY5p1_A0gWr znH<(Qvb!os14|R)n2Ost>jS2;d1zyLHu`Svm|&dZD+PpP{Bh>U&`Md;gRl64q;>{8MJJM$?UNUd`aC>BiLe>*{ zJY15->yW+<3rLgYeTruFDtk1ovU<$(_y7#HgUq>)r0{^}Xbth}V#6?%5jeFYt;SG^ z3qF)=uWRU;Jj)Q}cpY8-H+l_n$2$6{ZR?&*IGr{>ek!69ZH0ZoJ*Ji+ezzlJ^%qL3 zO5a`6gwFw(moEzqxh=yJ9M1FTn!eo&qD#y5AZXErHs%22?A+JmS&GIolml!)rZTnUDM3YgzYfT#;OXn)`PWv3Ta z!-i|-Wojv*k&bC}_JJDjiAK(Ba|YZgUI{f}TdEOFT2+}nPmttytw7j%@bQZDV1vvj z^rp{gRkCDmYJHGrE1~e~AE!-&6B6`7UxVQuvRrfdFkGX8H~SNP_X4EodVd;lXd^>eV1jN+Tt4}Rsn)R0LxBz0c=NXU|pUe!MQQFkGBWbR3&(jLm z%RSLc#p}5_dO{GD=DEFr=Fc% z85CBF>*t!6ugI?soX(*JNxBp+-DdZ4X0LldiK}+WWGvXV(C(Ht|!3$psR=&c*HIM=BmX;pRIpz@Ale{9dhGe(U2|Giv;# zOc|;?p67J=Q(kamB*aus=|XP|m{jN^6@V*Bpm?ye56Njh#vyJqE=DweC;?Rv7faX~ zde03n^I~0B2vUmr;w^X37tVxUK?4}ifsSH5_kpKZIzpYu0;Kv}SBGfI2AKNp+VN#z`nI{UNDRbo-wqa4NEls zICRJpu)??cj^*WcZ^MAv+;bDbh~gpN$1Cor<{Y2oyIDws^JsfW^5AL$azE(T0p&pP z1Mv~6Q44R&RHoH95&OuGx2srIr<@zYJTOMKiVs;Bx3py89I87LOb@%mr`0)#;7_~Z zzcZj8?w=)>%5@HoCHE_&hnu(n_yQ-L(~VjpjjkbT7e)Dk5??fApg(d>vwLRJ-x{um z*Nt?DqTSxh_MIyogY!vf1mU1`Gld-&L)*43f6dilz`Q@HEz;+>MDDYv9u!s;WXeao zUq=TaL$P*IFgJzrGc>j1dDOd zed+=ZBo?w4mr$2)Ya}?vedDopomhW1`#P<%YOJ_j=WwClX0xJH-f@s?^tmzs_j7t!k zK@j^zS0Q|mM4tVP5Ram$VbS6|YDY&y?Q1r1joe9dj08#CM{RSMTU}(RCh`hp_Rkl- zGd|Cv~G@F{DLhCizAm9AN!^{rNs8hu!G@8RpnGx7e`-+K$ffN<0qjR zGq^$dj_Tv!n*?zOSyk5skI7JVKJ)3jysnjIu-@VSzQiP8r6MzudCU=~?v-U8yzo^7 zGf~SUTvEp+S*!X9uX!sq=o}lH;r{pzk~M*VA(uyQ`3C8!{C;)&6)95fv(cK!%Cuz$ z_Zal57H6kPN>25KNiI6z6F)jzEkh#%OqU#-__Xzy)KyH};81#N6OfX$$IXWzOn`Q& z4f$Z1t>)8&8PcYfEwY5UadU1yg+U*(1m2ZlHoC-!2?gB!!fLhmTl))D@dhvkx#+Yj z1O=LV{(T%{^IeCuFK>%QR!VZ4GnO5tK8a+thWE zg4VytZrwcS?7^ zuZfhYnB8dwd%VLO?DK7pV5Wi<(`~DYqOXn8#jUIL^)12*Dbhk4GmL_E2`WX&iT16o zk(t|hok(Y|v-wzn?4x34T)|+SfZP>fiq!><*%vnxGN~ypST-FtC+@TPv*vYv@iU!_ z@2gf|PrgQ?Ktf*9^CnJ(x*CtZVB8!OBfg0%!wL;Z8(tYYre0vcnPGlyCc$V(Ipl*P z_(J!a=o@vp^%Efme!K74(Ke7A>Y}|sxV+JL^aYa{~m%5#$$+R1? zGaQhZTTX!#s#=Xtpegqero$RNt&`4xn3g$)=y*;=N=Qai)}~`xtxI_N*#MMCIq#HFifT zz(-*m;pVH&+4bixL&Bbg)W5FN^bH87pAHp)zPkWNMfTFqS=l~AC$3FX3kQUSh_C?-ZftyClgM)o_D7cX$RGlEYblux0jv5 zTr|i-I3@ZPCGheCl~BGhImF)K4!9@?pC(gi3ozX=a!|r1)LFxy_8c&wY0<^{2cm|P zv6Y`QktY*;I)IUd5y3ne1CqpVanlY45z8hf4&$EUBnucDj16pDa4&GI&TArYhf*xh zdj>*%APH8(h~c>o@l#%T>R$e>rwVx_WUB|~V`p^JHsg*y12lzj&zF}w6W09HwB2yb z%Q~`es&(;7#*DUC_w-Dmt7|$*?TA_m;zB+-u{2;Bg{O}nV7G_@7~<)Bv8fH^G$XG8$(&{A zwXJK5LRK%M34(t$&NI~MHT{UQ9qN-V_yn|%PqC81EIiSzmMM=2zb`mIwiP_b)x+2M z7Gd`83h79j#SItpQ}luuf2uOU`my_rY5T{6P#BNlb%h%<#MZb=m@y5aW;#o1^2Z)SWo+b`y0gV^iRcZtz5!-05vF z7wNo=hc6h4hc&s@uL^jqRvD6thVYtbErDK9k!;+a0xoE0WL7zLixjn5;$fXvT=O3I zT6jI&^A7k6R{&5#lVjz#8%_RiAa2{di{`kx79K+j72$H(!ass|B%@l%KeeKchYLe_ z>!(JC2fxsv>XVen+Y42GeYPxMWqm`6F$(E<6^s|g(slNk!lL*6v^W2>f6hh^mE$s= z3D$)}{V5(Qm&A6bp%2Q}*GZ5Qrf}n7*Hr51?bJOyA-?B4vg6y_EX<*-e20h{=0Mxs zbuQGZ$fLyO5v$nQ&^kuH+mNq9O#MWSfThtH|0q1i!NrWj^S}_P;Q1OkYLW6U^?_7G zx2wg?CULj7))QU(n{$0JE%1t2dWrMi2g-Os{v|8^wK{@qlj%+1b^?NI z$}l2tjp0g>K3O+p%yK<9!XqmQ?E9>z&(|^Pi~aSRwI5x$jaA62GFz9%fmO3t3a>cq zK8Xbv=5Ps~4mKN5+Eqw12(!PEyedFXv~VLxMB~HwT1Vfo51pQ#D8e$e4pFZ{&RC2P z5gTIzl{3!&(tor^BwZfR8j4k{7Rq#`riKXP2O-Bh66#WWK2w=z;iD9GLl+3 zpHIaI4#lQ&S-xBK8PiQ%dwOh?%BO~DCo06pN7<^dnZCN@NzY{_Z1>rrB0U|nC&+!2 z2y!oBcTd2;@lzyk(B=TkyZ)zy0deK05*Q0zk+o$@nun`VI1Er7pjq>8V zNmlW{p7S^Btgb(TA}jL(uR>`0w8gHP^T~Sh5Tkip^spk4SBAhC{TZU}_Z)UJw-}zm zPq{KBm!k)?P{`-(9?LFt&YN4s%SIZ-9lJ!Ws~B%exHOeVFk3~}HewnnH(d)qkLQ_d z6h>O)pEE{vbOVw}E+jdYC^wM+AAhaI(YAibUc@B#_mDss0Ji&BK{WG`4 zOk>vSNq(Bq2IB@s>>Rxm6Wv?h;ZXkpb1l8u|+_qXWdC*jjcPCixq;!%BVPSp#hP zqo`%cNf&YoQXHC$D=D45RiT|5ngPlh?0T~?lUf*O)){K@*Kbh?3RW1j9-T?%lDk@y z4+~?wKI%Y!-=O|_IuKz|=)F;V7ps=5@g)RrE;;tvM$gUhG>jHcw2Hr@fS+k^Zr~>G z^JvPrZc}_&d_kEsqAEMTMJw!!CBw)u&ZVzmq+ZworuaE&TT>$pYsd9|g9O^0orAe8 z221?Va!l1|Y5X1Y?{G7rt1sX#qFA^?RLG^VjoxPf63;AS=_mVDfGJKg73L zsGdnTUD40y(>S##2l|W2Cy!H(@@5KBa(#gs`vlz}Y~$ot5VsqPQ{{YtjYFvIumZzt zA{CcxZLJR|4#{j7k~Tu*jkwz8QA|5G1$Cl895R`Zyp;irp1{KN){kB30O8P1W5;@bG znvX74roeMmQlUi=v9Y%(wl$ZC#9tKNFpvi3!C}f1m6Ct|l2g%psc{TJp)@yu)*e2> z((p0Fg*8gJ!|3WZke9;Z{8}&NRkv7iP=#_y-F}x^y?2m%-D_aj^)f04%mneyjo_;) z6qc_Zu$q37d~X``*eP~Q>I2gg%rrV8v=kDfpp$=%Vj}hF)^dsSWygoN(A$g*E=Do6FX?&(@F#7pbiJ`;c0c@Ul zDqW_90Wm#5f2L<(Lf3)3TeXtI7nhYwRm(F;*r_G6K@OPW4H(Y3O5SjUzBC}u3d|eQ8*8d@?;zUPE+i#QNMn=r(ap?2SH@vo*m z3HJ%XuG_S6;QbWy-l%qU;8x;>z>4pMW7>R}J%QLf%@1BY(4f_1iixd-6GlO7Vp*yU zp{VU^3?s?90i=!#>H`lxT!q8rk>W_$2~kbpz7eV{3wR|8E=8**5?qn8#n`*(bt1xRQrdGxyx2y%B$qmw#>ZV$c7%cO#%JM1lY$Y0q?Yuo> ze9KdJoiM)RH*SB%^;TAdX-zEjA7@%y=!0=Zg%iWK7jVI9b&Dk}0$Af&08KHo+ zOwDhFvA(E|ER%a^cdh@^wLUlmIv6?_3=BvX8jKk92L=Y}7Jf5OGMfh` zBdR1wFCi-i5@`9km{isRb0O%TX+f~)KNaEz{rXQa89`YIF;EN&gN)cigu6mNh>?Cm zAO&Im2flv6D{jwm+y<%WsPe4!89n~KN|7}Cb{Z;XweER73r}Qp2 zz}WP4j}U0&(uD&9yGy6`!+_v-S(yG*iytsTR#x_Rc>=6u^vnRDnf1gP{#2>`ffrAC% zTZ5WQ@hAK;P;>kX{D)mIXe4%a5p=LO1xXH@8T?mz7Q@d)$3pL{{B!2{-v70L*o1AO+|n5beiw~ zk@(>m?T3{2k2c;NWc^`4@P&Z?BjxXJ@;x1qhn)9Mn*IFdt_J-dIqx5#d`NfyfX~m( zIS~5)MfZ2Uy?_4W`47i}u0ZgPh<{D|w_d#;D}Q&U$Q-G}xM1A@1f{#%A$jh6Qp&0hQ<0bPOM z-{1Wm&p%%#eb_?x7i;bol EfAhh=DF6Tf literal 0 HcmV?d00001 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000000..642d572ce90 --- /dev/null +++ b/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,2 @@ +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/core/com.b2international.snowowl.core.rest/pom.xml b/core/com.b2international.snowowl.core.rest/pom.xml index 1d276818581..a249ed4eb7e 100644 --- a/core/com.b2international.snowowl.core.rest/pom.xml +++ b/core/com.b2international.snowowl.core.rest/pom.xml @@ -1,273 +1,273 @@ - - 4.0.0 - - com.b2international.snowowl - core-parent - 7.3.0-SNAPSHOT - + + 4.0.0 + + com.b2international.snowowl + core-parent + 7.3.0-SNAPSHOT + - com.b2international.snowowl.core.rest - eclipse-plugin - - - 5.1.9.RELEASE - 5.1.6.RELEASE - 2.9.2 - - v12.13.0 - + com.b2international.snowowl.core.rest + eclipse-plugin - - - - io.springfox - springfox-swagger2 - ${springfox.version} - provided - - - org.reflections - reflections - - - - - org.springframework - spring-webmvc - ${spring.version} - provided - - - org.springframework.security - spring-security-config - ${spring.security.version} - provided - - - org.springframework.security - spring-security-web - ${spring.security.version} - provided - - - - - - - org.apache.maven.plugins - maven-clean-plugin - 3.1.0 - - - clean-folders - generate-sources - - clean - - - - - WEB-INF/lib - - .gitignore - - - - site - - .gitignore - - - - snow-owl-api-docs/node_modules - - - snow-owl-api-docs/build - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 3.1.1 - - - copy-runtime-dependencies - generate-sources - - copy-dependencies - - - - - spring-aop, - spring-beans, - spring-context, - spring-core, - spring-expression, - spring-plugin-core, - spring-plugin-metadata, - spring-security-config, - spring-security-core, - spring-security-web, - spring-web, - spring-webmvc, - springfox-core, - springfox-schema, - springfox-spi, - springfox-spring-web, - springfox-swagger-common, - springfox-swagger2, - - WEB-INF/lib - - - - - - com.github.eirslett - frontend-maven-plugin - 1.8.0 - - - install node and npm - - install-node-and-npm - - generate-resources - - - npm install - - npm - - generate-resources - - install - - - - npm build - - npm - - generate-resources - - ${basedir}/snow-owl-api-docs - run build - - - - - ${project.build.directory}/node - ${basedir}/snow-owl-api-docs - ${node.version} - - - - org.apache.maven.plugins - maven-resources-plugin - 3.1.0 - - - copy-static-resources - generate-resources - - copy-resources - - - ${basedir}/site - true - - - ${basedir}/snow-owl-api-docs/build - - - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-dependency-plugin - [3.0.2,) - - copy-dependencies - - - - - false - - - - - - org.apache.maven.plugins - maven-clean-plugin - [3.1.0,) - - clean - - - - - - - - - com.github.eirslett - frontend-maven-plugin - [1.8.0,) - - install-node-and-npm - npm - - - - - false - - - - - - org.apache.maven.plugins - maven-resources-plugin - [3.1.0,) - - copy-resources - - - - - false - - - - - - - - - - + + 5.1.9.RELEASE + 5.1.6.RELEASE + 2.9.2 + + v12.13.0 + + + + + + io.springfox + springfox-swagger2 + ${springfox.version} + provided + + + org.reflections + reflections + + + + + org.springframework + spring-webmvc + ${spring.version} + provided + + + org.springframework.security + spring-security-config + ${spring.security.version} + provided + + + org.springframework.security + spring-security-web + ${spring.security.version} + provided + + + + + + + org.apache.maven.plugins + maven-clean-plugin + 3.1.0 + + + clean-folders + generate-sources + + clean + + + + + WEB-INF/lib + + .gitignore + + + + site + + .gitignore + + + + snow-owl-api-docs/node_modules + + + snow-owl-api-docs/build + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + + copy-runtime-dependencies + generate-sources + + copy-dependencies + + + + + spring-aop, + spring-beans, + spring-context, + spring-core, + spring-expression, + spring-plugin-core, + spring-plugin-metadata, + spring-security-config, + spring-security-core, + spring-security-web, + spring-web, + spring-webmvc, + springfox-core, + springfox-schema, + springfox-spi, + springfox-spring-web, + springfox-swagger-common, + springfox-swagger2, + + WEB-INF/lib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + + copy-static-resources + generate-resources + + copy-resources + + + ${basedir}/site + true + + + ${basedir}/snow-owl-api-docs/build + + + + + + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-dependency-plugin + [3.0.2,) + + copy-dependencies + + + + + false + + + + + + org.apache.maven.plugins + maven-clean-plugin + [3.1.0,) + + clean + + + + + + + + + com.github.eirslett + frontend-maven-plugin + [1.8.0,) + + install-node-and-npm + npm + + + + + false + + + + + + org.apache.maven.plugins + maven-resources-plugin + [3.1.0,) + + copy-resources + + + + + false + + + + + + + + + + diff --git a/mvnw b/mvnw new file mode 100755 index 00000000000..41c0f0c23db --- /dev/null +++ b/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 00000000000..86115719e53 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/pom.xml b/pom.xml index d3924ecf378..2671543edca 100644 --- a/pom.xml +++ b/pom.xml @@ -1,935 +1,979 @@ - 4.0.0 - com.b2international.snowowl - snowowl-parent - 7.3.0-SNAPSHOT - pom + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + 4.0.0 + com.b2international.snowowl + snowowl-parent + 7.3.0-SNAPSHOT + pom - - UTF-8 - UTF-8 - - - 2.9.10 - 2.9.10.1 - 4.1.16.Final - 1.7.25 - 1.2.3 - [1.2.3,1.2.4) - 21.0 - [21.0.0,22.0.0) - 1.9.3 - 2.4.17 - 3.2.2 - [3.2.2,3.3.0) - 1.2.71 - 5.0.4-b2i - 4.5.10 - 0.4.3 - 9.4.18.v20190429 - 4.8.43 - 0.4.1 - 0.6.1 - 2.1.10 - 1.2 - 1.10 - 8.2.2 - 2.3.0 - 1.2.0 - 2.6.0 - 2.3.1 - - 1.5.0 - 1.5.0 - 2.18.0 - 0.8.4 - - - yyyyMMddHHmm - ${maven.build.timestamp} - + + UTF-8 + UTF-8 - - commons - core - fhir - net4j - snomed - cis - tests - releng - dist - + + 2.9.10 + 2.9.10.1 + 4.1.16.Final + 1.7.25 + 1.2.3 + [1.2.3,1.2.4) + 21.0 + [21.0.0,22.0.0) + 1.9.3 + 2.4.17 + 3.2.2 + [3.2.2,3.3.0) + 1.2.71 + 5.0.4-b2i + 4.5.10 + 0.4.3 + 9.4.18.v20190429 + 4.8.43 + 0.4.1 + 0.6.1 + 2.1.10 + 1.2 + 1.10 + 8.2.2 + 2.3.0 + 1.2.0 + 2.6.0 + 2.3.1 + + 1.5.0 + 1.5.0 + 2.18.0 + 0.8.4 - - - protege-mvn-repo - https://b2ihealthcare.github.io/protege/ - - true - never - - - false - never - - - - snomed-international-releases - https://maven.ihtsdotools.org/content/repositories/releases/ - - true - never - - - false - never - - - + + yyyyMMddHHmm + ${maven.build.timestamp} + - - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - provided - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - provided - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.databind.version} - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-cbor - ${jackson.version} - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${jackson.version} - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-smile - ${jackson.version} - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-csv - ${jackson.version} - provided - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - provided - - - com.fasterxml.jackson.module - jackson-module-afterburner - ${jackson.version} - provided - - - com.fasterxml.jackson.module - jackson-module-jaxb-annotations - ${jackson.version} - provided - - - com.thoughtworks.xstream - xstream - 1.4.7 - provided - - - org.eclipse.persistence - javax.persistence - 2.0.5 - provided - - - org.assertj - assertj-core - 1.7.1 - provided - - - org.yaml - snakeyaml - 1.25 - provided - - - io.reactivex.rxjava2 - rxjava - 2.0.7 - provided - - - org.reactivestreams - reactive-streams - 1.0.0 - provided - - - commons-collections - commons-collections - 3.2.2 - provided - - - com.google.guava - guava - ${guava.version} - provided - - - io.netty - netty-buffer - ${netty.version} - provided - - - io.netty - netty-codec - ${netty.version} - provided - - - io.netty - netty-codec-http - ${netty.version} - provided - - - io.netty - netty-common - ${netty.version} - provided - - - io.netty - netty-handler - ${netty.version} - provided - - - io.netty - netty-resolver - ${netty.version} - provided - - - io.netty - netty-transport - ${netty.version} - provided - - - org.jetbrains.kotlin - kotlin-osgi-bundle - ${kotlin.version} - provided - - - com.diffplug.osgi - com.diffplug.osgi.extension.sun.misc - 0.0.0 - provided - - - com.diffplug.osgi - com.diffplug.osgi.extension.sun.reflect - 0.0.0 - provided - - - ch.qos.logback - logback-classic - ${logback.version} - provided - - - ch.qos.logback - logback-core - ${logback.version} - provided - - - org.slf4j - slf4j-api - ${slf4j.version} - provided - - - org.slf4j - jcl-over-slf4j - ${slf4j.version} - provided - - - org.slf4j - jul-to-slf4j - ${slf4j.version} - provided - - - org.slf4j - log4j-over-slf4j - ${slf4j.version} - provided - - - io.github.classgraph - classgraph - ${classgraph.version} - provided - - - com.b2international.snowowl - protege-common - ${protege.version} - provided - - - - org.apache.felix - org.apache.felix.main - - - - - com.b2international.snowowl - protege-editor-core - ${protege.version} - provided - - - - org.eclipse.equinox - org.eclipse.equinox.common - - - org.eclipse.equinox - org.eclipse.equinox.registry - - - - - com.b2international.snowowl - protege-editor-owl - ${protege.version} - provided - - - - log4j - log4j - - - - - net.sourceforge.owlapi - owlapi-osgidistribution - ${owlapi.version} - provided - - - org.semanticweb.elk - elk-protege - ${elk.version} - provided - - - - log4j - log4j - - - - org.protege - protege-editor-core-application - - - org.protege - protege-editor-owl - - - - - org.eclipse.jetty - jetty-continuation - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-deploy - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-http - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-io - ${jetty.version} - provided - - - org.eclipse.jetty.osgi - jetty-osgi-boot - ${jetty.version} - provided - - - - org.eclipse.osgi - org.eclipse.osgi - - - org.eclipse.osgi - org.eclipse.osgi.services - - - org.ow2.asm - asm - - - org.ow2.asm - asm-commons - - - - - org.eclipse.jetty - jetty-security - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-servlet - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-util - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-webapp - ${jetty.version} - provided - - - org.eclipse.jetty - jetty-xml - ${jetty.version} - provided - - - net.bytebuddy - byte-buddy - ${net.bytebuddy.version} - provided - - - com.fasterxml - classmate - 1.3.4 - provided - - - org.mapstruct - mapstruct - 1.2.0.Final - provided - - - io.swagger - swagger-annotations - 1.5.23 - provided - - - io.swagger - swagger-models - 1.5.23 - provided - - - org.apache.httpcomponents - httpclient-osgi - 4.5.3 - provided - - - org.apache.httpcomponents - httpcore-osgi - 4.4.10 - provided - - - org.apache.httpcomponents - httpasyncclient-osgi - 4.1.4 - provided - - - de.svenkubiak - jBCrypt - ${jbcrypt.version} - provided - - - net.jodah - typetools - ${typetools.version} - provided - - - org.hdrhistogram - HdrHistogram - ${hdrhistogram.version} - provided - - - commons-codec - commons-codec - ${commons.codec.version} - provided - - - commons-logging - commons-logging - ${commons.logging.version} - provided - - - it.unimi.dsi - fastutil - ${fastutil.version} - provided - - - javax.activation - javax.activation-api - 1.2.0 - provided - - - javax.xml.bind - jaxb-api - ${jaxb.api.version} - provided - - - com.sun.xml.bind - jaxb-core - ${jaxb.api.version} - provided - - - com.sun.xml.bind - jaxb-impl - ${jaxb.api.version} - provided - - - com.sun.activation - javax.activation - ${javax.activation.version} - provided - - - org.snomed.otf - snomed-owl-toolkit - ${snomed.owl.toolkit.version} - bundle - provided - - - - com.google.inject - guice - - - com.google.inject.extensions - guice-assistedinject - - - com.google.inject.extensions - guice-multibindings - - - - - net.jodah - failsafe - ${failsafe.version} - provided - - + + commons + core + fhir + net4j + snomed + cis + tests + releng + dist + - - - - org.eclipse.tycho - tycho-maven-plugin - ${tycho.version} - true - - - org.eclipse.tycho - tycho-packaging-plugin - - false - false - - - - org.eclipse.tycho - tycho-source-plugin - ${tycho.version} - - - plugin-source - - plugin-source - - - - - - org.eclipse.tycho - target-platform-configuration - ${tycho.version} - - p2 - consider - - - ${project.groupId} - target-platform - ${project.version} - - - - - eclipse-plugin - org.eclipse.osgi - - [3.13.0,3.15.0] - - - - - - p2-installable-unit - org.eclipse.equinox.servletbridge.extensionbundle - - - - eclipse-plugin - org.codehaus.groovy - - ${groovy.version} - - - - eclipse-plugin - com.google.guava - - ${guava.versionRange} - - - - - p2-installable-unit - slf4j.api - - ${slf4j.version} - - - - p2-installable-unit - ch.qos.logback.classic - - ${logback.versionRange} - - - - p2-installable-unit - ch.qos.logback.core - - ${logback.versionRange} - - - - - p2-installable-unit - com.fasterxml.jackson.core.jackson-annotations - - ${jackson.version} - - - - p2-installable-unit - com.fasterxml.jackson.core.jackson-core - - ${jackson.version} - - - - p2-installable-unit - com.fasterxml.jackson.core.jackson-databind - - ${jackson.databind.version} - - - - p2-installable-unit - com.fasterxml.jackson.dataformat.jackson-dataformat-yaml - - ${jackson.version} - - - - p2-installable-unit - com.fasterxml.jackson.dataformat.jackson-dataformat-cbor - - ${jackson.version} - - - - p2-installable-unit - com.fasterxml.jackson.dataformat.jackson-dataformat-csv - - ${jackson.version} - - - - p2-installable-unit - com.fasterxml.jackson.dataformat.jackson-dataformat-xml - - ${jackson.version} - - - - p2-installable-unit - com.fasterxml.jackson.dataformat.jackson-dataformat-afterburner - - ${jackson.version} - - - - - p2-installable-unit - org.apache.commons.collections - - ${commons.collections.versionRange} - - - - p2-installable-unit - org.slf4j.api - - - - - - linux - gtk - x86_64 - - - win32 - win32 - x86_64 - - - - - - org.eclipse.tycho - tycho-p2-director-plugin - ${tycho.version} - - - org.codehaus.plexus - plexus-archiver - 2.4.4 - - - org.codehaus.plexus - plexus-component-api - - - org.codehaus.plexus - plexus-container-default - - - - - - - org.eclipse.tycho - tycho-p2-publisher-plugin - ${tycho.version} - - true - - - - org.eclipse.tycho - tycho-versions-plugin - ${tycho.version} - - - org.jacoco - jacoco-maven-plugin - ${jacoco.version} - - - - prepare-agent - - - - - - - - - org.eclipse.tycho - tycho-compiler-plugin - ${tycho.version} - - false - 11 - 11 - - **/*.groovy - **/*.xtend - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.0 - - 11 - 11 - - - - org.eclipse.tycho - tycho-surefire-plugin - ${tycho.version} - - false - - **/*Test*.java - - false - - - - org.eclipse.tycho - tycho-packaging-plugin - ${tycho.version} - - - org.eclipse.tycho.extras - tycho-buildtimestamp-jgit - ${tycho-extras.version} - - - - jgit - - pom.xml - - - - - org.eclipse.tycho - tycho-p2-repository-plugin - ${tycho.version} - - true - - - - org.apache.maven.plugins - maven-assembly-plugin - 2.3 - - - - + - - - docs - - - docs - true - - - - documentation - - - + + + false + + maven-central + remote-repos + https://repo.maven.apache.org/maven2 + + + + + + + + + + + + + + + - - - ${maven.repository.id} - ${nexus.releases.url} - - - ${maven.repository.id} - ${nexus.snapshots.url} - - + + protege-mvn-repo + https://b2ihealthcare.github.io/protege/ + + true + never + + + false + never + + + + snomed-international-releases + https://maven.ihtsdotools.org/content/repositories/releases/ + + true + never + + + false + never + + + + + + + + + + + + + + + + + + + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson.version} + provided + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + provided + + + com.fasterxml.jackson.core + jackson-databind + ${jackson.databind.version} + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-cbor + ${jackson.version} + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ${jackson.version} + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-smile + ${jackson.version} + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + ${jackson.version} + provided + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + provided + + + com.fasterxml.jackson.module + jackson-module-afterburner + ${jackson.version} + provided + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + ${jackson.version} + provided + + + com.thoughtworks.xstream + xstream + 1.4.7 + provided + + + org.eclipse.persistence + javax.persistence + 2.0.5 + provided + + + org.assertj + assertj-core + 1.7.1 + provided + + + org.yaml + snakeyaml + 1.25 + provided + + + io.reactivex.rxjava2 + rxjava + 2.0.7 + provided + + + org.reactivestreams + reactive-streams + 1.0.0 + provided + + + commons-collections + commons-collections + 3.2.2 + provided + + + com.google.guava + guava + ${guava.version} + provided + + + io.netty + netty-buffer + ${netty.version} + provided + + + io.netty + netty-codec + ${netty.version} + provided + + + io.netty + netty-codec-http + ${netty.version} + provided + + + io.netty + netty-common + ${netty.version} + provided + + + io.netty + netty-handler + ${netty.version} + provided + + + io.netty + netty-resolver + ${netty.version} + provided + + + io.netty + netty-transport + ${netty.version} + provided + + + org.jetbrains.kotlin + kotlin-osgi-bundle + ${kotlin.version} + provided + + + com.diffplug.osgi + com.diffplug.osgi.extension.sun.misc + 0.0.0 + provided + + + com.diffplug.osgi + com.diffplug.osgi.extension.sun.reflect + 0.0.0 + provided + + + ch.qos.logback + logback-classic + ${logback.version} + provided + + + ch.qos.logback + logback-core + ${logback.version} + provided + + + org.slf4j + slf4j-api + ${slf4j.version} + provided + + + org.slf4j + jcl-over-slf4j + ${slf4j.version} + provided + + + org.slf4j + jul-to-slf4j + ${slf4j.version} + provided + + + org.slf4j + log4j-over-slf4j + ${slf4j.version} + provided + + + io.github.classgraph + classgraph + ${classgraph.version} + provided + + + com.b2international.snowowl + protege-common + ${protege.version} + provided + + + + org.apache.felix + org.apache.felix.main + + + + + com.b2international.snowowl + protege-editor-core + ${protege.version} + provided + + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.eclipse.equinox + org.eclipse.equinox.registry + + + + + com.b2international.snowowl + protege-editor-owl + ${protege.version} + provided + + + + log4j + log4j + + + + + net.sourceforge.owlapi + owlapi-osgidistribution + ${owlapi.version} + provided + + + org.semanticweb.elk + elk-protege + ${elk.version} + provided + + + + log4j + log4j + + + + org.protege + protege-editor-core-application + + + org.protege + protege-editor-owl + + + + + org.eclipse.jetty + jetty-continuation + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-deploy + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-http + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-io + ${jetty.version} + provided + + + org.eclipse.jetty.osgi + jetty-osgi-boot + ${jetty.version} + provided + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.osgi + org.eclipse.osgi.services + + + org.ow2.asm + asm + + + org.ow2.asm + asm-commons + + + + + org.eclipse.jetty + jetty-security + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-servlet + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-util + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-webapp + ${jetty.version} + provided + + + org.eclipse.jetty + jetty-xml + ${jetty.version} + provided + + + net.bytebuddy + byte-buddy + ${net.bytebuddy.version} + provided + + + com.fasterxml + classmate + 1.3.4 + provided + + + org.mapstruct + mapstruct + 1.2.0.Final + provided + + + io.swagger + swagger-annotations + 1.5.23 + provided + + + io.swagger + swagger-models + 1.5.23 + provided + + + org.apache.httpcomponents + httpclient-osgi + 4.5.3 + provided + + + org.apache.httpcomponents + httpcore-osgi + 4.4.10 + provided + + + org.apache.httpcomponents + httpasyncclient-osgi + 4.1.4 + provided + + + de.svenkubiak + jBCrypt + ${jbcrypt.version} + provided + + + net.jodah + typetools + ${typetools.version} + provided + + + org.hdrhistogram + HdrHistogram + ${hdrhistogram.version} + provided + + + commons-codec + commons-codec + ${commons.codec.version} + provided + + + commons-logging + commons-logging + ${commons.logging.version} + provided + + + it.unimi.dsi + fastutil + ${fastutil.version} + provided + + + javax.activation + javax.activation-api + 1.2.0 + provided + + + javax.xml.bind + jaxb-api + ${jaxb.api.version} + provided + + + com.sun.xml.bind + jaxb-core + ${jaxb.api.version} + provided + + + com.sun.xml.bind + jaxb-impl + ${jaxb.api.version} + provided + + + com.sun.activation + javax.activation + ${javax.activation.version} + provided + + + org.snomed.otf + snomed-owl-toolkit + ${snomed.owl.toolkit.version} + bundle + provided + + + + com.google.inject + guice + + + com.google.inject.extensions + guice-assistedinject + + + com.google.inject.extensions + guice-multibindings + + + + + net.jodah + failsafe + ${failsafe.version} + provided + + + + + + + org.eclipse.tycho + tycho-maven-plugin + ${tycho.version} + true + + + org.eclipse.tycho + tycho-packaging-plugin + + false + false + + + + org.eclipse.tycho + tycho-source-plugin + ${tycho.version} + + + plugin-source + + plugin-source + + + + + + org.eclipse.tycho + target-platform-configuration + ${tycho.version} + + p2 + consider + + + ${project.groupId} + target-platform + ${project.version} + + + + + eclipse-plugin + org.eclipse.osgi + + [3.13.0,3.15.0] + + + + + + p2-installable-unit + org.eclipse.equinox.servletbridge.extensionbundle + + + + eclipse-plugin + org.codehaus.groovy + + ${groovy.version} + + + + eclipse-plugin + com.google.guava + + ${guava.versionRange} + + + + + p2-installable-unit + slf4j.api + + ${slf4j.version} + + + + p2-installable-unit + ch.qos.logback.classic + + ${logback.versionRange} + + + + p2-installable-unit + ch.qos.logback.core + + ${logback.versionRange} + + + + + p2-installable-unit + com.fasterxml.jackson.core.jackson-annotations + + ${jackson.version} + + + + p2-installable-unit + com.fasterxml.jackson.core.jackson-core + + ${jackson.version} + + + + p2-installable-unit + com.fasterxml.jackson.core.jackson-databind + + ${jackson.databind.version} + + + + p2-installable-unit + com.fasterxml.jackson.dataformat.jackson-dataformat-yaml + + ${jackson.version} + + + + p2-installable-unit + com.fasterxml.jackson.dataformat.jackson-dataformat-cbor + + ${jackson.version} + + + + p2-installable-unit + com.fasterxml.jackson.dataformat.jackson-dataformat-csv + + ${jackson.version} + + + + p2-installable-unit + com.fasterxml.jackson.dataformat.jackson-dataformat-xml + + ${jackson.version} + + + + p2-installable-unit + com.fasterxml.jackson.dataformat.jackson-dataformat-afterburner + + ${jackson.version} + + + + + p2-installable-unit + org.apache.commons.collections + + ${commons.collections.versionRange} + + + + p2-installable-unit + org.slf4j.api + + + + + + linux + gtk + x86_64 + + + win32 + win32 + x86_64 + + + + + + org.eclipse.tycho + tycho-p2-director-plugin + ${tycho.version} + + + org.codehaus.plexus + plexus-archiver + 2.4.4 + + + org.codehaus.plexus + plexus-component-api + + + org.codehaus.plexus + plexus-container-default + + + + + + + org.eclipse.tycho + tycho-p2-publisher-plugin + ${tycho.version} + + true + + + + org.eclipse.tycho + tycho-versions-plugin + ${tycho.version} + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + prepare-agent + + + + + + + + + org.eclipse.tycho + tycho-compiler-plugin + ${tycho.version} + + false + 11 + 11 + + **/*.groovy + **/*.xtend + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + 11 + + + + org.eclipse.tycho + tycho-surefire-plugin + ${tycho.version} + + false + + + + false + + + + org.eclipse.tycho + tycho-packaging-plugin + ${tycho.version} + + + org.eclipse.tycho.extras + tycho-buildtimestamp-jgit + ${tycho-extras.version} + + + + jgit + + pom.xml + + + + + org.eclipse.tycho + tycho-p2-repository-plugin + ${tycho.version} + + true + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.3 + + + + + + + + + + + + + docs + + + docs + true + + + + documentation + + + + + + + artifactory-releases + https://artifactory.ops.babylontech.co.uk/artifactory/babylon-maven-releases + + + artifactory-snapshots + https://artifactory.ops.babylontech.co.uk/artifactory/babylon-maven-snapshots + + + + + https://github.com/babylonhealth/snow-owl + scm:git:ssh://github.com/babylonhealth/snow-owl.git + scm:git:ssh@github.com:babylonhealth/snow-owl.git + - - https://github.com/b2ihealthcare/snow-owl - scm:git:ssh://github.com/b2ihealthcare/snow-owl.git - scm:git:ssh@github.com:b2ihealthcare/snow-owl.git - - \ No newline at end of file diff --git a/settings.xml b/settings.xml index 4a4b8adf9a2..aa4bc11d82e 100644 --- a/settings.xml +++ b/settings.xml @@ -2,26 +2,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> - - - repositories - - true - - - - url/to/local/nexus/instance - ${nexus.url}/content/repositories/snapshots - ${nexus.url}/content/repositories/releases - - - - - nexus_deployment - nexus_deployment_user - nexus_deployment_pass + artifactory-releases + ${env.ARTIFACTORY_USER_RW} + ${env.ARTIFACTORY_PWD_RW} + + + artifactory-snapshots + ${env.ARTIFACTORY_USER_RW} + ${env.ARTIFACTORY_PWD_RW} From 415c2da9edf52f7db6b2186ac3ae4b5908b4b820 Mon Sep 17 00:00:00 2001 From: ivelina-yordanova <56301327+ivelina-yordanova@users.noreply.github.com> Date: Mon, 10 Feb 2020 15:26:11 +0000 Subject: [PATCH 02/72] [chr-1066] - Update (#4) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [releng] prepare 6.24.0-SNAPSHOT * SO-3845: Handle ECL expressions in attributes' concept set ... ... definitions in MRCM validation rules * Revert "[releng] prepare 6.24.0-SNAPSHOT" This reverts commit 8cbd3f83463292a8e3c6d757120c27c8943957d4. * [releng] prepare 6.23.1-SNAPSHOT * [releng] release 6.23.1 * [releng] prepare 6.24.0-SNAPSHOT * [snomed.import] Set code system shortname in import details * Added VALUE_SET, MAPPING_SET as allowed values for supportedRefSetType * Exposed the supportedRefSetType XML attribute values. * SO-3853: Register ValueSet and MappingSet to contribute * SO-3864: change cardinality of ValueSet.compose to 0..1 As of https://www.hl7.org/fhir/valueset-definitions.html#ValueSet.compose * SO-3864: return object ID from TransactionContext.add method * SO-3864: set clearResources to true by default in SnowOwlAppRule * [index] Allow setting boost on all ES QueryBuilder instances * [index] Log the number of pending cluster tasks; don't repeat messages * SO-3864: extract common repository APIs to core.rest module * SO-3864: extract common Resource search props to ResourceRestSearch Introduce SnomedReferenceSetRestSearch and `POST /:path/refsets/search` endpoint. * SO-3864: remove unused classes from snomed.core.rest plugin * SO-3864: support dynamic loading of available API docs * SO-3821 Enabled search by mapPriority. * SO-3864: extract common branch aware test infrastructure to test.commons * SO-3864: minor changes to test.commons MANIFEST.MF * SO-3864: expose Elasticsearch Base64 UUID generator as IDs.base64UUID() * SO-3864: expose core.id package * SO-3881: Remove semantic engine projects including previous ... ... implementation of SCG https://snowowl.atlassian.net/browse/SO-3881 * SO-3864: rename ChangeRequest types `core.rest.codesystem.ChangeRequest` to `core.rest.domain.ResourceRequest`. `snomed.core.rest.domain.ChangeRequest` to `snomed.core.rest.domain.SnomedResourceRequest`. * SO-3864: pull up getResourceLocationURI to AbstractRestService * SO-3864: pull up comma joiner and JSON_UTF8 constants to RestExtensions * SO-3864: fix failed SNOMED CT FHIR ValueSet API tests * SO-3881: Implement grammar, parser and tests for SCG v2.3.1 - tests cover all available examples @ https://github.com/IHTSDO/SNOMEDCT-Languages https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Add scg modules to parent pom https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Add missing pom https://snowowl.atlassian.net/browse/SO-3881 * SO-3864: minor API improvements * SO-3864: minor API improvements * SO-3864: add RestExtensions.assertCreated helper * SO-3881: Update ECL parsing tests - ECL v1.3 Brief Syntax examples as of today from https://github.com/IHTSDO/SNOMEDCT-Languages https://snowowl.atlassian.net/browse/SO-3881 * SO-3892: Change member status to active if refset already contains ... ...the inactive concept, do not duplicate members. * SO-3881: Regenerate ECL grammar - renamed the following rules to be in sync with the specification and to avoid collision when ECL is mixed with other grammars: - Refinement -> EclRefinement - FocusConcept -> EclFocusConcept - ConceptReference -> EclConceptReference - AttributeGroup -> EclAttributeGroup - AttributeSet -> EclAttributeSet - removed unused terminal '!' https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Regenerate QL grammar due to ECL changes https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Share basic parser tests for Query Language https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Remove unused files https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Regenerate SCG grammar to synchronize terminal names ... among existing grammar definitions - removed Xtend stubs https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Replace AND, OR, MINUS and COMMA with grammar terminals - this is necessary to avoid collision with other derived language terminals https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Replace AND, OR, MINUS and COMMA with grammar terminals - add 'Filter' suffix to Conjunction, Disjunction and Exclusion grammar rules to distinguish rules and terminals * SO-3881: Share initial Xtext definition of ETL https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Share parser tests for ETL https://snowowl.atlassian.net/browse/SO-3881 * SO-3892: Handle MemberChangeKind.CHANGE as added * SO-3881: Prefer upper case version of AND / OR / MINUS in case of ... ECL serialization - generated extendable Xtext serializer classes - added parsing tests https://snowowl.atlassian.net/browse/SO-3881 * [core] Allow customization of component adjustment during publication * SO-3881: Fix various issues in ETL grammar definition - allow slot name to be unquoted with certain restrictions - fix whitespace in TokenReplacementSlot - introduce custom cardinality rule compared to Ecl.Cardinality - make exclusive terminals optional in integer and decimal ranges https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Add ETL parsing tests to parent pom https://snowowl.atlassian.net/browse/SO-3881 * [history] Ignore many-valued features altogether in HistoryInfoProvider Copy scalar fields to an "empty" CDO revision instead of cloning the original and unsetting the many-valued properties (which can cause an exception, if uninitialized EAttribute lists are present on the revision). * SO-3864: report method not allowed errors properly * SO-3881: Fix issues in ETL grammar definition - rename concept replacement slots for better readability - fix slot integer and slot decimal types - simplify StringReplacementSlot values https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Implement detailed ETL parser tests - added all IHTSDO templates as well https://snowowl.atlassian.net/browse/SO-3881 * [tests] add more specific concept reactivation test cases * SO-3893 #resolve Fix incorrect parentage values when reactivating concept's relationships first then the concept in two different commits. * [export] Create general ExportResult class (filename, UUID pair) * [releng] update changelog with 6.24.0 changes * SO-3881: Remove xtend generated files https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Prevent xtend generated files to be committed https://snowowl.atlassian.net/browse/SO-3881 * SO-3881: Share current ABNF syntax for ECL, SCG and ETL https://snowowl.atlassian.net/browse/SO-3881 * [snomed] accept all SctId statuses when publishing them * [releng] update changelog with 6.24.0 changes * SO-3858: Allow specifying namespace in random id generation * [releng] release 6.24.0 * [releng] prepare 6.25.0-SNAPSHOT * SO-3858: Fix generic validation rules, tests, test setup * SO-3858: Extract language member function variable to helper method * [cis] fix config file name of CIS product * [core] support unprotected routes/requests * [snomed] Update remaining references to Rf2ExportResult * SO-3893: Relocate fix for issue to Taxonomies class (7.x, partial). Stated OWL axiom handling is still missing. * [tests] add more specific concept reactivation test cases (7.x) * SO-3853: Register ValueSet and MappingSet to contribute (7.x) * [snomed.import] Set code system shortname in import details (7.x) * [validation] Add reference set type to OWL axiom members in... (7.x) ...GenericValidationRuleTest * [export] Wrap reads into an IndexReadRequest in SnomedRf2ExportRequest * [core] allow multiple unprotected requests to execute in bulk * [core] always include responseTime metric in request log entries * SO-3881: add ETL and SCG core bundles to snomed.core.feature * SO-3864: set clearResources to true by default in SnowOwlAppRule * [core] merge IndexReadRequest functionality into RepositoryRequest * [mrcm] Remove remaining checked in source files from mrcm.model project * [documentation] Remove non-existent project references from MANIFEST.MF * [releng] update changelog with 7.3.0 changes * [releng] release 7.3.0 * [releng] release 7.3.0 * [releng] update README.md with 7.3.0 release links * [releng] prepare 7.4.0-SNAPSHOT * [core] Ensure that all TerminologyRepositoryPlugin subclasses provide... ...a terminology repository initializer instance (used for initializing a default code system entry for each tooling). * [core] Fix AccessControl subclass on RepositoryClearRequest, move... ...factory method of request builder to RepositoryRequests * [core] Implement RepositoryTransactionContext#clearContents The implementation calls stageRemove on all instances of Revision and subclasses that are visible on the context branch using a matchAll query, at the time of method invocation. * [snomed] convert NumberFormatException to BadRequestException * [oomph] Add preference settings for .* package and static imports * [snomed] add support for module() expand * [api] change type of SnomedConcept.definitionStatus to SnomedConcept Support expansion of definition status concept via definitionStatus() expand parameter. Remove DefinitionStatus enum literal. * Update core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/id/IDs.java Co-Authored-By: András Péteri * [core] update javadoc suggested in #472 https://github.com/b2ihealthcare/snow-owl/pull/472#discussion_r373996831 * [api] add `id` filter to `commits` API Related to #473. * [api] support `affectedComponentId` details() expand parameter Related to #473. * Cast to distinguish from Map parameter. * [snomed] remove unnecessary definitionStatusId field from SnomedConcept * [snomed] fix possible definitionStatus NPE when using field selection * SO-3123: Add support for "complex map with map block" type reference sets (#474) - Add SnomedRefSetType enum literal for complex block map - Handle complex block maps in SnomedRefSetUtil methods - Add new "map block" field and refset header to SnomedRf2Headers - Specify supported referenced component type for complex block maps in class RefSetSupport - Add support for complex block map import; update index format - Extend refset member create and update requests with complex block map support; ensure that class cast exceptions are translated to bad requests when inspecting member properties. - Add support for exporting complex block maps to RF2 - Add SnomedDsvExportItemType literal for "map block" field - Add SCTID of complex block map identifier parent concept - Add complex block map type test cases to SNOMED e2e tests - Update FHIR's SnomedConceptMapApiProvider - Update FHIR concept map test cases * Exchanged descriptions. * [core] remove IComponent.ID_FUNCTION * [snomed] fix definitionStatus() expansion issues * [snomed] add acceptabilities() expansion to /descriptions API * [snomed] remove CaseSignificance enum literals * [snomed] support caseSignificance() expansion on descriptions * [core] fix unauthorized issue when executing console commands * SO-3123: Convert mapBlock field to an Integer when importing * SO-3858: Add support for nested, and reverse nested aggregation * [snomed] remove CharacteristicType enum literals * [snomed] remove RelationshipModifier enum literals * [snomed] support characteristicType() and modifier() expansion... ...on relationships * [qa] fix lgtm issue https://lgtm.com/rules/1511220334423/ * Revert "[qa] fix lgtm issue https://lgtm.com/rules/1511220334423/" This reverts commit 628bad4703b82f7af6564e49e9e57fec279e4983. * [snomed] run effective time restore only in non-import scenarios * [qa] suppress lgtm warning https://lgtm.com/rules/1511220334423/ * Upgrade to Elasticsearch 7.x (#478) * [index] bump version to Elasticsearch 7.5.2 * [index] fix tokenizer/analyzer compile errors * [index] use indices level when fetching cluster health * [index] fix EsNode initialization * [index] fix client compile errors * Fix type and other warnings printed by ES API. * [index] add CMS GC config to index tests * Fixes [parent] data too large issues during tests. * [rf2] reduce RF2 exporter scroll timeout to 1m * [tests] fix negative scores in SortIndexTest * [api] remove scrollId and scrollKeepAlive from Java API * Use searchAfter + branch@timestamp for efficient data snapshot paging/scrolling. * [core] remove scrollId from core models and API * [snomed] remove scrollId from snomed models and API * [rest] remove scrollId from core REST API * [snomed] remove scrollId from snomed REST API * [rf2] use branch@timestamp for RF2 exports * [build] add CMS GC settings to all tycho surefire executions * [launch] add CMS GC settings to all test launch configs * [qa] fix lgtm issues https://lgtm.com/rules/2049510531/ * [index] use bool query with should clauses for term filters with more than the configured index.max_terms_count. * Also make it possible to configure both maxTermsCount and resultWindow values from snowowl.yml (repository.index config). * [index] fix some of the type_removal warnings reported by ES * The remaining warnings thrown by the Mapping API, but we cannot remove it yet, due to our dependency to the TCP client infrastructure. Those warnings will be eliminated once ES 8 is out and we decide to upgrade to that (which will remove the TCP client functionality entirely). Fix some java compile warnings as well. And also add some serialVersionUIDs. * [index] fix nested field name in terms queries. Also fix decimal value conversion when number of terms is less than the max_terms_count. * [index] searches should always track total hits accurately * [core] update comments in SearchResourceRequestIterator * [index] aggregations should always track total hits accurately * [index] fix typo * [docker] bump elasticsearch-oss image version to 7.5.2 * [index] prevent unnecessary mapping updates during startup * [qa] fix lgtm issue https://lgtm.com/rules/1930000368/ * [qa] fix lgtm issue https://lgtm.com/rules/9990077/ * [qa] fix lgtm issue https://lgtm.com/rules/11000068/ * [qa] fix lgtm issue https://lgtm.com/rules/9990077/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] fix lgtm issue https://lgtm.com/rules/2049510531/ * [qa] ignore lgtm issue https://lgtm.com/rules/1954750296/ in Base64 * [qa] ignore lgtm issue https://lgtm.com/rules/1954750296/ (JavaBinCodec) * [qa] fix lgtm issue https://lgtm.com/rules/1507082716110/ * [snomed] remove InactivationIndicator and AssociationType enum literals Use new InactivationProperties object to specify indicator and association target values during component inactivation. Make processInactivation method generic in SnomedComponentUpdateRequest. * [index] Reorder classpath entries, remove source attachment paths * [dev] fix launch configurations Co-authored-by: Gábor Nagy Co-authored-by: AAAlinaaa Co-authored-by: Mark Czotter Co-authored-by: Balazs Banfai Co-authored-by: Gabriella Deak <45433791+adeakgabi@users.noreply.github.com> Co-authored-by: András Péteri --- CHANGELOG.md | 40 + README.md | 19 +- SnowOwlServer.setup | 12 + .../feature.xml | 2 +- .../pom.xml | 2 +- .../snowowl.yml} | 0 .../pom.xml | 2 +- .../snow-owl-cis.product | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../client/CisSnomedIdentifierService.java | 34 +- .../DefaultSnomedIdentifierService.java | 13 +- cis/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../com.b2international.commons.base/pom.xml | 2 +- .../commons/encoding/Base64.java | 3 +- .../META-INF/MANIFEST.MF | 2 +- .../com.b2international.commons.test/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- commons/com.b2international.commons/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../.launch/index-http-unit-tests.launch | 2 +- .../.launch/index-tcp-unit-tests.launch | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../com.b2international.index.tests/pom.xml | 6 +- .../index/MaxTermsCountTest.java | 74 + .../b2international/index/SortIndexTest.java | 2 +- commons/com.b2international.index/.classpath | 82 +- .../META-INF/MANIFEST.MF | 86 +- .../build.properties | 6 +- commons/com.b2international.index/pom.xml | 8 +- .../index/IndexClientFactory.java | 15 +- .../aggregations/AggregationBuilder.java | 10 + .../index/analyzer/DelimiterTokenizer.java | 64 - .../CharMatcherTokenizer.java | 11 +- .../ComponentTermAnalyzer.java | 6 +- .../index/compat/Highlighting.java | 1 - .../index/compat/TextConstants.java | 4 +- .../index/decimal/ModuleVersion.java | 1 - .../index/es/EsDocumentSearcher.java | 84 +- .../index/es/EsDocumentWriter.java | 9 +- .../index/es/EsIndexClientFactory.java | 2 +- .../com/b2international/index/es/EsNode.java | 9 +- .../index/es/admin/EsIndexAdmin.java | 37 +- .../index/es/client/EsClient.java | 4 +- .../index/es/client/EsClientBase.java | 7 +- .../index/es/client/http/EsHttpClient.java | 12 +- .../index/es/client/tcp/EsTcpClient.java | 15 +- .../index/es/query/EsQueryBuilder.java | 88 +- .../BranchMergeConflictException.java | 4 +- .../revision/RevisionBranchChangeSet.java | 3 +- .../index/revision/RevisionBranchPoint.java | 4 +- .../hadoop/hbase/util/OrderedBytes.java | 1 + .../apache/solr/common/util/JavaBinCodec.java | 1 + .../client/RestHighLevelClientExt.java | 8 - commons/com.b2international.mapdb/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../com.b2international.scripting.api/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- commons/pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../.launch/core-e2e-tests.launch | 6 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 4 +- .../snowowl/core/rest/AllSnowOwlApiTests.java | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 18 +- .../snow-owl-api-docs/src/App.js | 17 +- .../core/rest/AbstractRestService.java | 21 + .../snowowl/core/rest/BaseApiConfig.java | 8 +- .../core/rest/ControllerExceptionMapper.java | 26 +- .../snowowl/core/rest/SnowOwlApiConfig.java | 2 +- .../core/rest/SnowOwlApiRestService.java | 61 + .../core/rest/SnowOwlSecurityConfig.java | 1 + .../rest/branch}/BranchUpdateRestRequest.java | 4 +- .../rest/branch}/CreateBranchRestRequest.java | 2 +- .../rest/branch}/CreateReviewRequest.java | 4 +- .../core/rest/branch}/MergeRestRequest.java | 4 +- .../RepositoryBranchMergeRestService.java | 28 +- .../branch/RepositoryBranchRestService.java | 42 +- .../RepositoryBranchReviewRestService.java | 16 +- .../codesystem/CodeSystemRestService.java | 3 +- .../commit/RepositoryCommitRestService.java | 30 +- .../core/rest/compare/CompareRestRequest.java | 7 +- .../RepositoryBranchCompareRestService.java | 16 +- .../ResourceRequest.java} | 25 +- .../core/rest/domain/ResourceRestSearch.java | 81 + .../snowowl/core/rest/job/JobRestService.java | 12 +- .../ModelAttributeParameterExpanderExt.java | 2 +- .../validation/ValidationRestService.java | 17 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 4 +- core/com.b2international.snowowl.core/pom.xml | 2 +- .../snowowl/core/ApplicationContext.java | 6 +- .../core/authorization/Unprotected.java | 36 + .../snowowl/core/branch/Branches.java | 6 +- .../snowowl/core/domain/ExportResult.java | 10 +- .../snowowl/core/domain/IComponent.java | 10 +- .../domain/PageableCollectionResource.java | 23 +- .../core/domain/TransactionContext.java | 16 +- .../b2international/snowowl/core/id/IDs.java | 28 +- .../snowowl/core/merge/Merges.java | 8 +- .../core/monitoring/MonitoredRequest.java | 17 +- .../core/request/SearchResourceRequest.java | 29 +- .../request/SearchResourceRequestBuilder.java | 40 +- .../SearchResourceRequestIterator.java | 26 +- .../core/terminology/MapTargetTypes.java | 3 + .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../core/authorization/AuthorizedRequest.java | 5 +- .../core/commit/CommitInfoConverter.java | 40 +- .../core/commit/CommitInfoDetails.java | 5 +- .../commit/CommitInfoGetRequestBuilder.java | 6 +- .../core/commit/CommitInfoSearchRequest.java | 10 +- .../CommitInfoSearchRequestBuilder.java | 10 +- .../snowowl/core/commit/CommitInfos.java | 7 +- .../console/CommandLineAuthenticator.java | 10 +- .../core/console/CommandLineStream.java | 7 +- .../core/console/SnowOwlCommandProvider.java | 4 +- .../core/repository/RepositoryBuilder.java | 9 +- .../core/repository/RepositoryPlugin.java | 26 +- .../RepositoryTransactionContext.java | 47 +- .../TerminologyRepositoryInitializer.java | 10 +- .../TerminologyRepositoryPlugin.java | 6 +- .../core/validation/ValidationRequests.java | 8 +- .../eval/ValidationRuleEvaluator.java | 16 +- .../issue/ValidationIssueSearchRequest.java | 4 +- .../validation/issue/ValidationIssues.java | 7 +- .../rule/ValidationRuleSearchRequest.java | 4 +- .../core/validation/rule/ValidationRules.java | 7 +- .../ValidationWhiteListSearchRequest.java | 4 +- .../whitelist/ValidationWhiteLists.java | 7 +- .../snowowl/datastore/CodeSystemVersions.java | 6 +- .../snowowl/datastore/CodeSystems.java | 6 +- .../datastore/config/IndexConfiguration.java | 23 +- .../converter/BaseResourceConverter.java | 10 +- .../converter/ResourceConverter.java | 5 +- .../index/BaseRepositoryPreCommitHook.java | 12 +- .../datastore/oplock/DatastoreLocks.java | 8 +- .../oplock/DatastoreOperationLockManager.java | 2 +- .../remotejobs/RemoteJobTracker.java | 4 +- .../datastore/remotejobs/RemoteJobs.java | 6 +- .../request/BranchGetRequestBuilder.java | 4 +- .../request/BranchRequestBuilder.java | 6 +- .../request/BranchSearchRequest.java | 8 +- .../request/BranchSearchRequestBuilder.java | 4 +- .../request/CreateMergeRequestBuilder.java | 4 +- .../datastore/request/IndexReadRequest.java | 54 - .../RepositoryCommitRequestBuilder.java | 8 +- .../RepositoryIndexRequestBuilder.java | 38 - .../datastore/request/RepositoryRequest.java | 22 +- .../request/RepositoryRequestBuilder.java | 11 +- .../datastore/request/RepositoryRequests.java | 8 +- .../request/ReviewCreateRequestBuilder.java | 4 +- .../request/RevisionIndexRequestBuilder.java | 8 +- .../request/SearchIndexResourceRequest.java | 27 +- .../datastore/request/SearchMergeRequest.java | 2 +- .../compare/BranchCompareRequestBuilder.java | 6 +- .../request/job/SearchJobRequest.java | 6 +- .../repository/RepositoryClearRequest.java | 16 +- .../RepositoryClearRequestBuilder.java | 12 +- .../repository/RepositoryGetRequest.java | 2 +- .../request/system/ServerInfoGetRequest.java | 4 +- .../CodeSystemVersionCreateRequest.java | 15 +- .../core/request/CodeSystemCreateRequest.java | 6 +- .../request/CodeSystemGetRequestBuilder.java | 6 +- .../core/request/CodeSystemSearchRequest.java | 6 +- .../CodeSystemSearchRequestBuilder.java | 6 +- .../CodeSystemVersionSearchRequest.java | 6 +- ...CodeSystemVersionSearchRequestBuilder.java | 6 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../snowowl/identity/domain/Users.java | 4 +- .../identity/request/UserLoginRequest.java | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- core/pom.xml | 2 +- dist/pom.xml | 2 +- docker/docker-compose.yml | 2 +- documentation/META-INF/MANIFEST.MF | 5 +- documentation/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../model/codesystem/IConceptProperty.java | 64 +- .../core/model/codesystem/LookupRequest.java | 129 +- .../fhir/core/model/valueset/ValueSet.java | 22 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../.launch/fhir-api-tests.launch | 4 +- .../.launch/fhir-unit-tests.launch | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../snowowl/fhir/tests/AllFhirRestTests.java | 7 +- .../conceptmap/SnomedConceptMapRestTest.java | 2 + .../TestMapTypeReferenceSetCreator.java | 64 +- .../TranslateSnomedConceptMapRestTest.java | 82 +- .../valueset/SnomedValueSetRestTest.java | 6 +- .../valueset/TestReferenceSetCreator.java | 21 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../snowowl/core/rest/FhirApiConfig.java | 4 +- .../fhir/rest/FhirConceptMapRestService.java | 2 +- .../fhir/rest/StructureDefinitionService.java | 6 +- fhir/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- net4j/com.b2international.snowowl.rpc/pom.xml | 2 +- net4j/pom.xml | 2 +- pom.xml | 55 +- .../category.xml | 16 +- .../pom.xml | 2 +- .../snow-owl-oss.product | 2 +- releng/pom.xml | 2 +- releng/target-platform/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../snomed/common/SnomedConstants.java | 10 +- .../snomed/common/SnomedRf2Headers.java | 20 +- .../feature.xml | 16 +- .../pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- .../.launch/snomed-e2e-tests (cis).launch | 6 +- .../.launch/snomed-e2e-tests.launch | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../core/io/SnomedRefSetDSVExportTest.java | 15 +- .../snomed/core/issue/EclSerializerTest.java | 2 +- ...IssueSO2503RemoteJobDynamicMappingFix.java | 2 +- .../core/rest/AbstractSnomedApiTest.java | 101 +- .../snomed/core/rest/AllSnomedApiTests.java | 7 +- ...3019FixDeletionOfReferringMembersTest.java | 4 +- .../core/rest/SnomedApiTestConstants.java | 5 +- .../rest/SnomedCompareRestRequestTest.java | 2 +- .../rest/SnomedComponentRestRequests.java | 43 +- .../snomed/core/rest/SnomedComponentType.java | 14 +- .../core/rest/SnomedExportRestRequests.java | 3 +- .../core/rest/SnomedMergingRestRequests.java | 2 +- ...edReferenceSetDeletionPerformanceTest.java | 11 +- .../snomed/core/rest/SnomedRestFixtures.java | 86 +- .../rest/branches/SnomedBranchingApiTest.java | 57 +- .../rest/branches/SnomedMergeApiTest.java | 118 +- .../branches/SnomedMergeConflictTest.java | 44 +- .../rest/branches/SnomedReviewApiTest.java | 29 +- .../SnomedClassificationApiTest.java | 26 +- .../rest/components/SnomedConceptApiTest.java | 428 +- .../components/SnomedDescriptionApiTest.java | 144 +- .../SnomedModuleDependencyRefsetTest.java | 22 +- .../rest/components/SnomedRefSetApiTest.java | 12 +- .../components/SnomedRefSetBulkApiTest.java | 2 +- .../components/SnomedRefSetMemberApiTest.java | 7 +- .../SnomedRefSetMemberParameterizedTest.java | 26 +- .../SnomedRefSetParameterizedTest.java | 3 +- .../components/SnomedRelationshipApiTest.java | 21 +- .../rest/ext/SnomedExtensionCreationTest.java | 5 +- .../ext/SnomedExtensionDowngradeTest.java | 20 +- .../rest/ext/SnomedExtensionUpgradeTest.java | 278 +- .../ext/SnomedExtensionVersioningTest.java | 4 +- .../core/rest/io/SnomedExportApiTest.java | 98 +- .../core/rest/io/SnomedImportApiTest.java | 7 +- .../rest/io/SnomedImportRowValidatorTest.java | 4 +- .../SnomedConceptCreatePerformanceTest.java | 2 +- .../rest/perf/SnomedMergePerformanceTest.java | 8 +- .../versioning/SnomedVersioningApiTest.java | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../snowowl/core/rest/SnomedApiConfig.java | 5 +- .../core/rest/AbstractSnomedRestService.java | 6 +- .../rest/SnomedClassificationRestService.java | 32 +- .../core/rest/SnomedConceptRestService.java | 18 +- .../rest/SnomedDescriptionRestService.java | 17 +- .../core/rest/SnomedExportRestService.java | 10 +- .../core/rest/SnomedImportRestService.java | 9 +- .../SnomedReferenceSetMemberRestService.java | 17 +- .../rest/SnomedReferenceSetRestService.java | 99 +- .../rest/SnomedRelationshipRestService.java | 21 +- ...medRepositoryBranchCompareRestService.java | 33 + ...omedRepositoryBranchMergeRestService.java} | 23 +- .../SnomedRepositoryBranchRestService.java} | 23 +- ...omedRepositoryBranchReviewRestService.java | 33 + .../SnomedRepositoryCommitRestService.java | 33 + .../AbstractSnomedComponentRestUpdate.java | 15 +- .../core/rest/domain/ChangeRequest.java | 63 - .../domain/ExpandableSnomedRelationship.java | 153 - .../rest/domain/SnomedConceptRestSearch.java | 79 +- .../rest/domain/SnomedConceptRestUpdate.java | 71 +- .../domain/SnomedDescriptionRestInput.java | 20 +- .../domain/SnomedDescriptionRestSearch.java | 85 +- .../domain/SnomedDescriptionRestUpdate.java | 50 +- .../domain/SnomedInboundRelationships.java | 60 - .../domain/SnomedOutboundRelationships.java | 56 - .../SnomedReferenceSetMemberRestSearch.java | 83 +- ...java => SnomedReferenceSetRestSearch.java} | 35 +- .../domain/SnomedRelationshipRestInput.java | 37 +- .../domain/SnomedRelationshipRestSearch.java | 87 +- .../domain/SnomedRelationshipRestUpdate.java | 26 +- ...equest.java => SnomedResourceRequest.java} | 38 +- .../ClassificationRunNotFoundException.java | 35 - .../ExportRunNotFoundException.java | 35 - .../FullySpecifiedNameNotFoundException.java | 35 - .../PreferredTermNotFoundException.java | 35 - .../exceptions/SnomedExportException.java | 35 - ...dImportConfigurationNotFoundException.java | 39 - .../rest/services/FsnJoinerOperation.java | 4 +- .../services/ISnomedRf2ImportService.java | 9 +- .../rest/services/SnomedRf2ImportService.java | 5 +- .../.launch/snomed-core-unit-tests.launch | 5 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 5 +- ...lationshipIndexEntrySerializationTest.java | 8 +- .../META-INF/MANIFEST.MF | 5 +- .../pom.xml | 2 +- .../snomed/core/cli/SnomedCommand.java | 6 +- .../core/domain/AcceptabilityMembership.java | 66 + .../snomed/core/domain/AssociationTarget.java | 72 + .../snomed/core/domain/AssociationType.java | 107 - .../snomed/core/domain/CaseSignificance.java | 83 - .../core/domain/CharacteristicType.java | 98 - .../domain/CharacteristicTypePredicates.java | 123 - .../snomed/core/domain/DefinitionStatus.java | 78 - .../DescriptionInactivationIndicator.java | 121 - .../core/domain/InactivationIndicator.java | 119 - .../core/domain/InactivationProperties.java | 74 + .../core/domain/InactivationReason.java | 174 - .../core/domain/RelationshipModifier.java | 77 - .../snomed/core/domain/SnomedComponent.java | 22 +- .../snomed/core/domain/SnomedConcept.java | 131 +- .../snomed/core/domain/SnomedConcepts.java | 8 +- .../core/domain/SnomedCoreComponent.java | 114 +- .../snomed/core/domain/SnomedDescription.java | 112 +- .../core/domain/SnomedDescriptions.java | 7 +- .../core/domain/SnomedRelationship.java | 39 +- .../core/domain/SnomedRelationships.java | 7 +- .../domain/constraint/SnomedConstraints.java | 7 +- .../core/domain/refset/MemberChange.java | 9 +- .../core/domain/refset/MemberChangeImpl.java | 8 +- .../core/domain/refset/SnomedRefSetType.java | 38 +- .../refset/SnomedReferenceSetMember.java | 7 + .../refset/SnomedReferenceSetMembers.java | 7 +- .../domain/refset/SnomedReferenceSets.java | 7 +- .../snomed/core/ecl/DefaultEclSerializer.java | 6 +- .../core/ecl/SnomedEclEvaluationRequest.java | 8 +- .../ecl/SnomedEclRefinementEvaluator.java | 10 +- .../snomed/core/ecl/SnomedEclRewriter.java | 24 +- .../snomed/core/mrcm/io/MrcmCommand.java | 16 +- .../core/ql/SnomedQueryEvaluationRequest.java | 6 +- ...plexBlockMapReferenceSetMemberBuilder.java | 96 + .../snomed/core/store/SnomedComponents.java | 11 +- .../core/store/SnomedConceptBuilder.java | 18 +- ...ncreteDomainReferenceSetMemberBuilder.java | 12 +- .../core/store/SnomedDescriptionBuilder.java | 14 +- .../core/store/SnomedRelationshipBuilder.java | 24 +- .../core/version/SnomedVersioningRequest.java | 4 +- .../snomed/datastore/CaseSignificance.java | 125 - .../snomed/datastore/SnomedRefSetUtil.java | 18 +- .../converter/InactivationExpander.java | 115 - .../InactivationPropertiesExpander.java | 99 + .../datastore/converter/MembersExpander.java | 4 +- .../datastore/converter/ModuleExpander.java | 67 + .../converter/SnomedConceptConverter.java | 95 +- .../converter/SnomedConstraintConverter.java | 6 +- .../converter/SnomedDescriptionConverter.java | 154 +- .../SnomedReferenceSetConverter.java | 7 +- .../SnomedReferenceSetMemberConverter.java | 9 +- .../SnomedRelationshipConverter.java | 151 +- .../change/SnomedRepositoryPreCommitHook.java | 33 +- .../index/entry/SnomedConceptDocument.java | 25 +- .../entry/SnomedDescriptionIndexEntry.java | 21 +- .../entry/SnomedRefSetMemberIndexEntry.java | 45 +- .../entry/SnomedRelationshipIndexEntry.java | 15 +- .../taxonomy/ReasonerTaxonomyBuilder.java | 20 +- .../internal/rf2/SnomedDsvExportItemType.java | 5 +- ...seSnomedComponentUpdateRequestBuilder.java | 10 +- .../EvaluateQueryRefSetMemberRequest.java | 32 +- .../QueryRefSetMemberUpdateRequest.java | 14 +- .../datastore/request/RefSetSupport.java | 3 +- .../SnomedAssociationTargetUpdateRequest.java | 49 +- ...edComplexBlockMapMemberCreateDelegate.java | 89 + ...edComplexBlockMapMemberUpdateDelegate.java | 81 + .../request/SnomedComponentUpdateRequest.java | 108 +- .../request/SnomedConceptCreateRequest.java | 26 +- .../SnomedConceptCreateRequestBuilder.java | 11 +- .../request/SnomedConceptSearchRequest.java | 4 +- .../SnomedConceptSearchRequestBuilder.java | 4 +- .../request/SnomedConceptUpdateRequest.java | 146 +- .../SnomedConceptUpdateRequestBuilder.java | 28 +- ...medConcreteDomainMemberCreateDelegate.java | 5 +- .../SnomedConstraintSearchRequest.java | 4 +- .../SnomedDescriptionCreateRequest.java | 72 +- ...SnomedDescriptionCreateRequestBuilder.java | 20 +- .../SnomedDescriptionSearchRequest.java | 4 +- ...SnomedDescriptionSearchRequestBuilder.java | 39 +- .../SnomedDescriptionUpdateRequest.java | 128 +- ...SnomedDescriptionUpdateRequestBuilder.java | 28 +- .../request/SnomedOWLAxiomHelper.java | 21 +- .../SnomedRefSetMemberCreateRequest.java | 43 +- .../SnomedRefSetMemberSearchRequest.java | 9 +- .../SnomedRefSetMemberUpdateRequest.java | 40 +- .../request/SnomedRefSetSearchRequest.java | 4 +- .../SnomedRefSetSearchRequestBuilder.java | 39 +- .../SnomedRelationshipCreateRequest.java | 32 +- ...nomedRelationshipCreateRequestBuilder.java | 21 +- .../SnomedRelationshipSearchRequest.java | 4 +- .../SnomedRelationshipUpdateRequest.java | 53 +- ...nomedRelationshipUpdateRequestBuilder.java | 21 +- .../SnomedRepositoryCommitRequestBuilder.java | 11 +- .../request/dsv/SnomedDSVExportRequest.java | 4 +- .../SnomedSimpleTypeRefSetDSVExporter.java | 14 +- .../request/rf2/SnomedRf2ExportRequest.java | 24 +- .../rf2/SnomedRf2ExportRequestBuilder.java | 10 +- .../rf2/SnomedRf2ImportRequestBuilder.java | 9 +- .../rf2/exporter/Rf2ConceptExporter.java | 12 +- .../rf2/exporter/Rf2DescriptionExporter.java | 6 +- .../request/rf2/exporter/Rf2Exporter.java | 15 +- .../exporter/Rf2LanguageRefSetExporter.java | 3 +- .../rf2/exporter/Rf2RefSetExporter.java | 9 +- .../rf2/exporter/Rf2RelationshipExporter.java | 20 +- .../Rf2ComplexBlockMapRefSetContentType.java | 85 + .../rf2/importer/Rf2ConceptContentType.java | 6 +- .../importer/Rf2DescriptionContentType.java | 5 +- .../request/rf2/importer/Rf2Format.java | 3 +- .../importer/Rf2RelationshipContentType.java | 8 +- .../rf2/importer/Rf2TransactionContext.java | 27 +- ...omedConcreteDomainImportPostProcessor.java | 18 +- .../snomed/datastore/taxonomy/Taxonomies.java | 54 +- .../.project | 28 - .../META-INF/MANIFEST.MF | 16 - .../build.properties | 7 - .../plugin.properties | 2 - .../plugin.xml | 10 - .../pom.xml | 12 - .../queryast.ecore | 53 - .../queryast.genmodel | 49 - .../dsl/query/ChainedQueryRewriter.java | 31 - .../dsl/query/GraphMLExportRewriter.java | 150 - .../dsl/query/SyntaxErrorException.java | 54 - .../snomed/dsl/query/ast/AndClause.java | 32 - .../snomed/dsl/query/ast/AttributeClause.java | 40 - .../snomed/dsl/query/ast/BinaryRValue.java | 56 - .../snomed/dsl/query/ast/ConceptRef.java | 81 - .../snomed/dsl/query/ast/NotClause.java | 35 - .../dsl/query/ast/NumericDataClause.java | 121 - .../dsl/query/ast/NumericDataGroupClause.java | 65 - .../snomed/dsl/query/ast/OrClause.java | 32 - .../snowowl/snomed/dsl/query/ast/RValue.java | 39 - .../snowowl/snomed/dsl/query/ast/RefSet.java | 40 - .../snomed/dsl/query/ast/SubExpression.java | 34 - .../snomed/dsl/query/ast/UnaryRValue.java | 35 - .../dsl/query/queryast/AttributeClause.java | 30 - .../query/queryast/AttributeClauseGroup.java | 30 - .../dsl/query/queryast/BinaryRValue.java | 89 - .../snomed/dsl/query/queryast/ConceptRef.java | 119 - .../dsl/query/queryast/NumericDataClause.java | 143 - .../queryast/NumericDataGroupClause.java | 116 - .../snomed/dsl/query/queryast/RValue.java | 34 - .../snomed/dsl/query/queryast/RefSet.java | 62 - .../dsl/query/queryast/SubExpression.java | 30 - .../query/queryast/SubsumptionQuantifier.java | 247 - .../dsl/query/queryast/UnaryRValue.java | 62 - .../dsl/query/queryast/ecoreastFactory.java | 136 - .../dsl/query/queryast/ecoreastPackage.java | 1107 - .../query/queryast/impl/AndClauseImpl.java | 56 - .../impl/AttributeClauseGroupImpl.java | 60 - .../queryast/impl/AttributeClauseImpl.java | 56 - .../query/queryast/impl/BinaryRValueImpl.java | 264 - .../query/queryast/impl/ConceptRefImpl.java | 276 - .../query/queryast/impl/NotClauseImpl.java | 59 - .../queryast/impl/NumericDataClauseImpl.java | 335 - .../impl/NumericDataGroupClauseImpl.java | 299 - .../dsl/query/queryast/impl/OrClauseImpl.java | 57 - .../dsl/query/queryast/impl/RValueImpl.java | 64 - .../dsl/query/queryast/impl/RefSetImpl.java | 162 - .../queryast/impl/SubExpressionImpl.java | 60 - .../query/queryast/impl/UnaryRValueImpl.java | 186 - .../queryast/impl/ecoreastFactoryImpl.java | 268 - .../queryast/impl/ecoreastPackageImpl.java | 624 - .../queryast/util/ecoreastAdapterFactory.java | 360 - .../query/queryast/util/ecoreastSwitch.java | 405 - .../query/walker/ESCGExpressionVisitor.java | 67 - .../query/walker/VisitingQueryRewriter.java | 35 - .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../snomed/ecl/tests/EclInjectorProvider.java | 9 +- .../snomed/ecl/tests/EclParsingTest.xtend | 431 +- .../.gitignore | 2 - .../.launch/Generate ECL.launch | 14 - .../ECL_v1.3_ABNF_brief_syntax_20170717.txt | 74 + .../META-INF/MANIFEST.MF | 2 +- .../build.properties | 3 +- .../model/generated/Ecl.ecore | 28 +- .../model/generated/Ecl.genmodel | 18 +- .../pom.xml | 2 +- .../snomed/ecl/AbstractEclRuntimeModule.java | 2 +- .../snowowl/snomed/ecl/Ecl.xtextbin | Bin 8826 -> 9175 bytes .../ecl/EclStandaloneSetupGenerated.java | 2 +- .../snowowl/snomed/ecl/ecl/AncestorOf.java | 6 +- .../snomed/ecl/ecl/AncestorOrSelfOf.java | 6 +- .../ecl/ecl/AndExpressionConstraint.java | 10 +- .../snowowl/snomed/ecl/ecl/AndRefinement.java | 24 +- .../snowowl/snomed/ecl/ecl/Any.java | 2 +- .../snomed/ecl/ecl/AttributeComparison.java | 6 +- .../snomed/ecl/ecl/AttributeConstraint.java | 20 +- .../snomed/ecl/ecl/AttributeValueEquals.java | 2 +- .../ecl/ecl/AttributeValueNotEquals.java | 2 +- .../snomed/ecl/ecl/BooleanValueEquals.java | 6 +- .../snomed/ecl/ecl/BooleanValueNotEquals.java | 6 +- .../snowowl/snomed/ecl/ecl/Cardinality.java | 10 +- .../snowowl/snomed/ecl/ecl/ChildOf.java | 6 +- .../snowowl/snomed/ecl/ecl/Comparison.java | 2 +- .../snomed/ecl/ecl/DataTypeComparison.java | 2 +- .../snomed/ecl/ecl/DecimalValueEquals.java | 6 +- .../ecl/ecl/DecimalValueGreaterThan.java | 6 +- .../ecl/DecimalValueGreaterThanEquals.java | 6 +- .../snomed/ecl/ecl/DecimalValueLessThan.java | 6 +- .../ecl/ecl/DecimalValueLessThanEquals.java | 6 +- .../snomed/ecl/ecl/DecimalValueNotEquals.java | 6 +- .../snowowl/snomed/ecl/ecl/DescendantOf.java | 6 +- .../snomed/ecl/ecl/DescendantOrSelfOf.java | 6 +- .../ecl/ecl/DottedExpressionConstraint.java | 10 +- ...ibuteGroup.java => EclAttributeGroup.java} | 34 +- ...eference.java => EclConceptReference.java} | 28 +- .../snowowl/snomed/ecl/ecl/EclFactory.java | 8 +- .../snowowl/snomed/ecl/ecl/EclPackage.java | 148 +- .../{Refinement.java => EclRefinement.java} | 8 +- .../ecl/ExclusionExpressionConstraint.java | 10 +- .../snomed/ecl/ecl/ExpressionConstraint.java | 2 +- .../snomed/ecl/ecl/IntegerValueEquals.java | 6 +- .../ecl/ecl/IntegerValueGreaterThan.java | 6 +- .../ecl/IntegerValueGreaterThanEquals.java | 6 +- .../snomed/ecl/ecl/IntegerValueLessThan.java | 6 +- .../ecl/ecl/IntegerValueLessThanEquals.java | 6 +- .../snomed/ecl/ecl/IntegerValueNotEquals.java | 6 +- .../snowowl/snomed/ecl/ecl/MemberOf.java | 6 +- .../snomed/ecl/ecl/NestedExpression.java | 6 +- .../snomed/ecl/ecl/NestedRefinement.java | 14 +- .../ecl/ecl/OrExpressionConstraint.java | 10 +- .../snowowl/snomed/ecl/ecl/OrRefinement.java | 24 +- .../snowowl/snomed/ecl/ecl/ParentOf.java | 6 +- .../ecl/ecl/RefinedExpressionConstraint.java | 16 +- .../snowowl/snomed/ecl/ecl/Script.java | 6 +- .../snomed/ecl/ecl/StringValueEquals.java | 6 +- .../snomed/ecl/ecl/StringValueNotEquals.java | 6 +- .../snomed/ecl/ecl/impl/AncestorOfImpl.java | 4 +- .../ecl/ecl/impl/AncestorOrSelfOfImpl.java | 4 +- .../ecl/impl/AndExpressionConstraintImpl.java | 6 +- .../ecl/ecl/impl/AndRefinementImpl.java | 38 +- .../snowowl/snomed/ecl/ecl/impl/AnyImpl.java | 2 +- .../ecl/ecl/impl/AttributeComparisonImpl.java | 4 +- .../ecl/ecl/impl/AttributeConstraintImpl.java | 12 +- .../ecl/impl/AttributeValueEqualsImpl.java | 2 +- .../ecl/impl/AttributeValueNotEqualsImpl.java | 2 +- .../ecl/ecl/impl/BooleanValueEqualsImpl.java | 6 +- .../ecl/impl/BooleanValueNotEqualsImpl.java | 6 +- .../snomed/ecl/ecl/impl/CardinalityImpl.java | 6 +- .../snomed/ecl/ecl/impl/ChildOfImpl.java | 4 +- .../snomed/ecl/ecl/impl/ComparisonImpl.java | 2 +- .../ecl/ecl/impl/DataTypeComparisonImpl.java | 2 +- .../ecl/ecl/impl/DecimalValueEqualsImpl.java | 4 +- .../DecimalValueGreaterThanEqualsImpl.java | 4 +- .../ecl/impl/DecimalValueGreaterThanImpl.java | 4 +- .../impl/DecimalValueLessThanEqualsImpl.java | 4 +- .../ecl/impl/DecimalValueLessThanImpl.java | 4 +- .../ecl/impl/DecimalValueNotEqualsImpl.java | 4 +- .../snomed/ecl/ecl/impl/DescendantOfImpl.java | 4 +- .../ecl/ecl/impl/DescendantOrSelfOfImpl.java | 4 +- .../impl/DottedExpressionConstraintImpl.java | 6 +- ...upImpl.java => EclAttributeGroupImpl.java} | 72 +- ...Impl.java => EclConceptReferenceImpl.java} | 40 +- .../snomed/ecl/ecl/impl/EclFactoryImpl.java | 72 +- .../snomed/ecl/ecl/impl/EclPackageImpl.java | 191 +- ...nementImpl.java => EclRefinementImpl.java} | 12 +- .../ExclusionExpressionConstraintImpl.java | 6 +- .../ecl/impl/ExpressionConstraintImpl.java | 2 +- .../ecl/ecl/impl/IntegerValueEqualsImpl.java | 4 +- .../IntegerValueGreaterThanEqualsImpl.java | 4 +- .../ecl/impl/IntegerValueGreaterThanImpl.java | 4 +- .../impl/IntegerValueLessThanEqualsImpl.java | 4 +- .../ecl/impl/IntegerValueLessThanImpl.java | 4 +- .../ecl/impl/IntegerValueNotEqualsImpl.java | 4 +- .../snomed/ecl/ecl/impl/MemberOfImpl.java | 4 +- .../ecl/ecl/impl/NestedExpressionImpl.java | 4 +- .../ecl/ecl/impl/NestedRefinementImpl.java | 22 +- .../ecl/impl/OrExpressionConstraintImpl.java | 6 +- .../snomed/ecl/ecl/impl/OrRefinementImpl.java | 38 +- .../snomed/ecl/ecl/impl/ParentOfImpl.java | 4 +- .../impl/RefinedExpressionConstraintImpl.java | 22 +- .../snomed/ecl/ecl/impl/ScriptImpl.java | 4 +- .../ecl/ecl/impl/StringValueEqualsImpl.java | 4 +- .../ecl/impl/StringValueNotEqualsImpl.java | 4 +- .../ecl/ecl/util/EclAdapterFactory.java | 32 +- .../snomed/ecl/ecl/util/EclSwitch.java | 38 +- .../antlr/EclAntlrTokenFileProvider.java | 2 +- .../snomed/ecl/parser/antlr/EclParser.java | 2 +- .../parser/antlr/internal/InternalEclParser.g | 228 +- .../antlr/internal/InternalEclParser.java | 873 +- .../antlr/internal/InternalEclParser.tokens | 53 +- .../ecl/parser/antlr/lexer/InternalEclLexer.g | 20 +- .../parser/antlr/lexer/InternalEclLexer.java | 743 +- .../antlr/lexer/InternalEclLexer.tokens | 53 +- .../ecl/scoping/AbstractEclScopeProvider.java | 2 +- ...java => AbstractEclSemanticSequencer.java} | 178 +- ...ava => AbstractEclSyntacticSequencer.java} | 88 +- .../snomed/ecl/services/EclGrammarAccess.java | 488 +- .../ecl/validation/AbstractEclValidator.java | 3 +- .../snowowl/snomed/ecl/Ecl.xtext | 82 +- .../snowowl/snomed/ecl/GenerateEcl.mwe2 | 7 +- .../converter/EclValueConverterService.java | 2 +- .../ecl/serializer/EclSemanticSequencer.java} | 10 +- .../ecl/serializer/EclSyntacticSequencer.java | 50 + .../snomed/ecl/validation/EclValidator.java | 4 +- .../.classpath | 10 + .../.project | 10 +- .../META-INF/MANIFEST.MF | 12 + .../build.properties | 4 +- .../pom.xml | 67 + .../snomed/etl/tests/EtlInjectorProvider.java | 81 + .../snomed/etl/tests/EtlParsingTest.xtend | 1962 ++ .../xtend-gen/.gitignore | 5 + .../.classpath | 1 + .../.project | 10 +- .../ETL_v1.0_ABNF_syntax_20170721.txt | 142 + .../META-INF/MANIFEST.MF | 30 + .../build.properties | 18 + .../model/generated/Etl.ecore | 132 + .../model/generated/Etl.genmodel | 113 + .../plugin.xml | 13 + .../pom.xml | 17 + .../snomed/etl/AbstractEtlRuntimeModule.java | 226 + .../snowowl/snomed/etl/Etl.xtextbin | Bin 0 -> 14786 bytes .../etl/EtlStandaloneSetupGenerated.java | 54 + .../snowowl/snomed/etl/etl/Attribute.java | 106 + .../snomed/etl/etl/AttributeGroup.java | 75 + .../snomed/etl/etl}/AttributeValue.java | 14 +- .../etl/etl/ConceptIdReplacementSlot.java} | 19 +- .../snomed/etl/etl/ConceptReference.java | 105 + .../etl/etl/ConceptReplacementSlot.java | 85 + .../etl/etl/ConcreteValueReplacementSlot.java | 59 + .../etl/etl/DecimalReplacementSlot.java | 50 + .../snowowl/snomed/etl/etl/DecimalValue.java | 60 + .../snomed/etl/etl/EtlCardinality.java | 83 + .../snowowl/snomed/etl/etl/EtlFactory.java | 326 + .../snowowl/snomed/etl/etl/EtlPackage.java | 2658 +++ .../etl/etl/ExpressionReplacementSlot.java | 31 + .../snomed/etl/etl/ExpressionTemplate.java | 106 + .../snowowl/snomed/etl/etl/FocusConcept.java | 83 + .../etl/etl/IntegerReplacementSlot.java | 50 + .../snowowl/snomed/etl/etl/IntegerValue.java | 59 + .../snowowl/snomed/etl/etl/Refinement.java | 65 + .../snowowl/snomed/etl/etl/SlotDecimal.java} | 20 +- .../etl/etl/SlotDecimalMaximumValue.java | 85 + .../etl/etl/SlotDecimalMinimumValue.java | 85 + .../snomed/etl/etl/SlotDecimalRange.java | 82 + .../snomed/etl/etl/SlotDecimalValue.java | 60 + .../snowowl/snomed/etl/etl/SlotInteger.java} | 20 +- .../etl/etl/SlotIntegerMaximumValue.java | 83 + .../etl/etl/SlotIntegerMinimumValue.java | 83 + .../snomed/etl/etl/SlotIntegerRange.java | 82 + .../snomed/etl/etl/SlotIntegerValue.java | 59 + .../snomed/etl/etl/StringReplacementSlot.java | 50 + .../snowowl/snomed/etl/etl/StringValue.java | 59 + .../snowowl/snomed/etl/etl/SubExpression.java | 73 + .../etl/etl/TemplateInformationSlot.java | 83 + .../snomed/etl/etl/TokenReplacementSlot.java | 75 + .../etl/etl/impl/AttributeGroupImpl.java | 257 + .../snomed/etl/etl/impl/AttributeImpl.java | 357 + .../etl/etl/impl/AttributeValueImpl.java | 55 + .../impl/ConceptIdReplacementSlotImpl.java | 53 + .../etl/etl/impl/ConceptReferenceImpl.java | 339 + .../etl/impl/ConceptReplacementSlotImpl.java | 283 + .../ConcreteValueReplacementSlotImpl.java | 191 + .../etl/impl/DecimalReplacementSlotImpl.java | 179 + .../snomed/etl/etl/impl/DecimalValueImpl.java | 193 + .../etl/etl/impl/EtlCardinalityImpl.java | 250 + .../snomed/etl/etl/impl/EtlFactoryImpl.java | 511 + .../snomed/etl/etl/impl/EtlPackageImpl.java | 1500 ++ .../impl/ExpressionReplacementSlotImpl.java | 53 + .../etl/etl/impl/ExpressionTemplateImpl.java | 356 + .../snomed/etl/etl/impl/FocusConceptImpl.java | 283 + .../etl/impl/IntegerReplacementSlotImpl.java | 179 + .../snomed/etl/etl/impl/IntegerValueImpl.java | 191 + .../snomed/etl/etl/impl/RefinementImpl.java | 221 + .../snomed/etl/etl/impl/SlotDecimalImpl.java | 55 + .../etl/impl/SlotDecimalMaximumValueImpl.java | 252 + .../etl/impl/SlotDecimalMinimumValueImpl.java | 252 + .../etl/etl/impl/SlotDecimalRangeImpl.java | 282 + .../etl/etl/impl/SlotDecimalValueImpl.java | 193 + .../snomed/etl/etl/impl/SlotIntegerImpl.java | 55 + .../etl/impl/SlotIntegerMaximumValueImpl.java | 250 + .../etl/impl/SlotIntegerMinimumValueImpl.java | 250 + .../etl/etl/impl/SlotIntegerRangeImpl.java | 282 + .../etl/etl/impl/SlotIntegerValueImpl.java | 191 + .../etl/impl/StringReplacementSlotImpl.java | 175 + .../snomed/etl/etl/impl/StringValueImpl.java | 191 + .../etl/etl/impl/SubExpressionImpl.java | 256 + .../etl/impl/TemplateInformationSlotImpl.java | 282 + .../etl/impl/TokenReplacementSlotImpl.java | 238 + .../etl/etl/util/EtlAdapterFactory.java | 745 + .../snomed/etl/etl/util/EtlSwitch.java | 840 + .../antlr/EtlAntlrTokenFileProvider.java} | 13 +- .../snomed/etl/parser/antlr/EtlParser.java | 52 + .../parser/antlr/internal/InternalEtlParser.g | 5786 +++++ .../antlr/internal/InternalEtlParser.java | 18001 ++++++++++++++++ .../antlr/internal/InternalEtlParser.tokens | 51 + .../etl/parser/antlr/lexer/InternalEtlLexer.g | 126 + .../parser/antlr/lexer/InternalEtlLexer.java | 2092 ++ .../antlr/lexer/InternalEtlLexer.tokens | 51 + .../etl/scoping/AbstractEtlScopeProvider.java | 21 + .../etl/serializer/EtlSemanticSequencer.java | 732 + .../etl/serializer/EtlSyntacticSequencer.java | 633 + .../snomed/etl/services/EtlGrammarAccess.java | 2769 +++ .../etl/validation/AbstractEtlValidator.java} | 21 +- .../snowowl/snomed/etl/Etl.xtext | 158 + .../snowowl/snomed/etl/EtlRuntimeModule.java} | 26 +- .../snomed/etl/EtlStandaloneSetup.java} | 18 +- .../snowowl/snomed/etl/GenerateEtl.mwe2 | 99 + .../converter/EtlValueConverterService.java} | 12 +- .../snomed/etl/generator/EtlGenerator.java | 42 + .../snomed/etl/scoping/EtlScopeProvider.java} | 14 +- .../snomed/etl/validation/EtlValidator.java | 37 + .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../fhir/SnomedCodeSystemApiProvider.java | 8 +- .../fhir/SnomedConceptMapApiProvider.java | 19 +- .../fhir/SnomedValueSetApiProvider.java | 22 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../mrcm/SingletonConceptSetDefinition.java | 61 - .../SingletonConceptSetDefinitionImpl.java | 75 - .../.classpath | 10 + .../.project | 10 +- .../META-INF/MANIFEST.MF | 12 + .../build.properties | 4 +- .../pom.xml | 71 + .../snomed/ql/tests/QLInjectorProvider.java | 81 + .../snomed/ql/tests/QLParsingTest.xtend | 157 + .../xtend-gen/.gitignore | 5 + .../.gitignore | 3 - ...ate QL (ql) Language Infrastructure.launch | 14 - .../META-INF/MANIFEST.MF | 2 +- .../build.properties | 3 +- .../model/generated/QL.ecore | 6 +- .../model/generated/QL.genmodel | 22 +- .../pom.xml | 2 +- .../snomed/ql/AbstractQLRuntimeModule.java | 2 +- .../snowowl/snomed/ql/QL.xtextbin | Bin 12356 -> 12727 bytes .../snomed/ql/QLStandaloneSetupGenerated.java | 2 +- .../antlr/QLAntlrTokenFileProvider.java | 2 +- .../snomed/ql/parser/antlr/QLParser.java | 2 +- .../parser/antlr/internal/InternalQLParser.g | 348 +- .../antlr/internal/InternalQLParser.java | 1283 +- .../antlr/internal/InternalQLParser.tokens | 65 +- .../ql/parser/antlr/lexer/InternalQLLexer.g | 20 +- .../parser/antlr/lexer/InternalQLLexer.java | 903 +- .../parser/antlr/lexer/InternalQLLexer.tokens | 65 +- .../snomed/ql/ql/AcceptableInFilter.java | 6 +- .../snowowl/snomed/ql/ql/ActiveFilter.java | 10 +- .../snomed/ql/ql/CaseSignificanceFilter.java | 6 +- ...onjunction.java => ConjunctionFilter.java} | 30 +- ...isjunction.java => DisjunctionFilter.java} | 30 +- .../snowowl/snomed/ql/ql/Domain.java | 13 +- .../snowowl/snomed/ql/ql/DomainQuery.java | 10 +- .../{Exclusion.java => ExclusionFilter.java} | 30 +- .../snowowl/snomed/ql/ql/Filter.java | 2 +- .../snomed/ql/ql/LanguageCodeFilter.java | 6 +- .../snomed/ql/ql/LanguageRefSetFilter.java | 6 +- .../snomed/ql/ql/LexicalSearchType.java | 17 +- .../snowowl/snomed/ql/ql/ModuleFilter.java | 10 +- .../snowowl/snomed/ql/ql/NestedFilter.java | 6 +- .../snowowl/snomed/ql/ql/NestedQuery.java | 6 +- .../snomed/ql/ql/PreferredInFilter.java | 6 +- .../snowowl/snomed/ql/ql/PropertyFilter.java | 2 +- .../snowowl/snomed/ql/ql/QlFactory.java | 20 +- .../snowowl/snomed/ql/ql/QlPackage.java | 158 +- .../snowowl/snomed/ql/ql/Query.java | 6 +- .../snomed/ql/ql/QueryConjunction.java | 10 +- .../snowowl/snomed/ql/ql/QueryConstraint.java | 2 +- .../snomed/ql/ql/QueryDisjunction.java | 10 +- .../snowowl/snomed/ql/ql/QueryExclusion.java | 10 +- .../snowowl/snomed/ql/ql/SubQuery.java | 2 +- .../snowowl/snomed/ql/ql/TermFilter.java | 10 +- .../snowowl/snomed/ql/ql/TypeFilter.java | 6 +- .../ql/ql/impl/AcceptableInFilterImpl.java | 4 +- .../snomed/ql/ql/impl/ActiveFilterImpl.java | 8 +- .../ql/impl/CaseSignificanceFilterImpl.java | 4 +- ...onImpl.java => ConjunctionFilterImpl.java} | 58 +- ...onImpl.java => DisjunctionFilterImpl.java} | 58 +- .../snomed/ql/ql/impl/DomainQueryImpl.java | 6 +- ...sionImpl.java => ExclusionFilterImpl.java} | 58 +- .../snowowl/snomed/ql/ql/impl/FilterImpl.java | 2 +- .../ql/ql/impl/LanguageCodeFilterImpl.java | 6 +- .../ql/ql/impl/LanguageRefSetFilterImpl.java | 4 +- .../snomed/ql/ql/impl/ModuleFilterImpl.java | 8 +- .../snomed/ql/ql/impl/NestedFilterImpl.java | 4 +- .../snomed/ql/ql/impl/NestedQueryImpl.java | 4 +- .../ql/ql/impl/PreferredInFilterImpl.java | 4 +- .../snomed/ql/ql/impl/PropertyFilterImpl.java | 2 +- .../snomed/ql/ql/impl/QlFactoryImpl.java | 50 +- .../snomed/ql/ql/impl/QlPackageImpl.java | 153 +- .../ql/ql/impl/QueryConjunctionImpl.java | 6 +- .../ql/ql/impl/QueryConstraintImpl.java | 2 +- .../ql/ql/impl/QueryDisjunctionImpl.java | 6 +- .../snomed/ql/ql/impl/QueryExclusionImpl.java | 6 +- .../snowowl/snomed/ql/ql/impl/QueryImpl.java | 4 +- .../snomed/ql/ql/impl/SubQueryImpl.java | 2 +- .../snomed/ql/ql/impl/TermFilterImpl.java | 8 +- .../snomed/ql/ql/impl/TypeFilterImpl.java | 4 +- .../snomed/ql/ql/util/QlAdapterFactory.java | 32 +- .../snowowl/snomed/ql/ql/util/QlSwitch.java | 44 +- .../ql/scoping/AbstractQLScopeProvider.java | 2 +- .../ql/serializer/QLSemanticSequencer.java | 244 +- .../ql/serializer/QLSyntacticSequencer.java | 112 +- .../snomed/ql/services/QLGrammarAccess.java | 353 +- .../ql/validation/AbstractQLValidator.java | 3 +- .../snowowl/snomed/ql/GenerateQL.mwe2 | 9 +- .../snowowl/snomed/ql/QL.xtext | 20 +- .../snowowl/snomed/ql/QLRuntimeModule.java | 24 +- .../snomed/ql/validation/QLValidator.java | 36 +- .../.launch/snomed-reasoner-unit-tests.launch | 6 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../ClassificationTaskConverter.java | 21 +- .../converter/ConceptChangeConverter.java | 7 +- .../ConcreteDomainChangeConverter.java | 11 +- .../converter/DescriptionChangeConverter.java | 15 +- .../EquivalentConceptSetConverter.java | 13 +- .../RelationshipChangeConverter.java | 28 +- .../reasoner/domain/ClassificationTasks.java | 28 +- .../reasoner/domain/ConceptChanges.java | 28 +- .../domain/ConcreteDomainChanges.java | 28 +- .../reasoner/domain/DescriptionChanges.java | 28 +- .../domain/EquivalentConceptSets.java | 30 +- .../reasoner/domain/ReasonerConcept.java | 17 +- .../reasoner/domain/ReasonerDescription.java | 17 +- .../reasoner/domain/ReasonerExtensions.java | 30 +- .../reasoner/domain/ReasonerRelationship.java | 32 +- .../reasoner/domain/RelationshipChanges.java | 28 +- .../ClassificationGetRequestBuilder.java | 6 +- .../request/ClassificationSaveRequest.java | 7 +- .../request/ClassificationSearchRequest.java | 3 +- .../ClassificationSearchRequestBuilder.java | 6 +- .../ConcreteDomainChangeSearchRequest.java | 3 +- ...creteDomainChangeSearchRequestBuilder.java | 6 +- .../EquivalentConceptSetSearchRequest.java | 3 +- ...ivalentConceptSetSearchRequestBuilder.java | 6 +- .../ReasonerExtensionSearchRequest.java | 4 +- .../RelationshipChangeSearchRequest.java | 3 +- ...elationshipChangeSearchRequestBuilder.java | 6 +- .../reasoner/request/SaveJobRequest.java | 45 +- .../.classpath | 16 +- .../.project | 10 +- .../META-INF/MANIFEST.MF | 12 + .../build.properties | 4 +- .../pom.xml | 67 + .../snomed/scg/tests/ScgInjectorProvider.java | 81 + .../snomed/scg/tests/ScgParsingTest.xtend | 706 + .../xtend-gen/.gitignore | 5 + .../.classpath | 10 +- .../.project | 16 +- .../AFTER_REGENERATION_TODO.txt | 169 - .../META-INF/MANIFEST.MF | 42 +- .../SCG_v2.3.1_ABNF_syntax_20170717.txt | 38 + .../build.properties | 20 +- .../model/generated/Scg.ecore | 46 + .../model/generated/Scg.genmodel | 43 + .../plugin.properties | 8 - .../plugin.xml | 18 +- .../pom.xml | 21 +- .../snowowl/dsl/AbstractSCGRuntimeModule.java | 154 - .../com/b2international/snowowl/dsl/SCG.ecore | 31 - .../b2international/snowowl/dsl/SCG.genmodel | 31 - .../com/b2international/snowowl/dsl/SCG.xmi | 295 - .../dsl/SCGStandaloneSetupGenerated.java | 65 - .../SCGParsetreeConstructor.java | 1239 -- .../dsl/parser/antlr/internal/InternalSCG.g | 793 - .../parser/antlr/internal/InternalSCG.tokens | 16 - .../antlr/internal/InternalSCGLexer.java | 762 - .../antlr/internal/InternalSCGParser.java | 2403 --- .../snowowl/dsl/scg/Concept.java | 108 - .../snowowl/dsl/scg/Expression.java | 88 - .../snowowl/dsl/scg/ScgPackage.java | 545 - .../snowowl/dsl/scg/impl/ExpressionImpl.java | 332 - .../snowowl/dsl/scg/impl/ScgPackageImpl.java | 385 - .../dsl/services/SCGGrammarAccess.java | 755 - .../snomed/scg/AbstractScgRuntimeModule.java | 226 + .../snowowl/snomed/scg/Scg.xtextbin | Bin 0 -> 3644 bytes .../scg/ScgStandaloneSetupGenerated.java | 68 + .../antlr/ScgAntlrTokenFileProvider.java | 19 +- .../scg/parser/antlr/ScgParser.java} | 37 +- .../parser/antlr/internal/InternalScgParser.g | 1098 + .../antlr/internal/InternalScgParser.java | 3199 +++ .../antlr/internal/InternalScgParser.tokens | 20 + .../scg/parser/antlr/lexer/InternalScgLexer.g | 64 + .../parser/antlr/lexer/InternalScgLexer.java | 955 + .../antlr/lexer/InternalScgLexer.tokens | 20 + .../{dsl => snomed/scg}/scg/Attribute.java | 42 +- .../scg/scg/AttributeGroup.java} | 30 +- .../snomed/scg/scg/AttributeValue.java | 32 + .../snomed/scg/scg/ConceptReference.java | 82 + .../snowowl/snomed/scg/scg/DecimalValue.java | 60 + .../snowowl/snomed/scg/scg/Expression.java | 83 + .../snowowl/snomed/scg/scg/IntegerValue.java | 59 + .../snowowl/snomed/scg/scg/Refinement.java | 65 + .../{dsl => snomed/scg}/scg/ScgFactory.java | 73 +- .../snowowl/snomed/scg/scg/ScgPackage.java | 880 + .../snowowl/snomed/scg/scg/StringValue.java | 59 + .../snowowl/snomed/scg/scg/SubExpression.java | 73 + .../scg/scg/impl/AttributeGroupImpl.java} | 82 +- .../scg}/scg/impl/AttributeImpl.java | 79 +- .../scg}/scg/impl/AttributeValueImpl.java | 18 +- .../scg/scg/impl/ConceptReferenceImpl.java} | 112 +- .../snomed/scg/scg/impl/DecimalValueImpl.java | 193 + .../snomed/scg/scg/impl/ExpressionImpl.java | 282 + .../snomed/scg/scg/impl/IntegerValueImpl.java | 191 + .../snomed/scg/scg/impl/RefinementImpl.java | 221 + .../scg}/scg/impl/ScgFactoryImpl.java | 103 +- .../snomed/scg/scg/impl/ScgPackageImpl.java | 583 + .../snomed/scg/scg/impl/StringValueImpl.java | 191 + .../scg/scg/impl/SubExpressionImpl.java | 256 + .../scg}/scg/util/ScgAdapterFactory.java | 148 +- .../scg}/scg/util/ScgSwitch.java | 164 +- .../scg/scoping/AbstractScgScopeProvider.java | 21 + .../scg/serializer/ScgSemanticSequencer.java | 227 + .../scg/serializer/ScgSyntacticSequencer.java | 219 + .../snomed/scg/services/ScgGrammarAccess.java | 973 + .../scg/validation/AbstractScgValidator.java} | 25 +- .../snowowl/dsl/GenerateSCG.mwe2 | 110 - .../snowowl/dsl/SCG.properties | 3 - .../com/b2international/snowowl/dsl/SCG.xtext | 64 - .../snowowl/dsl/SCGPostProcessor.ext | 8 - .../snowowl/dsl/SCGPostProcessor.java | 67 - .../snowowl/dsl/SCGRewriter.java | 133 - .../snowowl/dsl/SCGStandaloneSetup.java | 69 - .../ExtractedSCGAttributeGroup.java | 74 - .../SCGExpressionExtractor.java | 126 - .../snowowl/dsl/formatting/SCGFormatter.java | 73 - .../dsl/util/ScgAttributeFinderVisitor.java | 108 - .../dsl/util/ScgExpressionTermCompleter.java | 91 - .../dsl/validation/SCGJavaValidator.java | 246 - .../snowowl/snomed/scg/GenerateScg.mwe2 | 94 + .../snowowl/snomed/scg/Scg.xtext | 126 + .../snowowl/snomed/scg/ScgRuntimeModule.java} | 16 +- .../snomed/scg/ScgStandaloneSetup.java | 27 + .../snomed/scg/generator/ScgGenerator.java | 42 + .../snomed/scg/scoping/ScgScopeProvider.java} | 26 +- .../snomed/scg/validation/ScgValidator.java | 37 + .../META-INF/MANIFEST.MF | 23 - .../pom.xml | 12 - .../test/AttributeGroupMergerTest.java | 226 - .../test/AttributeNormalizerTest.java | 80 - ...finitionAttributeRedundancyFilterTest.java | 118 - .../test/ConceptDefinitionMergerTest.java | 90 - .../test/ConceptDefinitionNormalizerTest.java | 149 - ...ExpressionCanonicalRepresentationTest.java | 58 - .../test/FocusConceptNormalizerTest.java | 131 - ...alFormGeneratorTestFromSnomedDocument.java | 284 - .../SimpleAstNormalFormGeneratorTest.java | 133 - .../test/UngroupedAttributesMergerTest.java | 503 - .../EscgVsBinaryResourcePerformanceTest.java | 147 - .../test/SubsumptionTesterTest.java | 415 - .../test/AllNormalFormGeneratorTests.java | 56 - .../test/SemanticEngineTestPlugin.java | 45 - .../simpleast/test/SnomedConcepts.java | 68 - .../simpleast/test/utils/TestUtils.java | 182 - .../src/configuration/snowowl.yml | 13 - .../test.escg | 1 - .../META-INF/MANIFEST.MF | 16 - .../pom.xml | 12 - .../simpleast/SemanticEngineActivator.java | 45 - .../normalform/AttributeClauseList.java | 43 - .../normalform/AttributeClauseListMerger.java | 166 - .../normalform/AttributeNameMatch.java | 68 - .../normalform/AttributeNormalizer.java | 96 - .../normalform/ConceptDefinition.java | 43 - ...ptDefinitionAttributeRedundancyFilter.java | 114 - .../normalform/ConceptDefinitionMerger.java | 93 - .../ConceptDefinitionNormalizer.java | 139 - .../FocusConceptNormalizationResult.java | 41 - .../normalform/FocusConceptNormalizer.java | 229 - .../normalform/RefinementsMerger.java | 68 - ...impleAstExpressionNormalFormGenerator.java | 88 - .../normalform/UngroupedAttributesMerger.java | 220 - .../subsumption/SubsumptionTester.java | 560 - .../utils/AttributeCollectionComparator.java | 31 - .../AttributeGroupCollectionComparator.java | 37 - .../simpleast/utils/CollectionComparator.java | 135 - .../utils/ConceptDefinitionComparator.java | 42 - .../simpleast/utils/ExpressionComparator.java | 38 - .../simpleast/utils/QueryAstUtils.java | 404 - .../META-INF/MANIFEST.MF | 22 - .../build.properties | 4 - .../pom.xml | 12 - .../test/AttributeNormalizerTest.java | 80 - ...finitionAttributeRedundancyFilterTest.java | 118 - .../test/ConceptDefinitionMergerTest.java | 90 - .../test/ConceptDefinitionNormalizerTest.java | 150 - ...ExpressionCanonicalRepresentationTest.java | 58 - .../test/FocusConceptNormalizerTest.java | 117 - .../normalform/test/GroupMergerTest.java | 227 - .../test/NormalFormGeneratorTest.java | 341 - ...alFormGeneratorTestFromSnomedDocument.java | 290 - .../test/UngroupedAttributesMergerTest.java | 503 - .../test/SubsumptionTesterTest.java | 427 - .../test/AllSemanticEngineTests.java | 64 - .../test/SemanticEngineTestPlugin.java | 45 - .../semanticengine/test/SnomedConcepts.java | 77 - .../semanticengine/test/utils/TestUtils.java | 69 - .../utils/test/ContextWrapperBuilderTest.java | 149 - .../utils/test/SemanticUtilsTest.java | 92 - .../src/configuration/snowowl.yml | 13 - .../test.escg | 1 - .../.classpath | 11 - .../META-INF/MANIFEST.MF | 16 - .../pom.xml | 12 - .../semanticengine/SemanticEnginePlugin.java | 45 - .../normalform/AttributeNameMatch.java | 70 - .../normalform/AttributeNormalizer.java | 90 - .../normalform/ConceptDefinition.java | 44 - ...ptDefinitionAttributeRedundancyFilter.java | 116 - .../normalform/ConceptDefinitionMerger.java | 93 - .../ConceptDefinitionNormalizer.java | 143 - .../ExpressionNormalFormGenerator.java | 36 - .../FocusConceptNormalizationResult.java | 41 - .../normalform/FocusConceptNormalizer.java | 232 - .../normalform/GroupMerger.java | 188 - .../normalform/RefinementsMerger.java | 69 - .../ScgExpressionNormalFormGenerator.java | 225 - .../normalform/UngroupedAttributesMerger.java | 221 - .../subsumption/SubsumptionTester.java | 424 - .../AttributePresenceCheckingVisitor.java | 68 - .../AttributeValueCollectionComparator.java | 29 - .../utils/AttributeValueComparator.java | 39 - .../AttributeValueExtractingVisitor.java | 71 - ...alKernelFocusConceptExtractingVisitor.java | 79 - .../utils/CollectionComparator.java | 132 - .../utils/ConceptCollectionComparator.java | 26 - .../utils/ConceptDefinitionComparator.java | 42 - .../utils/ContextWrapperBuilder.java | 157 - .../utils/ExpressionComparator.java | 32 - .../utils/GroupCollectionComparator.java | 38 - ...dDepthAttributeValueExtractingVisitor.java | 83 - .../utils/MessageDigestUtil.java | 54 - .../utils/ObjectComparator.java | 32 - ...imitiveClinicalKernelDetectingVisitor.java | 77 - .../utils/RefinementsComparator.java | 50 - .../semanticengine/utils/ScgBuilderUtils.java | 121 - .../semanticengine/utils/SemanticUtils.java | 316 - .../.classpath | 1 + .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 4 +- .../src/main/resources/scripts/rule666.groovy | 3 +- .../scripts/rule_duplicate_members.groovy | 2 +- .../scripts/rule_mrcm_constraint.groovy | 22 +- .../scripts/rule_mrcm_constraint_type.groovy | 30 +- .../snomed/AllGenericValidationTests.java | 3 + .../snomed/BaseGenericValidationRuleTest.java | 5 +- .../snomed/GenericValidationRuleTest.java | 71 +- snomed/pom.xml | 24 +- .../pom.xml | 2 +- .../META-INF/MANIFEST.MF | 7 +- .../pom.xml | 2 +- ...e_GB1000000_20200204_complex_block_map.zip | Bin 0 -> 4409 bytes .../snowowl/test/commons/Resources.java | 3 +- .../snowowl/test/commons/SnowOwlAppRule.java | 2 +- .../test/commons/rest/AbstractApiTest.java | 131 + .../test/commons}/rest/BranchBase.java | 2 +- .../rest/RepositoryBranchRestRequests.java | 46 +- .../test/commons/rest/RestExtensions.java | 10 + .../test/commons/snomed/DocumentBuilders.java | 5 +- .../RandomSnomedIdentiferGenerator.java | 21 +- .../commons/snomed/TestBranchContext.java | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 2 +- .../feature.xml | 2 +- .../pom.xml | 2 +- tests/pom.xml | 2 +- 1108 files changed, 71743 insertions(+), 39642 deletions(-) rename cis/com.b2international.snowowl.snomed.cis.product/assembly/common/{snowowl_config.yml => configuration/snowowl.yml} (100%) create mode 100644 commons/com.b2international.index.tests/src/com/b2international/index/MaxTermsCountTest.java delete mode 100644 commons/com.b2international.index/src/com/b2international/index/analyzer/DelimiterTokenizer.java rename commons/com.b2international.index/src/com/b2international/index/{analyzer => compat}/CharMatcherTokenizer.java (83%) rename commons/com.b2international.index/src/com/b2international/index/{analyzer => compat}/ComponentTermAnalyzer.java (91%) create mode 100644 core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiRestService.java rename {snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch}/BranchUpdateRestRequest.java (87%) rename {snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch}/CreateBranchRestRequest.java (96%) rename {snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch}/CreateReviewRequest.java (90%) rename {snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch}/MergeRestRequest.java (91%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchMergingRestService.java => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchMergeRestService.java (85%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchingRestService.java => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchRestService.java (84%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchReviewRestService.java => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchReviewRestService.java (91%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCommitInfoRestService.java => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/commit/RepositoryCommitRestService.java (84%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedCompareRestRequest.java => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/CompareRestRequest.java (88%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestService.java => core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/RepositoryBranchCompareRestService.java (82%) rename core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/{codesystem/ChangeRequest.java => domain/ResourceRequest.java} (63%) create mode 100644 core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRestSearch.java create mode 100644 core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/authorization/Unprotected.java rename snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/Rf2ExportResult.java => core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/ExportResult.java (86%) rename snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/ObjectComparator.java => core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/id/IDs.java (55%) delete mode 100644 core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/IndexReadRequest.java delete mode 100644 core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryIndexRequestBuilder.java create mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchCompareRestService.java rename snomed/{com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeCollectionComparator.java => com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchMergeRestService.java} (51%) rename snomed/{com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatusProvider.java => com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchRestService.java} (52%) create mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchReviewRestService.java create mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryCommitRestService.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ChangeRequest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ExpandableSnomedRelationship.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedInboundRelationships.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedOutboundRelationships.java rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/{SnomedConceptMini.java => SnomedReferenceSetRestSearch.java} (57%) rename snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/{SnomedIdentifierRequest.java => SnomedResourceRequest.java} (50%) delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ClassificationRunNotFoundException.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ExportRunNotFoundException.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/FullySpecifiedNameNotFoundException.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/PreferredTermNotFoundException.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedExportException.java delete mode 100644 snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedImportConfigurationNotFoundException.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AcceptabilityMembership.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationTarget.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationType.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CaseSignificance.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicType.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicTypePredicates.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatus.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DescriptionInactivationIndicator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationIndicator.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationProperties.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationReason.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/RelationshipModifier.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComplexBlockMapReferenceSetMemberBuilder.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/CaseSignificance.java delete mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationExpander.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationPropertiesExpander.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/ModuleExpander.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedComplexBlockMapMemberCreateDelegate.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedComplexBlockMapMemberUpdateDelegate.java create mode 100644 snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2ComplexBlockMapRefSetContentType.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/.project delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/META-INF/MANIFEST.MF delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/build.properties delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/plugin.properties delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/plugin.xml delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/pom.xml delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/queryast.ecore delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/queryast.genmodel delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ChainedQueryRewriter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/GraphMLExportRewriter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/SyntaxErrorException.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/AndClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/AttributeClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/BinaryRValue.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/ConceptRef.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/NotClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/NumericDataClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/NumericDataGroupClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/OrClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/RValue.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/RefSet.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/SubExpression.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/ast/UnaryRValue.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/AttributeClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/AttributeClauseGroup.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/BinaryRValue.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/ConceptRef.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/NumericDataClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/NumericDataGroupClause.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/RValue.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/RefSet.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/SubExpression.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/SubsumptionQuantifier.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/UnaryRValue.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/ecoreastFactory.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/ecoreastPackage.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/AndClauseImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/AttributeClauseGroupImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/AttributeClauseImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/BinaryRValueImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/ConceptRefImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/NotClauseImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/NumericDataClauseImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/NumericDataGroupClauseImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/OrClauseImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/RValueImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/RefSetImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/SubExpressionImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/UnaryRValueImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/ecoreastFactoryImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/impl/ecoreastPackageImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/util/ecoreastAdapterFactory.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/util/ecoreastSwitch.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/walker/ESCGExpressionVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/walker/VisitingQueryRewriter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.ecl/.gitignore delete mode 100644 snomed/com.b2international.snowowl.snomed.ecl/.launch/Generate ECL.launch create mode 100644 snomed/com.b2international.snowowl.snomed.ecl/ECL_v1.3_ABNF_brief_syntax_20170717.txt rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/ecl/{AttributeGroup.java => EclAttributeGroup.java} (68%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/ecl/{ConceptReference.java => EclConceptReference.java} (71%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/ecl/{Refinement.java => EclRefinement.java} (86%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/ecl/impl/{AttributeGroupImpl.java => EclAttributeGroupImpl.java} (73%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/ecl/impl/{ConceptReferenceImpl.java => EclConceptReferenceImpl.java} (83%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/ecl/impl/{RefinementImpl.java => EclRefinementImpl.java} (78%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/serializer/{EclSemanticSequencer.java => AbstractEclSemanticSequencer.java} (93%) rename snomed/com.b2international.snowowl.snomed.ecl/src-gen/com/b2international/snowowl/snomed/ecl/serializer/{EclSyntacticSequencer.java => AbstractEclSyntacticSequencer.java} (69%) rename snomed/{com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/RValue.java => com.b2international.snowowl.snomed.ecl/src/com/b2international/snowowl/snomed/ecl/serializer/EclSemanticSequencer.java} (69%) create mode 100644 snomed/com.b2international.snowowl.snomed.ecl/src/com/b2international/snowowl/snomed/ecl/serializer/EclSyntacticSequencer.java rename snomed/{com.b2international.snowowl.snomed.semanticengine.test => com.b2international.snowowl.snomed.etl.tests}/.classpath (67%) rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast.test => com.b2international.snowowl.snomed.etl.tests}/.project (76%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl.tests/META-INF/MANIFEST.MF rename snomed/{com.b2international.snowowl.snomed.semanticengine => com.b2international.snowowl.snomed.etl.tests}/build.properties (53%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl.tests/pom.xml create mode 100644 snomed/com.b2international.snowowl.snomed.etl.tests/src-gen/com/b2international/snowowl/snomed/etl/tests/EtlInjectorProvider.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl.tests/src/com/b2international/snowowl/snomed/etl/tests/EtlParsingTest.xtend create mode 100644 snomed/com.b2international.snowowl.snomed.etl.tests/xtend-gen/.gitignore rename snomed/{com.b2international.snowowl.snomed.dsl => com.b2international.snowowl.snomed.etl}/.classpath (91%) rename snomed/{com.b2international.snowowl.snomed.semanticengine => com.b2international.snowowl.snomed.etl}/.project (77%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/ETL_v1.0_ABNF_syntax_20170721.txt create mode 100644 snomed/com.b2international.snowowl.snomed.etl/META-INF/MANIFEST.MF create mode 100644 snomed/com.b2international.snowowl.snomed.etl/build.properties create mode 100644 snomed/com.b2international.snowowl.snomed.etl/model/generated/Etl.ecore create mode 100644 snomed/com.b2international.snowowl.snomed.etl/model/generated/Etl.genmodel create mode 100644 snomed/com.b2international.snowowl.snomed.etl/plugin.xml create mode 100644 snomed/com.b2international.snowowl.snomed.etl/pom.xml create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/AbstractEtlRuntimeModule.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/Etl.xtextbin create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/EtlStandaloneSetupGenerated.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/Attribute.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/AttributeGroup.java rename snomed/{com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/scg => com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl}/AttributeValue.java (78%) rename snomed/{com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/AndClause.java => com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/ConceptIdReplacementSlot.java} (61%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/ConceptReference.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/ConceptReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/ConcreteValueReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/DecimalReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/DecimalValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/EtlCardinality.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/EtlFactory.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/EtlPackage.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/ExpressionReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/ExpressionTemplate.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/FocusConcept.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/IntegerReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/IntegerValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/Refinement.java rename snomed/{com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/OrClause.java => com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotDecimal.java} (63%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotDecimalMaximumValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotDecimalMinimumValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotDecimalRange.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotDecimalValue.java rename snomed/{com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/queryast/NotClause.java => com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotInteger.java} (63%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotIntegerMaximumValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotIntegerMinimumValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotIntegerRange.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SlotIntegerValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/StringReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/StringValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/SubExpression.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/TemplateInformationSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/TokenReplacementSlot.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/AttributeGroupImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/AttributeImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/AttributeValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/ConceptIdReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/ConceptReferenceImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/ConceptReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/ConcreteValueReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/DecimalReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/DecimalValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/EtlCardinalityImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/EtlFactoryImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/EtlPackageImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/ExpressionReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/ExpressionTemplateImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/FocusConceptImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/IntegerReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/IntegerValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/RefinementImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotDecimalImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotDecimalMaximumValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotDecimalMinimumValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotDecimalRangeImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotDecimalValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotIntegerImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotIntegerMaximumValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotIntegerMinimumValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotIntegerRangeImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SlotIntegerValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/StringReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/StringValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/SubExpressionImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/TemplateInformationSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/impl/TokenReplacementSlotImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/util/EtlAdapterFactory.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/etl/util/EtlSwitch.java rename snomed/{com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/parser/antlr/SCGAntlrTokenFileProvider.java => com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/EtlAntlrTokenFileProvider.java} (70%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/EtlParser.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/internal/InternalEtlParser.g create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/internal/InternalEtlParser.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/internal/InternalEtlParser.tokens create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/lexer/InternalEtlLexer.g create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/lexer/InternalEtlLexer.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/parser/antlr/lexer/InternalEtlLexer.tokens create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/scoping/AbstractEtlScopeProvider.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/serializer/EtlSemanticSequencer.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/serializer/EtlSyntacticSequencer.java create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/services/EtlGrammarAccess.java rename snomed/{com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/validation/AbstractSCGJavaValidator.java => com.b2international.snowowl.snomed.etl/src-gen/com/b2international/snowowl/snomed/etl/validation/AbstractEtlValidator.java} (57%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/Etl.xtext rename snomed/{com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCGRuntimeModule.java => com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/EtlRuntimeModule.java} (55%) rename snomed/{com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/QueryRewriter.java => com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/EtlStandaloneSetup.java} (60%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/GenerateEtl.mwe2 rename snomed/{com.b2international.snowowl.snomed.dsl/src/com/b2international/snowowl/snomed/dsl/query/QueryParser.java => com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/converter/EtlValueConverterService.java} (65%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/generator/EtlGenerator.java rename snomed/{com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/scoping/SCGScopeProvider.java => com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/scoping/EtlScopeProvider.java} (63%) create mode 100644 snomed/com.b2international.snowowl.snomed.etl/src/com/b2international/snowowl/snomed/etl/validation/EtlValidator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.mrcm.model/src/com/b2international/snowowl/snomed/mrcm/SingletonConceptSetDefinition.java delete mode 100644 snomed/com.b2international.snowowl.snomed.mrcm.model/src/com/b2international/snowowl/snomed/mrcm/impl/SingletonConceptSetDefinitionImpl.java rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast.test => com.b2international.snowowl.snomed.ql.tests}/.classpath (67%) rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast => com.b2international.snowowl.snomed.ql.tests}/.project (76%) create mode 100644 snomed/com.b2international.snowowl.snomed.ql.tests/META-INF/MANIFEST.MF rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast.test => com.b2international.snowowl.snomed.ql.tests}/build.properties (53%) create mode 100644 snomed/com.b2international.snowowl.snomed.ql.tests/pom.xml create mode 100644 snomed/com.b2international.snowowl.snomed.ql.tests/src-gen/com/b2international/snowowl/snomed/ql/tests/QLInjectorProvider.java create mode 100644 snomed/com.b2international.snowowl.snomed.ql.tests/src/com/b2international/snowowl/snomed/ql/tests/QLParsingTest.xtend create mode 100644 snomed/com.b2international.snowowl.snomed.ql.tests/xtend-gen/.gitignore delete mode 100644 snomed/com.b2international.snowowl.snomed.ql/.gitignore delete mode 100644 snomed/com.b2international.snowowl.snomed.ql/.launch/Generate QL (ql) Language Infrastructure.launch rename snomed/com.b2international.snowowl.snomed.ql/src-gen/com/b2international/snowowl/snomed/ql/ql/{Conjunction.java => ConjunctionFilter.java} (75%) rename snomed/com.b2international.snowowl.snomed.ql/src-gen/com/b2international/snowowl/snomed/ql/ql/{Disjunction.java => DisjunctionFilter.java} (75%) rename snomed/com.b2international.snowowl.snomed.ql/src-gen/com/b2international/snowowl/snomed/ql/ql/{Exclusion.java => ExclusionFilter.java} (75%) rename snomed/com.b2international.snowowl.snomed.ql/src-gen/com/b2international/snowowl/snomed/ql/ql/impl/{ConjunctionImpl.java => ConjunctionFilterImpl.java} (78%) rename snomed/com.b2international.snowowl.snomed.ql/src-gen/com/b2international/snowowl/snomed/ql/ql/impl/{DisjunctionImpl.java => DisjunctionFilterImpl.java} (78%) rename snomed/com.b2international.snowowl.snomed.ql/src-gen/com/b2international/snowowl/snomed/ql/ql/impl/{ExclusionImpl.java => ExclusionFilterImpl.java} (79%) rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast => com.b2international.snowowl.snomed.scg.tests}/.classpath (51%) rename snomed/{com.b2international.snowowl.snomed.semanticengine.test => com.b2international.snowowl.snomed.scg.tests}/.project (76%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg.tests/META-INF/MANIFEST.MF rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast => com.b2international.snowowl.snomed.scg.tests}/build.properties (53%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg.tests/pom.xml create mode 100644 snomed/com.b2international.snowowl.snomed.scg.tests/src-gen/com/b2international/snowowl/snomed/scg/tests/ScgInjectorProvider.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg.tests/src/com/b2international/snowowl/snomed/scg/tests/ScgParsingTest.xtend create mode 100644 snomed/com.b2international.snowowl.snomed.scg.tests/xtend-gen/.gitignore delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/AFTER_REGENERATION_TODO.txt create mode 100644 snomed/com.b2international.snowowl.snomed.scg/SCG_v2.3.1_ABNF_syntax_20170717.txt create mode 100644 snomed/com.b2international.snowowl.snomed.scg/model/generated/Scg.ecore create mode 100644 snomed/com.b2international.snowowl.snomed.scg/model/generated/Scg.genmodel delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/plugin.properties delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/AbstractSCGRuntimeModule.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/SCG.ecore delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/SCG.genmodel delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/SCG.xmi delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/SCGStandaloneSetupGenerated.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/parseTreeConstruction/SCGParsetreeConstructor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/parser/antlr/internal/InternalSCG.g delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/parser/antlr/internal/InternalSCG.tokens delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/parser/antlr/internal/InternalSCGLexer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/parser/antlr/internal/InternalSCGParser.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/scg/Concept.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/scg/Expression.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/scg/ScgPackage.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/scg/impl/ExpressionImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/scg/impl/ScgPackageImpl.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/dsl/services/SCGGrammarAccess.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/AbstractScgRuntimeModule.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/Scg.xtextbin create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/ScgStandaloneSetupGenerated.java rename commons/com.b2international.index/src/com/b2international/index/analyzer/DelimiterAnalyzer.java => snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/ScgAntlrTokenFileProvider.java (53%) rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl/parser/antlr/SCGParser.java => snomed/scg/parser/antlr/ScgParser.java} (54%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/internal/InternalScgParser.g create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/internal/InternalScgParser.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/internal/InternalScgParser.tokens create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/lexer/InternalScgLexer.g create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/lexer/InternalScgLexer.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/parser/antlr/lexer/InternalScgLexer.tokens rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/Attribute.java (61%) rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl/scg/Group.java => snomed/scg/scg/AttributeGroup.java} (64%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/AttributeValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/ConceptReference.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/DecimalValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/Expression.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/IntegerValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/Refinement.java rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/ScgFactory.java (52%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/ScgPackage.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/StringValue.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/SubExpression.java rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl/scg/impl/GroupImpl.java => snomed/scg/scg/impl/AttributeGroupImpl.java} (67%) rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/impl/AttributeImpl.java (81%) rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/impl/AttributeValueImpl.java (81%) rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl/scg/impl/ConceptImpl.java => snomed/scg/scg/impl/ConceptReferenceImpl.java} (64%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/DecimalValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/ExpressionImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/IntegerValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/RefinementImpl.java rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/impl/ScgFactoryImpl.java (59%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/ScgPackageImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/StringValueImpl.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scg/impl/SubExpressionImpl.java rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/util/ScgAdapterFactory.java (53%) rename snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/{dsl => snomed/scg}/scg/util/ScgSwitch.java (54%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/scoping/AbstractScgScopeProvider.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/serializer/ScgSemanticSequencer.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/serializer/ScgSyntacticSequencer.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src-gen/com/b2international/snowowl/snomed/scg/services/ScgGrammarAccess.java rename snomed/com.b2international.snowowl.snomed.scg/{src/com/b2international/snowowl/dsl/ParseException.java => src-gen/com/b2international/snowowl/snomed/scg/validation/AbstractScgValidator.java} (55%) delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/GenerateSCG.mwe2 delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCG.properties delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCG.xtext delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCGPostProcessor.ext delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCGPostProcessor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCGRewriter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/SCGStandaloneSetup.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/expressionextractor/ExtractedSCGAttributeGroup.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/expressionextractor/SCGExpressionExtractor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/formatting/SCGFormatter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/util/ScgAttributeFinderVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/util/ScgExpressionTermCompleter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/dsl/validation/SCGJavaValidator.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/GenerateScg.mwe2 create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/Scg.xtext rename snomed/{com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/RefinementsMergerTest.java => com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/ScgRuntimeModule.java} (65%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/ScgStandaloneSetup.java create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/generator/ScgGenerator.java rename snomed/{com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedIdentifierResponse.java => com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/scoping/ScgScopeProvider.java} (61%) create mode 100644 snomed/com.b2international.snowowl.snomed.scg/src/com/b2international/snowowl/snomed/scg/validation/ScgValidator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/META-INF/MANIFEST.MF delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/pom.xml delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/AttributeGroupMergerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/AttributeNormalizerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/ConceptDefinitionAttributeRedundancyFilterTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/ConceptDefinitionMergerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/ConceptDefinitionNormalizerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/ExpressionCanonicalRepresentationTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/FocusConceptNormalizerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/NormalFormGeneratorTestFromSnomedDocument.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/SimpleAstNormalFormGeneratorTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/normalform/test/UngroupedAttributesMergerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/subsumption/test/EscgVsBinaryResourcePerformanceTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/subsumption/test/SubsumptionTesterTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/test/AllNormalFormGeneratorTests.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/test/SemanticEngineTestPlugin.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/test/SnomedConcepts.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/com/b2international/snowowl/semanticengine/simpleast/test/utils/TestUtils.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/src/configuration/snowowl.yml delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast.test/test.escg delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/META-INF/MANIFEST.MF delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/pom.xml delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/SemanticEngineActivator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/AttributeClauseList.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/AttributeClauseListMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/AttributeNameMatch.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/AttributeNormalizer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/ConceptDefinition.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/ConceptDefinitionAttributeRedundancyFilter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/ConceptDefinitionMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/ConceptDefinitionNormalizer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/FocusConceptNormalizationResult.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/FocusConceptNormalizer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/RefinementsMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/SimpleAstExpressionNormalFormGenerator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/normalform/UngroupedAttributesMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/subsumption/SubsumptionTester.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/AttributeCollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/AttributeGroupCollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/CollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/ConceptDefinitionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/ExpressionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/QueryAstUtils.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/META-INF/MANIFEST.MF delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/build.properties delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/pom.xml delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/AttributeNormalizerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/ConceptDefinitionAttributeRedundancyFilterTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/ConceptDefinitionMergerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/ConceptDefinitionNormalizerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/ExpressionCanonicalRepresentationTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/FocusConceptNormalizerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/GroupMergerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/NormalFormGeneratorTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/NormalFormGeneratorTestFromSnomedDocument.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/normalform/test/UngroupedAttributesMergerTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/subsumption/test/SubsumptionTesterTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/test/AllSemanticEngineTests.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/test/SemanticEngineTestPlugin.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/test/SnomedConcepts.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/test/utils/TestUtils.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/utils/test/ContextWrapperBuilderTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/com/b2international/snowowl/semanticengine/utils/test/SemanticUtilsTest.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/src/configuration/snowowl.yml delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine.test/test.escg delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/.classpath delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/META-INF/MANIFEST.MF delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/pom.xml delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/SemanticEnginePlugin.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/AttributeNameMatch.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/AttributeNormalizer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/ConceptDefinition.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/ConceptDefinitionAttributeRedundancyFilter.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/ConceptDefinitionMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/ConceptDefinitionNormalizer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/ExpressionNormalFormGenerator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/FocusConceptNormalizationResult.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/FocusConceptNormalizer.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/GroupMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/RefinementsMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/ScgExpressionNormalFormGenerator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/normalform/UngroupedAttributesMerger.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/subsumption/SubsumptionTester.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributePresenceCheckingVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeValueCollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeValueComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeValueExtractingVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ClinicalKernelFocusConceptExtractingVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/CollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ConceptCollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ConceptDefinitionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ContextWrapperBuilder.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ExpressionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/GroupCollectionComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/LimitedDepthAttributeValueExtractingVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/MessageDigestUtil.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ObjectComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/PrimitiveClinicalKernelDetectingVisitor.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/RefinementsComparator.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/ScgBuilderUtils.java delete mode 100644 snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/SemanticUtils.java create mode 100644 tests/com.b2international.snowowl.test.commons/resources/snomed/SnomedCT_RF2Release_GB1000000_20200204_complex_block_map.zip create mode 100644 tests/com.b2international.snowowl.test.commons/src/com/b2international/snowowl/test/commons/rest/AbstractApiTest.java rename {snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core => tests/com.b2international.snowowl.test.commons/src/com/b2international/snowowl/test/commons}/rest/BranchBase.java (94%) rename snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchingRestRequests.java => tests/com.b2international.snowowl.test.commons/src/com/b2international/snowowl/test/commons/rest/RepositoryBranchRestRequests.java (67%) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed3cb9ddbef..5e50a1d45a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,30 @@ # Change Log All notable changes to this project will be documented in this file. +## 7.3.0 + +### Changes from 6.x stream since 7.2.0 release + +All changes from the `6.x` stream (the 6.24.0 release) have been merged into the `7.3.0` release. See changelog entry `6.24.0` for details. + +### Core +- Support unprotected API routes/requests (d07e6c2, 2e5166a) + * `GET /admin/info` and `POST /admin/login` are unprotected routes +- Add back `responseTime` property (unit is milliseconds) to request log (57b913d) + +### SNOMED CT +- SNOMED CT computable languages are now supported (#470) + * [ETL 1.0](http://snomed.org/etl) + * [SCG 2.3.1](http://snomed.org/scg) + +### FHIR +- Exclude mapping members by default from ConceptMap responses (0ed6b1c, 14a1ad5, 67d1e03, 376391a, ) + +### Bugs/Improvements +- [core] simplify raw index read requests in Java API (5214922) +- [jobs] reduce memory requirements of job clean up (b43d658) +- [log] improve error logging from failed API requests, omit Broken pipe errors (edbc7f9) + ## 7.2.0 ### Changes from 6.x stream since 7.1.0 release @@ -206,6 +230,22 @@ The new improved and shiny Snow Owl 7.x documentation is available at `https://d * Removed `database` configuration options from `repository` node * Removed `revisionCache` configuration option from `repository` node +## 6.24.0 + +### API +- Support filtering refset members by `mapPriority` (a0bff3d) + +### Bugs/Improvements +- [index] Log the number of pending cluster tasks (959a088) +- [index] fix query boosting issue (2de4841) +- [core] Allow customization of component adjustment during publication (a0e6820) +- [history] Ignore many-valued features altogether in HistoryInfoProvider (526d3e7) +- [snomed] Fix incorrectly categorized query refset evaluation changes (#467) +- [snomed] Fix incorrect parentage values when reactivating concept's relationships first then the concept in two different commits (5298252) +- [cis] accept all SNOMED CT ID statuses when publishing them (c914c05) +- [mrcm] Handle ECL expressions in attributes' concept set definitions in MRCM validation rules (0cc7b61) +- [export] Create general ExportResult class (filename, UUID pair) (8265617) + ## 6.23.0 ### API diff --git a/README.md b/README.md index 6856cb700d2..dcc24a24281 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Snow Owl® is a highly scalable, open source terminology server with revision-control capabilities and collaborative authoring platform features. It allows you to store, search and author high volumes of terminology artifacts quickly and efficiently. [![build status](https://img.shields.io/travis/b2ihealthcare/snow-owl/7.x.svg?style=flat-square)](https://travis-ci.org/b2ihealthcare/snow-owl) -[![latest release](https://img.shields.io/github/tag/b2ihealthcare/snow-owl.svg?style=flat-square)](https://github.com/b2ihealthcare/snow-owl/releases/tag/v7.2.0) +[![latest release](https://img.shields.io/github/tag/b2ihealthcare/snow-owl.svg?style=flat-square)](https://github.com/b2ihealthcare/snow-owl/releases/tag/v7.3.0) [![downloads](https://img.shields.io/github/downloads/b2ihealthcare/snow-owl/total.svg?style=flat-square)](https://github.com/b2ihealthcare/snow-owl/releases/) [![Docker](https://img.shields.io/docker/pulls/b2ihealthcare/snow-owl-oss?style=flat-square)](https://hub.docker.com/r/b2ihealthcare/snow-owl-oss) [![GitHub](https://img.shields.io/github/license/b2ihealthcare/snow-owl.svg?style=flat-square)](https://github.com/b2ihealthcare/snow-owl/blob/7.x/LICENSE) @@ -18,10 +18,10 @@ Features include: * Maintains multiple versions (including unpublished and published) for each terminology artifact and provides APIs to access them all * Independent work branches offer work-in-process isolation, external business workflow integration and team collaboration * SNOMED CT and others - * Full SNOMED CT terminology support (full RF2 support, ECL v1.3, Reference Sets, OWL 2 EL/DL support, experimental Query Language) + * Full SNOMED CT terminology support (full RF2 support, ECL v1.3, SCG 2.3.1, ETL 1.0, Reference Sets, OWL Axioms, OWL 2 EL/DL support, experimental Query Language) * With its modular design, the server can maintain multiple terminologies (including local codes, mapping sets, value sets) * Various set of APIs - * SNOMED CT API (RESTful and native JAVA API) + * SNOMED CT API (RESTful and native Java API) * FHIR API * CIS API * Highly extensible and configurable @@ -32,16 +32,16 @@ Features include: # Download -* [WINDOWS](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.zip) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.zip.sha512) -* [MACOS/LINUX](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.tar.gz) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.tar.gz.sha512) -* [RPM](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.rpm) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.rpm.sha512) -* [DEB](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.deb) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.2.0/snow-owl-oss-7.2.0.deb.sha512) +* [WINDOWS](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.zip) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.zip.sha512) +* [MACOS/LINUX](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.tar.gz) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.tar.gz.sha512) +* [RPM](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.rpm) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.rpm.sha512) +* [DEB](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.deb) - [sha](https://github.com/b2ihealthcare/snow-owl/releases/download/v7.3.0/snow-owl-oss-7.3.0.deb.sha512) {% hint style="info" %} This distribution only includes features licensed under the Apache 2.0 license. To get access to the full set of features, please contact [B2i Healthcare](mailto:info@b2i.sg). {% endhint %} -View the detailed release notes [here](https://github.com/b2ihealthcare/snow-owl/releases/tag/v7.2.0). +View the detailed release notes [here](https://github.com/b2ihealthcare/snow-owl/releases/tag/v7.3.0). Not the version you're looking for? View [past releases](https://github.com/b2ihealthcare/snow-owl/releases). @@ -53,6 +53,7 @@ Once you have downloaded the appropriate package: * Run `bin/snowowl.sh` on unix, or `bin/snowowl.bat` on windows * Run `curl http://localhost:8080/snowowl/admin/info` +* Navigate to `http://localhost:8080/snowowl` * See [SNOMED CT API docs](https://docs.b2i.sg/snow-owl/api/snomed), [FHIR API docs](https://docs.b2i.sg/snow-owl/api/fhir) # Learn Snow Owl @@ -115,7 +116,7 @@ Make sure you have the following preferences enabled/disabled. 4. Wait until Eclipse resolves the target platform (click on the `Resolve` button if it refuses to do so) and then click on `Set as Active Target platform` 5. Wait until the build is complete and you have no compile errors 6. Launch `snow-owl-oss` launch configuration in the Run Configurations menu -7. Navigate to `http://localhost:8080/snowowl/snomed-ct/v3` +7. Navigate to `http://localhost:8080/snowowl` # Contributing diff --git a/SnowOwlServer.setup b/SnowOwlServer.setup index 91d2007fab3..34035f4604a 100644 --- a/SnowOwlServer.setup +++ b/SnowOwlServer.setup @@ -122,6 +122,18 @@ key="/instance/org.eclipse.egit.core/core_defaultRepositoryDir" value="${installation.location}/git"/> + + + + diff --git a/cis/com.b2international.snowowl.snomed.cis.feature/pom.xml b/cis/com.b2international.snowowl.snomed.cis.feature/pom.xml index 6046a40cb37..b3591bc91bf 100644 --- a/cis/com.b2international.snowowl.snomed.cis.feature/pom.xml +++ b/cis/com.b2international.snowowl.snomed.cis.feature/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl cis-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.cis.feature eclipse-feature diff --git a/cis/com.b2international.snowowl.snomed.cis.product/assembly/common/snowowl_config.yml b/cis/com.b2international.snowowl.snomed.cis.product/assembly/common/configuration/snowowl.yml similarity index 100% rename from cis/com.b2international.snowowl.snomed.cis.product/assembly/common/snowowl_config.yml rename to cis/com.b2international.snowowl.snomed.cis.product/assembly/common/configuration/snowowl.yml diff --git a/cis/com.b2international.snowowl.snomed.cis.product/pom.xml b/cis/com.b2international.snowowl.snomed.cis.product/pom.xml index f21221360aa..f048c7a5704 100644 --- a/cis/com.b2international.snowowl.snomed.cis.product/pom.xml +++ b/cis/com.b2international.snowowl.snomed.cis.product/pom.xml @@ -8,7 +8,7 @@ com.b2international.snowowl cis-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/cis/com.b2international.snowowl.snomed.cis.product/snow-owl-cis.product b/cis/com.b2international.snowowl.snomed.cis.product/snow-owl-cis.product index 38d2274e950..8f0f9c74357 100644 --- a/cis/com.b2international.snowowl.snomed.cis.product/snow-owl-cis.product +++ b/cis/com.b2international.snowowl.snomed.cis.product/snow-owl-cis.product @@ -1,7 +1,7 @@ - + diff --git a/cis/com.b2international.snowowl.snomed.cis.rest/META-INF/MANIFEST.MF b/cis/com.b2international.snowowl.snomed.cis.rest/META-INF/MANIFEST.MF index 1f508e2db60..407e9a0a51d 100644 --- a/cis/com.b2international.snowowl.snomed.cis.rest/META-INF/MANIFEST.MF +++ b/cis/com.b2international.snowowl.snomed.cis.rest/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT Component Identifier Service Bundle-SymbolicName: com.b2international.snowowl.snomed.cis.rest;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Automatic-Module-Name: com.b2international.snowowl.snomed.cis.rest Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/cis/com.b2international.snowowl.snomed.cis.rest/pom.xml b/cis/com.b2international.snowowl.snomed.cis.rest/pom.xml index 82c696ae515..528845980a7 100644 --- a/cis/com.b2international.snowowl.snomed.cis.rest/pom.xml +++ b/cis/com.b2international.snowowl.snomed.cis.rest/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl cis-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.cis.rest diff --git a/cis/com.b2international.snowowl.snomed.cis/META-INF/MANIFEST.MF b/cis/com.b2international.snowowl.snomed.cis/META-INF/MANIFEST.MF index f7eb652a840..c217dcac6db 100644 --- a/cis/com.b2international.snowowl.snomed.cis/META-INF/MANIFEST.MF +++ b/cis/com.b2international.snowowl.snomed.cis/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT CIS Bundle-SymbolicName: com.b2international.snowowl.snomed.cis;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Automatic-Module-Name: com.b2international.snowowl.snomed.cis Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/cis/com.b2international.snowowl.snomed.cis/pom.xml b/cis/com.b2international.snowowl.snomed.cis/pom.xml index 60f07fd7f90..ec7c7b4fedc 100644 --- a/cis/com.b2international.snowowl.snomed.cis/pom.xml +++ b/cis/com.b2international.snowowl.snomed.cis/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl cis-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.cis eclipse-plugin diff --git a/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/client/CisSnomedIdentifierService.java b/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/client/CisSnomedIdentifierService.java index 5923473df93..21c220f7240 100644 --- a/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/client/CisSnomedIdentifierService.java +++ b/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/client/CisSnomedIdentifierService.java @@ -377,48 +377,40 @@ public Map publish(final Set componentIds) { LOGGER.debug("Publishing {} component IDs.", componentIds.size()); final Map sctIds = getSctIds(componentIds); - final Map problemSctIds = ImmutableMap.copyOf(Maps.filterValues(sctIds, Predicates.not(Predicates.or( - SctId::isAssigned, - SctId::isPublished)))); - - HttpPut deprecateRequest = null; + + HttpPut publishRequest = null; String currentNamespace = null; try { - final Map assignedSctIds = ImmutableMap.copyOf(Maps.filterValues(sctIds, SctId::isAssigned)); - if (!assignedSctIds.isEmpty()) { - if (assignedSctIds.size() > 1) { - final Multimap componentIdsByNamespace = toNamespaceMultimap(assignedSctIds.keySet()); + final Map sctIdsToPublish = ImmutableMap.copyOf(Maps.filterValues(sctIds, Predicates.not(SctId::isPublished))); + if (!sctIdsToPublish.isEmpty()) { + if (sctIdsToPublish.size() > 1) { + final Multimap componentIdsByNamespace = toNamespaceMultimap(sctIdsToPublish.keySet()); for (final Entry> entry : componentIdsByNamespace.asMap().entrySet()) { currentNamespace = entry.getKey(); for (final Collection bulkIds : Iterables.partition(entry.getValue(), requestBulkLimit)) { LOGGER.debug("Sending bulk publication request for namespace {} with size {}.", currentNamespace, bulkIds.size()); - deprecateRequest = httpPut(String.format("sct/bulk/publish?token=%s", getToken()), createBulkPublishData(currentNamespace, bulkIds)); - execute(deprecateRequest); + publishRequest = httpPut(String.format("sct/bulk/publish?token=%s", getToken()), createBulkPublishData(currentNamespace, bulkIds)); + execute(publishRequest); } } } else { - final String componentId = Iterables.getOnlyElement(assignedSctIds.keySet()); + final String componentId = Iterables.getOnlyElement(sctIdsToPublish.keySet()); currentNamespace = SnomedIdentifiers.getNamespace(componentId); - deprecateRequest = httpPut(String.format("sct/publish?token=%s", getToken()), createPublishData(componentId)); - execute(deprecateRequest); + publishRequest = httpPut(String.format("sct/publish?token=%s", getToken()), createPublishData(componentId)); + execute(publishRequest); } } - if (!problemSctIds.isEmpty()) { - throw new SctIdStatusException("Cannot publish %s component IDs because they are not assigned or already published.", problemSctIds); - } - - return ImmutableMap.copyOf(assignedSctIds); - + return ImmutableMap.copyOf(sctIdsToPublish); } catch (IOException e) { throw new SnowowlRuntimeException(String.format("Exception while publishing IDs for namespace %s.", currentNamespace), e); } finally { - release(deprecateRequest); + release(publishRequest); } } diff --git a/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/memory/DefaultSnomedIdentifierService.java b/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/memory/DefaultSnomedIdentifierService.java index 3e930a1d9c4..4c1a76a2e73 100644 --- a/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/memory/DefaultSnomedIdentifierService.java +++ b/cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/memory/DefaultSnomedIdentifierService.java @@ -210,21 +210,14 @@ public Map publish(final Set componentIds) { LOGGER.debug("Publishing {} component IDs.", componentIds.size()); final Map sctIds = getSctIds(componentIds); - final Map problemSctIds = ImmutableMap.copyOf(Maps.filterValues(sctIds, Predicates.not(Predicates.or( - SctId::isAssigned, - SctId::isPublished)))); - final Map assignedSctIds = ImmutableMap.copyOf(Maps.filterValues(sctIds, SctId::isAssigned)); + final Map sctIdsToPublish = ImmutableMap.copyOf(Maps.filterValues(sctIds, Predicates.not(SctId::isPublished))); - for (final SctId sctId : assignedSctIds.values()) { + for (final SctId sctId : sctIdsToPublish.values()) { sctId.setStatus(IdentifierStatus.PUBLISHED.getSerializedName()); } - putSctIds(assignedSctIds); - - if (!problemSctIds.isEmpty()) { - LOGGER.warn("Cannot publish the following component IDs because they are not assigned or already published: {}", problemSctIds); - } + putSctIds(sctIdsToPublish); return ImmutableMap.copyOf(sctIds); } diff --git a/cis/pom.xml b/cis/pom.xml index 090b127a37d..0bd7121fd0a 100644 --- a/cis/pom.xml +++ b/cis/pom.xml @@ -9,7 +9,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/commons/com.b2international.collections.api/META-INF/MANIFEST.MF b/commons/com.b2international.collections.api/META-INF/MANIFEST.MF index 4363dd4c337..f1c1b811dfb 100644 --- a/commons/com.b2international.collections.api/META-INF/MANIFEST.MF +++ b/commons/com.b2international.collections.api/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Collections API Bundle-SymbolicName: com.b2international.collections.api;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy diff --git a/commons/com.b2international.collections.api/pom.xml b/commons/com.b2international.collections.api/pom.xml index af556fb7910..bf675d62680 100644 --- a/commons/com.b2international.collections.api/pom.xml +++ b/commons/com.b2international.collections.api/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.collections.api eclipse-plugin diff --git a/commons/com.b2international.collections.fastutil/META-INF/MANIFEST.MF b/commons/com.b2international.collections.fastutil/META-INF/MANIFEST.MF index f63f71b0d23..83a24d12f50 100644 --- a/commons/com.b2international.collections.fastutil/META-INF/MANIFEST.MF +++ b/commons/com.b2international.collections.fastutil/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Fastutil based implementation of Collections API Bundle-SymbolicName: com.b2international.collections.fastutil;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Fragment-Host: com.b2international.collections.api Export-Package: com.b2international.collections, diff --git a/commons/com.b2international.collections.fastutil/pom.xml b/commons/com.b2international.collections.fastutil/pom.xml index 2d1c8f5e59a..d70278d60ad 100644 --- a/commons/com.b2international.collections.fastutil/pom.xml +++ b/commons/com.b2international.collections.fastutil/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.collections.fastutil eclipse-plugin diff --git a/commons/com.b2international.collections.jackson/META-INF/MANIFEST.MF b/commons/com.b2international.collections.jackson/META-INF/MANIFEST.MF index e1c257e7014..9aef0555bcc 100644 --- a/commons/com.b2international.collections.jackson/META-INF/MANIFEST.MF +++ b/commons/com.b2international.collections.jackson/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Jackson Module for Primitive Collections API Bundle-SymbolicName: com.b2international.collections.jackson;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Require-Bundle: com.b2international.collections.api, diff --git a/commons/com.b2international.collections.jackson/pom.xml b/commons/com.b2international.collections.jackson/pom.xml index 77c0d07084e..ea318335ad1 100644 --- a/commons/com.b2international.collections.jackson/pom.xml +++ b/commons/com.b2international.collections.jackson/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.collections.jackson eclipse-plugin diff --git a/commons/com.b2international.commons.base/META-INF/MANIFEST.MF b/commons/com.b2international.commons.base/META-INF/MANIFEST.MF index 0cb333ff132..7654bcca86c 100644 --- a/commons/com.b2international.commons.base/META-INF/MANIFEST.MF +++ b/commons/com.b2international.commons.base/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: B2i Commons Base Bundle-SymbolicName: com.b2international.commons.base;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: com.b2international.commons, diff --git a/commons/com.b2international.commons.base/pom.xml b/commons/com.b2international.commons.base/pom.xml index 51929ff486b..b045e91eade 100644 --- a/commons/com.b2international.commons.base/pom.xml +++ b/commons/com.b2international.commons.base/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.commons.base eclipse-plugin diff --git a/commons/com.b2international.commons.base/src/com/b2international/commons/encoding/Base64.java b/commons/com.b2international.commons.base/src/com/b2international/commons/encoding/Base64.java index ab6dd1e7959..77a99c8413d 100644 --- a/commons/com.b2international.commons.base/src/com/b2international/commons/encoding/Base64.java +++ b/commons/com.b2international.commons.base/src/com/b2international/commons/encoding/Base64.java @@ -7,6 +7,7 @@ /** * Base64 Encoder/Decoder */ +@SuppressWarnings({"lgtm[java/constant-comparison]", "lgtm[java/dereferenced-value-may-be-null]"}) public class Base64 { @@ -1402,7 +1403,7 @@ public static String encodeFromFile( String filename ) { // Set up some useful variables java.io.File file = new java.io.File( filename ); - byte[] buffer = new byte[ Math.max((int)(file.length() * 1.4+1),40) ]; // Need max() for math on small files (v2.2.1); Need +1 for a few corner cases (v2.3.5) + byte[] buffer = new byte[ Math.max((int)((file.length() * 1.4) + 1), 40) ]; // Need max() for math on small files (v2.2.1); Need +1 for a few corner cases (v2.3.5) int length = 0; int numBytes = 0; diff --git a/commons/com.b2international.commons.test/META-INF/MANIFEST.MF b/commons/com.b2international.commons.test/META-INF/MANIFEST.MF index 414999cc4bd..b84225152ea 100644 --- a/commons/com.b2international.commons.test/META-INF/MANIFEST.MF +++ b/commons/com.b2international.commons.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: B2i Commons Test Bundle-SymbolicName: com.b2international.commons.test -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Fragment-Host: com.b2international.commons;bundle-version="3.9.0" diff --git a/commons/com.b2international.commons.test/pom.xml b/commons/com.b2international.commons.test/pom.xml index 4583a315737..8087f4681e6 100644 --- a/commons/com.b2international.commons.test/pom.xml +++ b/commons/com.b2international.commons.test/pom.xml @@ -6,7 +6,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.commons.test eclipse-test-plugin diff --git a/commons/com.b2international.commons/META-INF/MANIFEST.MF b/commons/com.b2international.commons/META-INF/MANIFEST.MF index 72111114e72..cdfc96f54d3 100644 --- a/commons/com.b2international.commons/META-INF/MANIFEST.MF +++ b/commons/com.b2international.commons/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: B2i Commons Bundle-SymbolicName: com.b2international.commons;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: com.b2international.commons, diff --git a/commons/com.b2international.commons/pom.xml b/commons/com.b2international.commons/pom.xml index 97a7fd54063..7903b85177b 100644 --- a/commons/com.b2international.commons/pom.xml +++ b/commons/com.b2international.commons/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.commons eclipse-plugin diff --git a/commons/com.b2international.index.tests.tools/META-INF/MANIFEST.MF b/commons/com.b2international.index.tests.tools/META-INF/MANIFEST.MF index eb1b5041686..91365bf0bc4 100644 --- a/commons/com.b2international.index.tests.tools/META-INF/MANIFEST.MF +++ b/commons/com.b2international.index.tests.tools/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Test tools for tests based on Index API Bundle-SymbolicName: com.b2international.index.tests.tools;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Require-Bundle: com.b2international.index, diff --git a/commons/com.b2international.index.tests.tools/pom.xml b/commons/com.b2international.index.tests.tools/pom.xml index 3311831282f..cddb7666bbf 100644 --- a/commons/com.b2international.index.tests.tools/pom.xml +++ b/commons/com.b2international.index.tests.tools/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.index.tests.tools eclipse-plugin diff --git a/commons/com.b2international.index.tests/.launch/index-http-unit-tests.launch b/commons/com.b2international.index.tests/.launch/index-http-unit-tests.launch index 7e8777f3646..b85bdf92e0f 100644 --- a/commons/com.b2international.index.tests/.launch/index-http-unit-tests.launch +++ b/commons/com.b2international.index.tests/.launch/index-http-unit-tests.launch @@ -29,7 +29,7 @@ - + diff --git a/commons/com.b2international.index.tests/.launch/index-tcp-unit-tests.launch b/commons/com.b2international.index.tests/.launch/index-tcp-unit-tests.launch index 2b4c84d5836..8a0fb87f7d8 100644 --- a/commons/com.b2international.index.tests/.launch/index-tcp-unit-tests.launch +++ b/commons/com.b2international.index.tests/.launch/index-tcp-unit-tests.launch @@ -29,12 +29,12 @@ - + - + diff --git a/commons/com.b2international.index.tests/META-INF/MANIFEST.MF b/commons/com.b2international.index.tests/META-INF/MANIFEST.MF index d3a1fe2600d..5983a0057a0 100644 --- a/commons/com.b2international.index.tests/META-INF/MANIFEST.MF +++ b/commons/com.b2international.index.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Generic Index API Test Suite Bundle-SymbolicName: com.b2international.index.tests;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy diff --git a/commons/com.b2international.index.tests/pom.xml b/commons/com.b2international.index.tests/pom.xml index 8e641286fbe..93e0007c40f 100644 --- a/commons/com.b2international.index.tests/pom.xml +++ b/commons/com.b2international.index.tests/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.index.tests eclipse-test-plugin @@ -49,7 +49,7 @@ test - ${tycho.testArgLine} -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml + ${tycho.testArgLine} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml @@ -59,7 +59,7 @@ test - ${tycho.testArgLine} -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml -Dso.index.es.useHttp + ${tycho.testArgLine} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml -Dso.index.es.useHttp diff --git a/commons/com.b2international.index.tests/src/com/b2international/index/MaxTermsCountTest.java b/commons/com.b2international.index.tests/src/com/b2international/index/MaxTermsCountTest.java new file mode 100644 index 00000000000..bafda1e3dd4 --- /dev/null +++ b/commons/com.b2international.index.tests/src/com/b2international/index/MaxTermsCountTest.java @@ -0,0 +1,74 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.index; + +import static com.google.common.collect.Sets.newHashSetWithExpectedSize; +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.Collection; +import java.util.Collections; +import java.util.Set; +import java.util.UUID; + +import org.junit.Test; + +import com.b2international.index.Fixtures.Data; +import com.b2international.index.es.query.EsQueryBuilder; +import com.b2international.index.query.Expressions; +import com.b2international.index.query.Query; +import com.b2international.index.query.SetPredicate; +import com.google.common.collect.ImmutableMap; + +/** + * This test should fail without the partitioning code for {@link SetPredicate}s in {@link EsQueryBuilder}, + * Elasticsearch prevents running queries with more than the configured index.max_terms_count. + * + * @since 7.4 + */ +public class MaxTermsCountTest extends BaseIndexTest { + + @Override + protected Collection> getTypes() { + return Collections.singleton(Data.class); + } + + @Test + public void queryWithMoreThanMaxTermsCount() throws Exception { + final int numberOfTerms = 2 * IndexClientFactory.DEFAULT_MAX_TERMS_COUNT; + final Set moreThanMaxTermsCount = newHashSetWithExpectedSize(numberOfTerms); + for (int i = 0; i < numberOfTerms; i++) { + moreThanMaxTermsCount.add(""+i); + } + + indexDocuments(ImmutableMap.of( + UUID.randomUUID().toString(), createData("1"), + UUID.randomUUID().toString(), createData("2"), + UUID.randomUUID().toString(), createData(""+(numberOfTerms + 1)) + )); + + // two matches + assertThat( + search(Query.select(Data.class).where(Expressions.matchAny("field1", moreThanMaxTermsCount)).build()).getTotal() + ).isEqualTo(2); + } + + private Data createData(String field1Value) { + final Data data = new Data(); + data.setField1(field1Value); + return data; + } + +} diff --git a/commons/com.b2international.index.tests/src/com/b2international/index/SortIndexTest.java b/commons/com.b2international.index.tests/src/com/b2international/index/SortIndexTest.java index 4158b0ea13e..85db6293236 100644 --- a/commons/com.b2international.index.tests/src/com/b2international/index/SortIndexTest.java +++ b/commons/com.b2international.index.tests/src/com/b2international/index/SortIndexTest.java @@ -327,7 +327,7 @@ public void sortScore() throws Exception { final Data data = new Data(); data.setField1(item); - data.setFloatField(100.0f - i); + data.setFloatField(NUM_DOCS - i); documents.put(Integer.toString(i), data); } diff --git a/commons/com.b2international.index/.classpath b/commons/com.b2international.index/.classpath index 3be072c85ae..9ae446cedd6 100644 --- a/commons/com.b2international.index/.classpath +++ b/commons/com.b2international.index/.classpath @@ -7,51 +7,55 @@ - - + + - - - - - - - - - - + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - + + + diff --git a/commons/com.b2international.index/META-INF/MANIFEST.MF b/commons/com.b2international.index/META-INF/MANIFEST.MF index d36c355ac0d..fabb32834f1 100644 --- a/commons/com.b2international.index/META-INF/MANIFEST.MF +++ b/commons/com.b2international.index/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Search Indexing Bundle-SymbolicName: com.b2international.index;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0", @@ -27,7 +27,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0", Export-Package: com.b2international.index, com.b2international.index.admin, com.b2international.index.aggregations, - com.b2international.index.analyzer, com.b2international.index.compat, com.b2international.index.decimal, com.b2international.index.es, @@ -47,6 +46,7 @@ Export-Package: com.b2international.index, org.apache.lucene.search, org.apache.solr.common.util, org.elasticsearch.cluster.health, + org.elasticsearch.common, org.tartarus.snowball, org.tartarus.snowball.ext Import-Package: javax.management, @@ -56,50 +56,54 @@ Import-Package: javax.management, org.slf4j.helpers;version="1.7.2", org.slf4j.spi;version="1.7.2" Bundle-ClassPath: ., - lib/aggs-matrix-stats-client-6.8.2.jar, - lib/analysis-common-6.8.2.jar, + lib/aggs-matrix-stats-client-7.5.2.jar, + lib/analysis-common-7.5.2.jar, lib/antlr4-runtime-4.5.3.jar, lib/asm-debug-all-5.1.jar, - lib/compiler-0.9.3.jar, - lib/elasticsearch-6.8.2.jar, - lib/elasticsearch-cli-6.8.2.jar, - lib/elasticsearch-core-6.8.2.jar, - lib/elasticsearch-rest-client-6.8.2.jar, - lib/elasticsearch-rest-high-level-client-6.8.2.jar, - lib/elasticsearch-secure-sm-6.8.2.jar, - lib/elasticsearch-ssl-config-6.8.2.jar, - lib/elasticsearch-x-content-6.8.2.jar, - lib/hppc-0.7.1.jar, + lib/compiler-0.9.6.jar, + lib/elasticsearch-7.5.2.jar, + lib/elasticsearch-cli-7.5.2.jar, + lib/elasticsearch-core-7.5.2.jar, + lib/elasticsearch-geo-7.5.2.jar, + lib/elasticsearch-rest-client-7.5.2.jar, + lib/elasticsearch-rest-high-level-client-7.5.2.jar, + lib/elasticsearch-secure-sm-7.5.2.jar, + lib/elasticsearch-ssl-config-7.5.2.jar, + lib/elasticsearch-x-content-7.5.2.jar, + lib/hppc-0.8.1.jar, + lib/hppcrt-0.7.5.jar, lib/jna-4.5.1.jar, - lib/joda-time-2.10.1.jar, + lib/joda-time-2.10.3.jar, lib/jopt-simple-5.0.2.jar, - lib/lang-mustache-client-6.8.2.jar, - lib/lang-painless-6.8.2.jar, + lib/lang-mustache-client-7.5.2.jar, + lib/lang-painless-7.5.2.jar, lib/log4j-api-2.11.1.jar, lib/log4j-core-2.11.1.jar, - lib/lucene-analyzers-common-7.7.0.jar, - lib/lucene-backward-codecs-7.7.0.jar, - lib/lucene-core-7.7.0.jar, - lib/lucene-grouping-7.7.0.jar, - lib/lucene-highlighter-7.7.0.jar, - lib/lucene-join-7.7.0.jar, - lib/lucene-memory-7.7.0.jar, - lib/lucene-misc-7.7.0.jar, - lib/lucene-queries-7.7.0.jar, - lib/lucene-queryparser-7.7.0.jar, - lib/lucene-sandbox-7.7.0.jar, - lib/lucene-spatial-7.7.0.jar, - lib/lucene-spatial-extras-7.7.0.jar, - lib/lucene-spatial3d-7.7.0.jar, - lib/lucene-suggest-7.7.0.jar, - lib/parent-join-client-6.8.2.jar, - lib/percolator-client-6.8.2.jar, - lib/rank-eval-client-6.8.2.jar, - lib/reindex-6.8.2.jar, - lib/reindex-client-6.8.2.jar, - lib/scripting-painless-spi-6.8.2.jar, + lib/lucene-analyzers-common-8.3.0.jar, + lib/lucene-backward-codecs-8.3.0.jar, + lib/lucene-core-8.3.0.jar, + lib/lucene-grouping-8.3.0.jar, + lib/lucene-highlighter-8.3.0.jar, + lib/lucene-join-8.3.0.jar, + lib/lucene-memory-8.3.0.jar, + lib/lucene-misc-8.3.0.jar, + lib/lucene-queries-8.3.0.jar, + lib/lucene-queryparser-8.3.0.jar, + lib/lucene-sandbox-8.3.0.jar, + lib/lucene-spatial-8.3.0.jar, + lib/lucene-spatial-extras-8.3.0.jar, + lib/lucene-spatial3d-8.3.0.jar, + lib/lucene-suggest-8.3.0.jar, + lib/mapper-extras-client-7.5.2.jar, + lib/parent-join-client-7.5.2.jar, + lib/percolator-client-7.5.2.jar, + lib/rank-eval-client-7.5.2.jar, + lib/reindex-7.5.2.jar, + lib/reindex-client-7.5.2.jar, + lib/scripting-painless-spi-7.5.2.jar, + lib/ssl-config-7.5.2.jar, lib/t-digest-3.2.jar, - lib/transport-6.8.2.jar, - lib/transport-netty4-6.8.2.jar, - lib/transport-netty4-client-6.8.2.jar + lib/transport-7.5.2.jar, + lib/transport-netty4-7.5.2.jar, + lib/transport-netty4-client-7.5.2.jar Bundle-Activator: com.b2international.index.Activator diff --git a/commons/com.b2international.index/build.properties b/commons/com.b2international.index/build.properties index f2f3e44d035..3e78378c73c 100644 --- a/commons/com.b2international.index/build.properties +++ b/commons/com.b2international.index/build.properties @@ -2,5 +2,9 @@ source.. = src/ output.. = target/classes/ bin.includes = META-INF/,\ .,\ - lib/ + lib/,\ + lib/elasticsearch-geo-7.5.2.jar,\ + lib/hppcrt-0.7.5.jar,\ + lib/mapper-extras-client-7.5.2.jar,\ + lib/ssl-config-7.5.2.jar bin.excludes = lib/.gitignore diff --git a/commons/com.b2international.index/pom.xml b/commons/com.b2international.index/pom.xml index 003b5e3f1d6..51c06aea870 100644 --- a/commons/com.b2international.index/pom.xml +++ b/commons/com.b2international.index/pom.xml @@ -4,13 +4,13 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.index eclipse-plugin - 6.8.2 + 7.5.2 2.11.1 @@ -96,12 +96,14 @@ elasticsearch, elasticsearch-cli, elasticsearch-core, + elasticsearch-geo, elasticsearch-rest-client, elasticsearch-rest-high-level-client, elasticsearch-secure-sm, elasticsearch-ssl-config, elasticsearch-x-content, hppc, + hppcrt, jna, joda-time, jopt-simple, @@ -124,12 +126,14 @@ lucene-spatial-extras, lucene-spatial3d, lucene-suggest, + mapper-extras-client, parent-join-client, percolator-client, rank-eval-client, reindex, reindex-client, scripting-painless-spi, + ssl-config, t-digest, transport, transport-netty4, diff --git a/commons/com.b2international.index/src/com/b2international/index/IndexClientFactory.java b/commons/com.b2international.index/src/com/b2international/index/IndexClientFactory.java index 4194f836616..4c3d1a727c1 100644 --- a/commons/com.b2international.index/src/com/b2international/index/IndexClientFactory.java +++ b/commons/com.b2international.index/src/com/b2international/index/IndexClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,11 @@ public interface IndexClientFactory { */ String RESULT_WINDOW_KEY = "max_result_window"; + /** + * Configuration key to specify the maximum number of term values in a terms query. By default it is set to {@value #DEFAULT_MAX_TERMS_COUNT}. + */ + String MAX_TERMS_COUNT_KEY = "max_terms_count"; + /** * Configuration key to specify the number of shards for the index. * Currently only the index.es fragment supports. @@ -117,6 +122,12 @@ public interface IndexClientFactory { */ int DEFAULT_RESULT_WINDOW = 100_099; + /** + * The default max terms count (from Elasticsearch default), + * more details + */ + int DEFAULT_MAX_TERMS_COUNT = 65_536; + /** * The default concurrency level for the bulk operations depends on the number of cores you have max(1, cores / 4). * Elasticsearch module only configuration key. @@ -147,7 +158,7 @@ public interface IndexClientFactory { * The default cluster.name value for embedded nodes and tcp based clients. */ String DEFAULT_CLUSTER_NAME = "elastic-snowowl"; - + /** * Create a new {@link IndexClient} with the given name. * diff --git a/commons/com.b2international.index/src/com/b2international/index/aggregations/AggregationBuilder.java b/commons/com.b2international.index/src/com/b2international/index/aggregations/AggregationBuilder.java index 771bdef0ace..7bf2d54397f 100644 --- a/commons/com.b2international.index/src/com/b2international/index/aggregations/AggregationBuilder.java +++ b/commons/com.b2international.index/src/com/b2international/index/aggregations/AggregationBuilder.java @@ -38,6 +38,7 @@ public final class AggregationBuilder implements ScriptExpression { private String groupByScript; private int minBucketSize = 1; private int bucketHitsLimit = 10; + private String path; AggregationBuilder(String name, Class select, Class from) { this.name = name; @@ -55,6 +56,11 @@ public AggregationBuilder onFieldValue(String field) { return this; } + public AggregationBuilder nested(String path) { + this.path = path; + return this; + } + public AggregationBuilder fields(String...fields) { return fields(ImmutableList.copyOf(fields)); } @@ -91,6 +97,10 @@ public String getName() { return name; } + public String getPath() { + return path; + } + public String getGroupByField() { return groupByField; } diff --git a/commons/com.b2international.index/src/com/b2international/index/analyzer/DelimiterTokenizer.java b/commons/com.b2international.index/src/com/b2international/index/analyzer/DelimiterTokenizer.java deleted file mode 100644 index 7a9c31194a8..00000000000 --- a/commons/com.b2international.index/src/com/b2international/index/analyzer/DelimiterTokenizer.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.index.analyzer; - -import org.apache.lucene.analysis.util.CharTokenizer; - -import com.b2international.index.compat.TextConstants; -import com.google.common.base.CharMatcher; - -/** - * A character-oriented tokenizer which splits tokens on whitespace and delimiters enumerated in - * {@link IndexUtils#DELIMITERS}, and also converts characters to lower case in the normalization phase. - * - */ -public class DelimiterTokenizer extends CharTokenizer { - - // Excludes 2000-2000a, which is handled as a range - private static final String BREAKING_WHITESPACE_CHARS = "\t\n\013\f\r \u0085\u1680\u2028\u2029\u205f\u3000"; - - // Excludes 2007, which is handled as a gap in a pair of ranges - private static final String NON_BREAKING_WHITESPACE_CHARS = "\u00a0\u180e\u202f"; - - /** - * @see TextConstants#WHITESPACE_OR_DELIMITER_MATCHER - */ - private static final CharMatcher TOKEN_CHARS; - - static { - TOKEN_CHARS = CharMatcher.ANY - .and(CharMatcher.anyOf(BREAKING_WHITESPACE_CHARS)) - .and(CharMatcher.anyOf(NON_BREAKING_WHITESPACE_CHARS)) - .and(CharMatcher.anyOf(TextConstants.DELIMITERS)) - .and(CharMatcher.inRange('\u2000', '\u200a')) - .precomputed(); - } - - public DelimiterTokenizer() { - super(); - } - - @Override - protected int normalize(int c) { - return Character.toLowerCase(c); - } - - @Override - protected boolean isTokenChar(int c) { - // We don't have whitespace characters to match in the supplementary code point range - return c >= Character.MIN_SUPPLEMENTARY_CODE_POINT || !TOKEN_CHARS.matches((char) c); - } -} diff --git a/commons/com.b2international.index/src/com/b2international/index/analyzer/CharMatcherTokenizer.java b/commons/com.b2international.index/src/com/b2international/index/compat/CharMatcherTokenizer.java similarity index 83% rename from commons/com.b2international.index/src/com/b2international/index/analyzer/CharMatcherTokenizer.java rename to commons/com.b2international.index/src/com/b2international/index/compat/CharMatcherTokenizer.java index a94013913a1..da985ea2fdc 100644 --- a/commons/com.b2international.index/src/com/b2international/index/analyzer/CharMatcherTokenizer.java +++ b/commons/com.b2international.index/src/com/b2international/index/compat/CharMatcherTokenizer.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.index.analyzer; +package com.b2international.index.compat; import org.apache.lucene.analysis.util.CharTokenizer; @@ -23,7 +23,7 @@ * A variant of {@link CharTokenizer} which splits tokens according to the specified {@link CharMatcher}, * converting characters to lower case in the normalization step. */ -public class CharMatcherTokenizer extends CharTokenizer { +final class CharMatcherTokenizer extends CharTokenizer { private final CharMatcher tokenBoundaryMatcher; @@ -32,11 +32,6 @@ public CharMatcherTokenizer(final CharMatcher tokenBoundaryMatcher) { this.tokenBoundaryMatcher = tokenBoundaryMatcher; } - @Override - protected int normalize(final int c) { - return Character.toLowerCase(c); - } - @Override protected boolean isTokenChar(final int c) { // CharMatcher can't be applied to the supplementary code point range diff --git a/commons/com.b2international.index/src/com/b2international/index/analyzer/ComponentTermAnalyzer.java b/commons/com.b2international.index/src/com/b2international/index/compat/ComponentTermAnalyzer.java similarity index 91% rename from commons/com.b2international.index/src/com/b2international/index/analyzer/ComponentTermAnalyzer.java rename to commons/com.b2international.index/src/com/b2international/index/compat/ComponentTermAnalyzer.java index f6310b2239c..7bfdb96501d 100644 --- a/commons/com.b2international.index/src/com/b2international/index/analyzer/ComponentTermAnalyzer.java +++ b/commons/com.b2international.index/src/com/b2international/index/compat/ComponentTermAnalyzer.java @@ -13,20 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.index.analyzer; +package com.b2international.index.compat; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenFilter; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.miscellaneous.ASCIIFoldingFilter; -import com.b2international.index.compat.TextConstants; - /** * A variant of {@link Analyzer} that uses {@link CharMatcherTokenizer} to tokenize incoming text and convert it to lower case, * then passes tokens through {@link ASCIIFoldingFilter} to convert any non-ASCII characters to their closest ASCII alternative. */ -public class ComponentTermAnalyzer extends Analyzer { +final class ComponentTermAnalyzer extends Analyzer { @Override protected TokenStreamComponents createComponents(final String fieldName) { diff --git a/commons/com.b2international.index/src/com/b2international/index/compat/Highlighting.java b/commons/com.b2international.index/src/com/b2international/index/compat/Highlighting.java index 870363b9d2d..031334f915c 100644 --- a/commons/com.b2international.index/src/com/b2international/index/compat/Highlighting.java +++ b/commons/com.b2international.index/src/com/b2international/index/compat/Highlighting.java @@ -26,7 +26,6 @@ import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; -import com.b2international.index.analyzer.ComponentTermAnalyzer; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; diff --git a/commons/com.b2international.index/src/com/b2international/index/compat/TextConstants.java b/commons/com.b2international.index/src/com/b2international/index/compat/TextConstants.java index 97a1f064ace..42c01edcefa 100644 --- a/commons/com.b2international.index/src/com/b2international/index/compat/TextConstants.java +++ b/commons/com.b2international.index/src/com/b2international/index/compat/TextConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,7 +42,7 @@ public abstract class TextConstants { /** * A {@link CharMatcher} that matches all characters in {@link #DELIMITERS} as well as all whitespace characters. */ - public static final CharMatcher WHITESPACE_OR_DELIMITER_MATCHER = INTERNAL_DELIMITER_MATCHER.or(CharMatcher.WHITESPACE).precomputed(); + public static final CharMatcher WHITESPACE_OR_DELIMITER_MATCHER = INTERNAL_DELIMITER_MATCHER.or(CharMatcher.whitespace()).precomputed(); private TextConstants() { throw new UnsupportedOperationException("This class is not supposed to be instantiated."); diff --git a/commons/com.b2international.index/src/com/b2international/index/decimal/ModuleVersion.java b/commons/com.b2international.index/src/com/b2international/index/decimal/ModuleVersion.java index 508709022db..d1f26018e69 100644 --- a/commons/com.b2international.index/src/com/b2international/index/decimal/ModuleVersion.java +++ b/commons/com.b2international.index/src/com/b2international/index/decimal/ModuleVersion.java @@ -15,7 +15,6 @@ */ package com.b2international.index.decimal; -import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.core.util.VersionUtil; /** diff --git a/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentSearcher.java b/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentSearcher.java index 2c37b70e75d..59d0da28cb8 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentSearcher.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentSearcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.b2international.index.es; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.Lists.newArrayList; import java.io.ByteArrayInputStream; @@ -28,6 +29,8 @@ import java.util.List; import java.util.Optional; +import org.apache.lucene.search.TotalHits; +import org.apache.lucene.search.TotalHits.Relation; import org.apache.solr.common.util.JavaBinCodec; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; @@ -41,10 +44,13 @@ import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.aggregations.AggregationBuilders; +import org.elasticsearch.search.aggregations.Aggregations; +import org.elasticsearch.search.aggregations.bucket.nested.Nested; +import org.elasticsearch.search.aggregations.bucket.nested.ReverseNested; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; -import org.elasticsearch.search.aggregations.metrics.tophits.TopHits; -import org.elasticsearch.search.aggregations.metrics.tophits.TopHitsAggregationBuilder; +import org.elasticsearch.search.aggregations.metrics.TopHits; +import org.elasticsearch.search.aggregations.metrics.TopHitsAggregationBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.sort.ScriptSortBuilder.ScriptSortType; @@ -107,7 +113,7 @@ public EsDocumentSearcher(EsIndexAdmin admin, ObjectMapper mapper) { public T get(Class type, String key) throws IOException { checkArgument(!Strings.isNullOrEmpty(key), "Key cannot be empty"); final DocumentMapping mapping = admin.mappings().getMapping(type); - final GetRequest req = new GetRequest(admin.getTypeIndex(mapping), mapping.typeAsString(), key) + final GetRequest req = new GetRequest(admin.getTypeIndex(mapping), key) .fetchSourceContext(FetchSourceContext.FETCH_SOURCE); final GetResponse res = admin.client().get(req); @@ -133,16 +139,16 @@ public Hits search(Query query) throws IOException { final int limit = query.getLimit(); final int toRead = Ints.min(limit, resultWindow); - final EsQueryBuilder esQueryBuilder = new EsQueryBuilder(mapping); + final EsQueryBuilder esQueryBuilder = new EsQueryBuilder(mapping, admin.settings()); final QueryBuilder esQuery = esQueryBuilder.build(query.getWhere()); - final SearchRequest req = new SearchRequest(admin.getTypeIndex(mapping)) - .types(mapping.typeAsString()); + final SearchRequest req = new SearchRequest(admin.getTypeIndex(mapping)); final SearchSourceBuilder reqSource = req.source() .size(toRead) .query(esQuery) - .trackScores(esQueryBuilder.needsScoring()); + .trackScores(esQueryBuilder.needsScoring()) + .trackTotalHitsUpTo(Integer.MAX_VALUE); // field selection final boolean fetchSource = applySourceFiltering(query.getFields(), query.isDocIdOnly(), mapping, reqSource); @@ -190,8 +196,10 @@ public Hits search(Query query) throws IOException { throw new IndexException("Couldn't execute query: " + e.getMessage(), null); } - final int totalHits = (int) response.getHits().getTotalHits(); - int numDocsToFetch = Math.min(limit, totalHits) - response.getHits().getHits().length; + TotalHits totalHits = response.getHits().getTotalHits(); + checkState(totalHits.relation == Relation.EQUAL_TO, "Searches should always track total hits accurately"); + final int totalHitCount = (int) totalHits.value; + int numDocsToFetch = Math.min(limit, totalHitCount) - response.getHits().getHits().length; final ImmutableList.Builder allHits = ImmutableList.builder(); allHits.add(response.getHits().getHits()); @@ -219,7 +227,7 @@ public Hits search(Query query) throws IOException { final Class select = query.getSelect(); final Class from = query.getFrom(); - return toHits(select, from, query.getFields(), fetchSource, limit, totalHits, response.getScrollId(), query.getSortBy(), allHits.build()); + return toHits(select, from, query.getFields(), fetchSource, limit, totalHitCount, response.getScrollId(), query.getSortBy(), allHits.build()); } private boolean applySourceFiltering(List fields, boolean isDocIdOnly, final DocumentMapping mapping, final SearchSourceBuilder reqSource) { @@ -242,7 +250,7 @@ private boolean applySourceFiltering(List fields, boolean isDocIdOnl } // Use docValues otherwise for field retrieval - fields.stream().forEach(field -> reqSource.docValueField(field, "use_field_mapping")); + fields.stream().forEach(field -> reqSource.docValueField(field)); reqSource.fetchSource(false); return false; } @@ -274,7 +282,7 @@ public Hits scroll(Scroll scroll) throws IOException { final DocumentMapping mapping = admin.mappings().getMapping(scroll.getFrom()); final boolean fetchSource = scroll.getFields().isEmpty() || requiresDocumentSourceField(mapping, scroll.getFields()); - return toHits(scroll.getSelect(), scroll.getFrom(), scroll.getFields(), fetchSource, response.getHits().getHits().length, (int) response.getHits().getTotalHits(), response.getScrollId(), null, response.getHits()); + return toHits(scroll.getSelect(), scroll.getFrom(), scroll.getFields(), fetchSource, response.getHits().getHits().length, (int) response.getHits().getTotalHits().value, response.getScrollId(), null, response.getHits()); } catch (IOException | ElasticsearchStatusException e) { final Throwable rootCause = Throwables.getRootCause(e); @@ -430,16 +438,16 @@ public Aggregation aggregate(AggregationBuilder aggregation) throws IO final EsClient client = admin.client(); final DocumentMapping mapping = admin.mappings().getMapping(aggregation.getFrom()); - final EsQueryBuilder esQueryBuilder = new EsQueryBuilder(mapping); + final EsQueryBuilder esQueryBuilder = new EsQueryBuilder(mapping, admin.settings()); final QueryBuilder esQuery = esQueryBuilder.build(aggregation.getQuery()); - final SearchRequest req = new SearchRequest(admin.getTypeIndex(mapping)) - .types(mapping.typeAsString()); + final SearchRequest req = new SearchRequest(admin.getTypeIndex(mapping)); final SearchSourceBuilder reqSource = req.source() .query(esQuery) .size(0) - .trackScores(false); + .trackScores(false) + .trackTotalHitsUpTo(Integer.MAX_VALUE); // field selection final boolean fetchSource = applySourceFiltering(aggregation.getFields(), false, mapping, reqSource); @@ -455,9 +463,24 @@ public Aggregation aggregate(AggregationBuilder aggregation) throws IO ImmutableMap.Builder> buckets = ImmutableMap.builder(); - Terms aggregationResult = response.getAggregations().get(aggregationName); + Aggregations topLevelAggregations = response.getAggregations(); + Nested nested = topLevelAggregations.get(nestedAggName(aggregation)); + Terms aggregationResult; + + if (nested != null) { + aggregationResult = nested.getAggregations().get(aggregationName); + } else { + aggregationResult = topLevelAggregations.get(aggregationName); + } + for (org.elasticsearch.search.aggregations.bucket.terms.Terms.Bucket bucket : aggregationResult.getBuckets()) { - final TopHits topHits = bucket.getAggregations().get(topHitsAggName(aggregation)); + final TopHits topHits; + if (nested != null) { + final ReverseNested reverseNested = bucket.getAggregations().get(reverseNestedAggName(aggregation)); + topHits = reverseNested.getAggregations().get(topHitsAggName(aggregation)); + } else { + topHits = bucket.getAggregations().get(topHitsAggName(aggregation)); + } Hits hits; if (topHits != null) { hits = toHits(aggregation.getSelect(), aggregation.getFrom(), aggregation.getFields(), fetchSource, aggregation.getBucketHitsLimit(), (int) bucket.getDocCount(), null, null, topHits.getHits()); @@ -486,6 +509,7 @@ private org.elasticsearch.search.aggregations.AggregationBuilder toEsAggregation throw new IllegalArgumentException("Specify either field or script parameter"); } + boolean isNested = !Strings.isNullOrEmpty(aggregation.getPath()); // add top hits agg to get the top N items for each bucket if (aggregation.getBucketHitsLimit() > 0) { TopHitsAggregationBuilder topHitsAgg = AggregationBuilders.topHits(topHitsAggName(aggregation)) @@ -500,11 +524,21 @@ private org.elasticsearch.search.aggregations.AggregationBuilder toEsAggregation .storedFields(STORED_FIELDS_NONE) .fetchSource(false); - aggregation.getFields().forEach(field -> topHitsAgg.docValueField(field, "use_field_mapping")); + aggregation.getFields().forEach(field -> topHitsAgg.docValueField(field)); } - termsAgg.subAggregation(topHitsAgg); + if (isNested) { + termsAgg.subAggregation(AggregationBuilders.reverseNested(reverseNestedAggName(aggregation)).subAggregation(topHitsAgg)); + } else { + termsAgg.subAggregation(topHitsAgg); + } + } + + if (isNested) { + return AggregationBuilders + .nested(nestedAggName(aggregation), aggregation.getPath()) + .subAggregation(termsAgg); } return termsAgg; @@ -513,5 +547,13 @@ private org.elasticsearch.search.aggregations.AggregationBuilder toEsAggregation private String topHitsAggName(AggregationBuilder aggregation) { return aggregation.getName() + "-top-hits"; } + + private String nestedAggName(AggregationBuilder aggregation) { + return aggregation.getName() + "-nested"; + } + + private String reverseNestedAggName(AggregationBuilder aggregation) { + return aggregation.getName() + "-reverse-nested"; + } } diff --git a/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentWriter.java b/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentWriter.java index 535e3ed77b1..5afbdcbf151 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentWriter.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/EsDocumentWriter.java @@ -185,7 +185,6 @@ public void afterBulk(long executionId, BulkRequest request, BulkResponse respon final Map indexOperationsForType = indexOperations.row(type); final DocumentMapping mapping = admin.mappings().getMapping(type); - final String typeString = mapping.typeAsString(); final String typeIndex = admin.getTypeIndex(mapping); mappingsToRefresh.add(mapping); @@ -220,14 +219,16 @@ public void afterBulk(long executionId, BulkRequest request, BulkResponse respon _source = mapper.writeValueAsBytes(obj); } - processor.add(new IndexRequest(typeIndex, typeString, id) + processor.add(new IndexRequest() + .index(typeIndex) + .id(id) .opType(OpType.INDEX) .source(_source, XContentType.JSON)); } } for (String id : deleteOperations.removeAll(type)) { - processor.add(new DeleteRequest(typeIndex, typeString, id)); + processor.add(new DeleteRequest(typeIndex, id)); } // Flush processor between index boundaries @@ -243,7 +244,7 @@ public void afterBulk(long executionId, BulkRequest request, BulkResponse respon mappingsToRefresh.add(mapping); for (String id : deleteOperations.removeAll(type)) { - processor.add(new DeleteRequest(typeIndex, typeString, id)); + processor.add(new DeleteRequest(typeIndex, id)); } // Flush processor between index boundaries diff --git a/commons/com.b2international.index/src/com/b2international/index/es/EsIndexClientFactory.java b/commons/com.b2international.index/src/com/b2international/index/es/EsIndexClientFactory.java index 3d5d18e860b..8f1dc0ae82f 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/EsIndexClientFactory.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/EsIndexClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/commons/com.b2international.index/src/com/b2international/index/es/EsNode.java b/commons/com.b2international.index/src/com/b2international/index/es/EsNode.java index 26b17385822..3273a802574 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/EsNode.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/EsNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.time.temporal.ChronoUnit; +import java.util.Collections; import java.util.Comparator; import org.elasticsearch.analysis.common.CommonAnalysisPlugin; @@ -145,7 +146,7 @@ private static void putSettingIfAbsent(Settings.Builder settings, String key, bo } protected EsNode(Settings settings, Path dataPath, boolean persistent) { - super(InternalSettingsPreparer.prepareEnvironment(settings, null), ImmutableList.>builder() + super(InternalSettingsPreparer.prepareEnvironment(settings, Collections.emptyMap(), null, null), ImmutableList.>builder() .add(CommonAnalysisPlugin.class) .add(MatrixAggregationPlugin.class) .add(Netty4Plugin.class) @@ -159,10 +160,6 @@ protected EsNode(Settings settings, Path dataPath, boolean persistent) { this.persistent = persistent; } - @Override - protected void registerDerivedNodeNameWithLogger(String nodeName) { - } - private static void waitForPendingTasks(Client client) { RetryPolicy retryPolicy = new RetryPolicy(); retryPolicy diff --git a/commons/com.b2international.index/src/com/b2international/index/es/admin/EsIndexAdmin.java b/commons/com.b2international.index/src/com/b2international/index/es/admin/EsIndexAdmin.java index df0a713c38e..d3189d50de6 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/admin/EsIndexAdmin.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/admin/EsIndexAdmin.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -86,7 +86,7 @@ public final class EsIndexAdmin implements IndexAdmin { private static final EnumSet DIFF_FLAGS = EnumSet.of(DiffFlags.ADD_ORIGINAL_VALUE_ON_REPLACE); private static final int DEFAULT_MAX_NUMBER_OF_VERSION_CONFLICT_RETRIES = 5; - private static final int BATCHS_SIZE = 10_000; + private static final int BATCH_SIZE = 10_000; private final Random random = new Random(); private final EsClient client; @@ -109,6 +109,7 @@ public EsIndexAdmin(EsClient client, ObjectMapper mapper, String name, Mappings this.settings.putIfAbsent(IndexClientFactory.COMMIT_CONCURRENCY_LEVEL, IndexClientFactory.DEFAULT_COMMIT_CONCURRENCY_LEVEL); this.settings.putIfAbsent(IndexClientFactory.RESULT_WINDOW_KEY, ""+IndexClientFactory.DEFAULT_RESULT_WINDOW); + this.settings.putIfAbsent(IndexClientFactory.MAX_TERMS_COUNT_KEY, ""+IndexClientFactory.DEFAULT_MAX_TERMS_COUNT); this.settings.putIfAbsent(IndexClientFactory.TRANSLOG_SYNC_INTERVAL_KEY, IndexClientFactory.DEFAULT_TRANSLOG_SYNC_INTERVAL); final String prefix = (String) settings.getOrDefault(IndexClientFactory.INDEX_PREFIX, IndexClientFactory.DEFAULT_INDEX_PREFIX); @@ -145,24 +146,23 @@ public void create() { for (DocumentMapping mapping : mappings.getMappings()) { final String index = getTypeIndex(mapping); final String type = mapping.typeAsString(); - final Map typeMapping = ImmutableMap.of(type, - ImmutableMap.builder() + final Map typeMapping = ImmutableMap.builder() .put("date_detection", false) .put("numeric_detection", false) .putAll(toProperties(mapping)) - .build()); + .build(); if (exists(mapping)) { // update mapping if required ImmutableOpenMap currentIndexMapping; try { - currentIndexMapping = client.indices().getMapping(new GetMappingsRequest().indices(index).types(type)).mappings().get(index); + currentIndexMapping = client.indices().getMapping(new GetMappingsRequest().types(type).indices(index)).mappings().get(index); } catch (Exception e) { throw new IndexException(String.format("Failed to get mapping of '%s' for type '%s'", name, mapping.typeAsString()), e); } try { - final ObjectNode newTypeMapping = mapper.valueToTree(typeMapping.get(type)); + final ObjectNode newTypeMapping = mapper.valueToTree(typeMapping); final ObjectNode currentTypeMapping = mapper.valueToTree(currentIndexMapping.get(type).getSourceAsMap()); final JsonNode diff = JsonDiff.asJson(currentTypeMapping, newTypeMapping, DIFF_FLAGS); final ArrayNode diffNode = ClassUtils.checkAndCast(diff, ArrayNode.class); @@ -236,10 +236,13 @@ private Map createIndexSettings() throws IOException { .put("number_of_replicas", "0") // disable es refresh, we will do it manually on each commit .put("refresh_interval", "-1") - .put(IndexClientFactory.RESULT_WINDOW_KEY, settings().get(IndexClientFactory.RESULT_WINDOW_KEY)) - .put(IndexClientFactory.TRANSLOG_SYNC_INTERVAL_KEY, settings().get(IndexClientFactory.TRANSLOG_SYNC_INTERVAL_KEY)) + // use async durability for the translog .put("translog.durability", "async") + // wait all shards during writes .put("write.wait_for_active_shards", "all") + .put(IndexClientFactory.RESULT_WINDOW_KEY, settings().get(IndexClientFactory.RESULT_WINDOW_KEY)) + .put(IndexClientFactory.MAX_TERMS_COUNT_KEY, settings().get(IndexClientFactory.MAX_TERMS_COUNT_KEY)) + .put(IndexClientFactory.TRANSLOG_SYNC_INTERVAL_KEY, settings().get(IndexClientFactory.TRANSLOG_SYNC_INTERVAL_KEY)) .build(); } @@ -306,8 +309,14 @@ private Map toProperties(DocumentMapping mapping) { Doc annotation = fieldType.getAnnotation(Doc.class); // this is a nested document type create a nested mapping final Map prop = newHashMap(); - prop.put("type", annotation.nested() ? "nested" : "object"); - prop.put("enabled", annotation.index() ? true : false); + // XXX type: object is the default for nested objects, ES won't store it in the mapping and will default to object even if explicitly set, which would cause unnecessary mapping update during boot + if (annotation.nested()) { + prop.put("type", "nested"); + } + // XXX enabled: true is the default, ES won't store it in the mapping and will default to true even if explicitly set, which would cause unnecessary mapping update during boot + if (!annotation.index()) { + prop.put("enabled", false); + } prop.putAll(toProperties(new DocumentMapping(fieldType))); properties.put(property, prop); } else { @@ -542,7 +551,7 @@ private void bulkIndexByScroll(final EsClient client, final Set mappingsToRefresh) { final DocumentMapping mapping = mappings().getMapping(op.getType()); - final QueryBuilder query = new EsQueryBuilder(mapping).build(op.getFilter()); + final QueryBuilder query = new EsQueryBuilder(mapping, settings).build(op.getFilter()); long versionConflicts = 0; int attempts = DEFAULT_MAX_NUMBER_OF_VERSION_CONFLICT_RETRIES; @@ -553,9 +562,9 @@ private void bulkIndexByScroll(final EsClient client, final BulkByScrollResponse response; if ("update".equals(command)) { - response = client.updateByQuery(getTypeIndex(mapping), mapping.typeAsString(), BATCHS_SIZE, script, getConcurrencyLevel(), query); + response = client.updateByQuery(getTypeIndex(mapping), BATCH_SIZE, script, getConcurrencyLevel(), query); } else if ("delete".equals(command)) { - response = client.deleteByQuery(getTypeIndex(mapping), mapping.typeAsString(), BATCHS_SIZE, getConcurrencyLevel(), query); + response = client.deleteByQuery(getTypeIndex(mapping), BATCH_SIZE, getConcurrencyLevel(), query); } else { throw new UnsupportedOperationException("Not implemented command: " + command); } diff --git a/commons/com.b2international.index/src/com/b2international/index/es/client/EsClient.java b/commons/com.b2international.index/src/com/b2international/index/es/client/EsClient.java index 398fff29180..231b2ef3470 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/client/EsClient.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/client/EsClient.java @@ -71,9 +71,9 @@ public interface EsClient extends AutoCloseable { BulkProcessor.Builder bulk(BulkProcessor.Listener listener); - BulkByScrollResponse updateByQuery(String index, String type, int batchSize, Script script, int numberOfSlices, QueryBuilder query) throws IOException; + BulkByScrollResponse updateByQuery(String index, int batchSize, Script script, int numberOfSlices, QueryBuilder query) throws IOException; - BulkByScrollResponse deleteByQuery(String index, String type, int batchSize, int numberOfSlices, QueryBuilder query) throws IOException; + BulkByScrollResponse deleteByQuery(String index, int batchSize, int numberOfSlices, QueryBuilder query) throws IOException; static EsClient create(final EsClientConfiguration configuration) { return ClientPool.create(configuration); diff --git a/commons/com.b2international.index/src/com/b2international/index/es/client/EsClientBase.java b/commons/com.b2international.index/src/com/b2international/index/es/client/EsClientBase.java index f0e0e4da7eb..28fcf9ca4f0 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/client/EsClientBase.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/client/EsClientBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.apache.http.HttpHost; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; +import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest.Level; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse; @@ -134,7 +135,9 @@ private String checkClusterAvailable(String previousAvailability) { private ClusterHealthResponse checkClusterHealth(ClusterHealthResponse previousHealth) { try { log.trace("Checking cluster health at '{}'...", host.toURI()); - return cluster().health(new ClusterHealthRequest()); + ClusterHealthRequest req = new ClusterHealthRequest(); + req.level(Level.INDICES); + return cluster().health(req); } catch (IOException e) { throw new IndexException("Failed to get cluster health", e); } diff --git a/commons/com.b2international.index/src/com/b2international/index/es/client/http/EsHttpClient.java b/commons/com.b2international.index/src/com/b2international/index/es/client/http/EsHttpClient.java index 3ad233df162..95da2d92971 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/client/http/EsHttpClient.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/client/http/EsHttpClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,8 +75,7 @@ public EsHttpClient(final EsClientConfiguration configuration) { .setSocketTimeout(configuration.getSocketTimeout()); final RestClientBuilder restClientBuilder = RestClient.builder(host()) - .setRequestConfigCallback(requestConfigCallback) - .setMaxRetryTimeoutMillis(configuration.getSocketTimeout()); // retry timeout should match socket timeout + .setRequestConfigCallback(requestConfigCallback); if (configuration.isProtected()) { @@ -150,15 +149,15 @@ public SearchResponse scroll(SearchScrollRequest req) throws IOException { @Override public final ClearScrollResponse clearScroll(ClearScrollRequest req) throws IOException { checkAvailable(); + // XXX use special client to handle 404 Bad Request on missing search context errors return clientExt.clearScroll(req, RequestOptions.DEFAULT); } @Override - public BulkByScrollResponse updateByQuery(String index, String type, int batchSize, Script script, int numberOfSlices, + public BulkByScrollResponse updateByQuery(String index, int batchSize, Script script, int numberOfSlices, QueryBuilder query) throws IOException { checkHealthy(index); UpdateByQueryRequest updateByQueryRequest = new UpdateByQueryRequest(index) - .setDocTypes(type) .setBatchSize(batchSize) .setQuery(query) .setScript(script) @@ -169,11 +168,10 @@ public BulkByScrollResponse updateByQuery(String index, String type, int batchSi } @Override - public BulkByScrollResponse deleteByQuery(String index, String type, int batchSize, int numberOfSlices, + public BulkByScrollResponse deleteByQuery(String index, int batchSize, int numberOfSlices, QueryBuilder query) throws IOException { checkHealthy(index); DeleteByQueryRequest deleteByQueryRequest = new DeleteByQueryRequest(index) - .setDocTypes(type) .setBatchSize(batchSize) .setQuery(query) .setSlices(numberOfSlices) diff --git a/commons/com.b2international.index/src/com/b2international/index/es/client/tcp/EsTcpClient.java b/commons/com.b2international.index/src/com/b2international/index/es/client/tcp/EsTcpClient.java index a5683f5fc68..c39b0e7b535 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/client/tcp/EsTcpClient.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/client/tcp/EsTcpClient.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ /** * @since 6.11 + * @deprecated */ public final class EsTcpClient extends EsClientBase { @@ -102,17 +103,16 @@ public ClearScrollResponse clearScroll(ClearScrollRequest req) throws IOExceptio @Override public Builder bulk(Listener listener) { - return BulkProcessor.builder(client, listener); + return BulkProcessor.builder(client::bulk, listener); } @Override - public BulkByScrollResponse updateByQuery(String index, String type, int batchSize, Script script, int numberOfSlices, + public BulkByScrollResponse updateByQuery(String index, int batchSize, Script script, int numberOfSlices, QueryBuilder query) throws IOException { - UpdateByQueryRequestBuilder ubqrb = UpdateByQueryAction.INSTANCE.newRequestBuilder(client); + UpdateByQueryRequestBuilder ubqrb = new UpdateByQueryRequestBuilder(client, UpdateByQueryAction.INSTANCE); ubqrb.source() .setIndices(index) - .setTypes(type) .setSize(batchSize) .setQuery(query); @@ -123,13 +123,12 @@ public BulkByScrollResponse updateByQuery(String index, String type, int batchSi } @Override - public BulkByScrollResponse deleteByQuery(String index, String type, int batchSize, int numberOfSlices, + public BulkByScrollResponse deleteByQuery(String index, int batchSize, int numberOfSlices, QueryBuilder query) throws IOException { - DeleteByQueryRequestBuilder dbqrb = DeleteByQueryAction.INSTANCE.newRequestBuilder(client); + DeleteByQueryRequestBuilder dbqrb = new DeleteByQueryRequestBuilder(client, DeleteByQueryAction.INSTANCE); dbqrb.source() .setIndices(index) - .setTypes(type) .setSize(batchSize) .setQuery(query); diff --git a/commons/com.b2international.index/src/com/b2international/index/es/query/EsQueryBuilder.java b/commons/com.b2international.index/src/com/b2international/index/es/query/EsQueryBuilder.java index 5416ac0a503..b228be11b7e 100644 --- a/commons/com.b2international.index/src/com/b2international/index/es/query/EsQueryBuilder.java +++ b/commons/com.b2international.index/src/com/b2international/index/es/query/EsQueryBuilder.java @@ -16,11 +16,11 @@ package com.b2international.index.es.query; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.collect.Sets.newHashSetWithExpectedSize; -import java.math.BigDecimal; -import java.util.Collection; import java.util.Deque; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.apache.lucene.search.join.ScoreMode; import org.elasticsearch.common.lucene.search.function.CombineFunction; @@ -33,39 +33,14 @@ import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders; import com.b2international.commons.exceptions.FormattedRuntimeException; +import com.b2international.index.IndexClientFactory; import com.b2international.index.compat.TextConstants; import com.b2international.index.mapping.DocumentMapping; -import com.b2international.index.query.BoolExpression; -import com.b2international.index.query.BooleanPredicate; -import com.b2international.index.query.BoostPredicate; -import com.b2international.index.query.DecimalPredicate; -import com.b2international.index.query.DecimalRangePredicate; -import com.b2international.index.query.DecimalSetPredicate; -import com.b2international.index.query.DisMaxPredicate; -import com.b2international.index.query.Expression; -import com.b2international.index.query.HasParentPredicate; -import com.b2international.index.query.IntPredicate; -import com.b2international.index.query.IntRangePredicate; -import com.b2international.index.query.IntSetPredicate; -import com.b2international.index.query.LongPredicate; -import com.b2international.index.query.LongRangePredicate; -import com.b2international.index.query.LongSetPredicate; -import com.b2international.index.query.MatchAll; -import com.b2international.index.query.MatchNone; -import com.b2international.index.query.NestedPredicate; -import com.b2international.index.query.Predicate; -import com.b2international.index.query.PrefixPredicate; -import com.b2international.index.query.RangePredicate; -import com.b2international.index.query.ScriptQueryExpression; -import com.b2international.index.query.ScriptScoreExpression; -import com.b2international.index.query.SetPredicate; -import com.b2international.index.query.SingleArgumentPredicate; -import com.b2international.index.query.StringPredicate; -import com.b2international.index.query.StringRangePredicate; -import com.b2international.index.query.StringSetPredicate; -import com.b2international.index.query.TextPredicate; +import com.b2international.index.query.*; import com.b2international.index.query.TextPredicate.MatchType; import com.b2international.index.util.DecimalUtils; +import com.google.common.base.Function; +import com.google.common.collect.Iterables; import com.google.common.collect.Queues; /** @@ -77,17 +52,19 @@ public final class EsQueryBuilder { private static String ILLEGAL_STACK_STATE_MESSAGE = "Illegal internal stack state: %s"; private final Deque deque = Queues.newLinkedBlockingDeque(); + private final Map settings; private final DocumentMapping mapping; private final String path; private boolean needsScoring; - public EsQueryBuilder(DocumentMapping mapping) { - this(mapping, ""); + public EsQueryBuilder(DocumentMapping mapping, Map settings) { + this(mapping, settings, ""); } - private EsQueryBuilder(DocumentMapping mapping, String path) { + private EsQueryBuilder(DocumentMapping mapping, Map settings, String path) { this.mapping = mapping; + this.settings = settings; this.path = path; } @@ -191,7 +168,7 @@ private void visit(BoolExpression bool) { final BoolQueryBuilder query = QueryBuilders.boolQuery(); for (Expression must : bool.mustClauses()) { // visit the item and immediately pop the deque item back - final EsQueryBuilder innerQueryBuilder = new EsQueryBuilder(mapping); + final EsQueryBuilder innerQueryBuilder = new EsQueryBuilder(mapping, settings); innerQueryBuilder.visit(must); if (innerQueryBuilder.needsScoring) { needsScoring = innerQueryBuilder.needsScoring; @@ -226,7 +203,7 @@ private void visit(BoolExpression bool) { private void visit(NestedPredicate predicate) { final String nestedPath = toFieldPath(predicate); final DocumentMapping nestedMapping = mapping.getNestedMapping(predicate.getField()); - final EsQueryBuilder nestedQueryBuilder = new EsQueryBuilder(nestedMapping, nestedPath); + final EsQueryBuilder nestedQueryBuilder = new EsQueryBuilder(nestedMapping, settings, nestedPath); nestedQueryBuilder.visit(predicate.getExpression()); needsScoring = nestedQueryBuilder.needsScoring; final QueryBuilder nestedQuery = nestedQueryBuilder.deque.pop(); @@ -271,7 +248,6 @@ private void visit(TextPredicate predicate) { query = QueryBuilders.queryStringQuery(TextConstants.escape(term)) .field(field) .escape(false) - .useDisMax(true) .allowLeadingWildcard(true) .defaultOperator(Operator.AND); break; @@ -292,20 +268,40 @@ private void visit(SingleArgumentPredicate predicate) { deque.push(QueryBuilders.termQuery(toFieldPath(predicate), predicate.getArgument())); } - private void visit(SetPredicate predicate) { - deque.push(QueryBuilders.termsQuery(toFieldPath(predicate), predicate.values())); - } - private void visit(DecimalPredicate predicate) { deque.push(QueryBuilders.termQuery(toFieldPath(predicate), DecimalUtils.encode(predicate.getArgument()))); } + private void visit(SetPredicate predicate) { + toTermsQuery(predicate, predicate.values(), null); + } + private void visit(DecimalSetPredicate predicate) { - final Collection terms = newHashSetWithExpectedSize(predicate.values().size()); - for (BigDecimal decimal : predicate.values()) { - terms.add(DecimalUtils.encode(decimal)); + toTermsQuery(predicate, predicate.values(), DecimalUtils::encode); + } + + // consider max terms count and break into multiple terms queries if number of terms are greater than that value + private void toTermsQuery(SetPredicate predicate, final Set terms, final Function valueConverter) { + final int maxTermsCount = Integer.parseInt((String) settings.get(IndexClientFactory.MAX_TERMS_COUNT_KEY)); + if (terms.size() > maxTermsCount) { + final BoolQueryBuilder bool = QueryBuilders.boolQuery().minimumShouldMatch(1); + Iterables.partition(terms, maxTermsCount).forEach(partition -> { + if (valueConverter != null) { + bool.should(QueryBuilders.termsQuery(toFieldPath(predicate), partition.stream().map(valueConverter).collect(Collectors.toSet()))); + } else { + bool.should(QueryBuilders.termsQuery(toFieldPath(predicate), partition)); + } + + }); + deque.push(bool); + } else { + // push the terms query directly + if (valueConverter != null) { + deque.push(QueryBuilders.termsQuery(toFieldPath(predicate), terms.stream().map(valueConverter).collect(Collectors.toSet()))); + } else { + deque.push(QueryBuilders.termsQuery(toFieldPath(predicate), terms)); + } } - deque.push(QueryBuilders.termsQuery(toFieldPath(predicate), terms)); } private void visit(PrefixPredicate predicate) { diff --git a/commons/com.b2international.index/src/com/b2international/index/revision/BranchMergeConflictException.java b/commons/com.b2international.index/src/com/b2international/index/revision/BranchMergeConflictException.java index c774f3e6ede..d1c2ebd40a6 100644 --- a/commons/com.b2international.index/src/com/b2international/index/revision/BranchMergeConflictException.java +++ b/commons/com.b2international.index/src/com/b2international/index/revision/BranchMergeConflictException.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,8 @@ */ public final class BranchMergeConflictException extends RuntimeException { + private static final long serialVersionUID = 1L; + private final List conflicts; public BranchMergeConflictException(List conflicts) { diff --git a/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchChangeSet.java b/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchChangeSet.java index 668c2de65e8..a69100ded36 100644 --- a/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchChangeSet.java +++ b/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchChangeSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.util.Map; import java.util.Set; -import com.b2international.index.IndexRead; import com.b2international.index.mapping.DocumentMapping; import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableSet; diff --git a/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchPoint.java b/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchPoint.java index 382788ba83b..968392fb33d 100644 --- a/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchPoint.java +++ b/commons/com.b2international.index/src/com/b2international/index/revision/RevisionBranchPoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,8 @@ @IP public final class RevisionBranchPoint implements Comparable, Serializable { + private static final long serialVersionUID = 1L; + private final long branchId; private final long timestamp; diff --git a/commons/com.b2international.index/src/org/apache/hadoop/hbase/util/OrderedBytes.java b/commons/com.b2international.index/src/org/apache/hadoop/hbase/util/OrderedBytes.java index c6525dedfbf..64dae987ead 100644 --- a/commons/com.b2international.index/src/org/apache/hadoop/hbase/util/OrderedBytes.java +++ b/commons/com.b2international.index/src/org/apache/hadoop/hbase/util/OrderedBytes.java @@ -266,6 +266,7 @@ * Orderly library. *

*/ +@SuppressWarnings({"lgtm[java/constant-comparison]"}) public class OrderedBytes { /* diff --git a/commons/com.b2international.index/src/org/apache/solr/common/util/JavaBinCodec.java b/commons/com.b2international.index/src/org/apache/solr/common/util/JavaBinCodec.java index e2d6d92052a..97e07ebcd9c 100644 --- a/commons/com.b2international.index/src/org/apache/solr/common/util/JavaBinCodec.java +++ b/commons/com.b2international.index/src/org/apache/solr/common/util/JavaBinCodec.java @@ -65,6 +65,7 @@ * - Converted internal streams into a regular DataInputStream/DataOutputStream * - Converted Solr Cache and hashing methods to use Guava counterparts */ +@SuppressWarnings({"lgtm[java/dereferenced-value-may-be-null]"}) public class JavaBinCodec { public static final byte diff --git a/commons/com.b2international.index/src/org/elasticsearch/client/RestHighLevelClientExt.java b/commons/com.b2international.index/src/org/elasticsearch/client/RestHighLevelClientExt.java index fb357396f6b..9d68beef9e7 100644 --- a/commons/com.b2international.index/src/org/elasticsearch/client/RestHighLevelClientExt.java +++ b/commons/com.b2international.index/src/org/elasticsearch/client/RestHighLevelClientExt.java @@ -143,18 +143,12 @@ static Request bulk(BulkRequest bulkRequest) throws IOException { if (Strings.hasLength(writeRequest.index())) { metadata.field("_index", writeRequest.index()); } - if (Strings.hasLength(writeRequest.type())) { - metadata.field("_type", writeRequest.type()); - } if (Strings.hasLength(writeRequest.id())) { metadata.field("_id", writeRequest.id()); } if (Strings.hasLength(writeRequest.routing())) { metadata.field("routing", writeRequest.routing()); } - if (Strings.hasLength(writeRequest.parent())) { - metadata.field("parent", writeRequest.parent()); - } if (writeRequest.version() != Versions.MATCH_ANY) { metadata.field("version", writeRequest.version()); } @@ -165,8 +159,6 @@ static Request bulk(BulkRequest bulkRequest) throws IOException { metadata.field("version_type", "external"); } else if (versionType == VersionType.EXTERNAL_GTE) { metadata.field("version_type", "external_gte"); - } else if (versionType == VersionType.FORCE) { - metadata.field("version_type", "force"); } } diff --git a/commons/com.b2international.mapdb/pom.xml b/commons/com.b2international.mapdb/pom.xml index abbd28bab32..7adb4b7ad2e 100644 --- a/commons/com.b2international.mapdb/pom.xml +++ b/commons/com.b2international.mapdb/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.mapdb eclipse-plugin diff --git a/commons/com.b2international.scripting.api/META-INF/MANIFEST.MF b/commons/com.b2international.scripting.api/META-INF/MANIFEST.MF index 96f1bddeb3f..358d98dcba1 100644 --- a/commons/com.b2international.scripting.api/META-INF/MANIFEST.MF +++ b/commons/com.b2international.scripting.api/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Scripting Module Bundle-SymbolicName: com.b2international.scripting.api;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy diff --git a/commons/com.b2international.scripting.api/pom.xml b/commons/com.b2international.scripting.api/pom.xml index 12e80cdb833..2e9e5f3f45e 100644 --- a/commons/com.b2international.scripting.api/pom.xml +++ b/commons/com.b2international.scripting.api/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.scripting.api eclipse-plugin diff --git a/commons/com.b2international.scripting.groovy/META-INF/MANIFEST.MF b/commons/com.b2international.scripting.groovy/META-INF/MANIFEST.MF index 8d4d1c7dcd8..fa359b7ddf4 100644 --- a/commons/com.b2international.scripting.groovy/META-INF/MANIFEST.MF +++ b/commons/com.b2international.scripting.groovy/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Scripting Groovy Module Bundle-SymbolicName: com.b2international.scripting.groovy;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.scripting.api;bundle-version="6.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/commons/com.b2international.scripting.groovy/pom.xml b/commons/com.b2international.scripting.groovy/pom.xml index 688a75deb2a..49b71b65d43 100644 --- a/commons/com.b2international.scripting.groovy/pom.xml +++ b/commons/com.b2international.scripting.groovy/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl commons-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.scripting.groovy eclipse-plugin diff --git a/commons/pom.xml b/commons/pom.xml index 686dcc95365..453e34d0432 100644 --- a/commons/pom.xml +++ b/commons/pom.xml @@ -9,7 +9,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/core/com.b2international.snowowl.core.rest.feature/feature.xml b/core/com.b2international.snowowl.core.rest.feature/feature.xml index a17984abe2b..212ea1ef3ae 100644 --- a/core/com.b2international.snowowl.core.rest.feature/feature.xml +++ b/core/com.b2international.snowowl.core.rest.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/core/com.b2international.snowowl.core.rest.feature/pom.xml b/core/com.b2international.snowowl.core.rest.feature/pom.xml index e1e57a666fa..9bb973c6ae3 100644 --- a/core/com.b2international.snowowl.core.rest.feature/pom.xml +++ b/core/com.b2international.snowowl.core.rest.feature/pom.xml @@ -4,7 +4,7 @@ 4.0.0 core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl com.b2international.snowowl.core.rest.feature diff --git a/core/com.b2international.snowowl.core.rest.tests/.launch/core-e2e-tests.launch b/core/com.b2international.snowowl.core.rest.tests/.launch/core-e2e-tests.launch index 7c4bd5b754b..42dff82117b 100644 --- a/core/com.b2international.snowowl.core.rest.tests/.launch/core-e2e-tests.launch +++ b/core/com.b2international.snowowl.core.rest.tests/.launch/core-e2e-tests.launch @@ -29,12 +29,12 @@ - + - - + + diff --git a/core/com.b2international.snowowl.core.rest.tests/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.core.rest.tests/META-INF/MANIFEST.MF index 740d3251f93..c8df3f1194f 100644 --- a/core/com.b2international.snowowl.core.rest.tests/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.core.rest.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Administrative RESTful API Tests Bundle-SymbolicName: com.b2international.snowowl.core.rest.tests -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.junit;bundle-version="4.12.0", diff --git a/core/com.b2international.snowowl.core.rest.tests/pom.xml b/core/com.b2international.snowowl.core.rest.tests/pom.xml index 544a50b12a4..678e769631e 100644 --- a/core/com.b2international.snowowl.core.rest.tests/pom.xml +++ b/core/com.b2international.snowowl.core.rest.tests/pom.xml @@ -8,7 +8,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT @@ -59,7 +59,7 @@ tycho-surefire-plugin false - ${tycho.testArgLine} -Xms1g -Xmx1g -XX:+AlwaysLockClassLoader -Dosgi.classloader.type=nonparallel -Djetty.home.bundle=org.eclipse.jetty.osgi.boot -Djetty.port=9090 -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml + ${tycho.testArgLine} -Xms1g -Xmx1g -XX:+AlwaysLockClassLoader -Dosgi.classloader.type=nonparallel -Djetty.home.bundle=org.eclipse.jetty.osgi.boot -Djetty.port=9090 -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml **/AllSnowOwlApiTests.java diff --git a/core/com.b2international.snowowl.core.rest.tests/src/com/b2international/snowowl/core/rest/AllSnowOwlApiTests.java b/core/com.b2international.snowowl.core.rest.tests/src/com/b2international/snowowl/core/rest/AllSnowOwlApiTests.java index dd7c3ebc1ea..0ae58af8f20 100644 --- a/core/com.b2international.snowowl.core.rest.tests/src/com/b2international/snowowl/core/rest/AllSnowOwlApiTests.java +++ b/core/com.b2international.snowowl.core.rest.tests/src/com/b2international/snowowl/core/rest/AllSnowOwlApiTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,7 @@ public class AllSnowOwlApiTests { @ClassRule public static final RuleChain appRule = RuleChain - .outerRule(SnowOwlAppRule.snowOwl(AllSnowOwlApiTests.class).clearResources(true)) + .outerRule(SnowOwlAppRule.snowOwl(AllSnowOwlApiTests.class)) .around(new BundleStartRule("org.eclipse.jetty.osgi.boot")) .around(new BundleStartRule("com.b2international.snowowl.core.rest")) .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, Branch.MAIN_PATH, Resources.Snomed.MINI_RF2_INT, Rf2ReleaseType.FULL)); diff --git a/core/com.b2international.snowowl.core.rest/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.core.rest/META-INF/MANIFEST.MF index d05a2263db2..4d3a45bd8ed 100644 --- a/core/com.b2international.snowowl.core.rest/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.core.rest/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl REST API Module Bundle-SymbolicName: com.b2international.snowowl.core.rest;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Automatic-Module-Name: com.b2international.snowowl.rest Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/core/com.b2international.snowowl.core.rest/pom.xml b/core/com.b2international.snowowl.core.rest/pom.xml index a249ed4eb7e..cc9f09b7ee7 100644 --- a/core/com.b2international.snowowl.core.rest/pom.xml +++ b/core/com.b2international.snowowl.core.rest/pom.xml @@ -1,12 +1,12 @@ - - 4.0.0 - - com.b2international.snowowl - core-parent - 7.3.0-SNAPSHOT - + + 4.0.0 + + com.b2international.snowowl + core-parent + 7.4.0-SNAPSHOT + com.b2international.snowowl.core.rest eclipse-plugin diff --git a/core/com.b2international.snowowl.core.rest/snow-owl-api-docs/src/App.js b/core/com.b2international.snowowl.core.rest/snow-owl-api-docs/src/App.js index 5773640189f..511bf40c034 100644 --- a/core/com.b2international.snowowl.core.rest/snow-owl-api-docs/src/App.js +++ b/core/com.b2international.snowowl.core.rest/snow-owl-api-docs/src/App.js @@ -10,7 +10,14 @@ const { Content, Sider } = Layout; class App extends React.Component { state = { - selectedKey: 'admin' + selectedKey: 'admin', + apis: [] + } + + componentDidMount() { + fetch(`${process.env.REACT_APP_SO_BASE_URL}/admin/apis`) + .then(response => response.json()) + .then(data => this.setState({ apis: data.items })); } onMenuSelect = (e) => { @@ -20,6 +27,7 @@ class App extends React.Component { } render() { + const apis = this.state.apis return ( <> @@ -41,10 +49,9 @@ class App extends React.Component { mode="inline" theme="dark" > - Admin API - SNOMED CT API - FHIR API - CIS API + { + apis.map(api => {api.title}) + } diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/AbstractRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/AbstractRestService.java index df914aca1ea..ed3223ae556 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/AbstractRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/AbstractRestService.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.StringReader; +import java.net.URI; import java.util.Collections; import java.util.List; import java.util.Set; @@ -25,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; +import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.CompareUtils; import com.b2international.commons.collections.Collections3; @@ -162,5 +164,24 @@ protected final List getExtendedLocales(final String acceptLangu throw new BadRequestException(e.getMessage()); } } + + /** + * Creates a Location header URI that should be returned from all POST resource create endpoints. + * @param resourceId - the identifier of the resource + * @return a URI to be added as Location header value + */ + protected final URI getResourceLocationURI(String resourceId) { + return MvcUriComponentsBuilder.fromController(getClass()).pathSegment(resourceId).build().toUri(); + } + + /** + * Creates a Location header URI that should be returned from all POST resource create endpoints. + * @param branch - the branch where the resource has been created + * @param resourceId - the identifier of the resource + * @return a URI to be added as Location header value + */ + protected final URI getResourceLocationURI(String branch, String resourceId) { + return MvcUriComponentsBuilder.fromController(getClass()).pathSegment(branch, resourceId).build().toUri(); + } } diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/BaseApiConfig.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/BaseApiConfig.java index 171dcba5dc7..00766f1112e 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/BaseApiConfig.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/BaseApiConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -94,7 +94,7 @@ protected final Docket docs( new SecurityReference("basic", new AuthorizationScope[0]), new SecurityReference("bearer", new AuthorizationScope[0]) )) - .build() + .build() )) .useDefaultResponseMessages(false) .ignoredParameterTypes(Principal.class) @@ -110,7 +110,9 @@ protected final Docket docs( ) ) .groupName(apiGroup) - .select().paths(paths).build() + .select() + .paths(paths) + .build() .apiInfo(new ApiInfo(apiTitle, apiDescription, apiVersion, apiTermsOfServiceUrl, new Contact("B2i Healthcare", apiLicenseUrl, apiContact), apiLicense, apiLicenseUrl, Collections.emptyList())); } diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/ControllerExceptionMapper.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/ControllerExceptionMapper.java index dc688277b84..ff4742554dc 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/ControllerExceptionMapper.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/ControllerExceptionMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,13 +20,16 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; +import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import com.b2international.commons.exceptions.*; +import com.b2international.commons.platform.PlatformUtil; import com.fasterxml.jackson.databind.JsonMappingException; +import com.google.common.base.Strings; import com.google.common.base.Throwables; /** @@ -47,14 +50,25 @@ public class ControllerExceptionMapper { @ExceptionHandler @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) public @ResponseBody RestApiError handle(final Exception ex) { - if (Throwables.getRootCause(ex).getMessage().toLowerCase().contains("broken pipe")) { + final String message = Throwables.getRootCause(ex).getMessage(); + if (!Strings.isNullOrEmpty(message) && message.toLowerCase().contains("broken pipe")) { return null; // socket is closed, cannot return any response } else { - LOG.trace("Exception during request processing", ex); + if (PlatformUtil.isDevVersion()) { + LOG.error("Exception during request processing", ex); + } else { + LOG.trace("Exception during request processing", ex); + } return RestApiError.of(ApiError.Builder.of(GENERIC_USER_MESSAGE).build()).build(HttpStatus.INTERNAL_SERVER_ERROR.value()); } } + @ExceptionHandler + @ResponseStatus(HttpStatus.METHOD_NOT_ALLOWED) + public @ResponseBody RestApiError handle(final HttpRequestMethodNotSupportedException e) { + return RestApiError.of(ApiError.Builder.of("Method " + e.getMethod() + " is not allowed").build()).build(HttpStatus.METHOD_NOT_ALLOWED.value()); + } + @ExceptionHandler @ResponseStatus(HttpStatus.UNAUTHORIZED) public @ResponseBody RestApiError handle(final UnauthorizedException ex) { @@ -72,7 +86,11 @@ public class ControllerExceptionMapper { @ExceptionHandler @ResponseStatus(HttpStatus.REQUEST_TIMEOUT) public @ResponseBody RestApiError handle(RequestTimeoutException ex) { - LOG.trace("Timeout during request processing", ex); + if (PlatformUtil.isDevVersion()) { + LOG.error("Timeout during request processing", ex); + } else { + LOG.trace("Timeout during request processing", ex); + } return RestApiError.of(ApiError.Builder.of(GENERIC_USER_MESSAGE).build()).build(HttpStatus.REQUEST_TIMEOUT.value()); } diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiConfig.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiConfig.java index 32eae362a80..60690283ce5 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiConfig.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiRestService.java new file mode 100644 index 00000000000..e5ceab373d0 --- /dev/null +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlApiRestService.java @@ -0,0 +1,61 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.core.rest; + +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.b2international.snowowl.core.domain.CollectionResource; +import com.google.common.collect.ImmutableMap; + +import springfox.documentation.annotations.ApiIgnore; +import springfox.documentation.service.Documentation; +import springfox.documentation.spring.web.DocumentationCache; + +/** + * @since 7.3 + */ +@ApiIgnore +@RestController +@RequestMapping(value = "/apis", produces = { AbstractRestService.JSON_MEDIA_TYPE }) +public class SnowOwlApiRestService extends AbstractRestService { + + @Autowired + private DocumentationCache documentCache; + + @GetMapping + public CollectionResource> get() { + List> items = documentCache.all().values().stream() + .sorted((d1, d2) -> d1.getResourceListing().getInfo().getTitle().compareTo(d2.getResourceListing().getInfo().getTitle())) + .map(this::toApiDoc) + .collect(Collectors.toList()); + return CollectionResource.of(items); + } + + private Map toApiDoc(Documentation doc) { + return ImmutableMap.of( + "id", doc.getGroupName(), + "title", doc.getResourceListing().getInfo().getTitle() + ); + } + +} diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlSecurityConfig.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlSecurityConfig.java index 4cf00535e4f..e1eccf6c70a 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlSecurityConfig.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/SnowOwlSecurityConfig.java @@ -43,6 +43,7 @@ public HttpFirewall allowUrlEncodedSlashHttpFirewall() { return firewall; } + @SuppressWarnings({"lgtm[java/spring-disabled-csrf-protection]"}) @Override protected void configure(final HttpSecurity http) throws Exception { http diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/BranchUpdateRestRequest.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/BranchUpdateRestRequest.java similarity index 87% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/BranchUpdateRestRequest.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/BranchUpdateRestRequest.java index 4c0cfef9492..373637e0db4 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/BranchUpdateRestRequest.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/BranchUpdateRestRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest.domain; +package com.b2international.snowowl.core.rest.branch; import com.b2international.commons.options.Metadata; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/CreateBranchRestRequest.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/CreateBranchRestRequest.java similarity index 96% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/CreateBranchRestRequest.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/CreateBranchRestRequest.java index aba489ec722..c40b26d14fc 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/CreateBranchRestRequest.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/CreateBranchRestRequest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest.domain; +package com.b2international.snowowl.core.rest.branch; import org.hibernate.validator.constraints.NotEmpty; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/CreateReviewRequest.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/CreateReviewRequest.java similarity index 90% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/CreateReviewRequest.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/CreateReviewRequest.java index 78cc6cdf82d..638f868e33c 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/CreateReviewRequest.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/CreateReviewRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest.domain; +package com.b2international.snowowl.core.rest.branch; import org.hibernate.validator.constraints.NotEmpty; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/MergeRestRequest.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/MergeRestRequest.java similarity index 91% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/MergeRestRequest.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/MergeRestRequest.java index aa7fdd68fea..e88785928f1 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/MergeRestRequest.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/MergeRestRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest.domain; +package com.b2international.snowowl.core.rest.branch; import org.hibernate.validator.constraints.NotEmpty; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchMergingRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchMergeRestService.java similarity index 85% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchMergingRestService.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchMergeRestService.java index 79338ebc21f..d00f601c630 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchMergingRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchMergeRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,16 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest; +package com.b2international.snowowl.core.rest.branch; -import java.net.URI; import java.util.Collections; import java.util.UUID; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import com.b2international.commons.validation.ApiValidation; import com.b2international.snowowl.core.ServiceProvider; @@ -34,7 +40,6 @@ import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.datastore.request.RepositoryRequests; import com.b2international.snowowl.datastore.request.job.JobRequests; -import com.b2international.snowowl.snomed.core.rest.domain.MergeRestRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -46,12 +51,14 @@ * @since 4.1 */ @Api(value = "Branches", description = "Branches", tags = "branches") -@RestController @RequestMapping(value="/merges", produces={AbstractRestService.JSON_MEDIA_TYPE}) -public class SnomedBranchMergingRestService extends AbstractSnomedRestService { +public abstract class RepositoryBranchMergeRestService extends AbstractRestService { - public SnomedBranchMergingRestService() { + private final String repositoryId; + + public RepositoryBranchMergeRestService(String repositoryId) { super(Collections.emptySet()); + this.repositoryId = repositoryId; } @ApiOperation( @@ -96,8 +103,7 @@ public ResponseEntity createMerge( .buildAsync() .execute(getBus()); - final URI linkUri = MvcUriComponentsBuilder.fromController(SnomedBranchMergingRestService.class).pathSegment(jobId).build().toUri(); - return ResponseEntity.accepted().location(linkUri).build(); + return ResponseEntity.accepted().location(getResourceLocationURI(jobId)).build(); } @ApiOperation( diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchingRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchRestService.java similarity index 84% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchingRestService.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchRestService.java index c533a74f9fb..bbec6cf8fae 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchingRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest; +package com.b2international.snowowl.core.rest.branch; import java.net.URI; import java.util.List; @@ -21,19 +21,23 @@ import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseStatus; import com.b2international.commons.validation.ApiValidation; import com.b2international.snowowl.core.branch.Branch; import com.b2international.snowowl.core.branch.Branches; -import com.b2international.snowowl.core.domain.CollectionResource; import com.b2international.snowowl.core.events.util.Promise; import com.b2international.snowowl.core.rest.AbstractRestService; import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.datastore.request.RepositoryRequests; -import com.b2international.snowowl.snomed.core.rest.domain.BranchUpdateRestRequest; -import com.b2international.snowowl.snomed.core.rest.domain.CreateBranchRestRequest; import com.google.common.collect.ImmutableList; import io.swagger.annotations.Api; @@ -46,12 +50,14 @@ * @since 4.1 */ @Api(value = "Branches", description = "Branches", tags = "branches") -@RestController @RequestMapping(value="/branches", produces={AbstractRestService.JSON_MEDIA_TYPE}) -public class SnomedBranchingRestService extends AbstractSnomedRestService { +public abstract class RepositoryBranchRestService extends AbstractRestService { - public SnomedBranchingRestService() { + private final String repositoryId; + + public RepositoryBranchRestService(String repositoryId) { super(Branch.Fields.ALL); + this.repositoryId = repositoryId; } @ApiOperation( @@ -66,7 +72,7 @@ public SnomedBranchingRestService() { @ResponseStatus(HttpStatus.CREATED) public Promise> createBranch(@RequestBody CreateBranchRestRequest request) { ApiValidation.checkInput(request); - final URI location = getBranchLocationHeader(request.path()); + final URI location = getResourceLocationURI(request.path()); return RepositoryRequests .branching() .prepareCreate() @@ -93,14 +99,6 @@ public Promise searchBranches( @RequestParam(value="name", required=false) final String[] names, - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value = "The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -119,8 +117,6 @@ public Promise searchBranches( .filterByName(names == null ? null : ImmutableList.copyOf(names)) .sortBy(extractSortFields(sort)) .setSearchAfter(searchAfter) - .setScrollId(scrollId) - .setScroll(scrollKeepAlive) .setLimit(limit) .build(repositoryId) .execute(getBus()); @@ -209,8 +205,4 @@ public Promise> updateBranch( .then(success -> ResponseEntity.noContent().build()); } - private URI getBranchLocationHeader(String branchPath) { - return MvcUriComponentsBuilder.fromController(SnomedBranchingRestService.class).pathSegment(branchPath).build().toUri(); - } - } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchReviewRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchReviewRestService.java similarity index 91% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchReviewRestService.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchReviewRestService.java index 3d68faef410..140f3ae18f2 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedBranchReviewRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/branch/RepositoryBranchReviewRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest; +package com.b2international.snowowl.core.rest.branch; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -23,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder; @@ -34,7 +33,6 @@ import com.b2international.snowowl.datastore.request.RepositoryRequests; import com.b2international.snowowl.datastore.review.ConceptChanges; import com.b2international.snowowl.datastore.review.Review; -import com.b2international.snowowl.snomed.core.rest.domain.CreateReviewRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -47,12 +45,14 @@ * @since 4.2 */ @Api(value = "Branches", description = "Branches", tags = "branches") -@RestController @RequestMapping(value="/reviews", produces={AbstractRestService.JSON_MEDIA_TYPE}) -public class SnomedBranchReviewRestService extends AbstractSnomedRestService { +public abstract class RepositoryBranchReviewRestService extends AbstractRestService { - public SnomedBranchReviewRestService() { + private final String repositoryId; + + public RepositoryBranchReviewRestService(String repositoryId) { super(Review.Fields.ALL); + this.repositoryId = repositoryId; } @ApiOperation( @@ -67,7 +67,7 @@ public SnomedBranchReviewRestService() { @ResponseStatus(HttpStatus.CREATED) public Promise> createReview(@RequestBody final CreateReviewRequest request) { ApiValidation.checkInput(request); - final UriComponentsBuilder linkTo = MvcUriComponentsBuilder.fromController(SnomedBranchReviewRestService.class); + final UriComponentsBuilder linkTo = MvcUriComponentsBuilder.fromController(RepositoryBranchReviewRestService.class); return RepositoryRequests .reviews() .prepareCreate() diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/CodeSystemRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/CodeSystemRestService.java index 2e50007c3ac..86c51bebef9 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/CodeSystemRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/CodeSystemRestService.java @@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.StringUtils; import com.b2international.commons.exceptions.BadRequestException; @@ -120,7 +119,7 @@ public ResponseEntity createCodeSystem( .execute(getBus()) .getSync().getResultAs(String.class); - return ResponseEntity.created(MvcUriComponentsBuilder.fromController(CodeSystemRestService.class).pathSegment(shortName).build().toUri()).build(); + return ResponseEntity.created(getResourceLocationURI(shortName)).build(); } @ApiOperation( diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCommitInfoRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/commit/RepositoryCommitRestService.java similarity index 84% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCommitInfoRestService.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/commit/RepositoryCommitRestService.java index d74e6b5df4d..cec2a4dbada 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCommitInfoRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/commit/RepositoryCommitRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,20 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest; +package com.b2international.snowowl.core.rest.commit; import java.util.List; +import java.util.Set; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; import com.b2international.index.revision.Commit; import com.b2international.snowowl.core.commit.CommitInfo; import com.b2international.snowowl.core.commit.CommitInfos; -import com.b2international.snowowl.core.domain.CollectionResource; import com.b2international.snowowl.core.events.util.Promise; import com.b2international.snowowl.core.rest.AbstractRestService; import com.b2international.snowowl.datastore.request.RepositoryRequests; @@ -41,12 +40,14 @@ * @since 7.0 */ @Api(value = "Commits", description = "Commits", tags = "commits") -@RestController @RequestMapping(value="/commits") -public class SnomedCommitInfoRestService extends AbstractSnomedRestService { +public abstract class RepositoryCommitRestService extends AbstractRestService { - public SnomedCommitInfoRestService() { + private final String repositoryId; + + public RepositoryCommitRestService(String repositoryId) { super(Commit.Fields.ALL); + this.repositoryId = repositoryId; } @ApiOperation( @@ -62,6 +63,10 @@ public Promise search( @RequestParam(value="author", required=false) final String author, + @ApiParam(value = "The identifier(s) to match") + @RequestParam(value="id", required=false) + final Set id, + @ApiParam(value = "Affected component identifier to match") @RequestParam(value="affectedComponentId", required=false) final String affectedComponentId, @@ -82,14 +87,6 @@ public Promise search( @RequestParam(value="expand", required=false) final String expand, - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value = "The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -104,14 +101,13 @@ public Promise search( return RepositoryRequests .commitInfos() .prepareSearchCommitInfo() + .filterByIds(id) .filterByAuthor(author) .filterByAffectedComponent(affectedComponentId) .filterByComment(comment) .filterByBranches(branch) .filterByTimestamp(timestamp) .setExpand(expand) - .setScroll(scrollKeepAlive) - .setScrollId(scrollId) .setSearchAfter(searchAfter) .setLimit(limit) .sortBy(extractSortFields(sort)) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedCompareRestRequest.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/CompareRestRequest.java similarity index 88% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedCompareRestRequest.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/CompareRestRequest.java index af6eda5a3af..d2333a9f532 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedCompareRestRequest.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/CompareRestRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest.domain; +package com.b2international.snowowl.core.rest.compare; import org.hibernate.validator.constraints.NotEmpty; import io.swagger.annotations.ApiParam; + /** * @since 7.0 */ -public final class SnomedCompareRestRequest { +public final class CompareRestRequest { @ApiParam(required = true) @NotEmpty diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/RepositoryBranchCompareRestService.java similarity index 82% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestService.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/RepositoryBranchCompareRestService.java index 03163c3c3fb..b50aacc6fd1 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/compare/RepositoryBranchCompareRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.rest; +package com.b2international.snowowl.core.rest.compare; import java.util.Collections; @@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestController; import com.b2international.commons.validation.ApiValidation; import com.b2international.snowowl.core.events.util.Promise; @@ -30,7 +29,6 @@ import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.datastore.request.RepositoryRequests; import com.b2international.snowowl.datastore.request.compare.CompareResult; -import com.b2international.snowowl.snomed.core.rest.domain.SnomedCompareRestRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -41,12 +39,14 @@ * @since 7.0 */ @Api(value = "Compare", description = "Compare", tags = "compare") -@RestController @RequestMapping(value = "/compare") -public class SnomedCompareRestService extends AbstractSnomedRestService { +public abstract class RepositoryBranchCompareRestService extends AbstractRestService { - public SnomedCompareRestService() { + private final String repositoryId; + + public RepositoryBranchCompareRestService(String repositoryId) { super(Collections.emptySet()); + this.repositoryId = repositoryId; } @ApiOperation( @@ -59,7 +59,7 @@ public SnomedCompareRestService() { }) @PostMapping(consumes = { AbstractRestService.JSON_MEDIA_TYPE }, produces = { AbstractRestService.JSON_MEDIA_TYPE }) @ResponseStatus(HttpStatus.OK) - public Promise compareBranches(@RequestBody SnomedCompareRestRequest request) { + public Promise compareBranches(@RequestBody CompareRestRequest request) { ApiValidation.checkInput(request); return RepositoryRequests.branching().prepareCompare() .setBase(request.getBaseBranch()) diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/ChangeRequest.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRequest.java similarity index 63% rename from core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/ChangeRequest.java rename to core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRequest.java index 6650e2de0ba..144fdd236d8 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/codesystem/ChangeRequest.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,13 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.core.rest.codesystem; +package com.b2international.snowowl.core.rest.domain; import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.google.common.base.MoreObjects; +import com.google.common.base.MoreObjects.ToStringHelper; /** + * @since 1.0 */ -public class ChangeRequest { +public class ResourceRequest { private T change; private String commitComment; @@ -42,13 +45,13 @@ public void setCommitComment(final String commitComment) { } @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("ChangeRequest [change="); - builder.append(change); - builder.append(", commitComment="); - builder.append(commitComment); - builder.append("]"); - return builder.toString(); + public final String toString() { + ToStringHelper toStringHelper = MoreObjects.toStringHelper(getClass()).add("change", change).add("commitComment", commitComment); + doToString(toStringHelper); + return toStringHelper.toString(); } + + protected void doToString(ToStringHelper toStringHelper) { + } + } \ No newline at end of file diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRestSearch.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRestSearch.java new file mode 100644 index 00000000000..31503980576 --- /dev/null +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/domain/ResourceRestSearch.java @@ -0,0 +1,81 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.core.rest.domain; + +import java.util.List; +import java.util.Set; + +import io.swagger.annotations.ApiParam; + +/** + * @since 7.3 + */ +public abstract class ResourceRestSearch { + + @ApiParam(value = "The identifier(s) to match") + private Set id; + + // scrolling/paging/expansion/sorting + @ApiParam(value = "Expansion parameters") + private String expand; + @ApiParam(value = "The search key to use for retrieving the next page of results") + private String searchAfter; + @ApiParam(value = "Sort keys") + private List sort; + @ApiParam(value = "The maximum number of items to return", defaultValue = "50") + private int limit = 50; + + public final Set getId() { + return id; + } + + public final void setId(Set id) { + this.id = id; + } + + public final String getExpand() { + return expand; + } + + public final void setExpand(String expand) { + this.expand = expand; + } + + public final String getSearchAfter() { + return searchAfter; + } + + public final void setSearchAfter(String searchAfter) { + this.searchAfter = searchAfter; + } + + public final List getSort() { + return sort; + } + + public final void setSort(List sort) { + this.sort = sort; + } + + public final int getLimit() { + return limit; + } + + public final void setLimit(int limit) { + this.limit = limit; + } + +} diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/job/JobRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/job/JobRestService.java index d25884fccef..b3c8cef56b7 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/job/JobRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/job/JobRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,14 +66,6 @@ public Promise searchJobs( @RequestParam(value = "user", required = false) final String user, - @ApiParam(value="The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value="A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value="The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -88,8 +80,6 @@ public Promise searchJobs( return JobRequests.prepareSearch() .filterByIds(ids) .filterByUser(user) - .setScroll(scrollKeepAlive) - .setScrollId(scrollId) .setSearchAfter(searchAfter) .setLimit(limit) .sortBy(extractSortFields(sort)) diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/util/ModelAttributeParameterExpanderExt.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/util/ModelAttributeParameterExpanderExt.java index ff79f521843..891f82b5208 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/util/ModelAttributeParameterExpanderExt.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/util/ModelAttributeParameterExpanderExt.java @@ -145,7 +145,7 @@ private Parameter simpleFields(String parentName, DocumentationContext documenta LOG.debug("Attempting to expand field: {}", each); String dataTypeName = Optional.fromNullable(typeNameFor(each.getFieldType().getErasedType())) .or(each.getFieldType().getErasedType().getSimpleName()); - LOG.debug("Building parameter for field: {}, with type: ", each, each.getFieldType()); + LOG.debug("Building parameter for field: {}, with type: {}", each, each.getFieldType()); ParameterExpansionContext parameterExpansionContext = new ParameterExpansionContext( dataTypeName, parentName, diff --git a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/validation/ValidationRestService.java b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/validation/ValidationRestService.java index b975e5b6989..a8509eac6cf 100644 --- a/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/validation/ValidationRestService.java +++ b/core/com.b2international.snowowl.core.rest/src/com/b2international/snowowl/core/rest/validation/ValidationRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.exceptions.BadRequestException; import com.b2international.commons.exceptions.NotFoundException; @@ -96,7 +95,7 @@ public class ValidationRestService extends AbstractRestService { .filter(ValidationRequests::isValidationJob) .map(entry -> RemoteJobEntry.from(entry).id(getHash(entry.getId())).build()) .collect(Collectors.toList()); - return new RemoteJobs(validationJobs, null, null, jobs.getLimit(), validationJobs.size()); + return new RemoteJobs(validationJobs, null, jobs.getLimit(), validationJobs.size()); }); } @@ -172,7 +171,7 @@ public ResponseEntity beginValidation( .getSync(); final String encodedId = Hashing.sha1().hashString(uniqueJobId, Charsets.UTF_8).toString().substring(0, 7); - return ResponseEntity.created(MvcUriComponentsBuilder.fromController(ValidationRestService.class).pathSegment(encodedId).build().toUri()).build(); + return ResponseEntity.created(getResourceLocationURI(encodedId)).build(); } @ApiOperation( @@ -208,14 +207,6 @@ public ResponseEntity beginValidation( @PathVariable(value="validationId") final String validationId, - @ApiParam(value="The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value="A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value="The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -270,8 +261,6 @@ public ResponseEntity beginValidation( return ValidationRequests.issues().prepareSearch() .isWhitelisted(false) .setLimit(limit) - .setScrollId(scrollId) - .setScroll(scrollKeepAlive) .setSearchAfter(searchAfter) .filterByBranchPath(branchPath) .buildAsync() diff --git a/core/com.b2international.snowowl.core.tests/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.core.tests/META-INF/MANIFEST.MF index ef1007c342d..e4af7c8b148 100644 --- a/core/com.b2international.snowowl.core.tests/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.core.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Core Tests Bundle-SymbolicName: com.b2international.snowowl.core.tests -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.snowowl.core;bundle-version="4.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/core/com.b2international.snowowl.core.tests/pom.xml b/core/com.b2international.snowowl.core.tests/pom.xml index d288a68bf39..b3580025cbe 100644 --- a/core/com.b2international.snowowl.core.tests/pom.xml +++ b/core/com.b2international.snowowl.core.tests/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.core.tests eclipse-test-plugin diff --git a/core/com.b2international.snowowl.core/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.core/META-INF/MANIFEST.MF index 1f47d22ecbc..2879d1cd177 100644 --- a/core/com.b2international.snowowl.core/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Core Bundle-SymbolicName: com.b2international.snowowl.core;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Activator: com.b2international.snowowl.core.CoreActivator Bundle-Vendor: B2i Healthcare Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0", @@ -24,6 +24,7 @@ Bundle-ActivationPolicy: lazy Export-Package: com.b2international.snowowl.core, com.b2international.snowowl.core.api, com.b2international.snowowl.core.api.component, + com.b2international.snowowl.core.authorization, com.b2international.snowowl.core.branch, com.b2international.snowowl.core.config, com.b2international.snowowl.core.date, @@ -34,6 +35,7 @@ Export-Package: com.b2international.snowowl.core, com.b2international.snowowl.core.events.util, com.b2international.snowowl.core.exceptions, com.b2international.snowowl.core.ft, + com.b2international.snowowl.core.id, com.b2international.snowowl.core.inject, com.b2international.snowowl.core.merge, com.b2international.snowowl.core.monitoring, diff --git a/core/com.b2international.snowowl.core/pom.xml b/core/com.b2international.snowowl.core/pom.xml index da02e9b0665..ef9d96760ab 100644 --- a/core/com.b2international.snowowl.core/pom.xml +++ b/core/com.b2international.snowowl.core/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.core eclipse-plugin diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/ApplicationContext.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/ApplicationContext.java index 1da7d6d31fd..1450c931e13 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/ApplicationContext.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/ApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public String toString() { } } - private static ApplicationContext instance; + private static volatile ApplicationContext instance; private final LoadingCache, ServiceRegistryEntry> serviceMap; @@ -102,7 +102,7 @@ public static ApplicationContext getInstance() { if (instance == null) { synchronized (ApplicationContext.class) { if (instance == null) { - instance = new ApplicationContext(); // lgtm[java/unsafe-double-checked-locking] + instance = new ApplicationContext(); } } } diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/authorization/Unprotected.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/authorization/Unprotected.java new file mode 100644 index 00000000000..c465603cc06 --- /dev/null +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/authorization/Unprotected.java @@ -0,0 +1,36 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.core.authorization; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import com.b2international.snowowl.core.events.Request; + +/** + * Annotation to let {@link Request} implementations to be executed with proper authorization. Should be used for unprotected routes. + * + * @since 7.3 + */ +@Documented +@Retention(RUNTIME) +@Target(TYPE) +public @interface Unprotected { +} diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/branch/Branches.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/branch/Branches.java index 334f6841696..0af789cfd14 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/branch/Branches.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/branch/Branches.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ */ public final class Branches extends PageableCollectionResource { - public Branches(List items, String scrollId, String searchAfter, int limit, int total) { - super(items, scrollId, searchAfter, limit, total); + public Branches(List items, String searchAfter, int limit, int total) { + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/Rf2ExportResult.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/ExportResult.java similarity index 86% rename from snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/Rf2ExportResult.java rename to core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/ExportResult.java index c129ba9ea9e..c57b78a3db5 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/Rf2ExportResult.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/ExportResult.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.domain; +package com.b2international.snowowl.core.domain; import java.util.UUID; @@ -23,14 +23,16 @@ /** * Holds the suggested filename for an export result, along with the identifier * in the file registry. + * + * @since */ -public final class Rf2ExportResult { +public final class ExportResult { private final String name; private final UUID registryId; @JsonCreator - public Rf2ExportResult( + public ExportResult( @JsonProperty("name") final String name, @JsonProperty("registryId") final UUID registryId) { diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/IComponent.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/IComponent.java index 5ac301c1c30..47c61df787c 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/IComponent.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/IComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import com.b2international.snowowl.core.ComponentIdentifier; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.google.common.base.Function; /** * Represents an identifiable component of a code system. @@ -36,13 +35,6 @@ public interface IComponent extends Serializable { */ long ROOT_IDL = Long.parseLong(ROOT_ID); - /** - * Function to extract the ID from an {@link IComponent} instance. - * - * @since 4.6 - */ - Function ID_FUNCTION = IComponent::getId; - /** * Returns the component identifier. * diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/PageableCollectionResource.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/PageableCollectionResource.java index 12c073df94f..55fe6367ebd 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/PageableCollectionResource.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/PageableCollectionResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +31,6 @@ //@ApiModel("Pageable Collection") public class PageableCollectionResource extends CollectionResource { - private final String scrollId; - private final String searchAfter; // @ApiModelProperty("The number of requested maximum items") @@ -41,9 +39,8 @@ public class PageableCollectionResource extends CollectionResource { // @ApiModelProperty("Total number of results available") private final int total; - protected PageableCollectionResource(List items, String scrollId, String searchAfter, int limit, int total) { + protected PageableCollectionResource(List items, String searchAfter, int limit, int total) { super(items); - this.scrollId = scrollId; this.searchAfter = searchAfter; this.limit = limit; this.total = total; @@ -58,17 +55,6 @@ public String getSearchAfter() { return searchAfter; } - /** - * Returns the scrollId associated with this pageable result set. It can be used to fetch the next batch of {@link #getLimit()} items from the - * repository. - * - * @return - * @see SearchResourceRequestBuilder#setScrollId(String) - */ - public String getScrollId() { - return scrollId; - } - /** * Returns the limit of this collection resource. * @@ -92,7 +78,6 @@ public int getTotal() { public String toString() { return MoreObjects.toStringHelper(PageableCollectionResource.class) .add("items", StringUtils.limitedToString(getItems(), 10)) - .add("scrollId", scrollId) .add("searchAfter", searchAfter) .add("limit", limit) .add("total", total).toString(); @@ -102,7 +87,6 @@ public String toString() { * Creates a new {@link PageableCollectionResource} from the given items, scrollId, searchAfter, limit and total arguments. * * @param items - * @param scrollId * @param searchAfter * @param limit * @param total @@ -110,11 +94,10 @@ public String toString() { */ @JsonCreator public static PageableCollectionResource of(@JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - return new PageableCollectionResource(items, scrollId, searchAfter, limit, total); + return new PageableCollectionResource(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/TransactionContext.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/TransactionContext.java index c6bd27a1a16..605079bdfff 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/TransactionContext.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/domain/TransactionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.b2international.index.Doc; import com.b2international.index.revision.Revision; +import com.b2international.index.revision.RevisionIndex; import com.b2international.snowowl.core.domain.DelegatingContext.Builder; import com.b2international.snowowl.core.exceptions.ComponentNotFoundException; @@ -27,7 +28,7 @@ * Represents an ongoing transaction to the underlying repository. The transaction can commit all aggregated changes up to a given point using the {@link #commit() commit method}. * The changes can be new, changed and deleted objects. * An object is basically a POJO with a {@link Doc} annotation, so the underlying repository will recognize and treat them properly during {@link #commit()}. - * If the given Object is an instance of {@link Revision} then it will be treated as a {@link Revision} will be persisted on the branch available via {@link #branch()}. + * If the given Object is an instance of {@link Revision} then it will be treated as a {@link Revision} and it will be persisted on the branch available via {@link #branch()}. * * @since 4.5 */ @@ -43,8 +44,9 @@ public interface TransactionContext extends BranchContext, AutoCloseable { * Adds the given {@link Object} to this transaction context as a completely new object. * * @param obj - the object to persist and add to the repository + * @return the identifier of the object if it is an instanceof of any of the following classes: {@link Revision} / {@link CodeSystemEntry} / {@link CodeSystemVersionEntry} or null in any other cases. */ - void add(Object obj); + String add(Object obj); /** * @param oldVersion @@ -135,7 +137,13 @@ public interface TransactionContext extends BranchContext, AutoCloseable { Map lookup(Collection componentIds, Class type); /** - * Clears the entire content of the repository this context belongs to. + * Stages all indexed instances of {@link Revision} and subclasses for deletion + * that are currently returned by a "match all" query using + * {@link RevisionIndex}. + *

+ * Documents not under revision control should be removed separately, along with + * any code system versions and corresponding version branches, if a complete + * clear operation is needed. */ void clearContents(); diff --git a/snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/ObjectComparator.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/id/IDs.java similarity index 55% rename from snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/ObjectComparator.java rename to core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/id/IDs.java index d5e9f2bd2fb..b9904482e15 100644 --- a/snomed/com.b2international.snowowl.snomed.semanticengine.simpleast/src/com/b2international/snowowl/semanticengine/simpleast/utils/ObjectComparator.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/id/IDs.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,20 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.semanticengine.simpleast.utils; +package com.b2international.snowowl.core.id; + +import org.elasticsearch.common.UUIDs; /** - * Generic superclass of object comparators. + * Class to use to generate decentralized random UUIDs. * - * - * @param + * @since 7.3 */ -public abstract class ObjectComparator { - +public class IDs { + /** - * @param expected - * @param actual - * @return true if the two objects are found to be equal, false otherwise + * Generates a time-based UUID (similar to Flake IDs), which is preferred when generating an ID to be indexed into a Lucene index as primary key. + * @return + * @see UUIDs */ - abstract public boolean equal(T expected, T actual); -} \ No newline at end of file + public static final String base64UUID() { + return UUIDs.base64UUID(); + } + +} diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/merge/Merges.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/merge/Merges.java index 616b76f29c2..1744aa4f3eb 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/merge/Merges.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/merge/Merges.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,13 +33,12 @@ public final class Merges extends PageableCollectionResource { * @param total - total number of items in the resultset */ public Merges(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } /** * Instantiates a pageable collection of Merge objects. * @param items - list of {@link Merge}s - * @param scrollId - scrollId for paging the result set continuously * @param searchAfter - searchAfter for paging the result set with a live cursor * @param limit - limit of items for a single page * @param total - total number of items in the result set @@ -47,11 +46,10 @@ public Merges(int limit, int total) { @JsonCreator public Merges( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/monitoring/MonitoredRequest.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/monitoring/MonitoredRequest.java index 6371dddf075..6ed2139df7c 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/monitoring/MonitoredRequest.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/monitoring/MonitoredRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,9 @@ */ package com.b2international.snowowl.core.monitoring; +import java.util.Map; +import java.util.concurrent.TimeUnit; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -22,6 +25,7 @@ import com.b2international.snowowl.core.events.DelegatingRequest; import com.b2international.snowowl.core.events.Request; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableMap; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tags; @@ -48,15 +52,18 @@ public R execute(ServiceProvider context) { } finally { final Tags tags = Tags.of("context", getContextId()); tags.and("context", DEFAULT_CONTEXT_ID); - responseTimeSample.stop(registry.timer("request_time", tags)); - LOG.info(getMessage(context)); + final long responseTime = responseTimeSample.stop(registry.timer("response_time", tags)); + final Map additionalInfo = ImmutableMap.of("metrics", ImmutableMap.of("responseTime", TimeUnit.NANOSECONDS.toMillis(responseTime))); + LOG.info(getMessage(context, additionalInfo)); } } - private String getMessage(ServiceProvider context) { + private String getMessage(ServiceProvider context, final Map additionalInfo) { try { final ObjectMapper mapper = context.service(ObjectMapper.class); - return mapper.writeValueAsString(next()); + final Map body = mapper.convertValue(next(), Map.class); + body.putAll(additionalInfo); + return mapper.writeValueAsString(body); } catch (Throwable e) { return "Unable to get request description: " + e.getMessage(); } diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequest.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequest.java index efbe28db012..37a184aa4be 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequest.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,7 @@ import com.b2international.commons.options.Options; import com.b2international.snowowl.core.ServiceProvider; import com.b2international.snowowl.core.api.SnowowlRuntimeException; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.base.Strings; /** * @since 5.2 @@ -172,8 +170,6 @@ public enum Operator { LESS_THAN_EQUALS, } - private String scrollId; - private String scrollKeepAlive; private String searchAfter; /** @@ -189,19 +185,6 @@ public enum Operator { protected SearchResourceRequest() {} - @JsonIgnore - protected final boolean isScrolled() { - return !Strings.isNullOrEmpty(scrollId()); - } - - void setScrollId(String scrollId) { - this.scrollId = scrollId; - } - - void setScrollKeepAlive(String scrollKeepAlive) { - this.scrollKeepAlive = scrollKeepAlive; - } - void setSearchAfter(String searchAfter) { this.searchAfter = searchAfter; } @@ -210,16 +193,6 @@ void setComponentIds(Set componentIds) { this.componentIds = componentIds; } - @JsonProperty - protected final String scrollId() { - return scrollId; - } - - @JsonProperty - protected final String scrollKeepAlive() { - return scrollKeepAlive; - } - @JsonProperty protected final String searchAfter() { return searchAfter; diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestBuilder.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestBuilder.java index 892f648e534..220945c7b22 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestBuilder.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,8 +38,6 @@ public abstract class SearchResourceRequestBuilder componentIds; - private String scrollKeepAlive; - private String scrollId; private String searchAfter; private int limit = 50; @@ -62,36 +60,6 @@ public B setSearchAfter(String searchAfter) { return getSelf(); } - /** - * Sets the scroll keep alive value to the specified value to start a scroll based on the query of this request. - * - * @param scrollKeepAlive - * @return this builder instance - */ - public final B setScroll(String scrollKeepAlive) { - this.scrollKeepAlive = scrollKeepAlive; - return getSelf(); - } - - /* - * Used by SearchResourceRequestIterator - */ - final String getScrollKeepAlive() { - return scrollKeepAlive; - } - - /** - * Sets the scroll Id to continue a previously started scroll. - * - * @param scrollId - * @return - * @see PageableCollectionResource#getScrollId() - */ - public final B setScrollId(String scrollId) { - this.scrollId = scrollId; - return getSelf(); - } - /** * Sets the limit of the result set returned * @param limit - limit of the result set @@ -162,7 +130,7 @@ public final B sortBy(List sorts) { * @return this builder instance */ public final B all() { - return setScroll(null).setLimit(MAX_LIMIT); + return setLimit(MAX_LIMIT); } /** @@ -170,7 +138,7 @@ public final B all() { * @return this builder instance */ public final B one() { - return setScroll(null).setLimit(1); + return setLimit(1); } // XXX: Does not allow null values or collections with null values @@ -196,8 +164,6 @@ protected final B addOption(Enum key, Object value) { protected ResourceRequest create() { final SearchResourceRequest req = createSearch(); req.setComponentIds(componentIds); - req.setScrollId(scrollId); - req.setScrollKeepAlive(scrollKeepAlive); req.setSearchAfter(searchAfter); req.setLimit(Math.min(limit, MAX_LIMIT)); req.setOptions(optionsBuilder.build()); diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestIterator.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestIterator.java index 999c5640b2f..5e6765e6825 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestIterator.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/request/SearchResourceRequestIterator.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,31 +18,23 @@ import java.util.function.Function; import com.b2international.snowowl.core.domain.PageableCollectionResource; -import com.google.common.base.Strings; import com.google.common.collect.AbstractIterator; /** * @since 6.4 * - * @param the search resource request builder type; an instance of this will be configured for scrolling + * @param the search resource request builder type; an instance of this will be configured for paging * @param the collection resource response type; the iterator will return results as instances of this type */ public final class SearchResourceRequestIterator< B extends SearchResourceRequestBuilder, R extends PageableCollectionResource> extends AbstractIterator { - /** - * The default scroll timeout value if none given on the initial search request builder. - * - * @see com.b2international.index.query.Query.DEFAULT_SCROLL_KEEP_ALIVE - */ - private static final String DEFAULT_SCROLL_KEEP_ALIVE = "60s"; - private final B searchRequestBuilder; private final Function executeHandler; private boolean firstRun = true; - private String scrollId; + private String searchAfter; private int visited; private int total; @@ -56,10 +48,6 @@ public final class SearchResourceRequestIterator< public SearchResourceRequestIterator(B searchRequestBuilder, Function executeHandler) { this.searchRequestBuilder = searchRequestBuilder; this.executeHandler = executeHandler; - - if (Strings.isNullOrEmpty(this.searchRequestBuilder.getScrollKeepAlive())) { - this.searchRequestBuilder.setScroll(DEFAULT_SCROLL_KEEP_ALIVE); - } } @Override @@ -69,8 +57,8 @@ protected R computeNext() { return endOfData(); } - // Execute the request with the last recorded scrollId (can be null on first run) - searchRequestBuilder.setScrollId(scrollId); + // Execute the request with the last recorded searchAfter value (can be null on first run) + searchRequestBuilder.setSearchAfter(searchAfter); R hits = executeHandler.apply(searchRequestBuilder); // Initialize total counter on first run @@ -83,8 +71,8 @@ protected R computeNext() { } } - // Update scrollId and visited counter - scrollId = hits.getScrollId(); + // Update searchAfter and visited counter + searchAfter = hits.getSearchAfter(); visited += hits.getItems().size(); return hits; diff --git a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/terminology/MapTargetTypes.java b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/terminology/MapTargetTypes.java index 1dea8300ac5..10f372aeaa7 100644 --- a/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/terminology/MapTargetTypes.java +++ b/core/com.b2international.snowowl.core/src/com/b2international/snowowl/core/terminology/MapTargetTypes.java @@ -33,4 +33,7 @@ private MapTargetTypes() { public static final String EXTENDED_MAP = "EXTENDED_MAP"; public static final String QUERY = "QUERY"; + // XXX: Not really SNOMED CT reference set types + public static final String VALUE_SET = "VALUE_SET"; + public static final String MAPPING_SET = "MAPPING_SET"; } diff --git a/core/com.b2international.snowowl.datastore.server.tests/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.datastore.server.tests/META-INF/MANIFEST.MF index 45fc6a3a51f..d73a4d8ada1 100644 --- a/core/com.b2international.snowowl.datastore.server.tests/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.datastore.server.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Datastore Tests Bundle-SymbolicName: com.b2international.snowowl.datastore.server.tests -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.snowowl.datastore;bundle-version="4.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/core/com.b2international.snowowl.datastore.server.tests/pom.xml b/core/com.b2international.snowowl.datastore.server.tests/pom.xml index ad66cd77469..a07d17ea6ad 100644 --- a/core/com.b2international.snowowl.datastore.server.tests/pom.xml +++ b/core/com.b2international.snowowl.datastore.server.tests/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.datastore.server.tests eclipse-test-plugin @@ -50,7 +50,7 @@ tycho-surefire-plugin false - ${tycho.testArgLine} + ${tycho.testArgLine} -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch **/AllCoreTests.java diff --git a/core/com.b2international.snowowl.datastore/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.datastore/META-INF/MANIFEST.MF index d8a9f994b83..4c122694f4a 100644 --- a/core/com.b2international.snowowl.datastore/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.datastore/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Terminology Datastore Bundle-SymbolicName: com.b2international.snowowl.datastore;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Activator: com.b2international.snowowl.datastore.DatastoreActivator Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/core/com.b2international.snowowl.datastore/pom.xml b/core/com.b2international.snowowl.datastore/pom.xml index f08f45115ff..ee3f728ebda 100644 --- a/core/com.b2international.snowowl.datastore/pom.xml +++ b/core/com.b2international.snowowl.datastore/pom.xml @@ -6,7 +6,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.datastore eclipse-plugin diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/authorization/AuthorizedRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/authorization/AuthorizedRequest.java index 8ae94f22516..5a4b70fc114 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/authorization/AuthorizedRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/authorization/AuthorizedRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,6 @@ import com.b2international.snowowl.identity.IdentityProvider; import com.b2international.snowowl.identity.domain.Permission; import com.b2international.snowowl.identity.domain.User; -import com.b2international.snowowl.identity.request.UserLoginRequest; import com.google.common.base.Strings; import com.google.common.collect.Iterables; @@ -63,7 +62,7 @@ public R execute(ServiceProvider context) { user = User.SYSTEM; } else if (Strings.isNullOrEmpty(authorizationToken)) { // allow login requests in - if (requests.size() == 1 && Iterables.getOnlyElement(requests) instanceof UserLoginRequest) { + if (requests.stream().allMatch(req -> req.getClass().isAnnotationPresent(Unprotected.class))) { user = User.SYSTEM; } else { // if there is authentication configured, but no authorization token found prevent execution and throw UnauthorizedException diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoConverter.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoConverter.java index 091dd9ba3e3..7653bbbdb81 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoConverter.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package com.b2international.snowowl.core.commit; +import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.collect.Lists.newArrayListWithExpectedSize; import java.util.Collection; @@ -29,9 +30,9 @@ import com.b2international.index.revision.Commit; import com.b2international.index.revision.CommitDetail; import com.b2international.snowowl.core.commit.CommitInfo.Builder; -import com.b2international.snowowl.core.commit.CommitInfoSearchRequest.OptionKey; import com.b2international.snowowl.core.domain.RepositoryContext; import com.b2international.snowowl.datastore.converter.BaseResourceConverter; +import com.google.common.base.Strings; /** * @since 5.2 @@ -46,8 +47,8 @@ public CommitInfoConverter(final RepositoryContext context, final Options expand } @Override - protected CommitInfos createCollectionResource(final List results, final String scrollId, String searchAfter, final int limit, final int total) { - return new CommitInfos(results, scrollId, searchAfter, limit, total); + protected CommitInfos createCollectionResource(final List results, String searchAfter, final int limit, final int total) { + return new CommitInfos(results, searchAfter, limit, total); } @Override @@ -56,32 +57,37 @@ protected CommitInfo toResource(final Commit doc) { // expand details if requested if (expand().containsKey(CommitInfo.Expand.DETAILS)) { - final Collection commitDetails = getCommitDetails(doc); + final Options detailsExpandOptions = expand().get(CommitInfo.Expand.DETAILS, Options.class); + final Collection commitDetails = getCommitDetails(doc, detailsExpandOptions); final List commitInfoDetails = commitDetails.stream() .flatMap(info -> toCommitInfoDetail(info)) .collect(Collectors.toList()); - builder.details(new CommitInfoDetails(commitInfoDetails, null, null, commitInfoDetails.size(), commitInfoDetails.size())); + builder.details(new CommitInfoDetails(commitInfoDetails, null, commitInfoDetails.size(), commitInfoDetails.size())); } return builder.build(); } - private Collection getCommitDetails(final Commit commit) { - if (filterContainsKey(CommitInfoSearchRequest.OptionKey.AFFECTED_COMPONENT)) { - final String affectedComponentId = filterGetString(CommitInfoSearchRequest.OptionKey.AFFECTED_COMPONENT); + private Collection getCommitDetails(final Commit commit, Options detailsExpandOptions) { + // use the filter defined affectedComponentId if present + final String affectedComponentId = getDetailsAffectedComponentId(filters, detailsExpandOptions); + if (!Strings.isNullOrEmpty(affectedComponentId)) { return commit.getDetailsByObject(affectedComponentId); + } else { + return commit.getDetails(); } - - return commit.getDetails(); - } - - private boolean filterContainsKey(OptionKey key) { - return filters.containsKey(key.name()); } - private String filterGetString(OptionKey key) { - return filters.getString(key.name()); + private String getDetailsAffectedComponentId(Options filters, Options expandOptions) { + checkNotNull(filters, "At least one filter source must be defined"); + if (filters.containsKey(CommitInfoSearchRequest.OptionKey.AFFECTED_COMPONENT_ID)) { + return filters.getString(CommitInfoSearchRequest.OptionKey.AFFECTED_COMPONENT_ID.name()); + } else if (expandOptions.containsKey("affectedComponentId")) { + return expandOptions.getString("affectedComponentId"); + } else { + return null; + } } private Stream toCommitInfoDetail(CommitDetail detail) { diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoDetails.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoDetails.java index a8a03bd5438..391af573452 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoDetails.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoDetails.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,10 +29,9 @@ public final class CommitInfoDetails extends PageableCollectionResource items, - @JsonProperty("scrollId") final String scrollId, @JsonProperty("searchAfter") final String searchAfter, @JsonProperty("limit") final int limit, @JsonProperty("total") final int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoGetRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoGetRequestBuilder.java index c56d53d20e6..cfb0ffd2829 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoGetRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoGetRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,14 +17,14 @@ import com.b2international.snowowl.core.domain.RepositoryContext; import com.b2international.snowowl.core.request.GetResourceRequestBuilder; -import com.b2international.snowowl.datastore.request.RepositoryIndexRequestBuilder; +import com.b2international.snowowl.datastore.request.RepositoryRequestBuilder; /** * @since 5.2 */ public final class CommitInfoGetRequestBuilder extends GetResourceRequestBuilder - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { CommitInfoGetRequestBuilder(String commitId) { super(new CommitInfoGetRequest(commitId)); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoSearchRequest.java index 3ceabb6a94f..89b7458d8e3 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfoSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,7 @@ enum OptionKey { COMMENT, TIME_STAMP_FROM, TIME_STAMP_TO, - AFFECTED_COMPONENT + AFFECTED_COMPONENT_ID } @@ -83,7 +83,7 @@ protected CommitInfos toCollectionResource(RepositoryContext context, Hits - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { CommitInfoSearchRequestBuilder() {} @@ -62,7 +62,7 @@ public CommitInfoSearchRequestBuilder filterByTimestamp(final Long timestampFrom } public CommitInfoSearchRequestBuilder filterByAffectedComponent(final String affectedComponentId) { - return addOption(AFFECTED_COMPONENT, affectedComponentId); + return addOption(AFFECTED_COMPONENT_ID, affectedComponentId); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfos.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfos.java index 00939cd1de5..f568e99ff11 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfos.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/commit/CommitInfos.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,16 +30,15 @@ public final class CommitInfos extends PageableCollectionResource { private static final long serialVersionUID = 1L; public CommitInfos(int limit, int total) { - this(Collections.emptyList(), null, null, limit, total); + this(Collections.emptyList(), null, limit, total); } @JsonCreator public CommitInfos( @JsonProperty("items") final List items, - @JsonProperty("scrollId") final String scrollId, @JsonProperty("searchAfter") final String searchAfter, @JsonProperty("limit") final int limit, @JsonProperty("total") final int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineAuthenticator.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineAuthenticator.java index 1cf3e82a59c..bd1613d8c38 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineAuthenticator.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineAuthenticator.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit; import com.b2international.commons.exceptions.NotFoundException; -import com.b2international.snowowl.core.ApplicationContext; import com.b2international.snowowl.eventbus.IEventBus; import com.b2international.snowowl.identity.domain.User; import com.b2international.snowowl.identity.request.UserRequests; @@ -33,8 +32,13 @@ */ public class CommandLineAuthenticator { + private final IEventBus bus; private User user; + public CommandLineAuthenticator(IEventBus bus) { + this.bus = bus; + } + public boolean authenticate(final CommandLineStream out) { out.print("Impersonate operation as: "); @@ -45,7 +49,7 @@ public boolean authenticate(final CommandLineStream out) { return false; } else { try { - user = UserRequests.prepareGet(username).buildAsync().execute(ApplicationContext.getServiceForClass(IEventBus.class)).getSync(1, TimeUnit.MINUTES); + user = UserRequests.prepareGet(username).buildAsync().execute(bus).getSync(1, TimeUnit.MINUTES); return true; } catch (NotFoundException e) { out.println("Cannot impersonate non-existing user '%s'.", username); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineStream.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineStream.java index 9b15afccb81..cd524253c46 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineStream.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/CommandLineStream.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,7 @@ */ package com.b2international.snowowl.core.console; +import com.b2international.snowowl.eventbus.IEventBus; import com.b2international.snowowl.identity.domain.User; /** @@ -28,8 +29,8 @@ public interface CommandLineStream { void println(Object o); - default User authenticate() { - final CommandLineAuthenticator authenticator = new CommandLineAuthenticator(); + default User authenticate(IEventBus bus) { + final CommandLineAuthenticator authenticator = new CommandLineAuthenticator(bus); if (!authenticator.authenticate(this)) { return null; diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/SnowOwlCommandProvider.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/SnowOwlCommandProvider.java index 834219ef571..eb1b69c50a4 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/SnowOwlCommandProvider.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/console/SnowOwlCommandProvider.java @@ -123,10 +123,10 @@ private CommandLine cli() { ) private final class SnowOwlCommand extends BaseCommand { - @Option(names = {"-v", "--version"}, versionHelp = true, description = "Show this help message and exit.") + @Option(names = {"-v", "--version"}, versionHelp = true, description = "Print version information and exit.") boolean versionInfoRequested; - @Option(names = {"-h", "--help"}, usageHelp = true, description = "Print version information and exit.") + @Option(names = {"-h", "--help"}, usageHelp = true, description = "Show this help message and exit.") boolean usageHelpRequested; @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryBuilder.java index 0321331a1d2..1fdf527e9fd 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,7 +39,7 @@ import com.b2international.snowowl.core.terminology.TerminologyComponent; import com.b2international.snowowl.datastore.CodeSystemEntry; import com.b2international.snowowl.datastore.CodeSystemVersionEntry; -import com.b2international.snowowl.datastore.request.IndexReadRequest; +import com.b2international.snowowl.datastore.request.RepositoryRequest; import com.b2international.snowowl.datastore.review.ConceptChanges; import com.b2international.snowowl.datastore.review.Review; import com.b2international.snowowl.datastore.version.VersioningRequestBuilder; @@ -156,10 +156,7 @@ public Repository build(Environment env) { // execute initialization steps repository.waitForHealth(Health.GREEN, 3 * 60L /*wait 3 minutes for GREEN repository status*/); - new IndexReadRequest((context) -> { - initializer.initialize(context); - return null; - }).execute(manager.getContext(repositoryId)); + new RepositoryRequest<>(repositoryId, initializer).execute(env); return repository; } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryPlugin.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryPlugin.java index fdce046b563..ba698ddf399 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryPlugin.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryPlugin.java @@ -106,16 +106,23 @@ public void init(SnowOwlConfiguration configuration, Environment env) throws Exc } private Map initIndexSettings(Environment env) { + final RepositoryConfiguration repositoryConfig = env.service(SnowOwlConfiguration.class) + .getModuleConfig(RepositoryConfiguration.class); + final IndexConfiguration indexConfig = repositoryConfig.getIndexConfiguration(); + + if (indexConfig.getClusterHealthTimeout() <= indexConfig.getSocketTimeout()) { + throw new IllegalStateException(String.format("Cluster health timeout (%s ms) must be greater than the socket timeout (%s ms).", + indexConfig.getClusterHealthTimeout(), + indexConfig.getSocketTimeout())); + } + + final ImmutableMap.Builder builder = ImmutableMap.builder(); builder.put(IndexClientFactory.DATA_DIRECTORY, env.getDataPath().resolve("indexes").toString()); builder.put(IndexClientFactory.CONFIG_DIRECTORY, env.getConfigPath().toString()); - - final RepositoryConfiguration repositoryConfig = env.service(SnowOwlConfiguration.class) - .getModuleConfig(RepositoryConfiguration.class); builder.put(IndexClientFactory.INDEX_PREFIX, repositoryConfig.getDeploymentId()); - - final IndexConfiguration indexConfig = repositoryConfig.getIndexConfiguration(); builder.put(IndexClientFactory.CLUSTER_NAME, indexConfig.getClusterName()); + // remove cluster configuration if (indexConfig.getClusterUrl() != null) { builder.put(IndexClientFactory.CLUSTER_URL, indexConfig.getClusterUrl()); if (indexConfig.getClusterUsername() != null) { @@ -126,16 +133,11 @@ private Map initIndexSettings(Environment env) { } } + builder.put(IndexClientFactory.RESULT_WINDOW_KEY, ""+indexConfig.getResultWindow()); + builder.put(IndexClientFactory.MAX_TERMS_COUNT_KEY, ""+indexConfig.getMaxTermsCount()); builder.put(IndexClientFactory.TRANSLOG_SYNC_INTERVAL_KEY, indexConfig.getCommitInterval()); builder.put(IndexClientFactory.COMMIT_CONCURRENCY_LEVEL, indexConfig.getCommitConcurrencyLevel()); builder.put(IndexClientFactory.CONNECT_TIMEOUT, indexConfig.getConnectTimeout()); - - if (indexConfig.getClusterHealthTimeout() <= indexConfig.getSocketTimeout()) { - throw new IllegalStateException(String.format("Cluster health timeout (%s ms) must be greater than the socket timeout (%s ms).", - indexConfig.getClusterHealthTimeout(), - indexConfig.getSocketTimeout())); - } - builder.put(IndexClientFactory.SOCKET_TIMEOUT, indexConfig.getSocketTimeout()); builder.put(IndexClientFactory.CLUSTER_HEALTH_TIMEOUT, indexConfig.getClusterHealthTimeout()); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryTransactionContext.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryTransactionContext.java index 561281dd3d5..4dd557c4d80 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryTransactionContext.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/RepositoryTransactionContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.eclipse.xtext.util.Pair; import org.eclipse.xtext.util.Tuples; @@ -34,9 +35,15 @@ import com.b2international.commons.exceptions.ConflictException; import com.b2international.commons.exceptions.CycleDetectedException; import com.b2international.commons.exceptions.LockedException; +import com.b2international.index.Hits; +import com.b2international.index.Index; import com.b2international.index.IndexException; import com.b2international.index.Searcher; +import com.b2international.index.admin.IndexAdmin; import com.b2international.index.mapping.DocumentMapping; +import com.b2international.index.mapping.Mappings; +import com.b2international.index.query.Expressions; +import com.b2international.index.query.Query; import com.b2international.index.revision.Commit; import com.b2international.index.revision.Operation; import com.b2international.index.revision.Revision; @@ -153,6 +160,8 @@ public Map lookup(Collection componentIds, Class type) private String getObjectId(Object component) { if (component instanceof CodeSystemEntry) { return ((CodeSystemEntry) component).getShortName(); + } else if (component instanceof CodeSystemVersionEntry) { + return ((CodeSystemVersionEntry) component).getVersionId(); } else if (component instanceof Revision) { return ((Revision) component).getId(); } @@ -163,7 +172,7 @@ private Pair> createComponentKey(final String componentId, return Tuples.>pair(componentId, type); } - private Iterable fetchComponents(Set componentIds, Class type) { + private Iterable fetchComponents(Collection componentIds, Class type) { try { if (Revision.class.isAssignableFrom(type)) { return service(RevisionSearcher.class).get(type, componentIds); @@ -176,19 +185,22 @@ private Iterable fetchComponents(Set componentIds, Class type) } @Override - public void add(Object o) { + public String add(Object o) { if (o instanceof CodeSystemEntry) { final CodeSystemEntry cs = (CodeSystemEntry) o; staging.stageNew(cs.getShortName(), cs); resolvedObjectsById.put(createComponentKey(cs.getShortName(), cs.getClass()), cs); + return cs.getShortName(); } else if (o instanceof CodeSystemVersionEntry) { final CodeSystemVersionEntry cs = (CodeSystemVersionEntry) o; staging.stageNew(cs.getVersionId(), cs); resolvedObjectsById.put(createComponentKey(cs.getVersionId(), cs.getClass()), cs); + return cs.getVersionId(); } else if (o instanceof Revision) { Revision rev = (Revision) o; staging.stageNew(rev); resolvedObjectsById.put(createComponentKey(rev.getId(), rev.getClass()), rev); + return rev.getId(); } else { throw new UnsupportedOperationException("Cannot add object to this repository: " + o); } @@ -338,7 +350,34 @@ public void setNotificationEnabled(boolean isNotificationEnabled) { @Override public void clearContents() { - throw new UnsupportedOperationException("Not implemented yet"); + final Index index = service(Index.class); + final IndexAdmin indexAdmin = index.admin(); + final Mappings mappings = indexAdmin.mappings(); + + final Stream> revisionTypes = mappings.getTypes() + .stream() + .filter(t -> Revision.class.isAssignableFrom(t)); + + revisionTypes.forEach(type -> { + + final Query idQuery = Query.select(String.class) + .from(type) + .fields(Revision.Fields.ID) + .where(Expressions.matchAll()) + .scroll() + .build(); + + final RevisionSearcher revisionSearcher = service(RevisionSearcher.class); + final Iterable> batches = revisionSearcher.scroll(idQuery); + + for (final Hits ids : batches) { + final Iterable revisions = fetchComponents(ids.getHits(), type); + revisions.forEach(rev -> { + final String revisionId = ((Revision) rev).getId(); + staging.stageRemove(revisionId, rev); + }); + } + }); } private static DatastoreLockContext createLockContext(String userId, String parentContextDescription) { diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryInitializer.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryInitializer.java index 8e9a8bb1167..627d2678a30 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryInitializer.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,9 @@ import com.b2international.snowowl.core.branch.Branch; import com.b2international.snowowl.core.domain.RepositoryContext; +import com.b2international.snowowl.core.events.Request; import com.b2international.snowowl.datastore.CodeSystemEntry; import com.b2international.snowowl.datastore.CodeSystems; -import com.b2international.snowowl.eventbus.IEventBus; import com.b2international.snowowl.identity.domain.User; import com.b2international.snowowl.terminologyregistry.core.request.CodeSystemRequests; @@ -34,14 +34,15 @@ * *

*/ -public abstract class TerminologyRepositoryInitializer { +public abstract class TerminologyRepositoryInitializer implements Request { /** * Executes initialization steps for the corresponding repository. * * @param context - the repository context to use for the repository initialization */ - public void initialize(RepositoryContext context) { + @Override + public final Void execute(RepositoryContext context) { CodeSystemEntry primaryCodeSystem = createPrimaryCodeSystem(); if (primaryCodeSystem != null) { @@ -68,6 +69,7 @@ public void initialize(RepositoryContext context) { .execute(context); } } + return null; } /** diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryPlugin.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryPlugin.java index c91002dd77f..7dbbf64e0f1 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryPlugin.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/repository/TerminologyRepositoryPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,9 +111,7 @@ protected Map, TerminologyComponent> getAdditionalTerminologyComponents protected void afterRun(SnowOwlConfiguration configuration, Environment env) throws Exception { } - protected TerminologyRepositoryInitializer getTerminologyRepositoryInitializer() { - return null; - } + protected abstract TerminologyRepositoryInitializer getTerminologyRepositoryInitializer(); /** * Subclasses may override and provide a custom precommit hook to be installed on the underlying repository. {@link BaseRepositoryPreCommitHook} diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/ValidationRequests.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/ValidationRequests.java index d0f06f3a46b..20758f4f37d 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/ValidationRequests.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/ValidationRequests.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,9 +47,11 @@ public static ValidateRequestBuilder prepareValidate() { } /** - * Creates a unique validation id + * Creates a unique validation id for the given codesystem on the given branch. + * + * @param shortName + * @param branch * - * @param codeSystemEntry * @return the unique id. */ public static String createUniqueValidationId(String shortName, String branch) { diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/eval/ValidationRuleEvaluator.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/eval/ValidationRuleEvaluator.java index 5b50e597653..a73940b2c01 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/eval/ValidationRuleEvaluator.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/eval/ValidationRuleEvaluator.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,7 +51,7 @@ public static void register(ValidationRuleEvaluator evaluator) { checkArgument(!INSTANCE.evaluators.containsKey(evaluator.type()), "Rule Evaluator '%s' is already registered", evaluator.type()); INSTANCE.evaluators.put(evaluator.type(), evaluator); } - + /** * Returns the available evaluator for the given type or null if there is not evaluator registered for that type. * @@ -75,13 +75,17 @@ public static Set types() { /** * Evaluate the given rule - * @param - * @param rule - the rule to evaluate - * @param params contains parameters for the rule evaluators (BranchContext should always be included) + * + * @param context + * - the branch context where the evaluation should run + * @param rule + * - the rule to evaluate + * @param params + * - parameters for the rule evaluators * @return * @throws Exception */ - List eval(BranchContext context, ValidationRule rule, Map params) throws Exception; + List eval(BranchContext context, ValidationRule rule, Map params) throws Exception; /** * Unique type identifier of this validation rule evaluator. The type should represent the kind of rules that this evaluator can evaluate using diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssueSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssueSearchRequest.java index 93a7bd2b8f3..6df63c59794 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssueSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssueSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -192,7 +192,7 @@ protected Class getDocumentType() { @Override protected ValidationIssues toCollectionResource(ServiceProvider context, Hits hits) { - return new ValidationIssues(hits.getHits(), hits.getScrollId(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); + return new ValidationIssues(hits.getHits(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssues.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssues.java index 1bd6740ea51..216fa9a0c55 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssues.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/issue/ValidationIssues.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ public final class ValidationIssues extends PageableCollectionResource { public ValidationIssues(int limit, int total) { - this(Collections.emptyList(), null, null, limit, total); + this(Collections.emptyList(), null, limit, total); } @JsonCreator public ValidationIssues( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRuleSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRuleSearchRequest.java index 34989f632bd..61a057d93a5 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRuleSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRuleSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ protected Class getDocumentType() { @Override protected ValidationRules toCollectionResource(ServiceProvider context, Hits hits) { - return new ValidationRules(hits.getHits(), hits.getScrollId(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); + return new ValidationRules(hits.getHits(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRules.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRules.java index f1fe61a0aa4..690af3602ed 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRules.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/rule/ValidationRules.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ public final class ValidationRules extends PageableCollectionResource { public ValidationRules(int limit, int total) { - this(Collections.emptyList(), null, null, limit, total); + this(Collections.emptyList(), null, limit, total); } @JsonCreator public ValidationRules( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteListSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteListSearchRequest.java index 9168e187a0f..774782d6fa9 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteListSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteListSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -138,7 +138,7 @@ protected Class getDocumentType() { @Override protected ValidationWhiteLists toCollectionResource(ServiceProvider context, Hits hits) { - return new ValidationWhiteLists(hits.getHits(), hits.getScrollId(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); + return new ValidationWhiteLists(hits.getHits(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteLists.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteLists.java index 6ab53d4136c..9add321a192 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteLists.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/core/validation/whitelist/ValidationWhiteLists.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ public final class ValidationWhiteLists extends PageableCollectionResource{ public ValidationWhiteLists(int limit, int total) { - this(Collections.emptyList(), null, null, limit, total); + this(Collections.emptyList(), null, limit, total); } @JsonCreator public ValidationWhiteLists( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystemVersions.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystemVersions.java index a100c5098d9..f96e70f3c2e 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystemVersions.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystemVersions.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public final class CodeSystemVersions extends PageableCollectionResource items, String scrollId, String searchAfter, int limit, int total) { - super(items, scrollId, searchAfter, limit, total); + public CodeSystemVersions(final List items, String searchAfter, int limit, int total) { + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystems.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystems.java index 3373f866781..f6fb89a7ce6 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystems.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/CodeSystems.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public final class CodeSystems extends PageableCollectionResource items, String scrollId, String searchAfter, int limit, int total) { - super(items, scrollId, searchAfter, limit, total); + public CodeSystems(List items, String searchAfter, int limit, int total) { + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/config/IndexConfiguration.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/config/IndexConfiguration.java index e737a63d94f..e6f97b6c3cb 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/config/IndexConfiguration.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/config/IndexConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,6 +49,10 @@ public class IndexConfiguration { private int socketTimeout = IndexClientFactory.DEFAULT_SOCKET_TIMEOUT; @Min(2_001) private int clusterHealthTimeout = IndexClientFactory.DEFAULT_CLUSTER_HEALTH_TIMEOUT; + + private int maxTermsCount = IndexClientFactory.DEFAULT_MAX_TERMS_COUNT; + + private int resultWindow = IndexClientFactory.DEFAULT_RESULT_WINDOW; @JsonProperty public String getCommitInterval() { @@ -149,4 +153,21 @@ public int getClusterHealthTimeout() { public void setClusterHealthTimeout(int clusterHealthTimeout) { this.clusterHealthTimeout = clusterHealthTimeout; } + + public int getMaxTermsCount() { + return maxTermsCount; + } + + public int getResultWindow() { + return resultWindow; + } + + public void setMaxTermsCount(int maxTermsCount) { + this.maxTermsCount = maxTermsCount; + } + + public void setResultWindow(int resultWindow) { + this.resultWindow = resultWindow; + } + } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/BaseResourceConverter.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/BaseResourceConverter.java index 4e0ae8e5db2..bbf1ce9d478 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/BaseResourceConverter.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/BaseResourceConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,11 +63,11 @@ protected final List locales() { @Override public final R convert(T component) { - return Iterables.getOnlyElement(convert(Collections.singleton(component), null, null, 1, 1)); + return Iterables.getOnlyElement(convert(Collections.singleton(component), null, 1, 1)); } @Override - public final CR convert(Collection components, String scrollId, String searchAfter, int limit, int total) { + public final CR convert(Collection components, String searchAfter, int limit, int total) { final List results = components .stream() .map(this::toResource) @@ -77,10 +77,10 @@ public final CR convert(Collection components, String scrollId, String search expand(results); } - return createCollectionResource(results, scrollId, searchAfter, limit, total); + return createCollectionResource(results, searchAfter, limit, total); } - protected abstract CR createCollectionResource(List results, String scrollId, String searchAfter, int limit, int total); + protected abstract CR createCollectionResource(List results, String searchAfter, int limit, int total); /** * Subclasses may override to expand resources based on the {@link #expand()} list. diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/ResourceConverter.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/ResourceConverter.java index 0dcf2773ba9..63fb07f64e7 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/ResourceConverter.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/converter/ResourceConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,11 +36,10 @@ public interface ResourceConverter> { * Convert multiple internal index based entities to resource based representations. * * @param components - * @param scrollId * @param searchAfter * @param limit * @param total * @return */ - CR convert(Collection components, String scrollId, String searchAfter, int limit, int total); + CR convert(Collection components, String searchAfter, int limit, int total); } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/index/BaseRepositoryPreCommitHook.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/index/BaseRepositoryPreCommitHook.java index 46f50555d11..b2e2c6a99f8 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/index/BaseRepositoryPreCommitHook.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/index/BaseRepositoryPreCommitHook.java @@ -90,7 +90,7 @@ private final void updateDocuments(StagingArea staging, RevisionSearcher index) preUpdateDocuments(staging, index); doProcess(getChangeSetProcessors(staging, index), staging, index); - postUpdateDocuments(staging); + postUpdateDocuments(staging, index); log.info("Processing changes successfully finished."); } @@ -118,6 +118,7 @@ protected final void doProcess(Collection changeSetProcessor * Subclasses may override this method to execute additional logic before the processing of the changeset. * * @param staging - the staging area before committing it to the repository + * @param index * @throws IOException */ protected void preUpdateDocuments(StagingArea staging, RevisionSearcher index) throws IOException { @@ -126,9 +127,12 @@ protected void preUpdateDocuments(StagingArea staging, RevisionSearcher index) t /** * Return a list of {@link ChangeSetProcessor}s to process the commit changeset. * + * @param staging - the staging area before committing it to the repository + * @param index * @return + * @throws IOException */ - protected Collection getChangeSetProcessors(StagingArea stagingArea, RevisionSearcher index) throws IOException { + protected Collection getChangeSetProcessors(StagingArea staging, RevisionSearcher index) throws IOException { return Collections.emptySet(); } @@ -136,8 +140,10 @@ protected Collection getChangeSetProcessors(StagingArea stag * Subclasses may override this method to execute additional logic after the processing of the changeset, but before committing it. * * @param staging - the staging area before committing it to the repository + * @param index + * @throws IOException */ - protected void postUpdateDocuments(StagingArea staging) { + protected void postUpdateDocuments(StagingArea staging, RevisionSearcher index) throws IOException { } // @SuppressWarnings("restriction") diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreLocks.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreLocks.java index 3ec24815cc9..9daf194f21d 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreLocks.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreLocks.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,12 +22,12 @@ /** * @since 7.1.0 */ -public class DatastoreLocks extends PageableCollectionResource { +public final class DatastoreLocks extends PageableCollectionResource { private static final long serialVersionUID = 1L; - public DatastoreLocks(List items, String scrollId, String searchAfter, int limit, int total) { - super(items, scrollId, searchAfter, limit, total); + public DatastoreLocks(List items, String searchAfter, int limit, int total) { + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreOperationLockManager.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreOperationLockManager.java index 6d804e2ced4..5acaf658751 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreOperationLockManager.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/oplock/DatastoreOperationLockManager.java @@ -389,7 +389,7 @@ private DatastoreLocks search(Expression query, int limit) { private DatastoreLocks search(Expression query, List fields, SortBy sortBy, int limit) { final Hits hits = searchHits(query, fields, sortBy, limit); - return new DatastoreLocks(hits.getHits(), null, null, hits.getLimit(), hits.getTotal()); + return new DatastoreLocks(hits.getHits(), null, hits.getLimit(), hits.getTotal()); } private Hits searchHits(Expression query, List fields, SortBy sortBy, int limit) { diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobTracker.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobTracker.java index e22debac887..50b9cb3f7c5 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobTracker.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobTracker.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -135,7 +135,7 @@ public RemoteJobs search(Expression query, int limit) { private RemoteJobs search(Expression query, List fields, SortBy sortBy, int limit) { final Hits hits = searchHits(query, fields, sortBy, limit); - return new RemoteJobs(hits.getHits(), null, null, hits.getLimit(), hits.getTotal()); + return new RemoteJobs(hits.getHits(), null, hits.getLimit(), hits.getTotal()); } private Hits searchHits(Expression query, List fields, SortBy sortBy, int limit) { diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobs.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobs.java index 4de8ff7563a..60186ba2063 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobs.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/remotejobs/RemoteJobs.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ public final class RemoteJobs extends PageableCollectionResource private static final long serialVersionUID = 1L; - public RemoteJobs(List items, String scrollId, String searchAfter, int limit, int total) { - super(items, scrollId, searchAfter, limit, total); + public RemoteJobs(List items, String searchAfter, int limit, int total) { + super(items, searchAfter, limit, total); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchGetRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchGetRequestBuilder.java index a943335a8d7..585b7e5b0f1 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchGetRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchGetRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ */ public final class BranchGetRequestBuilder extends GetResourceRequestBuilder - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { BranchGetRequestBuilder(String path) { super(new BranchGetRequest(path)); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchRequestBuilder.java index 2caff99aa61..b9a837d9e31 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,9 +33,7 @@ default AsyncRequest build(String repositoryId, String branch) { return new AsyncRequest<>( new RepositoryRequest<>(repositoryId, new HealthCheckingRequest<>( - new IndexReadRequest<>( - new BranchRequest<>(branch, build()) - ), + new BranchRequest<>(branch, build()), allowedHealthstates() ) ) diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequest.java index 2b760c36218..1ec714b6392 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,7 +63,7 @@ enum OptionKey { @Override protected Branches createEmptyResult(int limit) { - return new Branches(Collections.emptyList(), null, null, limit, 0); + return new Branches(Collections.emptyList(), null, limit, 0); } @Override @@ -99,7 +99,7 @@ protected Branches toCollectionResource(RepositoryContext context, Hits toBranchData(final BaseRevisionBranching branching, final Iterable hits) { @@ -129,7 +129,7 @@ private void expand(RepositoryContext context, List branchHits) { final BaseRevisionBranching branching = context.service(BaseRevisionBranching.class); for (Branch branchHit : branchHits) { final List children = toBranchData(branching, branching.getChildren(branchHit.path())); - branchHit.setChildren(new Branches(children, null, null, children.size(), children.size())); + branchHit.setChildren(new Branches(children, null, children.size(), children.size())); } } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequestBuilder.java index adf0fbbb894..3f6ac102887 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/BranchSearchRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ /** * @since 4.5 */ -public final class BranchSearchRequestBuilder extends SearchResourceRequestBuilder implements RepositoryIndexRequestBuilder { +public final class BranchSearchRequestBuilder extends SearchResourceRequestBuilder implements RepositoryRequestBuilder { BranchSearchRequestBuilder() { super(); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/CreateMergeRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/CreateMergeRequestBuilder.java index 0436210c023..84ec273ff64 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/CreateMergeRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/CreateMergeRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ /** * @since 4.5 */ -public final class CreateMergeRequestBuilder extends BaseRequestBuilder implements RepositoryIndexRequestBuilder { +public final class CreateMergeRequestBuilder extends BaseRequestBuilder implements RepositoryRequestBuilder { private String source; private String target; diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/IndexReadRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/IndexReadRequest.java deleted file mode 100644 index 10b74110537..00000000000 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/IndexReadRequest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.datastore.request; - -import com.b2international.commons.exceptions.IllegalQueryParameterException; -import com.b2international.index.Index; -import com.b2international.index.Searcher; -import com.b2international.index.query.QueryParseException; -import com.b2international.snowowl.core.domain.RepositoryContext; -import com.b2international.snowowl.core.events.DelegatingRequest; -import com.b2international.snowowl.core.events.Request; - -/** - * A subclass of {@link DelegatingRequest} that: - *

    - *
  • opens an index read transaction using {@link Index}; - *
  • executes the delegate with a {@link RepositoryContext} that allows access to {@link Searcher} from the read transaction. - *
- * - * @since 5.2 - */ -public final class IndexReadRequest extends DelegatingRequest { - - public IndexReadRequest(final Request next) { - super(next); - } - - @Override - public R execute(final RepositoryContext context) { - return context.service(Index.class).read(index -> { - try { - return next(context.inject() - .bind(Searcher.class, index) - .build()); - } catch (QueryParseException e) { - throw new IllegalQueryParameterException(e.getMessage()); - } - }); - } - -} diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryCommitRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryCommitRequestBuilder.java index d3433292494..1e73763a659 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryCommitRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryCommitRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,10 +89,8 @@ public AsyncRequest build(String repositoryId, String branch) { return new AsyncRequest<>( new RepositoryRequest<>(repositoryId, new HealthCheckingRequest<>( - new IndexReadRequest<>( - new BranchRequest<>(branch, - new RevisionIndexReadRequest(build()) - ) + new BranchRequest<>(branch, + new RevisionIndexReadRequest(build()) ), allowedHealthstates() ) diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryIndexRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryIndexRequestBuilder.java deleted file mode 100644 index 6e3180dfc5a..00000000000 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryIndexRequestBuilder.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.datastore.request; - -import com.b2international.snowowl.core.domain.RepositoryContext; -import com.b2international.snowowl.core.events.AsyncRequest; -import com.b2international.snowowl.core.events.RequestBuilder; - -/** - * @since 5.7 - */ -public interface RepositoryIndexRequestBuilder extends RequestBuilder, AllowedHealthStates { - - default AsyncRequest build(String repositoryId) { - return new AsyncRequest<>( - new RepositoryRequest<>(repositoryId, - new HealthCheckingRequest<>( - new IndexReadRequest<>(build()), - allowedHealthstates() - ) - ) - ); - } - -} diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequest.java index 5c903d32318..e7f52d678da 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,10 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; +import com.b2international.commons.exceptions.IllegalQueryParameterException; +import com.b2international.index.Index; +import com.b2international.index.Searcher; +import com.b2international.index.query.QueryParseException; import com.b2international.snowowl.core.ServiceProvider; import com.b2international.snowowl.core.domain.Bindable; import com.b2international.snowowl.core.domain.DelegatingContext; @@ -49,7 +53,8 @@ public String getContextId() { @Override public B execute(final ServiceProvider context) { - DelegatingContext.Builder repositoryContext = context.service(RepositoryContextProvider.class).getContext(repositoryId).inject(); + RepositoryContext originalRepositoryContext = context.service(RepositoryContextProvider.class).getContext(repositoryId); + DelegatingContext.Builder repositoryContext = originalRepositoryContext.inject(); // by default add a NullProgressMonitor binding to the context // if the previous context is a delegate context, injecting all services can override this safely @@ -58,7 +63,16 @@ public B execute(final ServiceProvider context) { if (context instanceof Bindable) { repositoryContext.bindAll((Bindable) context); } - - return next(repositoryContext.build()); + + // always "open" an index read context when executing requests inside a repository + return originalRepositoryContext.service(Index.class).read(index -> { + try { + return next(repositoryContext + .bind(Searcher.class, index) + .build()); + } catch (QueryParseException e) { + throw new IllegalQueryParameterException(e.getMessage()); + } + }); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequestBuilder.java index 8ab2c209f79..db469feac38 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequestBuilder.java @@ -31,10 +31,13 @@ public interface RepositoryRequestBuilder extends RequestBuilder build(String repositoryId) { return new AsyncRequest( - new RepositoryRequest(repositoryId, - new HealthCheckingRequest<>(build(), allowedHealthstates()) - ) - ); + new RepositoryRequest(repositoryId, + new HealthCheckingRequest<>( + build(), + allowedHealthstates() + ) + ) + ); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequests.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequests.java index 4fcaff7ec79..d77b04d43f4 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequests.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RepositoryRequests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.b2international.snowowl.datastore.request; import com.b2international.snowowl.core.commit.CommitInfoRequests; +import com.b2international.snowowl.datastore.request.repository.RepositoryClearRequestBuilder; import com.b2international.snowowl.datastore.request.repository.RepositoryGetRequestBuilder; import com.b2international.snowowl.datastore.request.repository.RepositorySearchRequestBuilder; import com.b2international.snowowl.datastore.request.system.ServerInfoGetRequestBuilder; @@ -72,5 +73,8 @@ public static RepositoryGetRequestBuilder prepareGet(String repositoryId) { public static ServerInfoGetRequestBuilder prepareGetServerInfo() { return new ServerInfoGetRequestBuilder(); } - + + public static RepositoryClearRequestBuilder prepareClear() { + return new RepositoryClearRequestBuilder(); + } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/ReviewCreateRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/ReviewCreateRequestBuilder.java index 10f995def68..417430f8666 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/ReviewCreateRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/ReviewCreateRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ /** * @since 4.5 */ -public final class ReviewCreateRequestBuilder extends BaseRequestBuilder implements RepositoryIndexRequestBuilder { +public final class ReviewCreateRequestBuilder extends BaseRequestBuilder implements RepositoryRequestBuilder { private String sourceBranch; private String targetBranch; diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RevisionIndexRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RevisionIndexRequestBuilder.java index 1e5fbe0fb8a..8af460560bf 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RevisionIndexRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/RevisionIndexRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,10 +34,8 @@ public interface RevisionIndexRequestBuilder extends RequestBuilder build(String repositoryId, String branch) { return new AsyncRequest<>( new RepositoryRequest<>(repositoryId, - new IndexReadRequest<>( - new BranchRequest<>(branch, - new RevisionIndexReadRequest<>(build()) - ) + new BranchRequest<>(branch, + new RevisionIndexReadRequest<>(build()) ) ) ); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchIndexResourceRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchIndexResourceRequest.java index 05db85b25d9..1856e7cf204 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchIndexResourceRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchIndexResourceRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.util.function.Function; import com.b2international.index.Hits; -import com.b2international.index.Scroll; import com.b2international.index.Searcher; import com.b2international.index.mapping.DocumentMapping; import com.b2international.index.query.Expression; @@ -58,21 +57,15 @@ public abstract class SearchIndexResourceRequest docType = getDocumentType(); final Searcher searcher = searcher(context); - final Hits hits; - if (isScrolled()) { - hits = searcher.scroll(new Scroll<>(docType, docType, fields(), scrollId(), scrollKeepAlive())); - } else { - final Expression where = prepareQuery(context); - hits = searcher.search(Query.select(docType) - .fields(fields()) - .where(where) - .scroll(scrollKeepAlive()) - .searchAfter(searchAfter()) - .limit(limit()) - .sortBy(sortBy()) - .withScores(trackScores()) - .build()); - } + final Expression where = prepareQuery(context); + final Hits hits = searcher.search(Query.select(docType) + .fields(fields()) + .where(where) + .searchAfter(searchAfter()) + .limit(limit()) + .sortBy(sortBy()) + .withScores(trackScores()) + .build()); return toCollectionResource(context, hits); } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchMergeRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchMergeRequest.java index ea7b7246fd2..ce65c686c44 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchMergeRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/SearchMergeRequest.java @@ -82,7 +82,7 @@ public Merges doExecute(RepositoryContext context) { final RemoteJobs jobs = context.service(RemoteJobTracker.class).search(queryBuilder.build(), Integer.MAX_VALUE); final ObjectMapper mapper = context.service(ObjectMapper.class); final List items = jobs.stream().map(job -> createMergefromJobEntry(job, mapper)).collect(Collectors.toList()); - return new Merges(items, jobs.getScrollId(), jobs.getSearchAfter(), jobs.getLimit(), jobs.getTotal()); + return new Merges(items, jobs.getSearchAfter(), jobs.getLimit(), jobs.getTotal()); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/compare/BranchCompareRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/compare/BranchCompareRequestBuilder.java index 4c81dd49721..92bdb18aaff 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/compare/BranchCompareRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/compare/BranchCompareRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,13 +18,13 @@ import com.b2international.snowowl.core.domain.RepositoryContext; import com.b2international.snowowl.core.events.BaseRequestBuilder; import com.b2international.snowowl.core.events.Request; -import com.b2international.snowowl.datastore.request.RepositoryIndexRequestBuilder; +import com.b2international.snowowl.datastore.request.RepositoryRequestBuilder; /** * @since 5.9 */ public final class BranchCompareRequestBuilder extends BaseRequestBuilder - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { private String base; private String compare; diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/job/SearchJobRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/job/SearchJobRequest.java index eeb9c333ed0..47302081902 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/job/SearchJobRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/job/SearchJobRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -77,7 +77,7 @@ protected Expression prepareQuery(ServiceProvider context) { @Override protected RemoteJobs toCollectionResource(ServiceProvider context, Hits hits) { - return new RemoteJobs(hits.getHits(), hits.getScrollId(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); + return new RemoteJobs(hits.getHits(), hits.getSearchAfter(), hits.getLimit(), hits.getTotal()); } @Override @@ -92,7 +92,7 @@ protected Class getDocumentType() { @Override protected RemoteJobs createEmptyResult(int limit) { - return new RemoteJobs(Collections.emptyList(), null, null, limit, 0); + return new RemoteJobs(Collections.emptyList(), null, limit, 0); } } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequest.java index de5fce72580..3845edeb9d2 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,32 +15,28 @@ */ package com.b2international.snowowl.datastore.request.repository; -import com.b2international.snowowl.core.authorization.RepositoryAccessControl; +import com.b2international.snowowl.core.authorization.BranchAccessControl; import com.b2international.snowowl.core.domain.TransactionContext; import com.b2international.snowowl.core.events.Request; import com.b2international.snowowl.identity.domain.Permission; /** - * Request to clear a repository. Mostly used during the import process as an option. + * Deletes all current revisions from a single branch. + * * @since 5.12 */ -public class RepositoryClearRequest implements Request, RepositoryAccessControl { +public class RepositoryClearRequest implements Request, BranchAccessControl { private static final long serialVersionUID = 1L; @Override - public Boolean execute(TransactionContext context) { + public Boolean execute(final TransactionContext context) { context.clearContents(); return true; } - - public static RepositoryClearRequestBuilder builder() { - return new RepositoryClearRequestBuilder(); - } @Override public String getOperation() { return Permission.EDIT; } - } diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequestBuilder.java index f4d8eb81461..e344f0190e5 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryClearRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,16 +22,16 @@ /** * Builder for request that clear the repository content. + * * @since 5.12 */ -public final class RepositoryClearRequestBuilder extends BaseRequestBuilder implements TransactionalRequestBuilder{ - - RepositoryClearRequestBuilder() {} +public final class RepositoryClearRequestBuilder + extends BaseRequestBuilder + implements TransactionalRequestBuilder{ @Override protected Request doBuild() { final RepositoryClearRequest req = new RepositoryClearRequest(); return req; } - -} \ No newline at end of file +} diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryGetRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryGetRequest.java index 6462341dba4..dfc38d421a1 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryGetRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/repository/RepositoryGetRequest.java @@ -22,7 +22,7 @@ /** * @since 5.8 */ -class RepositoryGetRequest extends GetResourceRequest { +final class RepositoryGetRequest extends GetResourceRequest { RepositoryGetRequest(String id) { super(id); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/system/ServerInfoGetRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/system/ServerInfoGetRequest.java index 7c619aac2d1..2ed4c423808 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/system/ServerInfoGetRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/system/ServerInfoGetRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import com.b2international.snowowl.core.RepositoryInfo; import com.b2international.snowowl.core.ServerInfo; import com.b2international.snowowl.core.ServiceProvider; +import com.b2international.snowowl.core.authorization.Unprotected; import com.b2international.snowowl.core.config.SnowOwlConfiguration; import com.b2international.snowowl.core.events.Request; import com.b2international.snowowl.datastore.DatastoreActivator; @@ -37,6 +38,7 @@ /** * @since 5.8 */ +@Unprotected class ServerInfoGetRequest implements Request { private static final long serialVersionUID = 1L; diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/version/CodeSystemVersionCreateRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/version/CodeSystemVersionCreateRequest.java index 4cf18126066..919d654fc7a 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/version/CodeSystemVersionCreateRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/datastore/request/version/CodeSystemVersionCreateRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,7 +55,6 @@ import com.b2international.snowowl.datastore.remotejobs.RemoteJob; import com.b2international.snowowl.datastore.request.BranchRequest; import com.b2international.snowowl.datastore.request.CommitResult; -import com.b2international.snowowl.datastore.request.IndexReadRequest; import com.b2international.snowowl.datastore.request.RepositoryRequest; import com.b2international.snowowl.datastore.request.RepositoryRequests; import com.b2international.snowowl.datastore.request.RevisionIndexReadRequest; @@ -141,13 +140,11 @@ public Boolean execute(ServiceProvider context) { // check that the specified effective time is valid in this code system validateEffectiveTime(context, codeSystem); new RepositoryRequest<>(repositoryId, - new IndexReadRequest<>( - new BranchRequest<>(codeSystem.getBranchPath(), - new RevisionIndexReadRequest( - context.service(RepositoryManager.class).get(codeSystemToVersion.getRepositoryUuid()) - .service(VersioningRequestBuilder.class) - .build(new VersioningConfiguration(user, codeSystemToVersion.getShortName(), versionId, description, effectiveTime)) - ) + new BranchRequest<>(codeSystem.getBranchPath(), + new RevisionIndexReadRequest( + context.service(RepositoryManager.class).get(codeSystemToVersion.getRepositoryUuid()) + .service(VersioningRequestBuilder.class) + .build(new VersioningConfiguration(user, codeSystemToVersion.getShortName(), versionId, description, effectiveTime)) ) ) ).execute(context); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemCreateRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemCreateRequest.java index e2c6f60e2f4..34613e90e01 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemCreateRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemCreateRequest.java @@ -94,11 +94,7 @@ void setExtensionOf(final String extensionOf) { @Override public String execute(final TransactionContext context) { checkCodeSystem(context); - - final CodeSystemEntry codeSystem = createCodeSystem(context); - context.add(codeSystem); - - return codeSystem.getShortName(); + return context.add(createCodeSystem(context)); } private void checkCodeSystem(final TransactionContext context) { diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemGetRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemGetRequestBuilder.java index b7a152ee92d..7c3e177629a 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemGetRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemGetRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ import com.b2international.snowowl.core.domain.RepositoryContext; import com.b2international.snowowl.core.request.GetResourceRequestBuilder; import com.b2international.snowowl.datastore.CodeSystemEntry; -import com.b2international.snowowl.datastore.request.RepositoryIndexRequestBuilder; +import com.b2international.snowowl.datastore.request.RepositoryRequestBuilder; /** * @since 4.7 */ public final class CodeSystemGetRequestBuilder extends GetResourceRequestBuilder - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { CodeSystemGetRequestBuilder(String uniqueId) { super(new CodeSystemGetRequest(uniqueId)); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequest.java index 4856844252a..4b7e8ac485d 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,12 +55,12 @@ protected Expression prepareQuery(RepositoryContext context) { @Override protected CodeSystems toCollectionResource(RepositoryContext context, Hits hits) { - return new CodeSystems(hits.getHits(), hits.getScrollId(), hits.getSearchAfter(), limit(), hits.getTotal()); + return new CodeSystems(hits.getHits(), hits.getSearchAfter(), limit(), hits.getTotal()); } @Override protected CodeSystems createEmptyResult(int limit) { - return new CodeSystems(Collections.emptyList(), null, null, limit, 0); + return new CodeSystems(Collections.emptyList(), null, limit, 0); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequestBuilder.java index b0826109291..8302209d00c 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemSearchRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,14 @@ import com.b2international.snowowl.core.request.SearchResourceRequest; import com.b2international.snowowl.core.request.SearchResourceRequestBuilder; import com.b2international.snowowl.datastore.CodeSystems; -import com.b2international.snowowl.datastore.request.RepositoryIndexRequestBuilder; +import com.b2international.snowowl.datastore.request.RepositoryRequestBuilder; /** * @since 4.7 */ public final class CodeSystemSearchRequestBuilder extends SearchResourceRequestBuilder - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { CodeSystemSearchRequestBuilder() { super(); diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequest.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequest.java index 5fa7be5086d..b3a0762d68f 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequest.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -117,12 +117,12 @@ protected Class getDocumentType() { @Override protected CodeSystemVersions toCollectionResource(RepositoryContext context, Hits hits) { - return new CodeSystemVersions(hits.getHits(), hits.getScrollId(), hits.getSearchAfter(), limit(), hits.getTotal()); + return new CodeSystemVersions(hits.getHits(), hits.getSearchAfter(), limit(), hits.getTotal()); } @Override protected CodeSystemVersions createEmptyResult(int limit) { - return new CodeSystemVersions(Collections.emptyList(), null, null, limit, 0); + return new CodeSystemVersions(Collections.emptyList(), null, limit, 0); } @Override diff --git a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequestBuilder.java b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequestBuilder.java index d93591558f5..3ff14e073e2 100644 --- a/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequestBuilder.java +++ b/core/com.b2international.snowowl.datastore/src/com/b2international/snowowl/terminologyregistry/core/request/CodeSystemVersionSearchRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import com.b2international.snowowl.core.request.SearchResourceRequest; import com.b2international.snowowl.core.request.SearchResourceRequestBuilder; import com.b2international.snowowl.datastore.CodeSystemVersions; -import com.b2international.snowowl.datastore.request.RepositoryIndexRequestBuilder; +import com.b2international.snowowl.datastore.request.RepositoryRequestBuilder; import com.b2international.snowowl.terminologyregistry.core.request.CodeSystemVersionSearchRequest.OptionKey; /** @@ -31,7 +31,7 @@ */ public final class CodeSystemVersionSearchRequestBuilder extends SearchResourceRequestBuilder - implements RepositoryIndexRequestBuilder { + implements RepositoryRequestBuilder { private String codeSystemShortName; private String versionId; diff --git a/core/com.b2international.snowowl.identity.file/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.identity.file/META-INF/MANIFEST.MF index 9101301de13..6228424f38d 100644 --- a/core/com.b2international.snowowl.identity.file/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.identity.file/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl File Identity Module Bundle-SymbolicName: com.b2international.snowowl.identity.file;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Fragment-Host: com.b2international.snowowl.identity Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ClassPath: . diff --git a/core/com.b2international.snowowl.identity.file/pom.xml b/core/com.b2international.snowowl.identity.file/pom.xml index 2fe8da90677..8b7ed8a8fc2 100644 --- a/core/com.b2international.snowowl.identity.file/pom.xml +++ b/core/com.b2international.snowowl.identity.file/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.identity.file eclipse-plugin diff --git a/core/com.b2international.snowowl.identity.ldap/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.identity.ldap/META-INF/MANIFEST.MF index 21d88a7be3b..fac5b7f3167 100644 --- a/core/com.b2international.snowowl.identity.ldap/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.identity.ldap/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl LDAP Identity Module Bundle-SymbolicName: com.b2international.snowowl.identity.ldap -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Fragment-Host: com.b2international.snowowl.identity Bundle-RequiredExecutionEnvironment: JavaSE-11 Import-Package: com.fasterxml.jackson.annotation;version="2.9.9", diff --git a/core/com.b2international.snowowl.identity.ldap/pom.xml b/core/com.b2international.snowowl.identity.ldap/pom.xml index 533a358bb94..bd6e5eb337c 100644 --- a/core/com.b2international.snowowl.identity.ldap/pom.xml +++ b/core/com.b2international.snowowl.identity.ldap/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.identity.ldap eclipse-plugin diff --git a/core/com.b2international.snowowl.identity/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.identity/META-INF/MANIFEST.MF index 725b65e171e..d5559d4450e 100644 --- a/core/com.b2international.snowowl.identity/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.identity/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Identity Management Bundle-SymbolicName: com.b2international.snowowl.identity;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy diff --git a/core/com.b2international.snowowl.identity/pom.xml b/core/com.b2international.snowowl.identity/pom.xml index e5e21af5ca5..b0983154109 100644 --- a/core/com.b2international.snowowl.identity/pom.xml +++ b/core/com.b2international.snowowl.identity/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.identity eclipse-plugin diff --git a/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/domain/Users.java b/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/domain/Users.java index bd09805aa75..42b2f999e93 100644 --- a/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/domain/Users.java +++ b/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/domain/Users.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,6 @@ public Users(int limit, int total) { } public Users(List items, int limit, int total) { - super(items, null, null, limit, total); + super(items, null, limit, total); } } diff --git a/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/request/UserLoginRequest.java b/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/request/UserLoginRequest.java index 69e9ddfdee7..47aad4d8123 100644 --- a/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/request/UserLoginRequest.java +++ b/core/com.b2international.snowowl.identity/src/com/b2international/snowowl/identity/request/UserLoginRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.b2international.commons.exceptions.UnauthorizedException; import com.b2international.snowowl.core.ServiceProvider; +import com.b2international.snowowl.core.authorization.Unprotected; import com.b2international.snowowl.core.events.Request; import com.b2international.snowowl.identity.IdentityProvider; import com.b2international.snowowl.identity.JWTGenerator; @@ -29,6 +30,7 @@ /** * @since 7.2 */ +@Unprotected public final class UserLoginRequest implements Request { @NotEmpty diff --git a/core/com.b2international.snowowl.logback.config/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.logback.config/META-INF/MANIFEST.MF index 8920a6b4499..de737c40237 100644 --- a/core/com.b2international.snowowl.logback.config/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.logback.config/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl's Logback Configuration Bundle-SymbolicName: com.b2international.snowowl.logback.config;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Fragment-Host: ch.qos.logback.classic;bundle-version="[1.1.3,2.0.0)" Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-Vendor: B2i Healthcare diff --git a/core/com.b2international.snowowl.logback.config/pom.xml b/core/com.b2international.snowowl.logback.config/pom.xml index b9a784d1517..4d18125d184 100644 --- a/core/com.b2international.snowowl.logback.config/pom.xml +++ b/core/com.b2international.snowowl.logback.config/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.logback.config eclipse-plugin diff --git a/core/com.b2international.snowowl.server.core.feature/feature.xml b/core/com.b2international.snowowl.server.core.feature/feature.xml index bd8e3c03b0c..e5624a8def5 100644 --- a/core/com.b2international.snowowl.server.core.feature/feature.xml +++ b/core/com.b2international.snowowl.server.core.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/core/com.b2international.snowowl.server.core.feature/pom.xml b/core/com.b2international.snowowl.server.core.feature/pom.xml index f081f939977..b6e95a0d36a 100644 --- a/core/com.b2international.snowowl.server.core.feature/pom.xml +++ b/core/com.b2international.snowowl.server.core.feature/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.server.core.feature eclipse-feature diff --git a/core/com.b2international.snowowl.server.dependencies.feature/feature.xml b/core/com.b2international.snowowl.server.dependencies.feature/feature.xml index 035e7df43e9..20a83d30a22 100644 --- a/core/com.b2international.snowowl.server.dependencies.feature/feature.xml +++ b/core/com.b2international.snowowl.server.dependencies.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/core/com.b2international.snowowl.server.dependencies.feature/pom.xml b/core/com.b2international.snowowl.server.dependencies.feature/pom.xml index a0a8e14f2d3..cc32d371aaa 100644 --- a/core/com.b2international.snowowl.server.dependencies.feature/pom.xml +++ b/core/com.b2international.snowowl.server.dependencies.feature/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.server.dependencies.feature eclipse-feature diff --git a/core/com.b2international.snowowl.server.product.feature/feature.xml b/core/com.b2international.snowowl.server.product.feature/feature.xml index 9e3c9c75861..99a50069a07 100644 --- a/core/com.b2international.snowowl.server.product.feature/feature.xml +++ b/core/com.b2international.snowowl.server.product.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/core/com.b2international.snowowl.server.product.feature/pom.xml b/core/com.b2international.snowowl.server.product.feature/pom.xml index e42166605ee..4689f5499fd 100644 --- a/core/com.b2international.snowowl.server.product.feature/pom.xml +++ b/core/com.b2international.snowowl.server.product.feature/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.server.product.feature eclipse-feature diff --git a/core/com.b2international.snowowl.server.product/META-INF/MANIFEST.MF b/core/com.b2international.snowowl.server.product/META-INF/MANIFEST.MF index d407a182ac0..25c13a5e58c 100644 --- a/core/com.b2international.snowowl.server.product/META-INF/MANIFEST.MF +++ b/core/com.b2international.snowowl.server.product/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Server Product Bundle-SymbolicName: com.b2international.snowowl.server.product;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.osgi;bundle-version="3.6.1", diff --git a/core/com.b2international.snowowl.server.product/pom.xml b/core/com.b2international.snowowl.server.product/pom.xml index 49634cf557e..e5db1410107 100644 --- a/core/com.b2international.snowowl.server.product/pom.xml +++ b/core/com.b2international.snowowl.server.product/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl core-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.server.product eclipse-plugin diff --git a/core/pom.xml b/core/pom.xml index 7be955f6b75..e869d69a21e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -9,7 +9,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/dist/pom.xml b/dist/pom.xml index 9a858f5e73e..2ab4fc0724c 100644 --- a/dist/pom.xml +++ b/dist/pom.xml @@ -9,7 +9,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 457df652546..1672f74a3d4 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -2,7 +2,7 @@ version: "3.7" services: elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.8.2 + image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.5.2 container_name: elasticsearch environment: cluster.name: "elastic-snowowl" diff --git a/documentation/META-INF/MANIFEST.MF b/documentation/META-INF/MANIFEST.MF index 87be5c68c15..5e6b49bb785 100644 --- a/documentation/META-INF/MANIFEST.MF +++ b/documentation/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Documentation Bundle-SymbolicName: documentation;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: JavaSE-11 @@ -14,7 +14,4 @@ Require-Bundle: com.b2international.commons, com.b2international.snowowl.core.rest, com.b2international.snowowl.snomed.common, com.b2international.snowowl.snomed.datastore, - com.b2international.snowowl.snomed.dsl, - com.b2international.snowowl.snomed.semanticengine, - com.b2international.snowowl.snomed.semanticengine.simpleast, com.b2international.snowowl.snomed.reasoner diff --git a/documentation/pom.xml b/documentation/pom.xml index d703e887597..837ac77ed07 100644 --- a/documentation/pom.xml +++ b/documentation/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT documentation diff --git a/fhir/com.b2international.snowowl.fhir.core/META-INF/MANIFEST.MF b/fhir/com.b2international.snowowl.fhir.core/META-INF/MANIFEST.MF index 0724d286a6f..03827ec06a6 100644 --- a/fhir/com.b2international.snowowl.fhir.core/META-INF/MANIFEST.MF +++ b/fhir/com.b2international.snowowl.fhir.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl FHIR API Core Bundle-SymbolicName: com.b2international.snowowl.fhir.core;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: com.b2international.snowowl.fhir.core, diff --git a/fhir/com.b2international.snowowl.fhir.core/pom.xml b/fhir/com.b2international.snowowl.fhir.core/pom.xml index 8ffa31d3324..d2adf00f1e0 100644 --- a/fhir/com.b2international.snowowl.fhir.core/pom.xml +++ b/fhir/com.b2international.snowowl.fhir.core/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl fhir-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.fhir.core diff --git a/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/IConceptProperty.java b/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/IConceptProperty.java index 7d0628ad10a..7037f7da08e 100644 --- a/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/IConceptProperty.java +++ b/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/IConceptProperty.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,24 +28,20 @@ public interface IConceptProperty extends FhirCodeSystem { /** - * Returns the FHIR type of the property. - * @return + * @return the FHIR type of the property. */ ConceptPropertyType getConceptPropertyType(); - + /** - * Returns the ID of the property. - * @return + * @return the ID of the property. */ default Code getType() { return getConceptPropertyType().getCode(); } - + default Property propertyOf(Object value, String description) { - Builder prop = Property.builder() - .code(getCodeValue()) - .description(description); - + Builder prop = Property.builder().code(getCodeValue()).description(description); + switch (getConceptPropertyType()) { case CODE: prop.valueCode((String) value); @@ -56,22 +52,22 @@ default Property propertyOf(Object value, String description) { case STRING: prop.valueString((String) value); break; - default: + default: throw new UnsupportedOperationException("Unsupported property type " + getConceptPropertyType()); } - + return prop.build(); } - + /** - * Creates a property for the value without description + * Creates a property for the value without description and returns it. + * * @param value * @return */ default Property propertyOf(Object value) { - Builder prop = Property.builder() - .code(getCodeValue()); - + Builder prop = Property.builder().code(getCodeValue()); + switch (getConceptPropertyType()) { case CODE: prop.valueCode((String) value); @@ -82,22 +78,22 @@ default Property propertyOf(Object value) { case STRING: prop.valueString((String) value); break; - default: + default: throw new UnsupportedOperationException("Unsupported property type " + getConceptPropertyType()); } return prop.build(); } - + /** * Creates a property for the supplier's value without description - * @param value + * + * @param function * @return */ default Property propertyOf(Supplier function) { - - Builder prop = Property.builder() - .code(getCodeValue()); - + + Builder prop = Property.builder().code(getCodeValue()); + switch (getConceptPropertyType()) { case CODE: prop.valueCode((String) function.get()); @@ -108,12 +104,12 @@ default Property propertyOf(Supplier function) { case STRING: prop.valueString((String) function.get()); break; - default: + default: throw new UnsupportedOperationException("Unsupported property type " + getConceptPropertyType()); } return prop.build(); } - + /** * Class that represents {@link IConceptProperty} computed dynamically from certain data sources, code systems, etc.. * @@ -132,7 +128,7 @@ private Dynamic(String codeSystemUri, String displayName, String code, ConceptPr this.code = code; this.propertyType = propertyType; } - + @Override public String getCodeSystemUri() { return codeSystemUri; @@ -147,24 +143,24 @@ public String getDisplayName() { public String getCodeValue() { return code; } - + @Override public ConceptPropertyType getConceptPropertyType() { return propertyType; } - + public static IConceptProperty valueCode(String codeSystemUri, String displayName, String code) { return new Dynamic(codeSystemUri, displayName, code, ConceptPropertyType.CODE); } - + public static IConceptProperty valueBoolean(String codeSystemUri, String displayName, String code) { return new Dynamic(codeSystemUri, displayName, code, ConceptPropertyType.BOOLEAN); } - + public static IConceptProperty valueString(String codeSystemUri, String displayName, String code) { return new Dynamic(codeSystemUri, displayName, code, ConceptPropertyType.STRING); } - + } - + } diff --git a/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/LookupRequest.java b/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/LookupRequest.java index d89814e4f05..e0019587627 100644 --- a/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/LookupRequest.java +++ b/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/codesystem/LookupRequest.java @@ -47,56 +47,42 @@ * @since 6.4 */ @JsonDeserialize(builder = LookupRequest.Builder.class) -@JsonPropertyOrder({"code", "system", "version", "coding", "date", "displayLanguage", "property"}) +@JsonPropertyOrder({ "code", "system", "version", "coding", "date", "displayLanguage", "property" }) public class LookupRequest { - + // The code that is to be located. If a code is provided, a system must be provided (0..1) private final Code code; // The system for the code that is to be located (0..1) private final Uri system; - + // The version that these details are based on (0..1) private final String version; // The coding to look up (0..1) private final Coding coding; - + /* - * The date for which the information should be returned. Normally, this is the - * current conditions (which is the default value) but under some circumstances, - * systems need to acccess this information as it would have been in the past. A - * typical example of this would be where code selection is constrained to the - * set of codes that were available when the patient was treated, not when the - * record is being edited. Note that which date is appropriate is a matter for - * implementation policy. + * The date for which the information should be returned. Normally, this is the current conditions (which is the default value) but under some + * circumstances, systems need to acccess this information as it would have been in the past. A typical example of this would be where code + * selection is constrained to the set of codes that were available when the patient was treated, not when the record is being edited. Note that + * which date is appropriate is a matter for implementation policy. */ private final Date date; - - //The requested language for display (see ExpansionProfile.displayLanguage) + + // The requested language for display (see ExpansionProfile.displayLanguage) private final Code displayLanguage; - + /* - * A property that the client wishes to be returned in the output. If no - * properties are specified, the server chooses what to return. The following - * properties are defined for all code systems: url, name, version (code system - * info) and code information: display, definition, designation, parent and - * child, and for designations, lang.X where X is a designation language code. - * Some of the properties are returned explicit in named parameters (when the - * names match), and the rest (except for lang.X) in the property parameter - * group + * A property that the client wishes to be returned in the output. If no properties are specified, the server chooses what to return. The + * following properties are defined for all code systems: url, name, version (code system info) and code information: display, definition, + * designation, parent and child, and for designations, lang.X where X is a designation language code. Some of the properties are returned + * explicit in named parameters (when the names match), and the rest (except for lang.X) in the property parameter group */ @FhirType(FhirDataType.PART) private final Collection property; - - LookupRequest( - Code code, - Uri system, - String version, - Coding coding, - Date date, - Code displayLanguage, - Collection properties) { + + LookupRequest(Code code, Uri system, String version, Coding coding, Date date, Code displayLanguage, Collection properties) { this.code = code; this.system = system; this.version = version; @@ -105,7 +91,7 @@ public class LookupRequest { this.displayLanguage = displayLanguage; this.property = properties; } - + public String getCode() { if (code != null) { return code.getCodeValue(); @@ -143,83 +129,81 @@ public Code getDisplayLanguage() { public Collection getProperties() { return property; } - + public Collection getPropertyCodes() { return property.stream().map(p -> p.getCodeValue()).collect(Collectors.toSet()); } /** - * Returns true if the given code is present in the given collection of properties, returns false otherwise. - * @param property - * @return + * @param propertyCode + * @return true if the given code is present in the given collection of properties, returns false otherwise. */ public final boolean containsProperty(Code propertyCode) { return property.contains(propertyCode); } - + /** - * Returns true if the property is requested - * @param conceptProperty - the property to check - * @return + * @param conceptProperty + * - the property to check + * @return true if the property is requested, false otherwise. */ public boolean isPropertyRequested(IConceptProperty conceptProperty) { return containsProperty(conceptProperty.getCode()); } - + /** - * Returns true if the version property is requested to be returned. - * @return + * @return true if the version property is requested to be returned, false otherwise. */ public final boolean isVersionPropertyRequested() { return containsProperty(SupportedCodeSystemRequestProperties.VERSION.getCode()); } - + /** * Returns true if the designation property is requested to be returned. + * * @return */ public final boolean isDesignationPropertyRequested() { return containsProperty(SupportedCodeSystemRequestProperties.DESIGNATION.getCode()); } - + public static Builder builder() { return new Builder(); } - + @AssertTrue(message = "Source needs to be set either via code/system or code or codeable concept") private boolean isSourceValid() { return true; - } - + } + @AssertTrue(message = "Code is not provided for the system") private boolean isCodeMissing() { if (system != null && code == null) { return false; } - + if (coding != null && coding.getCodeValue() == null) { return false; } - + return true; } - + @AssertTrue(message = "System is missing for provided code") private boolean isSystemMissing() { if (system == null && code != null) { return false; } - + if (coding != null && coding.getSystem() == null) { return false; } - + return true; } - - + @AssertTrue(message = "Code/system/version and Coding do not match. Probably would make sense to specify only one of them.") private boolean isCodeOrCodingInvalid() { @@ -227,33 +211,31 @@ private boolean isCodeOrCodingInvalid() { if (!coding.getCode().getCodeValue().equals(code.getCodeValue())) { return false; } - + if (!coding.getSystem().getUriValue().equals(system.getUriValue())) { return false; } - + if (!Objects.equals(coding.getVersion(), version)) { return false; } } return true; } - + @AssertTrue(message = "Both system URI and version tag identifies a version.") private boolean isUriVersionInvalid() { - //SNOMED CT specific, both the URI and version identifies the version + // SNOMED CT specific, both the URI and version identifies the version if (system != null) { - if (system.isSnomedUri() - && system.getUriValue().contains("version") - && version != null) { + if (system.isSnomedUri() && system.getUriValue().contains("version") && version != null) { return false; } } return true; } - @JsonPOJOBuilder(withPrefix="") + @JsonPOJOBuilder(withPrefix = "") public static final class Builder extends ValidatingBuilder { private Code code; @@ -263,9 +245,10 @@ public static final class Builder extends ValidatingBuilder { private Date date; private Code displayLanguage; private Set properties = Sets.newHashSet(); - - Builder() {} - + + Builder() { + } + public Builder code(final String code) { this.code = new Code(code); return this; @@ -275,7 +258,7 @@ public Builder system(final String system) { this.system = new Uri(system); return this; } - + public Builder version(final String version) { this.version = version; return this; @@ -285,7 +268,7 @@ public Builder coding(Coding coding) { this.coding = coding; return this; } - + public Builder date(String date) { try { this.date = Dates.parse(date, FhirConstants.DATE_TIME_FORMAT); @@ -294,7 +277,7 @@ public Builder date(String date) { } return this; } - + public Builder displayLanguage(final String displayLanguage) { this.displayLanguage = new Code(displayLanguage); return this; @@ -308,17 +291,17 @@ Builder property(Collection props) { properties = Collections3.toImmutableSet(props); return this; } - + public Builder properties(Collection properties) { this.properties = properties.stream().map(p -> new Code(p)).collect(Collectors.toSet()); return this; } - + public Builder codeProperties(Collection properties) { this.properties = Collections3.toImmutableSet(properties); return this; } - + public Builder addProperty(String property) { this.properties.add(new Code(property)); return this; @@ -330,5 +313,5 @@ protected LookupRequest doBuild() { } } - + } diff --git a/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/valueset/ValueSet.java b/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/valueset/ValueSet.java index a3e548d73e0..9c1b064bf48 100644 --- a/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/valueset/ValueSet.java +++ b/fhir/com.b2international.snowowl.fhir.core/src/com/b2international/snowowl/fhir/core/model/valueset/ValueSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ import com.b2international.snowowl.fhir.core.search.Summary; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.collect.Lists; import io.swagger.annotations.ApiModel; @@ -67,8 +66,7 @@ public class ValueSet extends MetadataResource { //at least one compose or expansion should exist @Valid - @JsonProperty("compose") - private final Collection composeParts; + private final Compose compose; @Valid @JsonProperty @@ -80,18 +78,18 @@ public ValueSet(Id id, final Meta meta, final Uri impliciteRules, Code language, final Uri url, final Identifier identifier, final String version, final String name, final String title, Code status, final Date date, String publisher, final Collection contacts, String description, final Collection usageContexts, final Collection jurisdictions, final Boolean immutable, final String purpose, final String copyright, - final Collection composeParts, final Expansion expansion) { + final Compose compose, final Expansion expansion) { super(id, meta, impliciteRules, language, text, url, identifier, version, name, title, status, date, publisher, contacts, description, usageContexts, jurisdictions, purpose, copyright); this.immutable = immutable; - this.composeParts = composeParts; + this.compose = compose; this.expansion = expansion; } - public Collection getComposeParts() { - return composeParts; + public Compose getCompose() { + return compose; } public static Builder builder(String valueSetId) { @@ -101,7 +99,7 @@ public static Builder builder(String valueSetId) { public static class Builder extends MetadataResource.Builder { private Boolean immutable; - private Collection composeParts = Lists.newArrayList(); + private Compose compose; private Expansion expansion; public Builder(String valueSetId) { @@ -113,8 +111,8 @@ public Builder immutable(Boolean immutable) { return getSelf(); } - public Builder addCompose(final Compose compose) { - this.composeParts.add(compose); + public Builder compose(final Compose compose) { + this.compose = compose; return getSelf(); } @@ -138,7 +136,7 @@ protected ValueSet doBuild() { return new ValueSet(id, meta, implicitRules, language, text, url, identifier, version, name, title, status, date, publisher, contacts, description, usageContexts, jurisdictions, immutable, - purpose, copyright, composeParts, expansion); + purpose, copyright, compose, expansion); } } diff --git a/fhir/com.b2international.snowowl.fhir.rest.feature/feature.xml b/fhir/com.b2international.snowowl.fhir.rest.feature/feature.xml index ba8d8ea9c39..0bba3a0d30d 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.feature/feature.xml +++ b/fhir/com.b2international.snowowl.fhir.rest.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/fhir/com.b2international.snowowl.fhir.rest.feature/pom.xml b/fhir/com.b2international.snowowl.fhir.rest.feature/pom.xml index 13300d28f44..b5ec154be91 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.feature/pom.xml +++ b/fhir/com.b2international.snowowl.fhir.rest.feature/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl fhir-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.fhir.rest.feature diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-api-tests.launch b/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-api-tests.launch index dcdf65f736f..09f539d28d2 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-api-tests.launch +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-api-tests.launch @@ -35,8 +35,8 @@ - - + + diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-unit-tests.launch b/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-unit-tests.launch index c5d11f74371..0d80f03841b 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-unit-tests.launch +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/.launch/fhir-unit-tests.launch @@ -33,7 +33,7 @@ - + diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/META-INF/MANIFEST.MF b/fhir/com.b2international.snowowl.fhir.rest.tests/META-INF/MANIFEST.MF index c6a5dd92c51..1f98def1a60 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/META-INF/MANIFEST.MF +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl FHIR API Tests Bundle-SymbolicName: com.b2international.snowowl.fhir.rest.tests -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.junit;bundle-version="4.12.0", diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/pom.xml b/fhir/com.b2international.snowowl.fhir.rest.tests/pom.xml index e82dad660b6..33afe030e21 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/pom.xml +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl fhir-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.fhir.rest.tests diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/AllFhirRestTests.java b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/AllFhirRestTests.java index e87a2f2aa47..e72811b866b 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/AllFhirRestTests.java +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/AllFhirRestTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,9 +64,10 @@ public class AllFhirRestTests { */ @ClassRule public static final RuleChain appRule = RuleChain - .outerRule(SnowOwlAppRule.snowOwl(AllFhirRestTests.class).clearResources(true)) + .outerRule(SnowOwlAppRule.snowOwl(AllFhirRestTests.class)) .around(new BundleStartRule("org.eclipse.jetty.osgi.boot")) .around(new BundleStartRule("com.b2international.snowowl.core.rest")) - .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, Branch.MAIN_PATH, Resources.Snomed.MINI_RF2_INT, Rf2ReleaseType.FULL)); + .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, Branch.MAIN_PATH, Resources.Snomed.MINI_RF2_INT, Rf2ReleaseType.FULL)) + .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, Branch.MAIN_PATH, Resources.Snomed.MINI_RF2_COMPLEX_BLOCK_MAP, Rf2ReleaseType.DELTA)); } diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/SnomedConceptMapRestTest.java b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/SnomedConceptMapRestTest.java index dbc2df1ca8f..d4be8f4ea2c 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/SnomedConceptMapRestTest.java +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/SnomedConceptMapRestTest.java @@ -39,6 +39,7 @@ public class SnomedConceptMapRestTest extends FhirRestTest { private static final String SIMPLE_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Map Type Reference Sets"; private static final String COMPLEX_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Complex Map Type Reference Sets"; + private static final String COMPLEX_BLOCK_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Complex Map With Map Block Type Reference Sets"; private static final String EXTENDED_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Extended Map Type Reference Sets"; private static final String FHIR_MAP_TYPE_REFSET_VERSION = "FHIR_MAP_TYPE_REFSET_VERSION"; @@ -51,6 +52,7 @@ public static void setupMaps() { mapTypeRefSetIds = TestMapTypeReferenceSetCreator.createSimpleMapTypeReferenceSets(mainBranch, SIMPLE_MAP_TYPE_REFSET_NAME, COMPLEX_MAP_TYPE_REFSET_NAME, + COMPLEX_BLOCK_MAP_TYPE_REFSET_NAME, EXTENDED_MAP_TYPE_REFSET_NAME, FHIR_MAP_TYPE_REFSET_VERSION); } diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TestMapTypeReferenceSetCreator.java b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TestMapTypeReferenceSetCreator.java index 7b8e2ebc5fe..42292b6ba0b 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TestMapTypeReferenceSetCreator.java +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TestMapTypeReferenceSetCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; @@ -58,7 +55,12 @@ public class TestMapTypeReferenceSetCreator extends TestArtifactCreator { * @param version * @return */ - public static List createSimpleMapTypeReferenceSets(String branchPath, String simpleMapName, String complexMapName, String extendedMapName, String version) { + public static List createSimpleMapTypeReferenceSets(String branchPath, + String simpleMapName, + String complexMapName, + String complexBlockMapName, + String extendedMapName, + String version) { List refsetIds = Lists.newArrayList(); @@ -66,22 +68,28 @@ public static List createSimpleMapTypeReferenceSets(String branchPath, S if (!refsetDescription.isPresent()) { - System.out.println("Creating test map type reference set..."); + System.out.println("Creating simple map type reference set..."); String refsetId = createRefsetConcept(branchPath, simpleMapName, SnomedRefSetType.SIMPLE_MAP); System.out.println("Creating reference set members for map type refset: " + simpleMapName); createSimpleMapping(branchPath, refsetId, FhirTestConcepts.BACTERIA, "Bacteria Target"); createSimpleMapping(branchPath, refsetId, FhirTestConcepts.MICROORGANISM, "MO"); refsetIds.add(refsetId); - - System.out.println("Creating test map type reference set..."); + System.out.println("Creating complex map type reference set..."); refsetId = createRefsetConcept(branchPath, complexMapName, SnomedRefSetType.COMPLEX_MAP); System.out.println("Creating reference set members for complex map type refset: " + complexMapName); createComplexMapping(branchPath, refsetId, FhirTestConcepts.BACTERIA, "Bacteria Target"); createComplexMapping(branchPath, refsetId, FhirTestConcepts.MICROORGANISM, "MO"); refsetIds.add(refsetId); - System.out.println("Creating test map type reference set..."); + System.out.println("Creating complex map with map block type reference set..."); + refsetId = createRefsetConcept(branchPath, complexBlockMapName, SnomedRefSetType.COMPLEX_BLOCK_MAP); + System.out.println("Creating reference set members for complex block map type refset: " + complexBlockMapName); + createComplexBlockMapping(branchPath, refsetId, FhirTestConcepts.BACTERIA, "Bacteria Target"); + createComplexBlockMapping(branchPath, refsetId, FhirTestConcepts.MICROORGANISM, "MO"); + refsetIds.add(refsetId); + + System.out.println("Creating extended map type reference set..."); refsetId = createRefsetConcept(branchPath, extendedMapName, SnomedRefSetType.EXTENDED_MAP); System.out.println("Creating reference set members for extended map type refset: " + extendedMapName); createExtendedMapping(branchPath, refsetId, FhirTestConcepts.BACTERIA, "Bacteria Target"); @@ -98,6 +106,8 @@ public static List createSimpleMapTypeReferenceSets(String branchPath, S refsetIds.add(simpleConcept.get().getConceptId()); Optional complexConcept = getRefsetConcept(branchPath, complexMapName); refsetIds.add(complexConcept.get().getConceptId()); + Optional complexBlockConcept = getRefsetConcept(branchPath, complexBlockMapName); + refsetIds.add(complexBlockConcept.get().getConceptId()); Optional extendedConcept = getRefsetConcept(branchPath, extendedMapName); refsetIds.add(extendedConcept.get().getConceptId()); return refsetIds; @@ -145,6 +155,30 @@ private static void createComplexMapping(String branchPath, String refsetId, Str } + private static void createComplexBlockMapping(String branchPath, String refsetId, String referencedConceptId, String mappingTarget) { + + Map properties = Maps.newHashMap(); + properties.put(SnomedRf2Headers.FIELD_MAP_TARGET, mappingTarget); + properties.put(SnomedRf2Headers.FIELD_MAP_ADVICE, "If microorganism then use something else"); + properties.put(SnomedRf2Headers.FIELD_MAP_GROUP, 1); + properties.put(SnomedRf2Headers.FIELD_MAP_PRIORITY, 1); + properties.put(SnomedRf2Headers.FIELD_MAP_RULE, "OTHERWISE TRUE"); + properties.put(SnomedRf2Headers.FIELD_CORRELATION_ID, "447561005"); //correlation not specified + properties.put(SnomedRf2Headers.FIELD_MAP_BLOCK, 1); + + SnomedRequests.prepareNewMember() + .setId(UUID.randomUUID().toString()) + .setModuleId(Concepts.MODULE_SCT_CORE) + .setActive(true) + .setReferenceSetId(refsetId) + .setProperties(properties) + .setReferencedComponentId(referencedConceptId) + .build(SnomedDatastoreActivator.REPOSITORY_UUID, branchPath, "info@b2international.com", "FHIR Automated Test Complex Block Map Type Refset Member") + .execute(getEventBus()) + .getSync(); + + } + private static void createExtendedMapping(String branchPath, String refsetId, String referencedConceptId, String mappingTarget) { Map properties = Maps.newHashMap(); @@ -202,8 +236,8 @@ private static String createRefsetConcept(String branchPath, String refsetName, .setModuleId(Concepts.MODULE_SCT_CORE) .addDescription(createDescription(refsetName + " (foundation metadata concept)", FULLY_SPECIFIED_NAME)) .addDescription(createDescription(refsetName, SYNONYM)) - .addRelationship(createIsaRelationship(CharacteristicType.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(refsetType))) - .addRelationship(createIsaRelationship(CharacteristicType.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(refsetType))) + .addRelationship(createIsaRelationship(Concepts.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(refsetType))) + .addRelationship(createIsaRelationship(Concepts.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(refsetType))) .setRefSet(SnomedRequests.prepareNewRefSet() .setReferencedComponentType(SnomedTerminologyComponentConstants.CONCEPT) .setMapTargetComponentType(SnomedTerminologyComponentConstants.CONCEPT) @@ -223,19 +257,19 @@ private static SnomedDescriptionCreateRequestBuilder createDescription(final Str .setLanguageCode("en") .setTypeId(type) .setTerm(term) - .setCaseSignificance(CaseSignificance.CASE_INSENSITIVE) + .setCaseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .setAcceptability(ImmutableMap.of(SnomedConstants.Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED)); } - private static SnomedRelationshipCreateRequestBuilder createIsaRelationship(final CharacteristicType characteristicType, String destinationId) { + private static SnomedRelationshipCreateRequestBuilder createIsaRelationship(final String characteristicTypeId, String destinationId) { return SnomedRequests.prepareNewRelationship() .setIdFromNamespace(Concepts.B2I_NAMESPACE) .setActive(true) .setModuleId(Concepts.MODULE_SCT_CORE) .setDestinationId(destinationId) .setTypeId(IS_A) - .setCharacteristicType(characteristicType) - .setModifier(RelationshipModifier.EXISTENTIAL); + .setCharacteristicTypeId(characteristicTypeId) + .setModifierId(Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); } } diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TranslateSnomedConceptMapRestTest.java b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TranslateSnomedConceptMapRestTest.java index d456bc1b930..0944a86a73d 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TranslateSnomedConceptMapRestTest.java +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/conceptmap/TranslateSnomedConceptMapRestTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ public class TranslateSnomedConceptMapRestTest extends FhirRestTest { private static final String SIMPLE_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Map Type Reference Sets"; private static final String COMPLEX_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Complex Map Type Reference Sets"; + private static final String COMPLEX_BLOCK_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Complex Map With Map Block Type Reference Sets"; private static final String EXTENDED_MAP_TYPE_REFSET_NAME = "FHIR Automated Test Extended Map Type Reference Sets"; private static final String FHIR_MAP_TYPE_REFSET_VERSION = "FHIR_MAP_TYPE_REFSET_VERSION"; @@ -58,6 +59,7 @@ public static void setupMaps() { mapTypeRefSetIds = TestMapTypeReferenceSetCreator.createSimpleMapTypeReferenceSets(mainBranch, SIMPLE_MAP_TYPE_REFSET_NAME, COMPLEX_MAP_TYPE_REFSET_NAME, + COMPLEX_BLOCK_MAP_TYPE_REFSET_NAME, EXTENDED_MAP_TYPE_REFSET_NAME, FHIR_MAP_TYPE_REFSET_VERSION); } @@ -79,43 +81,29 @@ public void translateMappingTest() throws Exception { TranslateResult result = objectMapper.convertValue(json, TranslateResult.class); assertTrue(result.getResult()); - assertEquals("3 match(es).", result.getMessage()); + assertEquals("4 match(es).", result.getMessage()); Collection matches = result.getMatches(); - assertEquals(3, matches.size()); + assertEquals(4, matches.size()); + assertMatchExists(matches, 0, "equivalent"); + assertMatchExists(matches, 1, "unmatched"); + assertMatchExists(matches, 2, "unmatched"); + assertMatchExists(matches, 3, "unmatched"); + } + + private void assertMatchExists(Collection matches, int refSetIndex, String equivalenceValue) { Optional optionalMatch = matches.stream() - .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(0))) - .findFirst(); - - assertTrue(optionalMatch.isPresent()); - - Match match = optionalMatch.get(); - assertEquals("equivalent", match.getEquivalence().getCodeValue()); - assertEquals("MO", match.getConcept().getCodeValue()); - - optionalMatch = matches.stream() - .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(1))) + .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(refSetIndex))) .findFirst(); assertTrue(optionalMatch.isPresent()); - - match = optionalMatch.get(); - assertEquals("unmatched", match.getEquivalence().getCodeValue()); - assertEquals("MO", match.getConcept().getCodeValue()); - - optionalMatch = matches.stream() - .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(2))) - .findFirst(); - - assertTrue(optionalMatch.isPresent()); - match = optionalMatch.get(); - assertEquals("unmatched", match.getEquivalence().getCodeValue()); + Match match = optionalMatch.get(); + assertEquals(equivalenceValue, match.getEquivalence().getCodeValue()); assertEquals("MO", match.getConcept().getCodeValue()); - } - + @Test public void reverseTranslateMappingTest() throws Exception { @@ -136,41 +124,15 @@ public void reverseTranslateMappingTest() throws Exception { TranslateResult result = objectMapper.convertValue(json, TranslateResult.class); assertTrue(result.getResult()); - assertEquals("3 match(es).", result.getMessage()); + assertEquals("4 match(es).", result.getMessage()); Collection matches = result.getMatches(); - assertEquals(3, matches.size()); - - Optional optionalMatch = matches.stream() - .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(0))) - .findFirst(); - - assertTrue(optionalMatch.isPresent()); - - Match match = optionalMatch.get(); - assertEquals("equivalent", match.getEquivalence().getCodeValue()); - assertEquals("MO", match.getConcept().getCodeValue()); - - optionalMatch = matches.stream() - .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(1))) - .findFirst(); - - assertTrue(optionalMatch.isPresent()); - - match = optionalMatch.get(); - assertEquals("unmatched", match.getEquivalence().getCodeValue()); - assertEquals("MO", match.getConcept().getCodeValue()); - - optionalMatch = matches.stream() - .filter(m -> m.getSource().getUriValue().equals("http://snomed.info/sct/id/" + mapTypeRefSetIds.get(2))) - .findFirst(); - - assertTrue(optionalMatch.isPresent()); - - match = optionalMatch.get(); - assertEquals("unmatched", match.getEquivalence().getCodeValue()); - assertEquals("MO", match.getConcept().getCodeValue()); + assertEquals(4, matches.size()); + assertMatchExists(matches, 0, "equivalent"); + assertMatchExists(matches, 1, "unmatched"); + assertMatchExists(matches, 2, "unmatched"); + assertMatchExists(matches, 3, "unmatched"); } //From a specific Map type reference set diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/SnomedValueSetRestTest.java b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/SnomedValueSetRestTest.java index fa80d426a7b..57a6b2756f4 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/SnomedValueSetRestTest.java +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/SnomedValueSetRestTest.java @@ -61,7 +61,7 @@ public void valueSetsTest() throws Exception { .body("resource.title", equalTo(SIMPLE_TYPE_REFSET_NAME)) .body("resource.name", equalTo(SIMPLE_TYPE_REFSET_NAME)) .body("resource.status", equalTo("active")) - .root("entry.find { it.fullUrl == 'http://localhost:"+RestExtensions.getPort()+"/snowowl/fhir/ValueSet/snomedStore:MAIN/FHIR_SIMPLE_TYPE_REFSET_VERSION:" + simpleTypeRefSetId+ "'}.resource.compose[0].include[0]") + .root("entry.find { it.fullUrl == 'http://localhost:"+RestExtensions.getPort()+"/snowowl/fhir/ValueSet/snomedStore:MAIN/FHIR_SIMPLE_TYPE_REFSET_VERSION:" + simpleTypeRefSetId+ "'}.resource.compose.include[0]") .body("system", equalTo(SnomedUri.SNOMED_BASE_URI_STRING)) .body("filter.size()", equalTo(1)) .body("filter[0].property", equalTo("expression")) @@ -110,7 +110,7 @@ public void getSingleQueryTypeValueSetTest() { .body("version", equalTo("FHIR_QUERY_TYPE_REFSET_VERSION")) .body("name", equalTo("FHIR Automated Test Simple Type Refset")) .body("status", equalTo("active")) - .root("compose[0].include[0]") + .root("compose.include[0]") .body("system", equalTo("http://snomed.info/sct")) .body("filter[0].property", equalTo("expression")) .body("filter[0].value", equalTo("<<410607006")) @@ -138,7 +138,7 @@ public void getSingleSnomedValueSetTest() { .body("name", equalTo("FHIR Automated Test Simple Type Reference Set")) .body("title", equalTo("FHIR Automated Test Simple Type Reference Set")) .body("status", equalTo("active")) - .root("compose[0].include[0]") + .root("compose.include[0]") .body("system", equalTo("http://snomed.info/sct")) .body("filter[0].property", equalTo("expression")) .body("filter[0].value", equalTo("^" + simpleTypeRefSetId)) diff --git a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/TestReferenceSetCreator.java b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/TestReferenceSetCreator.java index 7cfc361fdb8..173721f46fe 100644 --- a/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/TestReferenceSetCreator.java +++ b/fhir/com.b2international.snowowl.fhir.rest.tests/src/com/b2international/snowowl/fhir/tests/endpoints/valueset/TestReferenceSetCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,9 +31,6 @@ import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; @@ -148,8 +145,8 @@ private static String createQueryTypeReferenceset(String branchPath, String refs .setModuleId(Concepts.MODULE_SCT_CORE) .addDescription(createDescription(refsetName + "FHIR Automated Test Query Type Refset (foundation metadata concept)", FULLY_SPECIFIED_NAME)) .addDescription(createDescription(refsetName, SYNONYM)) - .addRelationship(createIsaRelationship(CharacteristicType.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.QUERY))) - .addRelationship(createIsaRelationship(CharacteristicType.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.QUERY))) + .addRelationship(createIsaRelationship(Concepts.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.QUERY))) + .addRelationship(createIsaRelationship(Concepts.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.QUERY))) .setRefSet(SnomedRequests.prepareNewRefSet() .setReferencedComponentType(SnomedTerminologyComponentConstants.CONCEPT) .setType(SnomedRefSetType.QUERY)) @@ -189,8 +186,8 @@ private static String createSimpleTypeRefsetConcept(String branchPath, String re .setModuleId(Concepts.MODULE_SCT_CORE) .addDescription(createDescription(refsetName +" (foundation metadata concept)", FULLY_SPECIFIED_NAME)) .addDescription(createDescription(refsetName, SYNONYM)) - .addRelationship(createIsaRelationship(CharacteristicType.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.SIMPLE))) - .addRelationship(createIsaRelationship(CharacteristicType.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.SIMPLE))) + .addRelationship(createIsaRelationship(Concepts.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.SIMPLE))) + .addRelationship(createIsaRelationship(Concepts.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(SnomedRefSetType.SIMPLE))) .setRefSet(SnomedRequests.prepareNewRefSet() .setReferencedComponentType(SnomedTerminologyComponentConstants.CONCEPT) .setType(SnomedRefSetType.SIMPLE)) @@ -209,19 +206,19 @@ private static SnomedDescriptionCreateRequestBuilder createDescription(final Str .setLanguageCode("en") .setTypeId(type) .setTerm(term) - .setCaseSignificance(CaseSignificance.CASE_INSENSITIVE) + .setCaseSignificanceId(Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .setAcceptability(ImmutableMap.of(SnomedConstants.Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.PREFERRED)); } - private static SnomedRelationshipCreateRequestBuilder createIsaRelationship(final CharacteristicType characteristicType, String destinationId) { + private static SnomedRelationshipCreateRequestBuilder createIsaRelationship(final String characteristicTypeId, String destinationId) { return SnomedRequests.prepareNewRelationship() .setIdFromNamespace(Concepts.B2I_NAMESPACE) .setActive(true) .setModuleId(Concepts.MODULE_SCT_CORE) .setDestinationId(destinationId) .setTypeId(IS_A) - .setCharacteristicType(characteristicType) - .setModifier(RelationshipModifier.EXISTENTIAL); + .setCharacteristicTypeId(characteristicTypeId) + .setModifierId(Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); } } diff --git a/fhir/com.b2international.snowowl.fhir.rest/META-INF/MANIFEST.MF b/fhir/com.b2international.snowowl.fhir.rest/META-INF/MANIFEST.MF index e09b34d2f3c..fc06d315e2b 100644 --- a/fhir/com.b2international.snowowl.fhir.rest/META-INF/MANIFEST.MF +++ b/fhir/com.b2international.snowowl.fhir.rest/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl FHIR REST API Bundle-SymbolicName: com.b2international.snowowl.fhir.rest -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.snowowl.core.rest Automatic-Module-Name: com.b2international.snowowl.fhir.rest diff --git a/fhir/com.b2international.snowowl.fhir.rest/pom.xml b/fhir/com.b2international.snowowl.fhir.rest/pom.xml index 5da3c650d0e..8bd9c734f04 100644 --- a/fhir/com.b2international.snowowl.fhir.rest/pom.xml +++ b/fhir/com.b2international.snowowl.fhir.rest/pom.xml @@ -4,7 +4,7 @@ com.b2international.snowowl fhir-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.fhir.rest diff --git a/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/core/rest/FhirApiConfig.java b/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/core/rest/FhirApiConfig.java index e5c74fd8ee4..22423600ef2 100644 --- a/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/core/rest/FhirApiConfig.java +++ b/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/core/rest/FhirApiConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ public Docket fhirDocs() { getApiBaseUrl(), "fhir", "1.0", - "Snow Owl® FHIR API", + "FHIR API", "https://b2i.sg/", "support@b2i.sg", "API License", diff --git a/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/FhirConceptMapRestService.java b/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/FhirConceptMapRestService.java index 279c7c08f7f..6ee63b8d8bb 100644 --- a/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/FhirConceptMapRestService.java +++ b/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/FhirConceptMapRestService.java @@ -272,7 +272,7 @@ public Parameters.Fhir translate( /** * HTTP POST request to translate a code that belongs to any {@link ConceptMap} in the system. - * @param {@link TranslateRequest} + * @param in - {@link TranslateRequest}} * @return translation of the code */ @ApiOperation( diff --git a/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/StructureDefinitionService.java b/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/StructureDefinitionService.java index 66f97462828..a02c4f074d4 100644 --- a/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/StructureDefinitionService.java +++ b/fhir/com.b2international.snowowl.fhir.rest/src/com/b2international/snowowl/fhir/rest/StructureDefinitionService.java @@ -59,7 +59,7 @@ public class StructureDefinitionService extends BaseFhirResourceRestService com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/net4j/com.b2international.snowowl.eventbus.tests/META-INF/MANIFEST.MF b/net4j/com.b2international.snowowl.eventbus.tests/META-INF/MANIFEST.MF index d205c3de340..0f616c0d71c 100644 --- a/net4j/com.b2international.snowowl.eventbus.tests/META-INF/MANIFEST.MF +++ b/net4j/com.b2international.snowowl.eventbus.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: EventBus Tests Bundle-SymbolicName: com.b2international.snowowl.eventbus.tests -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.snowowl.eventbus;bundle-version="3.1.0" Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/net4j/com.b2international.snowowl.eventbus.tests/pom.xml b/net4j/com.b2international.snowowl.eventbus.tests/pom.xml index 11a4980b2fc..82750d9e8c9 100644 --- a/net4j/com.b2international.snowowl.eventbus.tests/pom.xml +++ b/net4j/com.b2international.snowowl.eventbus.tests/pom.xml @@ -8,7 +8,7 @@ com.b2international.snowowl net4j-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/net4j/com.b2international.snowowl.eventbus/META-INF/MANIFEST.MF b/net4j/com.b2international.snowowl.eventbus/META-INF/MANIFEST.MF index 56131768725..844ebb93793 100644 --- a/net4j/com.b2international.snowowl.eventbus/META-INF/MANIFEST.MF +++ b/net4j/com.b2international.snowowl.eventbus/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Net4J Eventbus Bundle-SymbolicName: com.b2international.snowowl.eventbus;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.net4j;bundle-version="4.1.2", diff --git a/net4j/com.b2international.snowowl.eventbus/pom.xml b/net4j/com.b2international.snowowl.eventbus/pom.xml index 721d36b74d0..4e70935edc0 100644 --- a/net4j/com.b2international.snowowl.eventbus/pom.xml +++ b/net4j/com.b2international.snowowl.eventbus/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl net4j-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT
\ No newline at end of file diff --git a/net4j/com.b2international.snowowl.rpc.test/META-INF/MANIFEST.MF b/net4j/com.b2international.snowowl.rpc.test/META-INF/MANIFEST.MF index 7c91724b95f..5c5cd234abf 100644 --- a/net4j/com.b2international.snowowl.rpc.test/META-INF/MANIFEST.MF +++ b/net4j/com.b2international.snowowl.rpc.test/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Remote Procedure Call Tests Bundle-SymbolicName: com.b2international.snowowl.rpc.test;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy diff --git a/net4j/com.b2international.snowowl.rpc.test/pom.xml b/net4j/com.b2international.snowowl.rpc.test/pom.xml index 4147694780b..a95fc3e681e 100644 --- a/net4j/com.b2international.snowowl.rpc.test/pom.xml +++ b/net4j/com.b2international.snowowl.rpc.test/pom.xml @@ -7,7 +7,7 @@ com.b2international.snowowl net4j-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.rpc.test eclipse-test-plugin diff --git a/net4j/com.b2international.snowowl.rpc/META-INF/MANIFEST.MF b/net4j/com.b2international.snowowl.rpc/META-INF/MANIFEST.MF index 23130f33160..77c31904cce 100644 --- a/net4j/com.b2international.snowowl.rpc/META-INF/MANIFEST.MF +++ b/net4j/com.b2international.snowowl.rpc/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl Remote Procedure Call Bundle-SymbolicName: com.b2international.snowowl.rpc;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Activator: com.b2international.snowowl.internal.rpc.bundle.OM$Activator Bundle-Vendor: B2i Healthcare Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.100", diff --git a/net4j/com.b2international.snowowl.rpc/pom.xml b/net4j/com.b2international.snowowl.rpc/pom.xml index 25745c19ab2..73d947ed015 100644 --- a/net4j/com.b2international.snowowl.rpc/pom.xml +++ b/net4j/com.b2international.snowowl.rpc/pom.xml @@ -6,7 +6,7 @@ com.b2international.snowowl net4j-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.rpc eclipse-plugin diff --git a/net4j/pom.xml b/net4j/pom.xml index 3afea7d3c24..3bac0473923 100644 --- a/net4j/pom.xml +++ b/net4j/pom.xml @@ -9,7 +9,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/pom.xml b/pom.xml index 2671543edca..491146d1aeb 100644 --- a/pom.xml +++ b/pom.xml @@ -1,13 +1,13 @@ - 4.0.0 - com.b2international.snowowl - snowowl-parent - 7.3.0-SNAPSHOT - pom + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + 4.0.0 + com.b2international.snowowl + snowowl-parent + 7.4.0-SNAPSHOT + pom UTF-8 @@ -16,7 +16,7 @@ 2.9.10 2.9.10.1 - 4.1.16.Final + 4.1.43.Final 1.7.25 1.2.3 [1.2.3,1.2.4) @@ -66,7 +66,6 @@ - false @@ -75,21 +74,6 @@ remote-repos https://repo.maven.apache.org/maven2 - - - - - - - - - - - - - - - protege-mvn-repo https://b2ihealthcare.github.io/protege/ @@ -115,22 +99,6 @@ - - - - - - - - - - - - - - - - @@ -935,11 +903,6 @@ maven-assembly-plugin 2.3 - - - - -
diff --git a/releng/com.b2international.snowowl.server.update/category.xml b/releng/com.b2international.snowowl.server.update/category.xml index 4e613c9da34..6acec323a97 100644 --- a/releng/com.b2international.snowowl.server.update/category.xml +++ b/releng/com.b2international.snowowl.server.update/category.xml @@ -1,27 +1,27 @@ - + - + - + - + - + - + - + - + diff --git a/releng/com.b2international.snowowl.server.update/pom.xml b/releng/com.b2international.snowowl.server.update/pom.xml index 18abbafabee..9b21c4f1087 100644 --- a/releng/com.b2international.snowowl.server.update/pom.xml +++ b/releng/com.b2international.snowowl.server.update/pom.xml @@ -8,7 +8,7 @@ com.b2international.snowowl releng-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/releng/com.b2international.snowowl.server.update/snow-owl-oss.product b/releng/com.b2international.snowowl.server.update/snow-owl-oss.product index 7d2e1bdd081..668811f9f49 100644 --- a/releng/com.b2international.snowowl.server.update/snow-owl-oss.product +++ b/releng/com.b2international.snowowl.server.update/snow-owl-oss.product @@ -1,7 +1,7 @@ - + diff --git a/releng/pom.xml b/releng/pom.xml index 5b7ef026c9d..e609d301967 100644 --- a/releng/pom.xml +++ b/releng/pom.xml @@ -8,7 +8,7 @@ com.b2international.snowowl snowowl-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/releng/target-platform/pom.xml b/releng/target-platform/pom.xml index d543dcec475..a42f70aee0a 100644 --- a/releng/target-platform/pom.xml +++ b/releng/target-platform/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl releng-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT target-platform diff --git a/snomed/com.b2international.snowowl.snomed.common/META-INF/MANIFEST.MF b/snomed/com.b2international.snowowl.snomed.common/META-INF/MANIFEST.MF index 2263bc8aebf..60fe46c2c84 100644 --- a/snomed/com.b2international.snowowl.snomed.common/META-INF/MANIFEST.MF +++ b/snomed/com.b2international.snowowl.snomed.common/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT Commons Bundle-SymbolicName: com.b2international.snowowl.snomed.common -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Export-Package: com.b2international.snowowl.snomed.common diff --git a/snomed/com.b2international.snowowl.snomed.common/pom.xml b/snomed/com.b2international.snowowl.snomed.common/pom.xml index 7b91e7183f6..7c5e5d01d42 100644 --- a/snomed/com.b2international.snowowl.snomed.common/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.common/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl snomed-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.common eclipse-plugin diff --git a/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedConstants.java b/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedConstants.java index 38682f04115..b14fcfd3cfd 100644 --- a/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedConstants.java +++ b/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,13 +15,9 @@ */ package com.b2international.snowowl.snomed.common; -import java.util.Collection; -import java.util.Collections; import java.util.Map; import java.util.Set; -import com.google.common.collect.BiMap; -import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; @@ -200,6 +196,9 @@ private Concepts() { } public static final String REFSET_DRUG_TO_GROUPER_SIMPLE_MAP = "499896751000133109"; public static final String REFSET_DRUG_TO_PACKAGING_SIMPLE_MAP = "780548781000133105"; + // complex map with map block type + public static final String REFSET_COMPLEX_BLOCK_MAP_TYPE = "999001671000000105"; + //used for NEHTA AU AMT extension /**@deprecated For NEHTA only. {@value}*/ @Deprecated public static final String REFSET_STRENGTH = "700000111000036105"; @@ -427,7 +426,6 @@ private Concepts() { } // Module dependency public static final String ATTRIBUTE_TYPE_SOURCE_EFFECTIVE_TIME = "900000000000536009"; public static final String ATTRIBUTE_TYPE_TARGET_EFFECTIVE_TIME = "900000000000537000"; - } // RF2 effective time format diff --git a/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedRf2Headers.java b/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedRf2Headers.java index 14845c6d63f..32346426c61 100644 --- a/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedRf2Headers.java +++ b/snomed/com.b2international.snowowl.snomed.common/src/com/b2international/snowowl/snomed/common/SnomedRf2Headers.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,6 +121,9 @@ public abstract class SnomedRf2Headers { public static final String FIELD_MRCM_RULE_REFSET_ID = "mrcmRuleRefsetId"; + // Field used in "complex map with map block" reference sets + public static final String FIELD_MAP_BLOCK = "mapBlock"; + public static final String ATTRIBUTE_DESCRIPTION = "attributeDescription"; public static final String ATTRIBUTE_TYPE = "attributeType"; public static final String ATTRIBUTE_ORDER = "attributeOrder"; @@ -381,6 +384,21 @@ public abstract class SnomedRf2Headers { ATTRIBUTE_ORDER }; + public static final String[] COMPLEX_BLOCK_MAP_TYPE_HEADER = new String[] { + FIELD_ID, + FIELD_EFFECTIVE_TIME, + FIELD_ACTIVE, + FIELD_MODULE_ID, + FIELD_REFSET_ID, + FIELD_REFERENCED_COMPONENT_ID, + FIELD_MAP_GROUP, + FIELD_MAP_PRIORITY, + FIELD_MAP_RULE, + FIELD_MAP_ADVICE, + FIELD_MAP_TARGET, + FIELD_CORRELATION_ID, + FIELD_MAP_BLOCK }; + private SnomedRf2Headers() { // Prevent instantiation } diff --git a/snomed/com.b2international.snowowl.snomed.core.feature/feature.xml b/snomed/com.b2international.snowowl.snomed.core.feature/feature.xml index cdb57b79b4b..a034a036837 100644 --- a/snomed/com.b2international.snowowl.snomed.core.feature/feature.xml +++ b/snomed/com.b2international.snowowl.snomed.core.feature/feature.xml @@ -2,7 +2,7 @@ @@ -89,4 +89,18 @@ Visit us at http://b2i.sg version="0.0.0" unpack="false"/> + + + + diff --git a/snomed/com.b2international.snowowl.snomed.core.feature/pom.xml b/snomed/com.b2international.snowowl.snomed.core.feature/pom.xml index 7a333f8450e..79e4b1c9a27 100644 --- a/snomed/com.b2international.snowowl.snomed.core.feature/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.core.feature/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl snomed-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.core.feature eclipse-feature diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.feature/feature.xml b/snomed/com.b2international.snowowl.snomed.core.rest.feature/feature.xml index 4277d5ebc96..fb04555a59f 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.feature/feature.xml +++ b/snomed/com.b2international.snowowl.snomed.core.rest.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.feature/pom.xml b/snomed/com.b2international.snowowl.snomed.core.rest.feature/pom.xml index 37c19be6242..b469dde0a8a 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.feature/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.core.rest.feature/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl snomed-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.core.rest.feature eclipse-feature diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests (cis).launch b/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests (cis).launch index c842ddc9875..0021cc27a7c 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests (cis).launch +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests (cis).launch @@ -29,12 +29,12 @@ - + - - + + diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests.launch b/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests.launch index 3cbb0a2f41a..e2a5402d951 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests.launch +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/.launch/snomed-e2e-tests.launch @@ -33,7 +33,7 @@ - + diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/META-INF/MANIFEST.MF b/snomed/com.b2international.snowowl.snomed.core.rest.tests/META-INF/MANIFEST.MF index eeb63910cad..4bea1ec5c7c 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/META-INF/MANIFEST.MF +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT REST API Tests Bundle-SymbolicName: com.b2international.snowowl.snomed.core.rest.tests -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0", diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/pom.xml b/snomed/com.b2international.snowowl.snomed.core.rest.tests/pom.xml index bd99f16c3b9..e4f01fac8aa 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/pom.xml @@ -8,7 +8,7 @@ com.b2international.snowowl snomed-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/io/SnomedRefSetDSVExportTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/io/SnomedRefSetDSVExportTest.java index 28c9cba4351..4d2c2f1f865 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/io/SnomedRefSetDSVExportTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/io/SnomedRefSetDSVExportTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,6 @@ import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; import com.b2international.snowowl.snomed.core.domain.constraint.SnomedCardinalityPredicate; @@ -209,8 +208,8 @@ private Set relationshipKeysOf(SnomedConcepts concepts) { .stream() .flatMap(concept -> concept.getRelationships().stream()) .filter(r -> r.isActive() && - (CharacteristicType.STATED_RELATIONSHIP.equals(r.getCharacteristicType()) - || CharacteristicType.ADDITIONAL_RELATIONSHIP.equals(r.getCharacteristicType()))) + (Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId()) + || Concepts.ADDITIONAL_RELATIONSHIP.equals(r.getCharacteristicTypeId()))) .map(r -> String.format("%s=%s", r.getTypeId(), r.getDestinationId())) .collect(Collectors.toSet()); } @@ -236,8 +235,8 @@ private String createRefset(String branchPath, SnomedRefSetType type) { SnomedDescriptionCreateRequestBuilder fsn = toDescriptionRequest(Concepts.FULLY_SPECIFIED_NAME, "term-test"); SnomedDescriptionCreateRequestBuilder pt = toDescriptionRequest(Concepts.SYNONYM, "test"); - SnomedRelationshipCreateRequestBuilder statedIsA = toRelationshipRequest(Concepts.IS_A, CharacteristicType.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(type)); - SnomedRelationshipCreateRequestBuilder inferredIsA = toRelationshipRequest(Concepts.IS_A, CharacteristicType.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(type)); + SnomedRelationshipCreateRequestBuilder statedIsA = toRelationshipRequest(Concepts.IS_A, Concepts.STATED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(type)); + SnomedRelationshipCreateRequestBuilder inferredIsA = toRelationshipRequest(Concepts.IS_A, Concepts.INFERRED_RELATIONSHIP, SnomedRefSetUtil.getParentConceptId(type)); SnomedRefSetCreateRequestBuilder refSet = toRefSetRequest(type); @@ -293,13 +292,13 @@ private String generateId() { .orElseThrow(() -> new IllegalStateException("Couldn't generate identifier concept ID")); } - private SnomedRelationshipCreateRequestBuilder toRelationshipRequest(String typeId, CharacteristicType characteristicType, String desctinationId) { + private SnomedRelationshipCreateRequestBuilder toRelationshipRequest(String typeId, String characteristicTypeId, String desctinationId) { return SnomedRequests.prepareNewRelationship() .setIdFromNamespace(Concepts.B2I_NAMESPACE) .setModuleId(Concepts.MODULE_SCT_CORE) .setDestinationId(desctinationId) .setTypeId(typeId) - .setCharacteristicType(characteristicType); + .setCharacteristicTypeId(characteristicTypeId); } private SnomedDescriptionCreateRequestBuilder toDescriptionRequest(String typeId, String term) { diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/EclSerializerTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/EclSerializerTest.java index 50398a30cdf..2467c0296e3 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/EclSerializerTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/EclSerializerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/IssueSO2503RemoteJobDynamicMappingFix.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/IssueSO2503RemoteJobDynamicMappingFix.java index c2eb45a2ce7..98edcaf7276 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/IssueSO2503RemoteJobDynamicMappingFix.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/issue/IssueSO2503RemoteJobDynamicMappingFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedApiTest.java index 9fc85730b86..79b51c6f8b8 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,103 +15,16 @@ */ package com.b2international.snowowl.snomed.core.rest; -import java.util.Optional; -import java.util.Random; - -import org.junit.Rule; -import org.junit.rules.TestWatcher; -import org.junit.runner.Description; - -import com.b2international.snowowl.core.api.IBranchPath; -import com.b2international.snowowl.core.branch.Branch; -import com.b2international.snowowl.datastore.BranchPathUtils; -import com.b2international.snowowl.eventbus.IEventBus; -import com.b2international.snowowl.test.commons.Services; +import com.b2international.snowowl.test.commons.rest.AbstractApiTest; /** - * @since 2.0 + * @since 7.3 */ -@BranchBase(Branch.MAIN_PATH) -public abstract class AbstractSnomedApiTest { - - private static final Random RANDOM = new Random(); - - private final class CustomTestWatcher extends TestWatcher { - @Override - protected void starting(Description description) { - System.out.println("===== Start of " + description + " ====="); - - Class testClass = description.getTestClass(); - BranchBase branchBaseAnnotation = getBranchBaseAnnotation(testClass); - String testBasePath = getTestBasePath(branchBaseAnnotation); - String testClassName = testClass.getSimpleName(); - - if (isolateTests(branchBaseAnnotation)) { - String testMethodName = description.getMethodName() - .replace("[", "_") // Remove special characters from parameterized test names - .replace("]", ""); - - // Also add a random suffix if it would go over the 50 character branch name limit - if (testMethodName.length() > 50) { - String suffix = Integer.toString(RANDOM.nextInt(Integer.MAX_VALUE), 36); - testMethodName = testMethodName.substring(0, 44) + suffix; - } - - branchPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join(testBasePath, testClassName, testMethodName)); - } else { - branchPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join(testBasePath, testClassName)); - } - - SnomedBranchingRestRequests.createBranchRecursively(branchPath); - } - - @Override - protected void finished(Description description) { - System.out.println("===== End of " + description + " ====="); - } +public abstract class AbstractSnomedApiTest extends AbstractApiTest { - private BranchBase getBranchBaseAnnotation(Class type) { - if (type.isAnnotationPresent(BranchBase.class)) { - return type.getAnnotation(BranchBase.class); - } else { - if (type.getSuperclass() != null) { - BranchBase doc = getBranchBaseAnnotation(type.getSuperclass()); - if (doc != null) { - return doc; - } - } - - for (Class iface : type.getInterfaces()) { - BranchBase doc = getBranchBaseAnnotation(iface); - if (doc != null) { - return doc; - } - } - - return null; - } - } - - private String getTestBasePath(BranchBase branchBaseAnnotation) { - return Optional.ofNullable(branchBaseAnnotation) - .map(a -> a.value()) - .orElse(Branch.MAIN_PATH); - } - - private boolean isolateTests(BranchBase branchBaseAnnotation) { - return Optional.ofNullable(branchBaseAnnotation) - .map(a -> a.isolateTests()) - .orElse(true); - } - } - - protected IBranchPath branchPath; - - protected IEventBus getBus() { - return Services.bus(); + @Override + protected String getApiBaseUrl() { + return SnomedApiTestConstants.SCT_API; } - @Rule - public final TestWatcher watcher = new CustomTestWatcher(); - } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AllSnomedApiTests.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AllSnomedApiTests.java index 237e23d374c..c578e23ead1 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AllSnomedApiTests.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/AllSnomedApiTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -107,10 +107,11 @@ public class AllSnomedApiTests { @ClassRule public static final RuleChain appRule = RuleChain - .outerRule(SnowOwlAppRule.snowOwl(AllSnomedApiTests.class).clearResources(true)) + .outerRule(SnowOwlAppRule.snowOwl(AllSnomedApiTests.class)) .around(new BundleStartRule("org.eclipse.jetty.osgi.boot")) .around(new BundleStartRule("com.b2international.snowowl.core.rest")) .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, Branch.MAIN_PATH, Resources.Snomed.MINI_RF2_INT, Rf2ReleaseType.FULL)) - .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME, SnomedApiTestConstants.EXTENSION_PATH, Resources.Snomed.MINI_RF2_EXT, Rf2ReleaseType.DELTA)); + .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME, SnomedApiTestConstants.EXTENSION_PATH, Resources.Snomed.MINI_RF2_EXT, Rf2ReleaseType.DELTA)) + .around(new SnomedContentRule(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, Branch.MAIN_PATH, Resources.Snomed.MINI_RF2_COMPLEX_BLOCK_MAP, Rf2ReleaseType.DELTA)); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/Issue3019FixDeletionOfReferringMembersTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/Issue3019FixDeletionOfReferringMembersTest.java index 955969743da..76998118b2f 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/Issue3019FixDeletionOfReferringMembersTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/Issue3019FixDeletionOfReferringMembersTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import org.junit.Test; -import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; +import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedApiTestConstants.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedApiTestConstants.java index 7f1a1c1845d..829eb65bdd8 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedApiTestConstants.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedApiTestConstants.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.google.common.base.Joiner; import com.google.common.collect.ImmutableMap; /** @@ -71,8 +70,6 @@ public abstract class SnomedApiTestConstants { public static final String EXTENSION_PATH = "MAIN/2016-07-31/SNOMEDCT-B2I"; - public static final Joiner PATH_JOINER = Joiner.on('/'); - public static final String OWL_AXIOM_1 = "SubClassOf(ObjectIntersectionOf(:73211009 ObjectSomeValuesFrom(:246075003 :410942007)) :8801005)"; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestRequestTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestRequestTest.java index 141597bf9ad..a5169bfe426 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestRequestTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedCompareRestRequestTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentRestRequests.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentRestRequests.java index e3e46ac34c7..0755949c197 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentRestRequests.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentRestRequests.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,16 +15,21 @@ */ package com.b2international.snowowl.snomed.core.rest; +import static com.b2international.snowowl.test.commons.rest.RestExtensions.COMMA_JOINER; +import static com.b2international.snowowl.test.commons.rest.RestExtensions.JSON_UTF8; import static com.b2international.snowowl.test.commons.rest.RestExtensions.givenAuthenticatedRequest; +import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.assertNotNull; import java.util.Map; +import org.hamcrest.Matchers; + import com.b2international.snowowl.core.api.IBranchPath; -import com.google.common.base.Charsets; -import com.google.common.base.Joiner; +import com.b2international.snowowl.snomed.core.domain.AssociationTarget; +import com.b2international.snowowl.snomed.core.domain.InactivationProperties; +import com.google.common.collect.ImmutableMap; -import io.restassured.http.ContentType; import io.restassured.response.ValidatableResponse; /** @@ -34,9 +39,35 @@ */ public abstract class SnomedComponentRestRequests { - private static final Joiner COMMA_JOINER = Joiner.on(","); - private static final String JSON_UTF8 = ContentType.JSON.withCharset(Charsets.UTF_8); + public static ValidatableResponse assertInactivation(final IBranchPath branchPath, final String conceptId, InactivationProperties inactivationProperties) { + return assertInactivation(branchPath, conceptId, inactivationProperties, null); + } + + public static ValidatableResponse assertInactivation(final IBranchPath branchPath, final String conceptId, InactivationProperties inactivationProperties, final String defaultModuleId) { + ImmutableMap.Builder inactivationRequestBody = ImmutableMap.builder() + .put("active", false) + .put("inactivationProperties", inactivationProperties) + .put("commitComment", "Inactivated concept"); + + if (defaultModuleId != null) { + inactivationRequestBody.put("defaultModuleId", defaultModuleId); + } + SnomedComponentType type = SnomedComponentType.getByComponentId(conceptId); + updateComponent(branchPath, type, conceptId, inactivationRequestBody.build()) + .statusCode(204); + + final String[] associationReferenceSetIds = inactivationProperties.getAssociationTargets().stream().map(AssociationTarget::getReferenceSetId).toArray(length -> new String[length]); + final String[] associationTargets = inactivationProperties.getAssociationTargets().stream().map(AssociationTarget::getTargetComponentId).toArray(length -> new String[length]); + + return getComponent(branchPath, type, conceptId, "inactivationProperties(),members()") + .statusCode(200) + .body("active", equalTo(false)) + .body("inactivationProperties.inactivationIndicatorId", equalTo(inactivationProperties.getInactivationIndicatorId())) + .body("inactivationProperties.associationTargets.referenceSetId", Matchers.containsInAnyOrder(associationReferenceSetIds)) + .body("inactivationProperties.associationTargets.targetComponentId", Matchers.containsInAnyOrder(associationTargets)); + } + public static ValidatableResponse createComponent(IBranchPath branchPath, SnomedComponentType type, Map requestBody) { return givenAuthenticatedRequest(SnomedApiTestConstants.SCT_API) .contentType(JSON_UTF8) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentType.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentType.java index ac84f4729ea..98dcce5625a 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentType.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedComponentType.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ import java.util.Locale; +import com.b2international.snowowl.snomed.cis.SnomedIdentifiers; + /** * Enumerates SNOMED CT component types used in the REST API tests. * @@ -36,4 +38,14 @@ public enum SnomedComponentType { public String toLowerCasePlural() { return toString().toLowerCase(Locale.ENGLISH) + "s"; } + + public static SnomedComponentType getByComponentId(String componentId) { + switch (SnomedIdentifiers.getComponentCategory(componentId)) { + case CONCEPT: return SnomedComponentType.CONCEPT; + case DESCRIPTION: return SnomedComponentType.DESCRIPTION; + case RELATIONSHIP: return SnomedComponentType.RELATIONSHIP; + default: throw new UnsupportedOperationException("Not supported for componentId: " + componentId); + } + + } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestRequests.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestRequests.java index 9a02d1d2a3e..3ee49bb1cbb 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestRequests.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestRequests.java @@ -24,6 +24,7 @@ import java.io.InputStream; import java.util.Map; +import com.b2international.snowowl.test.commons.rest.AbstractApiTest; import com.google.common.io.ByteSource; import com.google.common.io.Files; @@ -33,7 +34,7 @@ /** * @since 5.4 */ -public abstract class SnomedExportRestRequests extends AbstractSnomedApiTest { +public abstract class SnomedExportRestRequests extends AbstractApiTest { public static ValidatableResponse createExport(final Map exportConfiguration) { return givenAuthenticatedRequest(SnomedApiTestConstants.SCT_API) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedMergingRestRequests.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedMergingRestRequests.java index a2b9485fd32..b57d1411c8c 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedMergingRestRequests.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedMergingRestRequests.java @@ -35,7 +35,7 @@ */ public abstract class SnomedMergingRestRequests { - private static final long MERGE_POLLING_INTERVAL = 2_000L; + private static final long MERGE_POLLING_INTERVAL = 200L; private static final Set FINISH_STATES = ImmutableSet.of( Merge.Status.COMPLETED.name(), diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetDeletionPerformanceTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetDeletionPerformanceTest.java index 729207eef84..aecb8a61735 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetDeletionPerformanceTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetDeletionPerformanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,6 @@ import com.b2international.snowowl.core.terminology.ComponentCategory; import com.b2international.snowowl.snomed.cis.domain.SctId; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; import com.b2international.snowowl.snomed.datastore.request.SnomedConceptCreateRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionCreateRequestBuilder; @@ -120,8 +119,8 @@ private void createConcepts(final Set conceptIds, final BulkRequestBuild .setModuleId(Concepts.MODULE_SCT_CORE) .addDescription(createDescriptionRequest(Concepts.FULLY_SPECIFIED_NAME, "fsn")) .addDescription(createDescriptionRequest(Concepts.SYNONYM, "pt")) - .addRelationship(createRelationshipRequest(Concepts.IS_A, CharacteristicType.STATED_RELATIONSHIP, Concepts.MODULE_SCT_CORE)) - .addRelationship(createRelationshipRequest(Concepts.IS_A, CharacteristicType.INFERRED_RELATIONSHIP, Concepts.MODULE_SCT_CORE)); + .addRelationship(createRelationshipRequest(Concepts.IS_A, Concepts.STATED_RELATIONSHIP, Concepts.MODULE_SCT_CORE)) + .addRelationship(createRelationshipRequest(Concepts.IS_A, Concepts.INFERRED_RELATIONSHIP, Concepts.MODULE_SCT_CORE)); bulk.add(conceptCreateRequestBuilder); } @@ -141,13 +140,13 @@ private Set generateConceptIds(int quantity) { .collect(Collectors.toSet()); } - private SnomedRelationshipCreateRequestBuilder createRelationshipRequest(String typeId, CharacteristicType characteristicType, String desctinationId) { + private SnomedRelationshipCreateRequestBuilder createRelationshipRequest(String typeId, String characteristicTypeId, String desctinationId) { return SnomedRequests.prepareNewRelationship() .setIdFromNamespace(Concepts.B2I_NAMESPACE) .setModuleId(Concepts.MODULE_SCT_CORE) .setDestinationId(desctinationId) .setTypeId(typeId) - .setCharacteristicType(characteristicType); + .setCharacteristicTypeId(characteristicTypeId); } private SnomedDescriptionCreateRequestBuilder createDescriptionRequest(String typeId, String term) { diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedRestFixtures.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedRestFixtures.java index d1de2d234d8..1fdb44bfcc7 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedRestFixtures.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/SnomedRestFixtures.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,9 +41,6 @@ import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; import com.b2international.snowowl.snomed.core.domain.refset.DataType; @@ -74,11 +71,15 @@ public static String createNewConcept(IBranchPath conceptPath) { } public static String createNewConcept(IBranchPath conceptPath, String parentConceptId) { - Map conceptRequestBody = createConceptRequestBody(parentConceptId) + Map conceptRequestBody = createConceptRequestBody(parentConceptId) .put("commitComment", "Created new concept") .build(); - return lastPathSegment(createComponent(conceptPath, SnomedComponentType.CONCEPT, conceptRequestBody) + return createNewConcept(conceptPath, conceptRequestBody); + } + + public static String createNewConcept(IBranchPath conceptPath, Map requestBody) { + return lastPathSegment(createComponent(conceptPath, SnomedComponentType.CONCEPT, requestBody) .statusCode(201) .body(equalTo("")) .extract().header("Location")); @@ -89,7 +90,12 @@ public static Builder createConceptRequestBody(String parentConc } public static Builder createConceptRequestBody(String parentConceptId, String moduleId, Map acceptabilityMap) { + return createConceptRequestBody(parentConceptId, moduleId, acceptabilityMap, true); + } + + public static Builder createConceptRequestBody(String parentConceptId, String moduleId, Map acceptabilityMap, boolean active) { Map relationshipRequestBody = ImmutableMap.builder() + .put("active", active) .put("moduleId", moduleId) .put("typeId", Concepts.IS_A) .put("destinationId", parentConceptId) @@ -112,6 +118,7 @@ public static Builder createConceptRequestBody(String parentConc .build(); Builder conceptRequestBody = ImmutableMap.builder() + .put("active", active) .put("moduleId", moduleId) .put("descriptions", ImmutableList.of(fsnRequestBody, ptRequestBody)) .put("relationships", ImmutableList.of(relationshipRequestBody)); @@ -132,7 +139,7 @@ public static String createNewDescription(IBranchPath descriptionPath, String co } public static String createNewDescription(IBranchPath descriptionPath, String conceptId, String typeId, Map acceptabilityMap, final String languageCode) { - Map requestBody = createDescriptionRequestBody(conceptId, typeId, Concepts.MODULE_SCT_CORE, acceptabilityMap, CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE, languageCode) + Map requestBody = createDescriptionRequestBody(conceptId, typeId, Concepts.MODULE_SCT_CORE, acceptabilityMap, Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE, languageCode) .put("commitComment", "Created new description") .build(); @@ -177,17 +184,17 @@ public static Builder createDescriptionRequestBody(String concep } public static Builder createDescriptionRequestBody(String conceptId, String typeId, String moduleId, Map acceptabilityMap) { - return createDescriptionRequestBody(conceptId, typeId, moduleId, acceptabilityMap, CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE); + return createDescriptionRequestBody(conceptId, typeId, moduleId, acceptabilityMap, Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE); } public static Builder createDescriptionRequestBody(String conceptId, String typeId, String moduleId, Map acceptabilityMap, - CaseSignificance caseSignificance) { - return createDescriptionRequestBody(conceptId, typeId, moduleId, acceptabilityMap, caseSignificance, DEFAULT_LANGUAGE_CODE); + String caseSignificanceId) { + return createDescriptionRequestBody(conceptId, typeId, moduleId, acceptabilityMap, caseSignificanceId, DEFAULT_LANGUAGE_CODE); } private static Builder createDescriptionRequestBody(String conceptId, String typeId, String moduleId, Map acceptabilityMap, - CaseSignificance caseSignificance, final String languageCode) { + String caseSignificanceId, final String languageCode) { return ImmutableMap.builder() .put("conceptId", conceptId) .put("moduleId", moduleId) @@ -195,23 +202,23 @@ private static Builder createDescriptionRequestBody(String conce .put("term", DEFAULT_TERM) .put("languageCode", languageCode) .put("acceptability", acceptabilityMap) - .put("caseSignificance", caseSignificance); + .put("caseSignificanceId", caseSignificanceId); } public static String createNewRelationship(IBranchPath relationshipPath) { - return createNewRelationship(relationshipPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.STATED_RELATIONSHIP, 0); + return createNewRelationship(relationshipPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.STATED_RELATIONSHIP, 0); } public static String createNewRelationship(IBranchPath relationshipPath, String sourceId, String typeId, String destinationId) { - return createNewRelationship(relationshipPath, sourceId, typeId, destinationId, CharacteristicType.STATED_RELATIONSHIP, 0); + return createNewRelationship(relationshipPath, sourceId, typeId, destinationId, Concepts.STATED_RELATIONSHIP, 0); } - public static String createNewRelationship(IBranchPath relationshipPath, String sourceId, String typeId, String destinationId, CharacteristicType characteristicType) { - return createNewRelationship(relationshipPath, sourceId, typeId, destinationId, characteristicType, 0); + public static String createNewRelationship(IBranchPath relationshipPath, String sourceId, String typeId, String destinationId, String characteristicTypeId) { + return createNewRelationship(relationshipPath, sourceId, typeId, destinationId, characteristicTypeId, 0); } - public static String createNewRelationship(IBranchPath relationshipPath, String sourceId, String typeId, String destinationId, CharacteristicType characteristicType, int group) { - Map relationshipRequestBody = createRelationshipRequestBody(sourceId, typeId, destinationId, Concepts.MODULE_SCT_CORE, characteristicType, group) + public static String createNewRelationship(IBranchPath relationshipPath, String sourceId, String typeId, String destinationId, String characteristicTypeId, int group) { + Map relationshipRequestBody = createRelationshipRequestBody(sourceId, typeId, destinationId, Concepts.MODULE_SCT_CORE, characteristicTypeId, group) .put("commitComment", "Created new relationship") .build(); @@ -222,24 +229,24 @@ public static String createNewRelationship(IBranchPath relationshipPath, String } public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId) { - return createRelationshipRequestBody(sourceId, typeId, destinationId, Concepts.MODULE_SCT_CORE, CharacteristicType.STATED_RELATIONSHIP, 0); + return createRelationshipRequestBody(sourceId, typeId, destinationId, Concepts.MODULE_SCT_CORE, Concepts.STATED_RELATIONSHIP, 0); } - public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId, CharacteristicType characteristicType) { - return createRelationshipRequestBody(sourceId, typeId, destinationId, Concepts.MODULE_SCT_CORE, characteristicType, 0); + public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId, String characteristicTypeId) { + return createRelationshipRequestBody(sourceId, typeId, destinationId, Concepts.MODULE_SCT_CORE, characteristicTypeId, 0); } - public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId, String moduleId) { - return createRelationshipRequestBody(sourceId, typeId, destinationId, moduleId, CharacteristicType.STATED_RELATIONSHIP, 0); + public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId, String moduleId, String characteristicTypeId) { + return createRelationshipRequestBody(sourceId, typeId, destinationId, moduleId, characteristicTypeId, 0); } - public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId, String moduleId, CharacteristicType characteristicType, int group) { + public static Builder createRelationshipRequestBody(String sourceId, String typeId, String destinationId, String moduleId, String characteristicTypeId, int group) { return ImmutableMap.builder() .put("moduleId", moduleId) .put("sourceId", sourceId) .put("typeId", typeId) .put("destinationId", destinationId) - .put("characteristicType", characteristicType) + .put("characteristicTypeId", characteristicTypeId) .put("group", group); } @@ -365,8 +372,8 @@ public static void inactivateRelationship(IBranchPath relationshipPath, String r } @SuppressWarnings("unchecked") - public static void reactivateConcept(IBranchPath conceptPath, String id) { - final Map concept = getComponent(conceptPath, SnomedComponentType.CONCEPT, id, "descriptions()", "relationships()") + public static void reactivateConcept(IBranchPath branch, String conceptId) { + final Map concept = getComponent(branch, SnomedComponentType.CONCEPT, conceptId, "descriptions()", "relationships()") .statusCode(200) .extract().as(Map.class); @@ -376,20 +383,23 @@ public static void reactivateConcept(IBranchPath conceptPath, String id) { reactivationRequest.remove("associationTargets"); reactivationRequest.put("commitComment", "Reactivated concept"); + // reactivate all relationships as well final Map relationships = (Map) reactivationRequest.get("relationships"); final List> relationshipItems = (List>) relationships.get("items"); - relationshipItems.get(0).put("active", true); + relationshipItems.forEach(relationship -> { + relationship.put("active", true); + }); - updateComponent(conceptPath, SnomedComponentType.CONCEPT, id, reactivationRequest).statusCode(204); + updateComponent(branch, SnomedComponentType.CONCEPT, conceptId, reactivationRequest).statusCode(204); } public static void changeCaseSignificance(IBranchPath descriptionPath, String descriptionId) { - changeCaseSignificance(descriptionPath, descriptionId, CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE); + changeCaseSignificance(descriptionPath, descriptionId, Concepts.ENTIRE_TERM_CASE_SENSITIVE); } - public static void changeCaseSignificance(IBranchPath descriptionPath, String descriptionId, CaseSignificance caseSignificance) { + public static void changeCaseSignificance(IBranchPath descriptionPath, String descriptionId, String caseSignificanceId) { Map descriptionUpdateRequest = ImmutableMap.builder() - .put("caseSignificance", caseSignificance) + .put("caseSignificanceId", caseSignificanceId) .put("commitComment", "Changed case significance on description") .build(); @@ -398,7 +408,7 @@ public static void changeCaseSignificance(IBranchPath descriptionPath, String de public static void changeToDefining(IBranchPath conceptPath, String conceptId) { Map conceptUpdateRequest = ImmutableMap.builder() - .put("definitionStatus", DefinitionStatus.FULLY_DEFINED) + .put("definitionStatusId", Concepts.FULLY_DEFINED) .put("commitComment", "Changed definition status on concept") .build(); @@ -550,6 +560,16 @@ public static Map getValidProperties(SnomedRefSetType refSetType .put(SnomedRf2Headers.FIELD_MAP_ADVICE, "complexMapAdvice") .put(SnomedRf2Headers.FIELD_CORRELATION_ID, Concepts.REFSET_CORRELATION_NOT_SPECIFIED) .build(); + case COMPLEX_BLOCK_MAP: + return ImmutableMap.builder() + .put(SnomedRf2Headers.FIELD_MAP_TARGET, "complexBlockMapTarget") + .put(SnomedRf2Headers.FIELD_MAP_GROUP, 0) + .put(SnomedRf2Headers.FIELD_MAP_PRIORITY, 0) + .put(SnomedRf2Headers.FIELD_MAP_RULE, "complexBlockMapRule") + .put(SnomedRf2Headers.FIELD_MAP_ADVICE, "complexBlockMapAdvice") + .put(SnomedRf2Headers.FIELD_CORRELATION_ID, Concepts.REFSET_CORRELATION_NOT_SPECIFIED) + .put(SnomedRf2Headers.FIELD_MAP_BLOCK, 1) + .build(); case DESCRIPTION_TYPE: return ImmutableMap.builder() .put(SnomedRf2Headers.FIELD_DESCRIPTION_FORMAT, Concepts.ROOT_CONCEPT) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedBranchingApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedBranchingApiTest.java index 6fd4f125d82..70846671403 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedBranchingApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedBranchingApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.b2international.snowowl.snomed.core.rest.branches; import static com.b2international.snowowl.datastore.BranchPathUtils.createPath; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.*; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.hasItem; @@ -34,54 +33,54 @@ public class SnomedBranchingApiTest extends AbstractSnomedApiTest { @Test public void readNonExistentBranch() { - getBranch(createPath("MAIN/x/y/z")).statusCode(404); + branching.getBranch(createPath("MAIN/x/y/z")).statusCode(404); } @Test public void createBranchWithNonexistentParent() { - createBranch(createPath("MAIN/x/y/z")).statusCode(400); + branching.createBranch(createPath("MAIN/x/y/z")).statusCode(400); } @Test public void updateMetadata() throws Exception { - updateBranch(branchPath, ImmutableMap.of("key", "value")); - getBranch(branchPath).body("metadata.key", equalTo("value")); + branching.updateBranch(branchPath, ImmutableMap.of("key", "value")); + branching.getBranch(branchPath).body("metadata.key", equalTo("value")); } @Test public void updateMainMetadata() throws Exception { // XXX: modifies MAIN branch, may affect other tests - updateBranch(BranchPathUtils.createMainPath(), ImmutableMap.of("key", "value")); - getBranch(BranchPathUtils.createMainPath()).body("metadata.key", equalTo("value")); + branching.updateBranch(BranchPathUtils.createMainPath(), ImmutableMap.of("key", "value")); + branching.getBranch(BranchPathUtils.createMainPath()).body("metadata.key", equalTo("value")); } @Test public void createChildBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); - getBranch(a).statusCode(200); + branching.createBranch(a).statusCode(201); + branching.getBranch(a).statusCode(200); } @Test public void createChildBranchWithMetadata() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a, ImmutableMap.of("key", "value")).statusCode(201); - getBranch(a).statusCode(200).body("metadata.key", equalTo("value")); + branching.createBranch(a, ImmutableMap.of("key", "value")).statusCode(201); + branching.getBranch(a).statusCode(200).body("metadata.key", equalTo("value")); } @Test public void createBranchTwice() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); - createBranch(a).statusCode(409); + branching.createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(409); } @Test public void deleteChildBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); - deleteBranch(a).statusCode(204); - getBranch(a).statusCode(200).body("deleted", equalTo(true)); + branching.createBranch(a).statusCode(201); + branching.deleteBranch(a).statusCode(204); + branching.getBranch(a).statusCode(200).body("deleted", equalTo(true)); } @Test @@ -89,13 +88,13 @@ public void deleteBranchRecursively() { IBranchPath a = createPath(branchPath, "a"); IBranchPath b = createPath(a, "b"); - createBranchRecursively(b); - getBranch(b).statusCode(200); - getBranch(a).statusCode(200); + branching.createBranchRecursively(b); + branching.getBranch(b).statusCode(200); + branching.getBranch(a).statusCode(200); - deleteBranch(a).statusCode(204); - getBranch(a).statusCode(200).body("deleted", equalTo(true)); - getBranch(b).statusCode(200).body("deleted", equalTo(true)); + branching.deleteBranch(a).statusCode(204); + branching.getBranch(a).statusCode(200).body("deleted", equalTo(true)); + branching.getBranch(b).statusCode(200).body("deleted", equalTo(true)); } @Test @@ -103,10 +102,10 @@ public void createBranchOnDeletedBranch() { IBranchPath a = createPath(branchPath, "a"); IBranchPath b = createPath(a, "b"); - createBranch(a).statusCode(201); - deleteBranch(a).statusCode(204); + branching.createBranch(a).statusCode(201); + branching.deleteBranch(a).statusCode(204); - createBranch(b).statusCode(400); + branching.createBranch(b).statusCode(400); } @Test @@ -114,13 +113,13 @@ public void getChildren() { IBranchPath a = createPath(branchPath, "a"); IBranchPath b = createPath(a, "b"); - createBranchRecursively(b); + branching.createBranchRecursively(b); - getAllBranches().statusCode(200) + branching.getAllBranches().statusCode(200) .body("items.name", hasItem(a.lastSegment())) .body("items.name", hasItem(b.lastSegment())); - getBranchChildren(branchPath).statusCode(200) + branching.getBranchChildren(branchPath).statusCode(200) .body("items.name", hasItem(a.lastSegment())) .body("items.name", hasItem(b.lastSegment())); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeApiTest.java index 7c3f12d9cd1..8c2c80abd8b 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.b2international.snowowl.snomed.core.rest.branches; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getNextAvailableEffectiveDate; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.deleteComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; @@ -42,9 +41,6 @@ import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; import com.google.common.collect.ImmutableMap; @@ -60,7 +56,7 @@ public class SnomedMergeApiTest extends AbstractSnomedApiTest { private static void rebaseConceptDeletionOverChange(IBranchPath parentPath, IBranchPath childPath, String conceptId) { final Map changeOnParent = ImmutableMap.builder() - .put("definitionStatus", DefinitionStatus.FULLY_DEFINED) + .put("definitionStatusId", Concepts.FULLY_DEFINED) .put("commitComment", "Changed definition status on parent") .build(); @@ -73,7 +69,7 @@ private static void rebaseConceptDeletionOverChange(IBranchPath parentPath, IBra @Test public void mergeNewConceptForward() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String conceptId = createNewConcept(a); merge(a, branchPath, "Merged new concept from child branch").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -85,7 +81,7 @@ public void mergeNewConceptForward() { @Test public void mergeNewDescriptionForward() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String descriptionId = createNewDescription(a); merge(a, branchPath, "Merged new description from child branch").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -97,7 +93,7 @@ public void mergeNewDescriptionForward() { @Test public void mergeNewRelationshipForward() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String relationshipId = createNewRelationship(a); merge(a, branchPath, "Merged new relationship from child branch").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -109,7 +105,7 @@ public void mergeNewRelationshipForward() { @Test public void noMergeWithNonExistentReview() throws BadRequestException { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); createNewConcept(a); merge(a, branchPath, "Merged new concept from child branch with non-existent review ID", "non-existent-id") @@ -188,18 +184,18 @@ public void noMergeWithNonExistentReview() throws BadRequestException { @Test public void mergeNewConceptToUnrelatedBranch() { final IBranchPath v1 = BranchPathUtils.createPath(branchPath, "v1"); - createBranch(v1).statusCode(201); + branching.createBranch(v1).statusCode(201); // Concept 1 is created on the two branches' common ancestor final String concept1Id = createNewConcept(branchPath); final IBranchPath v2 = BranchPathUtils.createPath(branchPath, "v2"); - createBranch(v2).statusCode(201); + branching.createBranch(v2).statusCode(201); final IBranchPath a = BranchPathUtils.createPath(v1, "extension-old"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final IBranchPath b = BranchPathUtils.createPath(v2, "extension-new"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); // Concept 2 is initially only visible on branch "extension-old" final String concept2Id = createNewConcept(a); @@ -218,9 +214,9 @@ public void mergeNewConceptToUnrelatedBranch() { @Test public void mergeNewDescriptionToUnrelatedBranch() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final IBranchPath b = BranchPathUtils.createPath(branchPath, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); final String descriptionId = createNewDescription(a); getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200); @@ -235,9 +231,9 @@ public void mergeNewDescriptionToUnrelatedBranch() { @Test public void mergeNewRelationshipToUnrelatedBranch() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final IBranchPath b = BranchPathUtils.createPath(branchPath, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); final String relationshipId = createNewRelationship(a); getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200); @@ -254,7 +250,7 @@ public void mergeReactivatedConcept() { final String conceptId = createInactiveConcept(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); reactivateConcept(a, conceptId); @@ -273,7 +269,7 @@ public void rebaseReactivatedConcept() { final String concept1Id = createInactiveConcept(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); reactivateConcept(a, concept1Id); @@ -303,7 +299,7 @@ public void rebaseReactivatedConcept() { @Test public void rebaseNewConceptDiverged() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String concept1Id = createNewConcept(branchPath); final String concept2Id = createNewConcept(a); @@ -328,7 +324,7 @@ public void rebaseNewConceptDiverged() { @Test public void rebaseNewDescriptionDiverged() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String description1Id = createNewDescription(branchPath); final String description2Id = createNewDescription(a); @@ -353,7 +349,7 @@ public void rebaseNewDescriptionDiverged() { @Test public void rebaseNewRelationshipDiverged() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String relationship1Id = createNewRelationship(branchPath); final String relationship2Id = createNewRelationship(a); @@ -378,10 +374,10 @@ public void rebaseNewRelationshipDiverged() { @Test public void rebaseNewConceptStale() { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); final String concept1Id = createNewConcept(b); final String concept2Id = createNewConcept(a); @@ -410,12 +406,12 @@ public void rebaseChangedConceptOnParentDeletedOnBranch() { final String conceptId = createNewConcept(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); rebaseConceptDeletionOverChange(branchPath, a, conceptId); // Concept should still be present on parent, and deleted on child - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(200).body("definitionStatus", equalTo(DefinitionStatus.FULLY_DEFINED.name())); + getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(200).body("definitionStatusId", equalTo(Concepts.FULLY_DEFINED)); getComponent(a, SnomedComponentType.CONCEPT, conceptId).statusCode(404); } @@ -424,14 +420,14 @@ public void rebaseChangedDescriptionOnParentDeletedOnBranch() { final String descriptionId = createNewDescription(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); changeCaseSignificance(branchPath, descriptionId); // Parent branch changes to CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE deleteComponent(a, SnomedComponentType.DESCRIPTION, descriptionId, false).statusCode(204); merge(branchPath, a, "Rebased deletion over case significance change").body("status", equalTo(Merge.Status.COMPLETED.name())); - getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificance", equalTo(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.name())); + getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE)); getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(404); } @@ -440,7 +436,7 @@ public void rebaseAndMergeChangedOnParentDeletedOnBranch() { final String conceptId = createNewConcept(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); rebaseConceptDeletionOverChange(branchPath, a, conceptId); @@ -456,12 +452,12 @@ public void rebaseAndMergeChangedDescription() { final String description1Id = createNewDescription(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String description2Id = createNewDescription(branchPath); final Map requestBody = ImmutableMap.builder() - .put("caseSignificance", CaseSignificance.CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .put("moduleId", Concepts.MODULE_ROOT) .put("commitComment", "Changed case significance and module on child") .build(); @@ -476,11 +472,11 @@ public void rebaseAndMergeChangedDescription() { // Description 1 retains the changes on child, keeps the original values on parent getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200) - .body("caseSignificance", equalTo(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.name())) + .body("caseSignificanceId", equalTo(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE)) .body("moduleId", equalTo(Concepts.MODULE_SCT_CORE)); getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200) - .body("caseSignificance", equalTo(CaseSignificance.CASE_INSENSITIVE.name())) + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)) .body("moduleId", equalTo(Concepts.MODULE_ROOT)); merge(a, branchPath, "Merged description change to parent").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -490,11 +486,11 @@ public void rebaseAndMergeChangedDescription() { // Description 1 changes are visible everywhere getComponent(branchPath, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200) - .body("caseSignificance", equalTo(CaseSignificance.CASE_INSENSITIVE.name())) + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)) .body("moduleId", equalTo(Concepts.MODULE_ROOT)); getComponent(a, SnomedComponentType.DESCRIPTION, description1Id).statusCode(200) - .body("caseSignificance", equalTo(CaseSignificance.CASE_INSENSITIVE.name())) + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)) .body("moduleId", equalTo(Concepts.MODULE_ROOT)); } @@ -503,7 +499,7 @@ public void rebaseAndMergeNewDescriptionBothDeleted() { final String description1Id = createNewDescription(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String description2Id = createNewDescription(branchPath); @@ -532,7 +528,7 @@ public void rebaseOverReusedRelationshipId() { final String relationshipId = createNewRelationship(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); deleteComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, false).statusCode(204); @@ -561,7 +557,7 @@ public void rebaseOverReusedRelationshipId() { @Test public void rebaseTextDefinitions() throws Exception { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); // Create two new text definitions with "cross-shaped" acceptability on child final String textDefinition1Id = createNewTextDefinition(a, ImmutableMap.of(Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED, Concepts.REFSET_LANGUAGE_TYPE_US, Acceptability.ACCEPTABLE)); @@ -586,13 +582,13 @@ public void rebaseTextDefinitions() throws Exception { @Test public void rebaseStaleBranchWithChangesOnDeletedContent() throws Exception { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String relationshipId = createNewRelationship(a); final String descriptionId = createNewDescription(a); final IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); deleteComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId, false).statusCode(204); deleteComponent(a, SnomedComponentType.DESCRIPTION, descriptionId, false).statusCode(204); @@ -615,13 +611,13 @@ public void rebaseStaleBranchWithChangesOnDeletedContent() throws Exception { @Test public void rebaseStaleBranchWithChangesOnNewContent() throws Exception { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String relationshipId = createNewRelationship(a); final String descriptionId = createNewDescription(a); final IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); changeCaseSignificance(b, descriptionId); changeRelationshipGroup(b, relationshipId); @@ -630,27 +626,31 @@ public void rebaseStaleBranchWithChangesOnNewContent() throws Exception { createNewRelationship(branchPath); merge(branchPath, a, "Rebased new components over new relationship").body("status", equalTo(Merge.Status.COMPLETED.name())); - getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificance", equalTo(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.name())); - getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("group", equalTo(0)); + getComponent(a, SnomedComponentType.DESCRIPTION, descriptionId) + .statusCode(200) + .body("caseSignificanceId", equalTo(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE)); + getComponent(a, SnomedComponentType.RELATIONSHIP, relationshipId) + .statusCode(200) + .body("group", equalTo(0)); // "b" should be STALE at this point, try to rebase it, it should pass and the components should still exist with changed content merge(a, b, "Rebased changed components over new components").body("status", equalTo(Merge.Status.COMPLETED.name())); // Verify that the two components have the modified values - getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificance", equalTo(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.name())); + getComponent(b, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200).body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE)); getComponent(b, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200).body("group", equalTo(99)); } @Test public void rebaseStaleBranchWithDeleteOnChangedContent() throws Exception { final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final String relationshipId = createNewRelationship(a); final String descriptionId = createNewDescription(a); final IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); // Make changes on branch "a" changeCaseSignificance(a, descriptionId); @@ -678,10 +678,10 @@ public void rebaseChangedConceptOnBranchDeletedOnParent() { final String conceptId = createNewConcept(branchPath); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final Map requestBody = ImmutableMap.builder() - .put("definitionStatus", DefinitionStatus.FULLY_DEFINED) + .put("definitionStatusId", Concepts.FULLY_DEFINED) .put("commitComment", "Changed definition status on child") .build(); @@ -700,7 +700,7 @@ public void rebaseUnsetEffectiveTimeOnSource() { updateRefSetMemberEffectiveTime(branchPath, memberId, calendar.getTime()); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); calendar.add(Calendar.DATE, 1); updateRefSetMemberEffectiveTime(branchPath, memberId, calendar.getTime()); // Parent increases the effective time by one day @@ -734,7 +734,7 @@ public void rebaseUnsetEffectiveTimeOnTarget() { updateRefSetMemberEffectiveTime(branchPath, memberId, calendar.getTime()); final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); final Map parentRequest = ImmutableMap.builder() .put("active", false) @@ -766,10 +766,10 @@ public void rebaseConceptDeletionOverNewOutboundRelationships() throws Exception // new child branch of test parent branch final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); // create a new outbound relationship - final String newOutboundRelationshipFromDeletedConcept = createNewRelationship(branchPath, deletedConcept, Concepts.FINDING_SITE, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + final String newOutboundRelationshipFromDeletedConcept = createNewRelationship(branchPath, deletedConcept, Concepts.FINDING_SITE, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); // delete destination concept on child branch deleteComponent(a, SnomedComponentType.CONCEPT, deletedConcept, false); @@ -790,10 +790,10 @@ public void rebaseConceptDeletionOverNewInboundRelationships() throws Exception // new child branch of test parent branch final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); // create a new relationship to newly created destination concept on parent branch - final String newInboundRelationshipToDeletedConcept = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.FINDING_SITE, deletedConcept, CharacteristicType.INFERRED_RELATIONSHIP); + final String newInboundRelationshipToDeletedConcept = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.FINDING_SITE, deletedConcept, Concepts.INFERRED_RELATIONSHIP); // delete destination concept on child branch deleteComponent(a, SnomedComponentType.CONCEPT, deletedConcept, false); @@ -813,11 +813,11 @@ public void rebaseConceptDeletionOverNewOutAndInboundRelationships() throws Exce // new child branch of test parent branch final IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); // create a new relationship to newly created destination concept on parent branch - final String newInboundRelationshipToDeletedConcept = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.FINDING_SITE, deletedConcept, CharacteristicType.INFERRED_RELATIONSHIP); - final String newOutboundRelationshipFromDeletedConcept = createNewRelationship(branchPath, deletedConcept, Concepts.FINDING_SITE, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + final String newInboundRelationshipToDeletedConcept = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.FINDING_SITE, deletedConcept, Concepts.INFERRED_RELATIONSHIP); + final String newOutboundRelationshipFromDeletedConcept = createNewRelationship(branchPath, deletedConcept, Concepts.FINDING_SITE, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); // delete destination concept on child branch deleteComponent(a, SnomedComponentType.CONCEPT, deletedConcept, false); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeConflictTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeConflictTest.java index 5673d4f9251..227f6918beb 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeConflictTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedMergeConflictTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ package com.b2international.snowowl.snomed.core.rest.branches; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getNextAvailableEffectiveDate; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.deleteComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.updateComponent; @@ -50,7 +49,6 @@ import com.b2international.snowowl.datastore.BranchPathUtils; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; import com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; @@ -68,9 +66,9 @@ public void changedInSourceAndTargetMergeConflict() { String descriptionId = createNewDescription(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); - changeCaseSignificance(branchPath, descriptionId, CaseSignificance.CASE_INSENSITIVE); // Parent branch changes to CaseSignificance.CASE_INSENSITIVE + changeCaseSignificance(branchPath, descriptionId, Concepts.ENTIRE_TERM_CASE_INSENSITIVE); // Parent branch changes to CaseSignificance.CASE_INSENSITIVE changeCaseSignificance(a, descriptionId); // Child branch changes to CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE Collection conflicts = merge(branchPath, a, "Rebased case significance change over case significance change") @@ -82,8 +80,8 @@ public void changedInSourceAndTargetMergeConflict() { ConflictingAttribute attribute = ConflictingAttributeImpl.builder() .property("caseSignificanceId") - .oldValue(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.getConceptId()) - .value(CaseSignificance.CASE_INSENSITIVE.getConceptId()) + .oldValue(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE) + .value(Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .build(); MergeConflict conflict = Iterables.getOnlyElement(conflicts); @@ -99,16 +97,16 @@ public void changedInSourceAndTargetMultipleConflict() { String descriptionId = createNewDescription(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); Map changesOnParent = ImmutableMap.builder() - .put("caseSignificance", CaseSignificance.CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .put("moduleId", Concepts.MODULE_ROOT) .put("commitComment", "Changed case significance and module on parent") .build(); Map changesOnBranch = ImmutableMap.builder() - .put("caseSignificance", CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_SENSITIVE) .put("moduleId", Concepts.MODULE_SCT_MODEL_COMPONENT) .put("commitComment", "Changed case significance and module on branch") .build(); @@ -132,8 +130,8 @@ public void changedInSourceAndTargetMultipleConflict() { Map expectedAttributes = newHashMap(); expectedAttributes.put("caseSignificanceId", ConflictingAttributeImpl.builder() .property("caseSignificanceId") - .oldValue(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.getConceptId()) - .value(CaseSignificance.CASE_INSENSITIVE.getConceptId()) + .oldValue(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE) + .value(Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .build()); expectedAttributes.put("moduleId", ConflictingAttributeImpl.builder() @@ -156,7 +154,7 @@ public void changedInSourceDetachedInTargetMergeConflict() { String memberId = createNewRefSetMember(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); Date nextEffectiveTime = getNextAvailableEffectiveDate(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME); String nextEffectiveTimeAsString = EffectiveTimes.format(nextEffectiveTime, DateFormats.SHORT); @@ -206,7 +204,7 @@ public void changedInSourceDetachedInTargetMergeConflict() { @Test public void addedInSourceAndTargetMergeConflict() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String descriptionId = createNewDescription(branchPath); @@ -218,7 +216,7 @@ public void addedInSourceAndTargetMergeConflict() { .put("term", "Synonym of root concept") .put("languageCode", "en") .put("acceptability", SnomedApiTestConstants.UK_ACCEPTABLE_MAP) - .put("caseSignificance", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .put("commitComment", "Created new synonym with duplicate SCTID") .build(); @@ -245,7 +243,7 @@ public void addedInTargetDetachedInSourceMergeConflict() { String conceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); deleteComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204); String relationshipId = createNewRelationship(a, Concepts.ROOT_CONCEPT, Concepts.PART_OF, conceptId); @@ -274,7 +272,7 @@ public void addedInSourceDetachedInTargetMergeConflict() { String conceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, conceptId); deleteComponent(a, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204); @@ -298,7 +296,7 @@ public void deleteReferencedComponentOnSourceMergeConflict() { String conceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); deleteComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204); String memberId = createNewRefSetMember(a, conceptId); @@ -328,7 +326,7 @@ public void deleteReferencedComponentOnTargetMergeConflict() { String conceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); createNewRefSetMember(branchPath, conceptId); deleteComponent(a, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204); @@ -352,7 +350,7 @@ public void noMergeNewDescriptionToUnrelatedBranch() { String conceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); /* * XXX: Creating a new description on the concept itself would result in a DELETED_WHILE_CHANGED conflict; @@ -361,7 +359,7 @@ public void noMergeNewDescriptionToUnrelatedBranch() { createNewDescription(a, Concepts.ROOT_CONCEPT, conceptId); IBranchPath b = BranchPathUtils.createPath(branchPath, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); deleteComponent(b, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204); @@ -385,12 +383,12 @@ public void noMergeNewRelationshipToUnrelatedBranch() { String conceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); createNewRelationship(a, Concepts.ROOT_CONCEPT, Concepts.PART_OF, conceptId); IBranchPath b = BranchPathUtils.createPath(branchPath, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); deleteComponent(b, SnomedComponentType.CONCEPT, conceptId, false).statusCode(204); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedReviewApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedReviewApiTest.java index c04749fa261..a3e5b99816f 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedReviewApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/branches/SnomedReviewApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.core.rest.branches; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.deleteComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createNewConcept; import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createNewDescription; @@ -89,7 +88,7 @@ public void createReviewRebaseMain() { @Test public void createRegularReview() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String reviewId = getReviewJobId(createReview(a, branchPath)); @@ -104,7 +103,7 @@ public void reviewBeforeMerge() { String deletedConceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String newConceptId = createNewConcept(a); createNewRelationship(a); @@ -126,7 +125,7 @@ public void reviewBeforeRebase() { String deletedConceptId = createNewConcept(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String newConceptId = createNewConcept(branchPath); createNewRelationship(branchPath); @@ -148,7 +147,7 @@ public void reviewDescriptionInactivationRebase() { String descriptionId = createNewDescription(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); inactivateDescription(branchPath, descriptionId); @@ -165,7 +164,7 @@ public void reviewRelationshipInactivationRebase() { String relationshipId = createNewRelationship(branchPath); IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); inactivateRelationship(branchPath, relationshipId); @@ -181,12 +180,12 @@ public void reviewRelationshipInactivationRebase() { @Test public void reviewAfterParentRebase() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String deletedConceptId = createNewConcept(a); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); deleteComponent(a, SnomedComponentType.CONCEPT, deletedConceptId, false).statusCode(204); String newConcept1Id = createNewConcept(a); @@ -216,12 +215,12 @@ public void reviewAfterParentRebase() { @Test public void reviewAfterParentMerge() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String deletedConceptId = createNewConcept(a); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); deleteComponent(a, SnomedComponentType.CONCEPT, deletedConceptId, false).statusCode(204); String newConcept1Id = createNewConcept(a); @@ -254,7 +253,7 @@ public void reviewAfterParentMerge() { @Test public void deleteReviewAndChanges() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String reviewId = getReviewJobId(createReview(a, branchPath)); waitForReviewJob(reviewId).body("status", equalTo(ReviewStatus.CURRENT.name())); @@ -269,7 +268,7 @@ public void deleteReviewAndChanges() { @Test public void setReviewStale() throws Exception { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String reviewId = getReviewJobId(createReview(a, branchPath)); waitForReviewJob(reviewId).body("status", equalTo(ReviewStatus.CURRENT.name())); @@ -285,9 +284,9 @@ public void setReviewStale() throws Exception { @Test public void setReviewStaleAfterParentRebase() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranch(b).statusCode(201); + branching.createBranch(b).statusCode(201); createNewConcept(branchPath); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/classification/SnomedClassificationApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/classification/SnomedClassificationApiTest.java index 80162230a28..c0bbc93b16d 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/classification/SnomedClassificationApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/classification/SnomedClassificationApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,8 +48,6 @@ import com.b2international.snowowl.core.api.IBranchPath; import com.b2international.snowowl.core.repository.JsonSupport; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; @@ -75,7 +73,7 @@ public class SnomedClassificationApiTest extends AbstractSnomedApiTest { private static int getPersistedInferredRelationshipCount(IBranchPath conceptPath, String conceptId) { List> relationships = getComponent(conceptPath, SnomedComponentType.CONCEPT, conceptId, - "relationships(\"active\":true,\"characteristicType\":\"" + CharacteristicType.INFERRED_RELATIONSHIP.getConceptId() + "\")") + "relationships(\"active\":true,\"characteristicTypeId\":\"" + Concepts.INFERRED_RELATIONSHIP + "\")") .statusCode(200) .extract() .jsonPath() @@ -196,11 +194,11 @@ public void persistRedundantRelationship() throws Exception { String childConceptId = createNewConcept(branchPath, parentConceptId); // Add "regular" inferences before running the classification - createNewRelationship(branchPath, parentConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); - createNewRelationship(branchPath, childConceptId, Concepts.IS_A, parentConceptId, CharacteristicType.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, parentConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, childConceptId, Concepts.IS_A, parentConceptId, Concepts.INFERRED_RELATIONSHIP); // Add redundant information that should be removed - createNewRelationship(branchPath, childConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, childConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); String classificationId = getClassificationJobId(beginClassification(branchPath)); waitForClassificationJob(branchPath, classificationId) @@ -237,13 +235,13 @@ public void testRedundantRelationshipModuleChange() throws Exception { String childConceptId = createNewConcept(branchPath, parentConceptId); // Add "regular" inferences before running the classification - createNewRelationship(branchPath, parentConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); - createNewRelationship(branchPath, childConceptId, Concepts.IS_A, parentConceptId, CharacteristicType.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, parentConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, childConceptId, Concepts.IS_A, parentConceptId, Concepts.INFERRED_RELATIONSHIP); // Add redundant information that should be removed Map relationshipRequestBody = createRelationshipRequestBody( childConceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, - Concepts.MODULE_SCT_MODEL_COMPONENT, CharacteristicType.INFERRED_RELATIONSHIP, 0) + Concepts.MODULE_SCT_MODEL_COMPONENT, Concepts.INFERRED_RELATIONSHIP, 0) .put("commitComment", "Created new relationship") .build(); @@ -297,11 +295,11 @@ public void issue_SO_2152_testGroupRenumbering() throws Exception { String conceptId = createNewConcept(branchPath); // Add "regular" inferences before running the classification - createNewRelationship(branchPath, conceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, conceptId, Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); // Add new relationship to the root as stated createNewRelationship(branchPath); // Add the same relationship with a different group to the new concept as inferred - createNewRelationship(branchPath, conceptId, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.INFERRED_RELATIONSHIP, 5); + createNewRelationship(branchPath, conceptId, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.INFERRED_RELATIONSHIP, 5); String classificationId = getClassificationJobId(beginClassification(branchPath)); waitForClassificationJob(branchPath, classificationId) @@ -390,8 +388,8 @@ private static void assertInferredIsAExists(FluentIterable c && parentConceptId.equals(relationship.getDestinationId()) && relationship.getGroup() == 0 && relationship.getUnionGroup() == 0 - && RelationshipModifier.EXISTENTIAL.equals(relationship.getModifier()) - && CharacteristicType.INFERRED_RELATIONSHIP.equals(relationship.getCharacteristicType()); + && Concepts.EXISTENTIAL_RESTRICTION_MODIFIER.equals(relationship.getModifierId()) + && Concepts.INFERRED_RELATIONSHIP.equals(relationship.getCharacteristicTypeId()); })); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedConceptApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedConceptApiTest.java index 3aa89aeafee..de733ad2017 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedConceptApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedConceptApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,7 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getNextAvailableEffectiveDateAsString; import static com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants.UK_ACCEPTABLE_MAP; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranchRecursively; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.deleteBranch; +import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.assertInactivation; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.deleteComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; @@ -36,18 +35,18 @@ import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.reactivateConcept; import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.reserveComponentId; import static com.b2international.snowowl.test.commons.rest.RestExtensions.lastPathSegment; +import static com.google.common.collect.Maps.newHashMap; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.hasItem; -import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.CoreMatchers.nullValue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.util.Collection; +import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; @@ -70,7 +69,13 @@ import com.b2international.snowowl.snomed.cis.domain.SctId; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.*; +import com.b2international.snowowl.snomed.core.domain.AssociationTarget; +import com.b2international.snowowl.snomed.core.domain.InactivationProperties; +import com.b2international.snowowl.snomed.core.domain.SnomedConcept; +import com.b2international.snowowl.snomed.core.domain.SnomedDescription; +import com.b2international.snowowl.snomed.core.domain.SnomedDescriptions; +import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; +import com.b2international.snowowl.snomed.core.domain.SnomedRelationships; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; @@ -82,6 +87,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; +import com.google.common.collect.Maps; import io.restassured.response.ValidatableResponse; @@ -182,7 +188,7 @@ public void createConceptWithReservedId() { @Test public void createConceptOnDeletedBranch() { - deleteBranch(branchPath); + branching.deleteBranch(branchPath); Map requestBody = createConceptRequestBody(Concepts.ROOT_CONCEPT) .put("commitComment", "Created new concept on deleted branch") @@ -232,42 +238,173 @@ public void testConceptInactivation() throws Exception { } @Test - public void testConceptReactivation() throws Exception { - // Create two concepts, add an additional relationship pointing from one to the other - String conceptId1 = createNewConcept(branchPath); - String conceptId2 = createNewConcept(branchPath); - String relationshipId = createNewRelationship(branchPath, conceptId1, Concepts.PART_OF, conceptId2); + public void reactivateConceptWithActiveParentAndInboundRelationship() throws Exception { + // Create two concepts, one that will be inactivated + String conceptWithReferenceToInactivatedConcept = createNewConcept(branchPath); + String conceptToInactivate = createNewConcept(branchPath); + // and an inbound relationship to the inactivated concept + String inboundStatedRelationshipId = createNewRelationship(branchPath, conceptWithReferenceToInactivatedConcept, Concepts.PART_OF, conceptToInactivate, Concepts.STATED_RELATIONSHIP); + // and an outbound inferred relationships, which will be reactivated along with the concept + String outboundInferredRelationshipId = createNewRelationship(branchPath, conceptToInactivate, Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); // Inactivate the concept with the relationship is pointing to + final InactivationProperties inactivationProperties = new InactivationProperties( + Concepts.DUPLICATE, + ImmutableList.of( + new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, conceptWithReferenceToInactivatedConcept) + ) + ); Map inactivationBody = ImmutableMap.builder() .put("active", false) - .put("inactivationIndicator", InactivationIndicator.DUPLICATE) - .put("associationTargets", ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO, ImmutableList.of(conceptId1))) + .put("inactivationProperties", inactivationProperties) .put("commitComment", "Inactivated concept") .build(); - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, inactivationBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.DUPLICATE.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), hasItem(conceptId1)); + updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptToInactivate, inactivationBody) + .statusCode(204); + + getComponent(branchPath, SnomedComponentType.CONCEPT, conceptToInactivate, "inactivationProperties()") + .statusCode(200) + .body("active", equalTo(false)) + .body("inactivationProperties.inactivationIndicatorId", equalTo(Concepts.DUPLICATE)) + .body("inactivationProperties.associationTargets.referenceSetId", hasItem(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION)) + .body("inactivationProperties.associationTargets.targetComponentId", hasItem(conceptWithReferenceToInactivatedConcept)); // Verify that the inbound relationship is inactive - getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200) - .body("active", equalTo(false)); + getComponent(branchPath, SnomedComponentType.RELATIONSHIP, inboundStatedRelationshipId) + .statusCode(200) + .body("active", equalTo(false)); // Reactivate the concept - reactivateConcept(branchPath, conceptId2); + reactivateConcept(branchPath, conceptToInactivate); + // verify that the inferred outbound relationship is active again + getComponent(branchPath, SnomedComponentType.RELATIONSHIP, outboundInferredRelationshipId) + .statusCode(200) + .body("active", equalTo(true)); + // Verify that the concept is active again, it has two active descriptions, no association targets, no indicator - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, "inactivationProperties()").statusCode(200) - .body("active", equalTo(true)) - .body("inactivationIndicator", nullValue()) - .body("associationTargets", nullValue()); - + getComponent(branchPath, SnomedComponentType.CONCEPT, conceptToInactivate, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT))) // verify the the inferred and stated hierarchy is back and valid + .body("statedParentIds", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT))) + .body("ancestorIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedAncestorIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))); + // Verify that the inbound relationship is still inactive, meaning that manual reactivation is required - getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200) - .body("active", equalTo(false)); + getComponent(branchPath, SnomedComponentType.RELATIONSHIP, inboundStatedRelationshipId).statusCode(200) + .body("active", equalTo(false)); + } + + @Test + public void reactivateConceptWithInactiveParent() throws Exception { + // Create two concepts, one that will be inactivated + String inactiveParentConcept = createNewConcept(branchPath, createConceptRequestBody(ROOT_CONCEPT, Concepts.MODULE_SCT_CORE, SnomedApiTestConstants.UK_PREFERRED_MAP, false) + .put("commitComment", "Created new concept") + .build()); + String inactiveChildConcept = createNewConcept(branchPath, createConceptRequestBody(inactiveParentConcept, Concepts.MODULE_SCT_CORE, SnomedApiTestConstants.UK_PREFERRED_MAP, false) + .put("commitComment", "Created new concept") + .build()); + + // Reactivate the child concept + reactivateConcept(branchPath, inactiveChildConcept); + + // Verify that the concept is active again, no association targets, no indicator + getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveChildConcept, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedParentIds", equalTo(ImmutableList.of(inactiveParentConcept))) + .body("ancestorIds", equalTo(ImmutableList.of())) + .body("statedAncestorIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))); + + // after reactivating the parent the child should have the proper parentage set + reactivateConcept(branchPath, inactiveParentConcept); + + getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveParentConcept, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedParentIds", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT))) + .body("ancestorIds", equalTo(ImmutableList.of())) + .body("statedAncestorIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))); + + getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveChildConcept, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedParentIds", equalTo(ImmutableList.of(inactiveParentConcept))) + .body("ancestorIds", equalTo(ImmutableList.of())) + .body("statedAncestorIds", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT, IComponent.ROOT_ID))); + } + + @Test + public void reactivateConceptWithInactiveParentRelationshipsFirst() throws Exception { + // Create two concepts, one that will be inactivated + String inactiveParentConcept = createNewConcept(branchPath, createConceptRequestBody(ROOT_CONCEPT, Concepts.MODULE_SCT_CORE, SnomedApiTestConstants.UK_PREFERRED_MAP, false) + .put("commitComment", "Created new concept") + .build()); + String inactiveChildConcept = createNewConcept(branchPath, createConceptRequestBody(inactiveParentConcept, Concepts.MODULE_SCT_CORE, SnomedApiTestConstants.UK_PREFERRED_MAP, false) + .put("commitComment", "Created new concept") + .build()); + + final Map concept = getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveChildConcept, "relationships()") + .statusCode(200) + .extract().as(Map.class); + // Reactivate relationships first + final List> relationshipItems = (List>) ((Map) concept.get("relationships")).get("items"); + relationshipItems.forEach(relationship -> { + final Map updatedRelationship = newHashMap(relationship); + updatedRelationship.put("active", true); + updatedRelationship.put("commitComment", "Reactivate Relationship"); + updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, (String) relationship.get("id"), updatedRelationship).statusCode(204); + }); + + // Reactivate the child concept + final Map reactivationRequest = Maps.newHashMap(concept); + reactivationRequest.put("active", true); + reactivationRequest.remove("inactivationIndicator"); + reactivationRequest.remove("associationTargets"); + reactivationRequest.remove("relationships"); //remove relationships from concept update call + reactivationRequest.put("commitComment", "Reactivated concept"); + + updateComponent(branchPath, SnomedComponentType.CONCEPT, inactiveChildConcept, reactivationRequest).statusCode(204); + + // Verify that the concept is active again, no association targets, no indicator + getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveChildConcept, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedParentIds", equalTo(ImmutableList.of(inactiveParentConcept))) + .body("ancestorIds", equalTo(ImmutableList.of())) + .body("statedAncestorIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))); + + // after reactivating the parent the child should have the proper parentage set + reactivateConcept(branchPath, inactiveParentConcept); + + getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveParentConcept, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedParentIds", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT))) + .body("ancestorIds", equalTo(ImmutableList.of())) + .body("statedAncestorIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))); + + getComponent(branchPath, SnomedComponentType.CONCEPT, inactiveChildConcept, "inactivationProperties()").statusCode(200) + .body("active", equalTo(true)) + .body("inactivationIndicator", nullValue()) + .body("associationTargets", nullValue()) + .body("parentIds", equalTo(ImmutableList.of(IComponent.ROOT_ID))) + .body("statedParentIds", equalTo(ImmutableList.of(inactiveParentConcept))) + .body("ancestorIds", equalTo(ImmutableList.of())) + .body("statedAncestorIds", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT, IComponent.ROOT_ID))); } @Test @@ -304,85 +441,56 @@ public void restoreEffectiveTimeOnReleasedConcept() throws Exception { @Test public void updateAssociationTarget() throws Exception { - String conceptId1 = createNewConcept(branchPath); - String conceptId2 = createNewConcept(branchPath); - String conceptId3 = createNewConcept(branchPath); - - // Inactivate the duplicate concept and point to the other one - Map inactivationRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", InactivationIndicator.DUPLICATE) - .put("associationTargets", ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO, ImmutableList.of(conceptId1))) - .put("commitComment", "Inactivated concept") - .build(); - - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, inactivationRequestBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.DUPLICATE.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), hasItem(conceptId1)); - - // Update the inactivation reason and association target properties - Map updateRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", InactivationIndicator.AMBIGUOUS) - .put("associationTargets", ImmutableMap.of(AssociationType.REPLACED_BY, ImmutableList.of(conceptId3))) - .put("commitComment", "Changed inactivation reason and association target") - .build(); - - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, updateRequestBody).statusCode(204); - - // Verify association target and inactivation indicator update - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.AMBIGUOUS.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), nullValue()) - .body("associationTargets." + AssociationType.REPLACED_BY.name(), allOf(hasItem(conceptId3), not(hasItem(conceptId1)))); + String conceptToInactivate = createNewConcept(branchPath); + String firstAssociationTarget = createNewConcept(branchPath); + String secondAssociationTarget = createNewConcept(branchPath); + + // Inactivate the concept first pointing to the first association target + assertInactivation( + branchPath, + conceptToInactivate, + new InactivationProperties(Concepts.DUPLICATE, ImmutableList.of( + new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, firstAssociationTarget) + )) + ); + + // Inactivate again, this time it will update the inactivation reason and association target properties + assertInactivation( + branchPath, + conceptToInactivate, + new InactivationProperties(Concepts.AMBIGUOUS, ImmutableList.of( + new AssociationTarget(Concepts.REFSET_REPLACED_BY_ASSOCIATION, secondAssociationTarget) + )) + ); } - + @Test public void updateAssociationTargetWithReuse() throws Exception { - String conceptId1 = createNewConcept(branchPath); - String conceptId2 = createNewConcept(branchPath); - String conceptId3 = createNewConcept(branchPath); - String conceptId4 = createNewConcept(branchPath); + String conceptToInactivate = createNewConcept(branchPath); + String firstAssociationTarget = createNewConcept(branchPath); + String secondAssociationTarget = createNewConcept(branchPath); + String thirdAssociationTarget = createNewConcept(branchPath); // Inactivate the duplicate concept and point to the other one - Map inactivationRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", InactivationIndicator.DUPLICATE) - .put("associationTargets", ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO, ImmutableList.of(conceptId1))) - .put("commitComment", "Inactivated concept") - .build(); - - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, inactivationRequestBody).statusCode(204); - Collection memberIds = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, - "members()", "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.DUPLICATE.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), hasItem(conceptId1)) - .extract().path("members.items.id"); - + Collection memberIds = assertInactivation( + branchPath, + conceptToInactivate, + new InactivationProperties(Concepts.DUPLICATE, ImmutableList.of( + new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, firstAssociationTarget) + )) + ).extract().path("members.items.id"); assertEquals(2, memberIds.size()); - // Update the inactivation reason and association target - Map updateRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", InactivationIndicator.AMBIGUOUS) - .put("associationTargets", ImmutableMap.of( - AssociationType.POSSIBLY_EQUIVALENT_TO, ImmutableList.of(conceptId3, conceptId1), - AssociationType.REPLACED_BY, ImmutableList.of(conceptId4))) - .put("commitComment", "Changed inactivation reason and association targets") - .build(); - - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, updateRequestBody).statusCode(204); - Collection updatedMemberIds = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, - "members()", "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.AMBIGUOUS.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), allOf(hasItem(conceptId3), hasItem(conceptId1))) - .body("associationTargets." + AssociationType.REPLACED_BY.name(), hasItem(conceptId4)) - .extract().path("members.items.id"); + // Inactivate again, this time it will update the inactivation reason and association target properties + Collection updatedMemberIds = assertInactivation( + branchPath, + conceptToInactivate, + new InactivationProperties(Concepts.AMBIGUOUS, ImmutableList.of( + new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, firstAssociationTarget), + new AssociationTarget(Concepts.REFSET_REPLACED_BY_ASSOCIATION, secondAssociationTarget), + new AssociationTarget(Concepts.REFSET_REPLACED_BY_ASSOCIATION, thirdAssociationTarget) + )) + ).extract().path("members.items.id"); // Verify that the member UUIDs have not been cycled assertEquals(4, updatedMemberIds.size()); @@ -391,46 +499,28 @@ public void updateAssociationTargetWithReuse() throws Exception { @Test public void updateAssociationTargetWithDefaultModule() throws Exception { - String conceptId1 = createNewConcept(branchPath); - String conceptId2 = createNewConcept(branchPath); - String conceptId3 = createNewConcept(branchPath); + String conceptToInactivate = createNewConcept(branchPath); + String firstAssociationTarget = createNewConcept(branchPath); + String secondAssociationTarget = createNewConcept(branchPath); // Inactivate the duplicate concept and point to the other one - Map inactivationRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", InactivationIndicator.DUPLICATE) - .put("associationTargets", ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO, ImmutableList.of(conceptId1))) - .put("commitComment", "Inactivated concept") - .build(); - - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, inactivationRequestBody) - .statusCode(204); - - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, "inactivationProperties()") - .statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.DUPLICATE.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), hasItem(conceptId1)); + assertInactivation( + branchPath, + conceptToInactivate, + new InactivationProperties(Concepts.DUPLICATE, ImmutableList.of( + new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, firstAssociationTarget) + )) + ); // Update the inactivation reason and association target properties, specifying the module - Map updateRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", InactivationIndicator.AMBIGUOUS) - .put("associationTargets", ImmutableMap.of(AssociationType.REPLACED_BY, ImmutableList.of(conceptId3))) - .put("commitComment", "Changed inactivation reason and association target") - .put("defaultModuleId", "449081005") // SNOMED CT Spanish edition module - .build(); - - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, updateRequestBody) - .statusCode(204); - - // Verify association target and inactivation indicator update - final ValidatableResponse response = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId2, "inactivationProperties(),members()") - .statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(InactivationIndicator.AMBIGUOUS.toString())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), nullValue()) - .body("associationTargets." + AssociationType.REPLACED_BY.name(), allOf(hasItem(conceptId3), not(hasItem(conceptId1)))); + final ValidatableResponse response = assertInactivation( + branchPath, + conceptToInactivate, + new InactivationProperties(Concepts.AMBIGUOUS, ImmutableList.of( + new AssociationTarget(Concepts.REFSET_REPLACED_BY_ASSOCIATION, secondAssociationTarget) + )), + "449081005" // defaultModuleId + ); // Check that the default module is honored final SnomedReferenceSetMembers refSetMembers = response.extract() @@ -449,18 +539,14 @@ public void updateInactivationIndicatorOnActiveConcept() throws Exception { // ensure that the concept does not have any indicator set before the update getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "inactivationProperties()") .statusCode(200) - .body("inactivationIndicator", nullValue()); + .body("inactivationProperties.inactivationIndicator", nullValue()); // Inactivate the duplicate concept and point to the other one - Map updateReq = ImmutableMap.builder() - .put("inactivationIndicator", InactivationIndicator.PENDING_MOVE) - .put("commitComment", "Add a pending move indicator to an active concept") - .build(); - updateComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, updateReq) - .statusCode(204); - getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "inactivationProperties()") - .statusCode(200) - .body("inactivationIndicator", equalTo(InactivationIndicator.PENDING_MOVE.toString())); + assertInactivation( + branchPath, + conceptId, + new InactivationProperties(Concepts.PENDING_MOVE, ImmutableList.of()) + ); } @Test @@ -478,13 +564,14 @@ public void updateInactivationIndicatorOnActiveConceptWithAssociationTargets() t // ensure that the concept does not have any indicator set before the update SnomedReferenceSetMembers currentMembers = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "inactivationProperties(),members()") .statusCode(200) - .body("inactivationIndicator", nullValue()) - .body("associationTargets", equalTo(ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO.name(), ImmutableList.of(Concepts.ROOT_CONCEPT)))) + .body("inactivationProperties.inactivationIndicatorId", nullValue()) + .body("inactivationProperties.associationTargets.referenceSetId", equalTo(ImmutableList.of(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION))) + .body("inactivationProperties.associationTargets.targetComponentId", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT))) .extract() .jsonPath().getObject("members", SnomedReferenceSetMembers.class); Map updateReq = ImmutableMap.builder() - .put("inactivationIndicator", InactivationIndicator.PENDING_MOVE) + .put("inactivationProperties", new InactivationProperties(Concepts.PENDING_MOVE, ImmutableList.of(new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, Concepts.ROOT_CONCEPT)))) // XXX also pass the current members to the update, without the fix this would cause duplicate association members .put("members", currentMembers) .put("commitComment", "Add a pending move indicator to an active concept") @@ -493,8 +580,9 @@ public void updateInactivationIndicatorOnActiveConceptWithAssociationTargets() t .statusCode(204); List memberIds = getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "inactivationProperties(),members()") .statusCode(200) - .body("inactivationIndicator", equalTo(InactivationIndicator.PENDING_MOVE.toString())) - .body("associationTargets", equalTo(ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO.name(), ImmutableList.of(Concepts.ROOT_CONCEPT)))) + .body("inactivationProperties.inactivationIndicatorId", equalTo(Concepts.PENDING_MOVE)) + .body("inactivationProperties.associationTargets.referenceSetId", equalTo(ImmutableList.of(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION))) + .body("inactivationProperties.associationTargets.targetComponentId", equalTo(ImmutableList.of(Concepts.ROOT_CONCEPT))) .extract().path("members.items.id"); assertThat(memberIds.remove(associationMemberId)).isTrue(); @@ -531,7 +619,7 @@ public void deleteConceptOnNestedBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranchRecursively(b); + branching.createBranchRecursively(b); // New component on nested branch resets the container's version to 1 again createNewConcept(b, parentId); @@ -609,7 +697,7 @@ public void addDescriptionViaConceptUpdate() throws Exception { newTextDefinition.setTypeId(Concepts.TEXT_DEFINITION); newTextDefinition.setTerm("Text Definiton " + new Date()); newTextDefinition.setLanguageCode("en"); - newTextDefinition.setCaseSignificance(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE); + newTextDefinition.setCaseSignificanceId(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE); newTextDefinition.setModuleId(Concepts.MODULE_SCT_CORE); List changedDescriptions = ImmutableList.builder() @@ -643,13 +731,13 @@ public void addRelationshipViaConceptUpdate() throws Exception { SnomedRelationship newRelationship = new SnomedRelationship(); newRelationship.setId(reserveComponentId(null, ComponentCategory.RELATIONSHIP)); newRelationship.setActive(true); - newRelationship.setCharacteristicType(CharacteristicType.STATED_RELATIONSHIP); + newRelationship.setCharacteristicTypeId(Concepts.STATED_RELATIONSHIP); newRelationship.setTypeId(Concepts.PART_OF); newRelationship.setDestinationId(Concepts.NAMESPACE_ROOT); newRelationship.setModuleId(Concepts.MODULE_SCT_CORE); newRelationship.setGroup(0); newRelationship.setUnionGroup(0); - newRelationship.setModifier(RelationshipModifier.EXISTENTIAL); + newRelationship.setModifierId(Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); final List changedRelationships = ImmutableList.builder() .addAll(concept.getRelationships()) @@ -866,7 +954,7 @@ public void createConceptWithOwlAxiomMemberWithSubClassOfExpression() throws Exc assertNotNull(conceptWithAxiomMember); assertEquals(1, conceptWithAxiomMember.getMembers().getTotal()); - assertEquals(DefinitionStatus.PRIMITIVE, conceptWithAxiomMember.getDefinitionStatus()); + assertEquals(Concepts.PRIMITIVE, conceptWithAxiomMember.getDefinitionStatusId()); } @Test @@ -896,7 +984,7 @@ public void createConceptWithOwlAxiomMemberWithEquivalentClassesExpression() thr assertNotNull(conceptWithAxiomMember); assertEquals(1, conceptWithAxiomMember.getMembers().getTotal()); - assertEquals(DefinitionStatus.FULLY_DEFINED, conceptWithAxiomMember.getDefinitionStatus()); + assertEquals(Concepts.FULLY_DEFINED, conceptWithAxiomMember.getDefinitionStatusId()); } @Test @@ -925,7 +1013,7 @@ public void createConceptWithOwlAxiomMemberWithComplexSubClassOfExpressionShould assertNotNull(conceptWithAxiomMember); assertEquals(1, conceptWithAxiomMember.getMembers().getTotal()); - assertEquals(DefinitionStatus.PRIMITIVE, conceptWithAxiomMember.getDefinitionStatus()); + assertEquals(Concepts.PRIMITIVE, conceptWithAxiomMember.getDefinitionStatusId()); } @Test @@ -944,7 +1032,7 @@ public void createConceptWithoutOwlAxiomMembersConceptDefinitionStatusShouldDefa .getSync(); assertNotNull(concept); - assertEquals(DefinitionStatus.PRIMITIVE, concept.getDefinitionStatus()); + assertEquals(Concepts.PRIMITIVE, concept.getDefinitionStatusId()); } @Test @@ -953,7 +1041,7 @@ public void testUpdateConceptDefinitionStatusWithoutAxiomMembers() { // Update the definition status on concept Map updateRequestBody = ImmutableMap.builder() - .put("definitionStatus", DefinitionStatus.FULLY_DEFINED) + .put("definitionStatusId", Concepts.FULLY_DEFINED) .put("commitComment", "Changed definition status of concept to fully defined") .build(); @@ -961,7 +1049,7 @@ public void testUpdateConceptDefinitionStatusWithoutAxiomMembers() { // Verify change of definition status on concept getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId, "").statusCode(200) - .body("definitionStatus", equalTo(DefinitionStatus.FULLY_DEFINED.toString())); + .body("definitionStatusId", equalTo(Concepts.FULLY_DEFINED)); } @Test @@ -970,7 +1058,7 @@ public void testUpdateConceptDefinitionStatusWithAxiomMembersShouldNotChange() { // Update the definition status on concept final Map definitionStatusUpdateRequestBody = ImmutableMap.builder() - .put("definitionStatus", DefinitionStatus.FULLY_DEFINED) + .put("definitionStatusId", Concepts.FULLY_DEFINED) .put("commitComment", "Changed definition status of concept to fully defined") .build(); @@ -992,7 +1080,7 @@ public void testUpdateConceptDefinitionStatusWithAxiomMembersShouldNotChange() { final Map updateRequestBody = ImmutableMap.builder() .put("members", SnomedReferenceSetMembers.of(changedMembers)) - .put("definitionStatus", DefinitionStatus.PRIMITIVE) + .put("definitionStatusId", Concepts.PRIMITIVE) .put("commitComment", "Add new reference set member via concept update") .build(); @@ -1005,7 +1093,7 @@ public void testUpdateConceptDefinitionStatusWithAxiomMembersShouldNotChange() { assertEquals(1, updatedConcept.getMembers().getTotal()); // Verify that definition status is still fully defined - assertEquals(DefinitionStatus.FULLY_DEFINED, updatedConcept.getDefinitionStatus()); + assertEquals(Concepts.FULLY_DEFINED, updatedConcept.getDefinitionStatusId()); } @Test @@ -1040,7 +1128,7 @@ public void testUpdateConceptDefinitionStatusWithEquivalentClassesAxiomMember() assertEquals(1, updatedConcept.getMembers().getTotal()); // Verify that definition status was updated to FULLY DEFINED - assertEquals(DefinitionStatus.FULLY_DEFINED, updatedConcept.getDefinitionStatus()); + assertEquals(Concepts.FULLY_DEFINED, updatedConcept.getDefinitionStatusId()); } @Test @@ -1049,7 +1137,7 @@ public void testUpdateConceptDefinitionStatusWithSubClassOfAxiomMemberShouldChan // Update the definition status on concept final Map definitionStatusUpdateRequestBody = ImmutableMap.builder() - .put("definitionStatus", DefinitionStatus.FULLY_DEFINED) + .put("definitionStatusId", Concepts.FULLY_DEFINED) .put("commitComment", "Changed definition status of concept to fully defined") .build(); @@ -1082,7 +1170,7 @@ public void testUpdateConceptDefinitionStatusWithSubClassOfAxiomMemberShouldChan assertEquals(1, updatedConcept.getMembers().getTotal()); // Verify that definition status was updated to FULLY DEFINED - assertEquals(DefinitionStatus.PRIMITIVE, updatedConcept.getDefinitionStatus()); + assertEquals(Concepts.PRIMITIVE, updatedConcept.getDefinitionStatusId()); } @Test @@ -1097,7 +1185,7 @@ public void testPendingMoveUpdateOnConceptWithSetDescriptions() { final List descriptions = conceptBeforeDescriptionPendingMoveChanges.getDescriptions() .stream() .map(desc -> { - desc.setInactivationIndicator(DescriptionInactivationIndicator.PENDING_MOVE); + desc.setInactivationProperties(new InactivationProperties(Concepts.PENDING_MOVE, Collections.emptyList())); desc.setActive(false); return desc; }).collect(Collectors.toList()); @@ -1116,7 +1204,7 @@ public void testPendingMoveUpdateOnConceptWithSetDescriptions() { conceptAfterDescriptionPendingMoveChanges.getDescriptions().forEach(desc -> { // Check descriptions inactivation indicator - assertEquals(DescriptionInactivationIndicator.PENDING_MOVE, desc.getInactivationIndicator()); + assertEquals(Concepts.PENDING_MOVE, desc.getInactivationProperties().getInactivationIndicatorId()); }); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedDescriptionApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedDescriptionApiTest.java index dba820bc4da..a3afb3c6024 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedDescriptionApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedDescriptionApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createCodeSystemAndVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getNextAvailableEffectiveDateAsString; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranchRecursively; +import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.assertInactivation; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.deleteComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; @@ -46,6 +46,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.UUID; @@ -57,18 +58,14 @@ import com.b2international.index.revision.RevisionIndex; import com.b2international.index.revision.TimestampProvider; import com.b2international.snowowl.core.ApplicationContext; -import com.b2international.snowowl.core.RepositoryInfo; import com.b2international.snowowl.core.RepositoryManager; -import com.b2international.snowowl.core.RepositoryInfo.Health; import com.b2international.snowowl.core.api.IBranchPath; import com.b2international.snowowl.core.domain.TransactionContext; import com.b2international.snowowl.core.events.bulk.BulkRequest; import com.b2international.snowowl.core.events.bulk.BulkRequestBuilder; -import com.b2international.snowowl.core.repository.DefaultRepositoryContext; import com.b2international.snowowl.core.setup.Environment; import com.b2international.snowowl.core.terminology.ComponentCategory; import com.b2international.snowowl.datastore.BranchPathUtils; -import com.b2international.snowowl.datastore.request.IndexReadRequest; import com.b2international.snowowl.datastore.request.RepositoryRequest; import com.b2international.snowowl.snomed.cis.ISnomedIdentifierService; import com.b2international.snowowl.snomed.cis.domain.IdentifierStatus; @@ -76,9 +73,8 @@ import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.AssociationType; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.DescriptionInactivationIndicator; +import com.b2international.snowowl.snomed.core.domain.AssociationTarget; +import com.b2international.snowowl.snomed.core.domain.InactivationProperties; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; @@ -193,7 +189,7 @@ public void createDuplicateDescription() { public void createDescriptionCaseInsensitive() { Map requestBody = createDescriptionRequestBody(Concepts.ROOT_CONCEPT, Concepts.SYNONYM, Concepts.MODULE_SCT_CORE, SnomedApiTestConstants.UK_ACCEPTABLE_MAP, - CaseSignificance.CASE_INSENSITIVE) + Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .put("commitComment", "Created new description with case insensitive significance") .build(); @@ -202,7 +198,7 @@ public void createDescriptionCaseInsensitive() { .extract().header("Location")); getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200) - .body("caseSignificance", equalTo(CaseSignificance.CASE_INSENSITIVE.name())); + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)); } @Test @@ -311,84 +307,60 @@ public void testReactivateThenInactivateDescription() throws Exception { @Test public void inactivateWithIndicator() { String descriptionId = createNewDescription(branchPath); - Map requestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", DescriptionInactivationIndicator.DUPLICATE) - .put("commitComment", "Inactivated description with indicator") - .build(); - - updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, requestBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(DescriptionInactivationIndicator.DUPLICATE.name())); + assertInactivation( + branchPath, + descriptionId, + new InactivationProperties(Concepts.DUPLICATE, Collections.emptyList()) + ); } @Test public void inactivateWithIndicatorAndAssociationTarget() { - String description1Id = createNewDescription(branchPath); - String description2Id = createNewDescription(branchPath); - - Map requestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", DescriptionInactivationIndicator.DUPLICATE) - .put("associationTargets", ImmutableMap.of(AssociationType.POSSIBLY_EQUIVALENT_TO.name(), ImmutableList.of(description1Id))) - .put("commitComment", "Inactivated description with indicator and association target") - .build(); + String descriptionToInactivate = createNewDescription(branchPath); + String associationTarget = createNewDescription(branchPath); - updateComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id, requestBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.DESCRIPTION, description2Id, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(DescriptionInactivationIndicator.DUPLICATE.name())) - .body("associationTargets." + AssociationType.POSSIBLY_EQUIVALENT_TO.name(), hasItem(description1Id)); + assertInactivation( + branchPath, + descriptionToInactivate, + new InactivationProperties(Concepts.DUPLICATE, ImmutableList.of(new AssociationTarget(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, associationTarget))) + ); } @Test public void updateIndicatorAfterInactivation() { - String descriptionId = createNewDescription(branchPath); - Map inactivationRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", DescriptionInactivationIndicator.DUPLICATE) - .put("commitComment", "Inactivated description with indicator") - .build(); - - updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, inactivationRequestBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(DescriptionInactivationIndicator.DUPLICATE.name())); - - Map updateRequestBody = ImmutableMap.builder() - .put("active", false) - .put("inactivationIndicator", DescriptionInactivationIndicator.OUTDATED) - .put("commitComment", "Updated inactivation indicator on description") - .build(); + String descriptionToInactivate = createNewDescription(branchPath); + + assertInactivation( + branchPath, + descriptionToInactivate, + new InactivationProperties(Concepts.DUPLICATE, Collections.emptyList()) + ); - updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, updateRequestBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "inactivationProperties()").statusCode(200) - .body("active", equalTo(false)) - .body("inactivationIndicator", equalTo(DescriptionInactivationIndicator.OUTDATED.name())); + assertInactivation( + branchPath, + descriptionToInactivate, + new InactivationProperties(Concepts.OUTDATED, Collections.emptyList()) + ); } @Test public void updateInactivationIndicatorOnActiveReleasedDescription() throws Exception { - String descriptionId = createNewDescription(branchPath); - Map inactivationRequestBody = ImmutableMap.builder() - .put("inactivationIndicator", DescriptionInactivationIndicator.PENDING_MOVE) - .put("commitComment", "Add pending move to description") - .build(); - updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, inactivationRequestBody).statusCode(204); - getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "inactivationProperties()").statusCode(200) - .body("inactivationIndicator", equalTo(DescriptionInactivationIndicator.PENDING_MOVE.name())); + String descriptionToInactivate = createNewDescription(branchPath); + + assertInactivation( + branchPath, + descriptionToInactivate, + new InactivationProperties(Concepts.PENDING_MOVE, Collections.emptyList()) + ); // release component createCodeSystemAndVersion(branchPath, "SNOMEDCT-RELDESC-INACTIVATIONINDICATOR", "v1", "20180701"); - Map updateRequestBody = ImmutableMap.builder() - .put("inactivationIndicator", DescriptionInactivationIndicator.CONCEPT_NON_CURRENT) - .put("commitComment", "Updated inactivation indicator on description") - .build(); - - updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, updateRequestBody).statusCode(204); - SnomedDescription description = getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "members()").statusCode(200).extract().as(SnomedDescription.class); + SnomedDescription description = assertInactivation( + branchPath, + descriptionToInactivate, + new InactivationProperties(Concepts.CONCEPT_NON_CURRENT, Collections.emptyList()) + ).extract().as(SnomedDescription.class); SnomedReferenceSetMember inactivationIndicator = description.getMembers().stream() .filter(member -> Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR.equals(member.getReferenceSetId())) @@ -404,13 +376,13 @@ public void updateCaseSignificance() { String descriptionId = createNewDescription(branchPath); Map inactivationRequestBody = ImmutableMap.builder() .put("active", false) - .put("caseSignificance", CaseSignificance.CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_INSENSITIVE) .put("commitComment", "Updated description case significance") .build(); updateComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, inactivationRequestBody).statusCode(204); getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId).statusCode(200) - .body("caseSignificance", equalTo(CaseSignificance.CASE_INSENSITIVE.name())); + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_INSENSITIVE)); } @Test @@ -598,7 +570,7 @@ public void updateAcceptabilityWithRemove() throws Exception { public void createDescriptionOnNestedBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranchRecursively(b); + branching.createBranchRecursively(b); String descriptionId = createNewDescription(b); @@ -619,7 +591,7 @@ public void deleteDescriptionOnNestedBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranchRecursively(b); + branching.createBranchRecursively(b); // New description on nested branch resets the concept's version to 1 again createNewDescription(b, conceptId); @@ -656,18 +628,16 @@ public void testDuplicateMemberCleanupEmptiesAcceptabilityMap() throws Exception .field(SnomedRf2Headers.FIELD_ACCEPTABILITY_ID, Concepts.REFSET_DESCRIPTION_ACCEPTABILITY_PREFERRED) .build(); - new RepositoryRequest<>(SnomedDatastoreActivator.REPOSITORY_UUID, new IndexReadRequest<>( - context -> { - ApplicationContext.getServiceForClass(RepositoryManager.class) - .get(SnomedDatastoreActivator.REPOSITORY_UUID) - .service(RevisionIndex.class) - .prepareCommit(branchPath.getPath()) - .stageNew(member) - .withContext(context) - .commit(ApplicationContext.getServiceForClass(TimestampProvider.class).getTimestamp(), "test", "Added duplicate language reference set member to " + descriptionId); - return null; - } - )).execute(ApplicationContext.getServiceForClass(Environment.class)); + new RepositoryRequest<>(SnomedDatastoreActivator.REPOSITORY_UUID, context -> { + ApplicationContext.getServiceForClass(RepositoryManager.class) + .get(SnomedDatastoreActivator.REPOSITORY_UUID) + .service(RevisionIndex.class) + .prepareCommit(branchPath.getPath()) + .stageNew(member) + .withContext(context) + .commit(ApplicationContext.getServiceForClass(TimestampProvider.class).getTimestamp(), "test", "Added duplicate language reference set member to " + descriptionId); + return null; + }).execute(ApplicationContext.getServiceForClass(Environment.class)); // Check the acceptability map; the description should be acceptable in the UK reference set SnomedDescription description = getComponent(branchPath, SnomedComponentType.DESCRIPTION, descriptionId, "members()").statusCode(200) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedModuleDependencyRefsetTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedModuleDependencyRefsetTest.java index 9c4699fe7ca..be1aa2d7d8d 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedModuleDependencyRefsetTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedModuleDependencyRefsetTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.b2international.snowowl.snomed.core.rest.components; import static com.b2international.snowowl.snomed.core.rest.CodeSystemRestRequests.createCodeSystem; @@ -23,9 +38,8 @@ import com.b2international.snowowl.core.date.DateFormats; import com.b2international.snowowl.core.date.EffectiveTimes; import com.b2international.snowowl.datastore.BranchPathUtils; -import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; +import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; @@ -127,11 +141,11 @@ public void updateRelevantModDepMembersForExtensionVersions() { // create both inferred and stated relationships Map inferredRelationshipRequestBody = SnomedRestFixtures - .createRelationshipRequestBody(NORWEGIAN_MODULE_CONCEPT_ID, Concepts.IS_A, Concepts.MODULE_ROOT, NORWEGIAN_MODULE_CONCEPT_ID, CharacteristicType.INFERRED_RELATIONSHIP, 0) + .createRelationshipRequestBody(NORWEGIAN_MODULE_CONCEPT_ID, Concepts.IS_A, Concepts.MODULE_ROOT, NORWEGIAN_MODULE_CONCEPT_ID, Concepts.INFERRED_RELATIONSHIP, 0) .put("commitComment", "Created inferred is_a from the norwegian module concept to SCT_MODULE_CORE").build(); Map statedRelationshipRequestBody = SnomedRestFixtures - .createRelationshipRequestBody(NORWEGIAN_MODULE_CONCEPT_ID, Concepts.IS_A, Concepts.MODULE_ROOT, NORWEGIAN_MODULE_CONCEPT_ID, CharacteristicType.STATED_RELATIONSHIP, 0) + .createRelationshipRequestBody(NORWEGIAN_MODULE_CONCEPT_ID, Concepts.IS_A, Concepts.MODULE_ROOT, NORWEGIAN_MODULE_CONCEPT_ID, Concepts.STATED_RELATIONSHIP, 0) .put("commitComment", "Created state is_a from the norwegian module concept to SCT_MODULE_CORE").build(); createComponent(branchPath, SnomedComponentType.RELATIONSHIP, inferredRelationshipRequestBody).statusCode(201); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetApiTest.java index 5aa2d09b41e..7ce67f6297e 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,13 @@ */ package com.b2international.snowowl.snomed.core.rest.components; -import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.*; -import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.*; -import static org.hamcrest.CoreMatchers.*; +import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; +import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createConcreteDomainParentConcept; +import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createConcreteDomainRefSet; +import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createNewRefSet; +import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createNewRefSetMember; +import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.inactivateConcept; +import static org.hamcrest.CoreMatchers.equalTo; import org.junit.Test; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetBulkApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetBulkApiTest.java index 4b3646f1840..362af7465f6 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetBulkApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetBulkApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberApiTest.java index 75e8da3a6e8..4630bcb8a66 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,7 +52,6 @@ import com.b2international.snowowl.datastore.request.CommitResult; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.core.domain.refset.DataType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; @@ -803,7 +802,7 @@ public void executeSyncAction() throws Exception { String conceptId = createNewConcept(branchPath, parentId); conceptIds.add(conceptId); // Need to add an inferred IS A counterpart, as query evaluation uses inferred relationships - createNewRelationship(branchPath, conceptId, Concepts.IS_A, parentId, CharacteristicType.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, conceptId, Concepts.IS_A, parentId, Concepts.INFERRED_RELATIONSHIP); } final Map memberRequest = ImmutableMap.builder() @@ -827,7 +826,7 @@ public void executeSyncAction() throws Exception { // Add a new concept that matches the query, then sync again String extraConceptId = createNewConcept(branchPath, parentId); conceptIds.add(extraConceptId); - createNewRelationship(branchPath, extraConceptId, Concepts.IS_A, parentId, CharacteristicType.INFERRED_RELATIONSHIP); + createNewRelationship(branchPath, extraConceptId, Concepts.IS_A, parentId, Concepts.INFERRED_RELATIONSHIP); executeSyncAction(memberId); checkReferencedComponentIds(conceptIds, simpleRefSetId); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberParameterizedTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberParameterizedTest.java index aa020f900b7..a2b39cc68de 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberParameterizedTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetMemberParameterizedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +64,9 @@ import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; -import com.b2international.snowowl.snomed.core.rest.BranchBase; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; +import com.b2international.snowowl.snomed.datastore.request.SnomedRelationshipGetRequestBuilder; +import com.b2international.snowowl.test.commons.rest.BranchBase; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; @@ -93,6 +94,7 @@ public static Collection data() { { SnomedRefSetType.ATTRIBUTE_VALUE }, // Concrete data type reference sets are tested separately { SnomedRefSetType.COMPLEX_MAP }, + { SnomedRefSetType.COMPLEX_BLOCK_MAP }, { SnomedRefSetType.DESCRIPTION_TYPE }, { SnomedRefSetType.EXTENDED_MAP }, { SnomedRefSetType.LANGUAGE }, @@ -402,6 +404,16 @@ private Map getUpdateProperties() { .put(SnomedRf2Headers.FIELD_MAP_ADVICE, "complexMapAdvice2") .put(SnomedRf2Headers.FIELD_CORRELATION_ID, Concepts.NAMESPACE_ROOT) .build(); + case COMPLEX_BLOCK_MAP: + return ImmutableMap.builder() + .put(SnomedRf2Headers.FIELD_MAP_TARGET, "complexBlockMapTarget2") + .put(SnomedRf2Headers.FIELD_MAP_GROUP, 1) + .put(SnomedRf2Headers.FIELD_MAP_PRIORITY, 1) + .put(SnomedRf2Headers.FIELD_MAP_RULE, "complexBlockMapRule2") + .put(SnomedRf2Headers.FIELD_MAP_ADVICE, "complexBlockMapAdvice2") + .put(SnomedRf2Headers.FIELD_CORRELATION_ID, Concepts.NAMESPACE_ROOT) + .put(SnomedRf2Headers.FIELD_MAP_BLOCK, 2) + .build(); case DESCRIPTION_TYPE: return ImmutableMap.builder() .put(SnomedRf2Headers.FIELD_DESCRIPTION_FORMAT, Concepts.NAMESPACE_ROOT) @@ -514,6 +526,16 @@ private Map getInvalidProperties() { .put(SnomedRf2Headers.FIELD_CORRELATION_ID, Concepts.REFSET_CORRELATION_NOT_SPECIFIED) .put(SnomedRf2Headers.FIELD_MAP_CATEGORY_ID, Concepts.MAP_CATEGORY_NOT_CLASSIFIED) .build(); + case COMPLEX_BLOCK_MAP: + return ImmutableMap.builder() + .put(SnomedRf2Headers.FIELD_MAP_TARGET, "complexBlockMapTarget") + .put(SnomedRf2Headers.FIELD_MAP_GROUP, 10) + .put(SnomedRf2Headers.FIELD_MAP_PRIORITY, 10) + .put(SnomedRf2Headers.FIELD_MAP_RULE, "complexBlockMapRule") + .put(SnomedRf2Headers.FIELD_MAP_ADVICE, "complexBlockMapAdvice") + .put(SnomedRf2Headers.FIELD_CORRELATION_ID, Concepts.REFSET_CORRELATION_NOT_SPECIFIED) + .put(SnomedRf2Headers.FIELD_MAP_BLOCK, "not an integer") + .build(); case LANGUAGE: return ImmutableMap.builder() .put(SnomedRf2Headers.FIELD_ACCEPTABILITY_ID, "") diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetParameterizedTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetParameterizedTest.java index fbb92c9f9dd..bdfb1a6af73 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetParameterizedTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRefSetParameterizedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,6 +69,7 @@ public static Collection data() { { SnomedRefSetType.ATTRIBUTE_VALUE }, // Concrete data type reference sets are tested separately { SnomedRefSetType.COMPLEX_MAP }, + { SnomedRefSetType.COMPLEX_BLOCK_MAP }, { SnomedRefSetType.DESCRIPTION_TYPE }, { SnomedRefSetType.EXTENDED_MAP }, { SnomedRefSetType.LANGUAGE }, diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRelationshipApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRelationshipApiTest.java index 3bb9bf14fa2..f12a4b59a21 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRelationshipApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/components/SnomedRelationshipApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createCodeSystemAndVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getNextAvailableEffectiveDateAsString; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranchRecursively; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.deleteComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; @@ -52,8 +51,6 @@ import com.b2international.snowowl.snomed.cis.domain.SctId; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; @@ -161,7 +158,7 @@ public void createDuplicateRelationship() { @Test public void createRelationshipInferred() { Map requestBody = createRelationshipRequestBody(Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, - CharacteristicType.INFERRED_RELATIONSHIP) + Concepts.INFERRED_RELATIONSHIP) .put("commitComment", "Created new relationship with inferred characteristic type") .build(); @@ -170,7 +167,7 @@ public void createRelationshipInferred() { .extract().header("Location")); getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200) - .body("characteristicType", equalTo(CharacteristicType.INFERRED_RELATIONSHIP.name())); + .body("characteristicTypeId", equalTo(Concepts.INFERRED_RELATIONSHIP)); } @Test @@ -299,33 +296,33 @@ public void changeRelationshipUnionGroup() { public void changeRelationshipCharacteristicType() { String relationshipId = createNewRelationship(branchPath); Map requestBody = ImmutableMap.builder() - .put("characteristicType", CharacteristicType.ADDITIONAL_RELATIONSHIP) + .put("characteristicTypeId", Concepts.ADDITIONAL_RELATIONSHIP) .put("commitComment", "Updated relationship characteristic type") .build(); updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, requestBody).statusCode(204); getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200) - .body("characteristicType", equalTo(CharacteristicType.ADDITIONAL_RELATIONSHIP.name())); + .body("characteristicTypeId", equalTo(Concepts.ADDITIONAL_RELATIONSHIP)); } @Test public void changeRelationshipModifier() { String relationshipId = createNewRelationship(branchPath); Map requestBody = ImmutableMap.builder() - .put("modifier", RelationshipModifier.UNIVERSAL) + .put("modifierId", Concepts.UNIVERSAL_RESTRICTION_MODIFIER) .put("commitComment", "Updated relationship modifier") .build(); updateComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId, requestBody).statusCode(204); getComponent(branchPath, SnomedComponentType.RELATIONSHIP, relationshipId).statusCode(200) - .body("modifier", equalTo(RelationshipModifier.UNIVERSAL.name())); + .body("modifierId", equalTo(Concepts.UNIVERSAL_RESTRICTION_MODIFIER)); } @Test public void createRelationshipOnNestedBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranchRecursively(b); + branching.createBranchRecursively(b); String relationshipId = createNewRelationship(b); @@ -352,7 +349,7 @@ public void deleteRelationshipOnNestedBranch() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); IBranchPath b = BranchPathUtils.createPath(a, "b"); - createBranchRecursively(b); + branching.createBranchRecursively(b); // New relationship on nested branch resets the concept's version to 1 again createNewRelationship(b, conceptId, Concepts.PART_OF, Concepts.NAMESPACE_ROOT); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionCreationTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionCreationTest.java index 66be7da97d7..8f8356532c4 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionCreationTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionCreationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2017-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemRestRequests.createCodeSystem; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getVersion; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createNewConcept; import static org.hamcrest.CoreMatchers.equalTo; @@ -73,7 +72,7 @@ public void createExtensionVersion01() { @Test public void createExtensionVersion02() { IBranchPath a = BranchPathUtils.createPath(branchPath, "a"); - createBranch(a).statusCode(201); + branching.createBranch(a).statusCode(201); String conceptId = createNewConcept(a); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionDowngradeTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionDowngradeTest.java index 0f115a4bfaf..0ddfa64d008 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionDowngradeTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionDowngradeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemRestRequests.getCodeSystem; import static com.b2international.snowowl.snomed.core.rest.CodeSystemRestRequests.updateCodeSystem; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getVersion; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedRestFixtures.createNewConcept; @@ -37,12 +36,11 @@ import com.b2international.snowowl.datastore.CodeSystemVersion; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; -import com.b2international.snowowl.snomed.core.rest.BranchBase; import com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; +import com.b2international.snowowl.test.commons.rest.BranchBase; import com.google.common.collect.ImmutableMap; /** @@ -59,11 +57,11 @@ public void downgradeB2iExtensionWithoutChanges() { .extract() .as(CodeSystemVersion.class); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join(version.getParentBranchPath(), + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join(version.getParentBranchPath(), version.getVersion(), SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); merge(branchPath, targetPath, "Downgraded B2i extension to 2016-01-31.").body("status", equalTo(Merge.Status.COMPLETED.name())); Map updateRequest = ImmutableMap.builder() @@ -84,11 +82,11 @@ public void downgradeB2iExtensionWithNewConceptOnUpgradedBranch() { .statusCode(200) .extract().as(CodeSystemVersion.class); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join(version.getParentBranchPath(), + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join(version.getParentBranchPath(), version.getVersion(), SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); String conceptId = createNewConcept(targetPath); @@ -113,11 +111,11 @@ public void downgradeWithConflictingContent() { .statusCode(200) .extract().as(CodeSystemVersion.class); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join(version.getParentBranchPath(), + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join(version.getParentBranchPath(), version.getVersion(), SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); Map requestBody = ImmutableMap.builder() .put("id", "476216051000154119") // Description of Date-time reference set @@ -127,7 +125,7 @@ public void downgradeWithConflictingContent() { .put("term", "Synonym of root concept") .put("languageCode", "en") .put("acceptability", SnomedApiTestConstants.UK_ACCEPTABLE_MAP) - .put("caseSignificance", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE) .put("commitComment", "Created new synonym with duplicate SCTID") .build(); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionUpgradeTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionUpgradeTest.java index a5722b0a818..e2fe62f8d3f 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionUpgradeTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionUpgradeTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,6 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemRestRequests.updateCodeSystem; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createVersion; import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.getNextAvailableEffectiveDateAsString; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.updateComponent; @@ -49,19 +48,17 @@ import com.b2international.snowowl.core.branch.Branch; import com.b2international.snowowl.core.merge.Merge; import com.b2international.snowowl.datastore.BranchPathUtils; -import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; +import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; -import com.b2international.snowowl.snomed.core.rest.BranchBase; import com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; +import com.b2international.snowowl.test.commons.rest.BranchBase; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; @@ -74,18 +71,22 @@ @BranchBase(value = SnomedApiTestConstants.EXTENSION_PATH, isolateTests = false) public class SnomedExtensionUpgradeTest extends AbstractSnomedApiTest { + private String getFirstRelationshipId(SnomedConcept concept, String characteristicTypeId) { + return concept.getRelationships().getItems().stream().filter(r -> characteristicTypeId.equals(r.getCharacteristicTypeId())).findFirst().get().getId(); + } + @Test public void upgradeWithoutChanges() { String effectiveDate = getNextAvailableEffectiveDateAsString(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME); String versionId = "v1"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); merge(branchPath, targetPath, "Upgraded B2i extension to v1.").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -106,12 +107,12 @@ public void upgradeWithNewConceptOnSource() { String versionId = "v2"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); String conceptId = createNewConcept(branchPath); @@ -136,12 +137,12 @@ public void upgradeWithNewConceptOnTarget() { String versionId = "v3"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); String conceptId = createNewConcept(targetPath); @@ -167,12 +168,12 @@ public void upgradeWithConflictingContent() { String versionId = "v4"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); Map requestBody = ImmutableMap.builder() .put("id", "476216051000154119") // Description of Date-time reference set @@ -182,7 +183,7 @@ public void upgradeWithConflictingContent() { .put("term", "Synonym of root concept") .put("languageCode", "en") .put("acceptability", SnomedApiTestConstants.UK_ACCEPTABLE_MAP) - .put("caseSignificance", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE) .put("commitComment", "Created new synonym with duplicate SCTID") .build(); @@ -205,7 +206,7 @@ public void upgradeWithBackAndForthDonatedConcept() { .put("term", descriptionTerm) .put("languageCode", DEFAULT_LANGUAGE_CODE) .put("acceptability", SnomedApiTestConstants.UK_ACCEPTABLE_MAP) - .put("caseSignificance", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE) .put("commitComment", "Created new synonym") .build(); @@ -224,16 +225,16 @@ public void upgradeWithBackAndForthDonatedConcept() { .body("released", equalTo(true)) .body("effectiveTime", equalTo(effectiveDate)) .body("moduleId", equalTo(Concepts.MODULE_SCT_CORE)) - .body("caseSignificance", equalTo(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.toString())); + .body("caseSignificanceId", equalTo(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE)); // upgrade extension to latest INT version - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); merge(branchPath, targetPath, "Upgraded B2i extension to v10").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -248,7 +249,7 @@ public void upgradeWithBackAndForthDonatedConcept() { // update description on extension, change module and case significance Map descriptionUpdateRequest = ImmutableMap.builder() - .put("caseSignificance", CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_SENSITIVE) .put("moduleId", Concepts.MODULE_B2I_EXTENSION) .put("commitComment", "Changed case significance on description") .build(); @@ -260,7 +261,7 @@ public void upgradeWithBackAndForthDonatedConcept() { .body("released", equalTo(true)) .body("effectiveTime", nullValue()) .body("moduleId", equalTo(Concepts.MODULE_B2I_EXTENSION)) - .body("caseSignificance", equalTo(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.toString())); + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE)); // version extension @@ -277,7 +278,7 @@ public void upgradeWithBackAndForthDonatedConcept() { // update description on MAIN ("take" extension changes and apply it in INT) Map intDescriptionUpdateRequest = ImmutableMap.builder() - .put("caseSignificance", CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE) + .put("caseSignificanceId", Concepts.ENTIRE_TERM_CASE_SENSITIVE) .put("commitComment", "Changed case significance on description on MAIN") .build(); @@ -294,16 +295,16 @@ public void upgradeWithBackAndForthDonatedConcept() { .body("released", equalTo(true)) .body("effectiveTime", equalTo(newIntEffectiveDate)) .body("moduleId", equalTo(Concepts.MODULE_SCT_CORE)) - .body("caseSignificance", equalTo(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.toString())); + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE)); // upgrade extension to new INT version - IBranchPath newTargetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath newTargetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, newIntversionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(newTargetPath).statusCode(201); + branching.createBranch(newTargetPath).statusCode(201); merge(targetPath, newTargetPath, "Upgraded B2i extension to v11").body("status", equalTo(Merge.Status.COMPLETED.name())); @@ -320,7 +321,7 @@ public void upgradeWithBackAndForthDonatedConcept() { .body("released", equalTo(true)) .body("effectiveTime", equalTo(newIntEffectiveDate)) .body("moduleId", equalTo(Concepts.MODULE_SCT_CORE)) - .body("caseSignificance", equalTo(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.toString())); + .body("caseSignificanceId", equalTo(Concepts.ENTIRE_TERM_CASE_SENSITIVE)); } @@ -341,12 +342,12 @@ public void upgradeWithDonatedConcept() { Concepts.SYNONYM, extensionSynonymTerm, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map additionalRelationshipRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.ADDITIONAL_RELATIONSHIP); + Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.ADDITIONAL_RELATIONSHIP); Map extensionConceptRequestBody = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody, inferredIsaRequestBody, additionalRelationshipRequestBody), @@ -368,12 +369,9 @@ public void upgradeWithDonatedConcept() { String extensionSynonymId = extensionConcept.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm)) .findFirst().get().getId(); - String extensionStatedIsaId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); - String extensionAdditionalRelationshipId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.ADDITIONAL_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId = getFirstRelationshipId(extensionConcept, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId = getFirstRelationshipId(extensionConcept, Concepts.INFERRED_RELATIONSHIP); + String extensionAdditionalRelationshipId = getFirstRelationshipId(extensionConcept, Concepts.ADDITIONAL_RELATIONSHIP); // create new version on MAIN @@ -381,12 +379,12 @@ public void upgradeWithDonatedConcept() { String versionId = "v5"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT concept with same ID but different description and relationship IDs on version branch @@ -396,9 +394,9 @@ public void upgradeWithDonatedConcept() { Concepts.SYNONYM, extensionPtTerm, SnomedApiTestConstants.UK_PREFERRED_MAP); Map intStatedIsaRequestBody = createRelationshipRequestBody("", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map intInferredIsaRequestBody = createRelationshipRequestBody("", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map intConceptRequestBody = createConceptRequestBody(extensionConceptId, "", Concepts.MODULE_SCT_CORE, ImmutableList.of(intStatedIsaRequestBody, intInferredIsaRequestBody), @@ -418,10 +416,8 @@ public void upgradeWithDonatedConcept() { .getId(); String intPtId = intConcept.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionPtTerm)).findFirst().get().getId(); - String intStatedIsaId = intConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String intInferredIsaId = intConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String intStatedIsaId = getFirstRelationshipId(intConcept, Concepts.STATED_RELATIONSHIP); + String intInferredIsaId = getFirstRelationshipId(intConcept, Concepts.INFERRED_RELATIONSHIP); assertEquals(intConceptId, extensionConceptId); assertNotEquals(intConcept.getModuleId(), extensionConcept.getModuleId()); @@ -481,7 +477,7 @@ public void upgradeWithDonatedDescription() { .put("term", descriptionTerm) .put("languageCode", DEFAULT_LANGUAGE_CODE) .put("acceptability", SnomedApiTestConstants.US_ACCEPTABLE_MAP) - .put("caseSignificance", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE) + .put("caseSignificanceId", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE) .put("commitComment", "Created new extension synonym") .build(); @@ -493,7 +489,7 @@ public void upgradeWithDonatedDescription() { .statusCode(200) .extract().as(SnomedDescription.class); - assertEquals(CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE, extensionDescription.getCaseSignificance()); + assertEquals(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE, extensionDescription.getCaseSignificanceId()); assertThat(extensionDescription.getAcceptabilityMap().containsKey(Concepts.REFSET_LANGUAGE_TYPE_US)); assertEquals(Acceptability.ACCEPTABLE, extensionDescription.getAcceptabilityMap().get(Concepts.REFSET_LANGUAGE_TYPE_US)); assertFalse(extensionDescription.getAcceptabilityMap().containsKey(Concepts.REFSET_LANGUAGE_TYPE_UK)); @@ -504,12 +500,12 @@ public void upgradeWithDonatedDescription() { String versionId = "v6"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT description with same ID but with slightly different properties @@ -521,7 +517,7 @@ public void upgradeWithDonatedDescription() { .put("term", descriptionTerm) .put("languageCode", "en") .put("acceptability", SnomedApiTestConstants.UK_ACCEPTABLE_MAP) - .put("caseSignificance", CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE) + .put("caseSignificance", Concepts.ENTIRE_TERM_CASE_SENSITIVE) .put("commitComment", "Created new donated synonym") .build(); @@ -535,7 +531,7 @@ public void upgradeWithDonatedDescription() { .statusCode(200) .extract().as(SnomedDescription.class); - assertEquals(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE, donatedDescription.getCaseSignificance()); + assertEquals(Concepts.ENTIRE_TERM_CASE_SENSITIVE, donatedDescription.getCaseSignificanceId()); assertThat(donatedDescription.getAcceptabilityMap().containsKey(Concepts.REFSET_LANGUAGE_TYPE_UK)); assertEquals(Acceptability.ACCEPTABLE, donatedDescription.getAcceptabilityMap().get(Concepts.REFSET_LANGUAGE_TYPE_UK)); assertFalse(donatedDescription.getAcceptabilityMap().containsKey(Concepts.REFSET_LANGUAGE_TYPE_US)); @@ -557,7 +553,7 @@ public void upgradeWithDonatedDescription() { .extract().as(SnomedDescription.class); assertEquals(Concepts.MODULE_SCT_CORE, donatedDescriptionInExtension.getModuleId()); - assertEquals(CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE, donatedDescriptionInExtension.getCaseSignificance()); + assertEquals(Concepts.ENTIRE_TERM_CASE_SENSITIVE, donatedDescriptionInExtension.getCaseSignificanceId()); assertThat(donatedDescriptionInExtension.getAcceptabilityMap().containsKey(Concepts.REFSET_LANGUAGE_TYPE_US)); assertEquals(Acceptability.ACCEPTABLE, donatedDescriptionInExtension.getAcceptabilityMap().get(Concepts.REFSET_LANGUAGE_TYPE_US)); assertThat(donatedDescriptionInExtension.getAcceptabilityMap().containsKey(Concepts.REFSET_LANGUAGE_TYPE_UK)); @@ -574,7 +570,7 @@ public void upgradeWithDonatedRelationship() { .put("sourceId", Concepts.ROOT_CONCEPT) .put("typeId", Concepts.PART_OF) .put("destinationId", Concepts.NAMESPACE_ROOT) - .put("characteristicType", CharacteristicType.ADDITIONAL_RELATIONSHIP) + .put("characteristicTypeId", Concepts.ADDITIONAL_RELATIONSHIP) .put("group", 0) .put("commitComment", "Created new extension relationship") .build(); @@ -587,7 +583,7 @@ public void upgradeWithDonatedRelationship() { .statusCode(200) .extract().as(SnomedRelationship.class); - assertEquals(CharacteristicType.ADDITIONAL_RELATIONSHIP, extensionRelationship.getCharacteristicType()); + assertEquals(Concepts.ADDITIONAL_RELATIONSHIP, extensionRelationship.getCharacteristicTypeId()); assertEquals(0, extensionRelationship.getGroup().intValue()); // create new version on MAIN @@ -596,12 +592,12 @@ public void upgradeWithDonatedRelationship() { String versionId = "v9"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT relationship with same ID but with slightly different properties @@ -611,7 +607,7 @@ public void upgradeWithDonatedRelationship() { .put("sourceId", Concepts.ROOT_CONCEPT) .put("typeId", Concepts.PART_OF) .put("destinationId", Concepts.NAMESPACE_ROOT) - .put("characteristicType", CharacteristicType.INFERRED_RELATIONSHIP) + .put("characteristicTypeId", Concepts.INFERRED_RELATIONSHIP) .put("group", 1) .put("commitComment", "Created new donated INT relationship") .build(); @@ -626,7 +622,7 @@ public void upgradeWithDonatedRelationship() { .statusCode(200) .extract().as(SnomedRelationship.class); - assertEquals(CharacteristicType.INFERRED_RELATIONSHIP, donatedRelationship.getCharacteristicType()); + assertEquals(Concepts.INFERRED_RELATIONSHIP, donatedRelationship.getCharacteristicTypeId()); assertEquals(1, donatedRelationship.getGroup().intValue()); // upgrade extension to new INT version @@ -646,7 +642,7 @@ public void upgradeWithDonatedRelationship() { .extract().as(SnomedRelationship.class); assertEquals(Concepts.MODULE_SCT_CORE, donatedRelationshipInExtension.getModuleId()); - assertEquals(CharacteristicType.INFERRED_RELATIONSHIP, donatedRelationshipInExtension.getCharacteristicType()); + assertEquals(Concepts.INFERRED_RELATIONSHIP, donatedRelationshipInExtension.getCharacteristicTypeId()); assertEquals(1, donatedRelationshipInExtension.getGroup().intValue()); } @@ -667,9 +663,9 @@ public void upgradeWithDonatedConceptAndDescriptions() { Concepts.SYNONYM, extensionSynonymTerm, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map extensionConceptRequestBody = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody, inferredIsaRequestBody), @@ -691,10 +687,8 @@ public void upgradeWithDonatedConceptAndDescriptions() { String extensionSynonymId = extensionConcept.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm)) .findFirst().get().getId(); - String extensionStatedIsaId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId = getFirstRelationshipId(extensionConcept, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId = getFirstRelationshipId(extensionConcept, Concepts.INFERRED_RELATIONSHIP); // create new version on MAIN @@ -702,12 +696,12 @@ public void upgradeWithDonatedConceptAndDescriptions() { String versionId = "v7"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT concept with same ID but different description and relationship IDs on version branch @@ -717,9 +711,9 @@ public void upgradeWithDonatedConceptAndDescriptions() { Concepts.SYNONYM, extensionPtTerm, SnomedApiTestConstants.UK_PREFERRED_MAP); Map intStatedIsaRequestBody = createRelationshipRequestBody("", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map intInferredIsaRequestBody = createRelationshipRequestBody("", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map intConceptRequestBody = createConceptRequestBody(extensionConceptId, "", Concepts.MODULE_SCT_CORE, ImmutableList.of(intStatedIsaRequestBody, intInferredIsaRequestBody), @@ -739,10 +733,8 @@ public void upgradeWithDonatedConceptAndDescriptions() { .getId(); String intPtId = intConcept.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionPtTerm)).findFirst().get().getId(); - String intStatedIsaId = intConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String intInferredIsaId = intConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String intStatedIsaId = getFirstRelationshipId(intConcept, Concepts.STATED_RELATIONSHIP); + String intInferredIsaId = getFirstRelationshipId(intConcept, Concepts.INFERRED_RELATIONSHIP); assertEquals(intConceptId, extensionConceptId); assertNotEquals(intConcept.getModuleId(), extensionConcept.getModuleId()); @@ -814,9 +806,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { Concepts.SYNONYM, extensionSynonymTerm, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map extensionConceptRequestBody = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody, inferredIsaRequestBody), @@ -838,10 +830,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { String extensionSynonymId = extensionConcept.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm)) .findFirst().get().getId(); - String extensionStatedIsaId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId = extensionConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId = getFirstRelationshipId(extensionConcept, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId = getFirstRelationshipId(extensionConcept, Concepts.INFERRED_RELATIONSHIP); // create new version on MAIN @@ -849,12 +839,12 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { String versionId = "v8"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT concept with same ID but different description and relationship IDs on version branch @@ -864,9 +854,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { Concepts.SYNONYM, extensionPtTerm, SnomedApiTestConstants.UK_PREFERRED_MAP); Map intStatedIsaRequestBody = createRelationshipRequestBody(extensionStatedIsaId, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map intInferredIsaRequestBody = createRelationshipRequestBody(extensionInferredIsaId, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map intConceptRequestBody = createConceptRequestBody(extensionConceptId, "", Concepts.MODULE_SCT_CORE, ImmutableList.of(intStatedIsaRequestBody, intInferredIsaRequestBody), @@ -886,10 +876,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { .getId(); String intPtId = intConcept.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionPtTerm)).findFirst().get().getId(); - String intStatedIsaId = intConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String intInferredIsaId = intConcept.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String intStatedIsaId = getFirstRelationshipId(intConcept, Concepts.STATED_RELATIONSHIP); + String intInferredIsaId = getFirstRelationshipId(intConcept, Concepts.INFERRED_RELATIONSHIP); assertEquals(intConceptId, extensionConceptId); assertNotEquals(intConcept.getModuleId(), extensionConcept.getModuleId()); @@ -938,7 +926,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { assertTrue(descriptionIds.contains(extensionSynonymId)); List donatedStatedIsas = donatedConceptInExtension.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedStatedIsas.size()); @@ -947,7 +935,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationships() { assertEquals(Concepts.MODULE_SCT_CORE, donatedStatedIsa.getModuleId()); List donatedInferredIsas = donatedConceptInExtension.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.INFERRED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedInferredIsas.size()); @@ -974,9 +962,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef Concepts.SYNONYM, extensionSynonymTerm1, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody1 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody1 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map extensionConceptRequestBody1 = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody1, inferredIsaRequestBody1), @@ -998,10 +986,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef String extensionSynonymId1 = extensionConcept1.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm1)) .findFirst().get().getId(); - String extensionStatedIsaId1 = extensionConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId1 = extensionConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId1 = getFirstRelationshipId(extensionConcept1, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId1 = getFirstRelationshipId(extensionConcept1, Concepts.INFERRED_RELATIONSHIP); // create another extension concept which references the previous one @@ -1017,12 +1003,12 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef Concepts.SYNONYM, extensionSynonymTerm2, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody2 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody2 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map partOfRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.PART_OF, extensionConceptId1, CharacteristicType.ADDITIONAL_RELATIONSHIP); + Concepts.PART_OF, extensionConceptId1, Concepts.ADDITIONAL_RELATIONSHIP); Map extensionConceptRequestBody2 = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody2, inferredIsaRequestBody2, partOfRequestBody), @@ -1044,12 +1030,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef String extensionSynonymId2 = extensionConcept2.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm2)) .findFirst().get().getId(); - String extensionStatedIsaId2 = extensionConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId2 = extensionConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); - String extensionPartOfId = extensionConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.ADDITIONAL_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId2 = getFirstRelationshipId(extensionConcept2, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId2 = getFirstRelationshipId(extensionConcept2, Concepts.INFERRED_RELATIONSHIP); + String extensionPartOfId = getFirstRelationshipId(extensionConcept2, Concepts.ADDITIONAL_RELATIONSHIP); // create new version on MAIN @@ -1057,12 +1040,12 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef String versionId = "v13"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT concept with same ID on version branch @@ -1072,9 +1055,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef Concepts.SYNONYM, extensionPtTerm1, SnomedApiTestConstants.UK_PREFERRED_MAP); Map intStatedIsaRequestBody1 = createRelationshipRequestBody(extensionStatedIsaId1, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map intInferredIsaRequestBody1 = createRelationshipRequestBody(extensionInferredIsaId1, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map intConceptRequestBody1 = createConceptRequestBody(extensionConceptId1, "", Concepts.MODULE_SCT_CORE, ImmutableList.of(intStatedIsaRequestBody1, intInferredIsaRequestBody1), @@ -1094,10 +1077,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef .getId(); String intPtId1 = intConcept1.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionPtTerm1)).findFirst().get().getId(); - String intStatedIsaId1 = intConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String intInferredIsaId1 = intConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String intStatedIsaId1 = getFirstRelationshipId(intConcept1, Concepts.STATED_RELATIONSHIP); + String intInferredIsaId1 = getFirstRelationshipId(intConcept1, Concepts.INFERRED_RELATIONSHIP); assertEquals(intConceptId1, extensionConceptId1); assertNotEquals(intConcept1.getModuleId(), extensionConcept1.getModuleId()); @@ -1115,9 +1096,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef Concepts.SYNONYM, extensionPtTerm2, SnomedApiTestConstants.UK_PREFERRED_MAP); Map intStatedIsaRequestBody2 = createRelationshipRequestBody(extensionStatedIsaId2, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map intInferredIsaRequestBody2 = createRelationshipRequestBody(extensionInferredIsaId2, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map intConceptRequestBody2 = createConceptRequestBody(extensionConceptId2, "", Concepts.MODULE_SCT_CORE, ImmutableList.of(intStatedIsaRequestBody2, intInferredIsaRequestBody2), @@ -1137,10 +1118,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef .getId(); String intPtId2 = intConcept2.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionPtTerm2)).findFirst().get().getId(); - String intStatedIsaId2 = intConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String intInferredIsaId2 = intConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String intStatedIsaId2 = getFirstRelationshipId(intConcept2, Concepts.STATED_RELATIONSHIP); + String intInferredIsaId2 = getFirstRelationshipId(intConcept2, Concepts.INFERRED_RELATIONSHIP); assertEquals(intConceptId2, extensionConceptId2); assertNotEquals(intConcept2.getModuleId(), extensionConcept2.getModuleId()); @@ -1197,7 +1176,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef assertEquals(Concepts.MODULE_B2I_EXTENSION, additionalSyonym.getModuleId()); List donatedStatedIsas = donatedConceptInExtension1.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedStatedIsas.size()); @@ -1206,7 +1185,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef assertEquals(Concepts.MODULE_SCT_CORE, donatedStatedIsa.getModuleId()); List donatedInferredIsas = donatedConceptInExtension1.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.INFERRED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedInferredIsas.size()); @@ -1249,7 +1228,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef assertEquals(Concepts.MODULE_B2I_EXTENSION, additionalSyonym2.getModuleId()); List donatedStatedIsas2 = donatedConceptInExtension2.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedStatedIsas2.size()); @@ -1258,7 +1237,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef assertEquals(Concepts.MODULE_SCT_CORE, donatedStatedIsa2.getModuleId()); List donatedInferredIsas2 = donatedConceptInExtension2.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.INFERRED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedInferredIsas2.size()); @@ -1267,7 +1246,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithCrossRef assertEquals(Concepts.MODULE_SCT_CORE, donatedInferredIsa2.getModuleId()); List additionalRelationships = donatedConceptInExtension2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.ADDITIONAL_RELATIONSHIP) + .filter(r -> Concepts.ADDITIONAL_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, additionalRelationships.size()); @@ -1295,9 +1274,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal Concepts.SYNONYM, extensionSynonymTerm1, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody1 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody1 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map extensionConceptRequestBody1 = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody1, inferredIsaRequestBody1), @@ -1319,10 +1298,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal String extensionSynonymId1 = extensionConcept1.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm1)) .findFirst().get().getId(); - String extensionStatedIsaId1 = extensionConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId1 = extensionConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId1 = getFirstRelationshipId(extensionConcept1, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId1 = getFirstRelationshipId(extensionConcept1, Concepts.INFERRED_RELATIONSHIP); // create another extension concept which references the previous one @@ -1338,12 +1315,12 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal Concepts.SYNONYM, extensionSynonymTerm2, SnomedApiTestConstants.UK_ACCEPTABLE_MAP); Map statedIsaRequestBody2 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map inferredIsaRequestBody2 = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map partOfRequestBody = createRelationshipRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, - Concepts.PART_OF, extensionConceptId1, CharacteristicType.ADDITIONAL_RELATIONSHIP); + Concepts.PART_OF, extensionConceptId1, Concepts.ADDITIONAL_RELATIONSHIP); Map extensionConceptRequestBody2 = createConceptRequestBody(Concepts.B2I_NAMESPACE, Concepts.MODULE_B2I_EXTENSION, ImmutableList.of(statedIsaRequestBody2, inferredIsaRequestBody2, partOfRequestBody), @@ -1365,12 +1342,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal String extensionSynonymId2 = extensionConcept2.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionSynonymTerm2)) .findFirst().get().getId(); - String extensionStatedIsaId2 = extensionConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String extensionInferredIsaId2 = extensionConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); - String extensionPartOfId = extensionConcept2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.ADDITIONAL_RELATIONSHIP).findFirst().get().getId(); + String extensionStatedIsaId2 = getFirstRelationshipId(extensionConcept2, Concepts.STATED_RELATIONSHIP); + String extensionInferredIsaId2 = getFirstRelationshipId(extensionConcept2, Concepts.INFERRED_RELATIONSHIP); + String extensionPartOfId = getFirstRelationshipId(extensionConcept2, Concepts.ADDITIONAL_RELATIONSHIP); // create new version on MAIN @@ -1378,12 +1352,12 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal String versionId = "v12"; createVersion(SnomedTerminologyComponentConstants.SNOMED_SHORT_NAME, versionId, effectiveDate).statusCode(201); - IBranchPath targetPath = BranchPathUtils.createPath(SnomedApiTestConstants.PATH_JOINER.join( + IBranchPath targetPath = BranchPathUtils.createPath(PATH_JOINER.join( Branch.MAIN_PATH, versionId, SnomedTerminologyComponentConstants.SNOMED_B2I_SHORT_NAME)); - createBranch(targetPath).statusCode(201); + branching.createBranch(targetPath).statusCode(201); // create INT concept with same ID on version branch @@ -1393,9 +1367,9 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal Concepts.SYNONYM, extensionPtTerm1, SnomedApiTestConstants.UK_PREFERRED_MAP); Map intStatedIsaRequestBody1 = createRelationshipRequestBody(extensionStatedIsaId1, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.STATED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.STATED_RELATIONSHIP); Map intInferredIsaRequestBody1 = createRelationshipRequestBody(extensionInferredIsaId1, "", Concepts.MODULE_SCT_CORE, - Concepts.IS_A, Concepts.ROOT_CONCEPT, CharacteristicType.INFERRED_RELATIONSHIP); + Concepts.IS_A, Concepts.ROOT_CONCEPT, Concepts.INFERRED_RELATIONSHIP); Map intConceptRequestBody1 = createConceptRequestBody(extensionConceptId1, "", Concepts.MODULE_SCT_CORE, ImmutableList.of(intStatedIsaRequestBody1, intInferredIsaRequestBody1), @@ -1415,10 +1389,8 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal .getId(); String intPtId1 = intConcept1.getDescriptions().getItems().stream().filter(d -> d.getTerm().equals(extensionPtTerm1)).findFirst().get().getId(); - String intStatedIsaId1 = intConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP).findFirst().get().getId(); - String intInferredIsaId1 = intConcept1.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP).findFirst().get().getId(); + String intStatedIsaId1 = getFirstRelationshipId(intConcept1, Concepts.STATED_RELATIONSHIP); + String intInferredIsaId1 = getFirstRelationshipId(intConcept1, Concepts.INFERRED_RELATIONSHIP); assertEquals(intConceptId1, extensionConceptId1); assertNotEquals(intConcept1.getModuleId(), extensionConcept1.getModuleId()); @@ -1477,7 +1449,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal assertEquals(Concepts.MODULE_B2I_EXTENSION, additionalSyonym.getModuleId()); List donatedStatedIsas = donatedConceptInExtension1.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedStatedIsas.size()); @@ -1486,7 +1458,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal assertEquals(Concepts.MODULE_SCT_CORE, donatedStatedIsa.getModuleId()); List donatedInferredIsas = donatedConceptInExtension1.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.INFERRED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, donatedInferredIsas.size()); @@ -1529,7 +1501,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal assertEquals(Concepts.MODULE_B2I_EXTENSION, additionalSyonym2.getModuleId()); List extensionStatedIsas2 = extensionConceptInExtension2.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.STATED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, extensionStatedIsas2.size()); @@ -1538,7 +1510,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal assertEquals(Concepts.MODULE_B2I_EXTENSION, extensionStatedIsa2.getModuleId()); List extensionInferredIsas2 = extensionConceptInExtension2.getRelationships().getItems().stream() - .filter(r -> r.getTypeId().equals(Concepts.IS_A) && r.getCharacteristicType() == CharacteristicType.INFERRED_RELATIONSHIP) + .filter(r -> r.getTypeId().equals(Concepts.IS_A) && Concepts.INFERRED_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, extensionInferredIsas2.size()); @@ -1547,7 +1519,7 @@ public void upgradeWithDonatedConceptAndDescriptionsAndRelationshipsWithExternal assertEquals(Concepts.MODULE_B2I_EXTENSION, extensionInferredIsa2.getModuleId()); List additionalRelationships = extensionConceptInExtension2.getRelationships().getItems().stream() - .filter(r -> r.getCharacteristicType() == CharacteristicType.ADDITIONAL_RELATIONSHIP) + .filter(r -> Concepts.ADDITIONAL_RELATIONSHIP.equals(r.getCharacteristicTypeId())) .collect(toList()); assertEquals(1, additionalRelationships.size()); @@ -1610,18 +1582,18 @@ private Map createDescriptionRequestBody(String id, String names return builder.build(); } - private Map createRelationshipRequestBody(String namespace, String moduleId, String typeId, String destinationId, CharacteristicType characteristicType) { - return createRelationshipRequestBody("", namespace, moduleId, typeId, destinationId, characteristicType); + private Map createRelationshipRequestBody(String namespace, String moduleId, String typeId, String destinationId, String characteristicTypeId) { + return createRelationshipRequestBody("", namespace, moduleId, typeId, destinationId, characteristicTypeId); } - private Map createRelationshipRequestBody(String id, String namespace, String moduleId, String typeId, String destinationId, CharacteristicType characteristicType) { + private Map createRelationshipRequestBody(String id, String namespace, String moduleId, String typeId, String destinationId, String characteristicTypeId) { Builder builder = ImmutableMap.builder() .put("moduleId", moduleId) .put("namespaceId", Strings.isNullOrEmpty(namespace) ? "" : namespace) .put("typeId", typeId) .put("destinationId", destinationId) - .put("characteristicType", characteristicType); + .put("characteristicType", characteristicTypeId); if (!Strings.isNullOrEmpty(id)) { builder.put("id", id); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionVersioningTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionVersioningTest.java index 80ecfb49ab4..6e67b42b138 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionVersioningTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/ext/SnomedExtensionVersioningTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,9 +26,9 @@ import org.junit.Test; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; -import com.b2international.snowowl.snomed.core.rest.BranchBase; import com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; +import com.b2international.snowowl.test.commons.rest.BranchBase; /** * @since 4.7 diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedExportApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedExportApiTest.java index 5ff71211ca5..d37e25be8d7 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedExportApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedExportApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import static com.b2international.snowowl.snomed.core.rest.CodeSystemVersionRestRequests.createVersion; import static com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants.UK_ACCEPTABLE_MAP; import static com.b2international.snowowl.snomed.core.rest.SnomedApiTestConstants.UK_PREFERRED_MAP; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.createComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.getComponent; import static com.b2international.snowowl.snomed.core.rest.SnomedComponentRestRequests.updateComponent; @@ -72,15 +71,12 @@ import com.b2international.snowowl.core.attachments.InternalAttachmentRegistry; import com.b2international.snowowl.core.date.DateFormats; import com.b2international.snowowl.core.date.EffectiveTimes; +import com.b2international.snowowl.core.domain.ExportResult; import com.b2international.snowowl.core.events.util.Promise; import com.b2international.snowowl.datastore.BranchPathUtils; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; -import com.b2international.snowowl.snomed.core.domain.Rf2ExportResult; import com.b2international.snowowl.snomed.core.domain.Rf2RefSetExportLayout; import com.b2international.snowowl.snomed.core.domain.Rf2ReleaseType; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; @@ -136,7 +132,7 @@ private static void assertArchiveContainsFiles(File exportArchive, Map existingFiles = newHashSet(); - try (FileSystem fs = FileSystems.newFileSystem(exportArchive.toPath(), null)) { + try (FileSystem fs = FileSystems.newFileSystem(exportArchive.toPath(), (ClassLoader) null)) { for (Path path : fs.getRootDirectories()) { Files.walkFileTree(path, new SimpleFileVisitor() { @Override @@ -169,7 +165,7 @@ private static Multimap> collectLines(File exportA Multimap> resultMap = ArrayListMultimap.create(); - try (FileSystem fs = FileSystems.newFileSystem(exportArchive.toPath(), null)) { + try (FileSystem fs = FileSystems.newFileSystem(exportArchive.toPath(), (ClassLoader) null)) { for (Path path : fs.getRootDirectories()) { Files.walkFileTree(path, new SimpleFileVisitor() { @Override @@ -229,9 +225,9 @@ public void createInvalidExportConfiguration() { @Test public void exportUnpublishedDeltaRelationships() throws Exception { - String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.STATED_RELATIONSHIP); - String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.INFERRED_RELATIONSHIP); - String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.ADDITIONAL_RELATIONSHIP); + String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.STATED_RELATIONSHIP); + String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.INFERRED_RELATIONSHIP); + String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.ADDITIONAL_RELATIONSHIP); String transientEffectiveTime = "20170301"; @@ -258,7 +254,7 @@ public void exportUnpublishedDeltaRelationships() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.STATED_RELATIONSHIP.getConceptId(), + Concepts.STATED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String inferredLine = TAB_JOINER.join(inferredRelationshipId, @@ -269,7 +265,7 @@ public void exportUnpublishedDeltaRelationships() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.INFERRED_RELATIONSHIP.getConceptId(), + Concepts.INFERRED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String additionalLine = TAB_JOINER.join(additionalRelationshipId, @@ -280,7 +276,7 @@ public void exportUnpublishedDeltaRelationships() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.ADDITIONAL_RELATIONSHIP.getConceptId(), + Concepts.ADDITIONAL_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); Multimap> fileToLinesMap = ArrayListMultimap.>create(); @@ -298,7 +294,7 @@ public void exportUnpublishedDeltaRelationships() throws Exception { @Test public void executeMultipleExportsAtTheSameTime() throws Exception { - Promise first = SnomedRequests.rf2().prepareExport() + Promise first = SnomedRequests.rf2().prepareExport() .setCodeSystem("SNOMEDCT") .setReleaseType(Rf2ReleaseType.FULL) .setCountryNamespaceElement("INT") @@ -308,7 +304,7 @@ public void executeMultipleExportsAtTheSameTime() throws Exception { .build(SnomedDatastoreActivator.REPOSITORY_UUID) .execute(getBus()); - Promise second = SnomedRequests.rf2().prepareExport() + Promise second = SnomedRequests.rf2().prepareExport() .setCodeSystem("SNOMEDCT") .setCountryNamespaceElement("INT") .setRefSetExportLayout(Rf2RefSetExportLayout.COMBINED) @@ -323,8 +319,8 @@ public void executeMultipleExportsAtTheSameTime() throws Exception { @Override public String apply(List input) { - Rf2ExportResult firstResult = (Rf2ExportResult) input.get(0); - Rf2ExportResult secondResult = (Rf2ExportResult) input.get(1); + ExportResult firstResult = (ExportResult) input.get(0); + ExportResult secondResult = (ExportResult) input.get(1); InternalAttachmentRegistry fileRegistry = (InternalAttachmentRegistry) ApplicationContext.getServiceForClass(AttachmentRegistry.class); @@ -367,9 +363,9 @@ public String apply(Throwable input) { public void exportDeltaInDateRangeFromVersion() throws Exception { createCodeSystem(branchPath, "SNOMEDCT-DELTA").statusCode(201); - String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.STATED_RELATIONSHIP); - String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.INFERRED_RELATIONSHIP); - String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.ADDITIONAL_RELATIONSHIP); + String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.STATED_RELATIONSHIP); + String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.INFERRED_RELATIONSHIP); + String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.ADDITIONAL_RELATIONSHIP); String versionEffectiveTime = "20170302"; createVersion("SNOMEDCT-DELTA", "v1", versionEffectiveTime).statusCode(201); @@ -401,7 +397,7 @@ public void exportDeltaInDateRangeFromVersion() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.STATED_RELATIONSHIP.getConceptId(), + Concepts.STATED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String inferredLine = TAB_JOINER.join(inferredRelationshipId, @@ -412,7 +408,7 @@ public void exportDeltaInDateRangeFromVersion() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.INFERRED_RELATIONSHIP.getConceptId(), + Concepts.INFERRED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String additionalLine = TAB_JOINER.join(additionalRelationshipId, @@ -423,7 +419,7 @@ public void exportDeltaInDateRangeFromVersion() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.ADDITIONAL_RELATIONSHIP.getConceptId(), + Concepts.ADDITIONAL_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); Multimap> fileToLinesMap = ArrayListMultimap.>create(); @@ -442,9 +438,9 @@ public void exportDeltaInDateRangeFromVersion() throws Exception { public void exportDeltaInDateRangeAndUnpublishedComponents() throws Exception { createCodeSystem(branchPath, "SNOMEDCT-GAMMA").statusCode(201); - String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.STATED_RELATIONSHIP); - String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.INFERRED_RELATIONSHIP); - String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.ADDITIONAL_RELATIONSHIP); + String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.STATED_RELATIONSHIP); + String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.INFERRED_RELATIONSHIP); + String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.ADDITIONAL_RELATIONSHIP); String relationshipEffectiveTime = "20170303"; createVersion("SNOMEDCT-GAMMA", "v1", relationshipEffectiveTime).statusCode(201); @@ -484,7 +480,7 @@ public void exportDeltaInDateRangeAndUnpublishedComponents() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.STATED_RELATIONSHIP.getConceptId(), + Concepts.STATED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String inferredLine = TAB_JOINER.join(inferredRelationshipId, @@ -495,7 +491,7 @@ public void exportDeltaInDateRangeAndUnpublishedComponents() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.INFERRED_RELATIONSHIP.getConceptId(), + Concepts.INFERRED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String additionalLine = TAB_JOINER.join(additionalRelationshipId, @@ -506,14 +502,14 @@ public void exportDeltaInDateRangeAndUnpublishedComponents() throws Exception { Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, - CharacteristicType.ADDITIONAL_RELATIONSHIP.getConceptId(), + Concepts.ADDITIONAL_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String conceptLine = TAB_JOINER.join(conceptId, conceptEffectiveTime, "1", Concepts.MODULE_SCT_CORE, - DefinitionStatus.PRIMITIVE.getConceptId()); + Concepts.PRIMITIVE); String descriptionLine = TAB_JOINER.join(descriptionId, "", @@ -523,7 +519,7 @@ public void exportDeltaInDateRangeAndUnpublishedComponents() throws Exception { "en", Concepts.SYNONYM, "Description term", - CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.getConceptId()); + Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE); Multimap> fileToLinesMap = ArrayListMultimap.>create(); @@ -557,7 +553,7 @@ public void exportContentFromVersionFixerTask() throws Exception { IBranchPath taskBranch = BranchPathUtils.createPath(versionPath, "Fix01"); // create fixer branch for version branch - createBranch(taskBranch).statusCode(201); + branching.createBranch(taskBranch).statusCode(201); // change an existing component final String newEffectiveTime = "20170302"; @@ -618,7 +614,7 @@ public void exportContentFromVersionFixerTaskTransEffTime() throws Exception { IBranchPath taskBranch = BranchPathUtils.createPath(versionPath, "Fix01"); // create fixer branch for version branch - createBranch(taskBranch).statusCode(201); + branching.createBranch(taskBranch).statusCode(201); // change an existing component @@ -698,10 +694,10 @@ public void exportPublishedAndUnpublishedTextDef() throws Exception { final File exportArchive = getExportFile(exportId); String textDefinitionLine = getComponentLine(ImmutableList. of(textDefinitionId, versionEffectiveTime, "1", MODULE_SCT_CORE, conceptId, "en", - Concepts.TEXT_DEFINITION, "Description term", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.getConceptId())); + Concepts.TEXT_DEFINITION, "Description term", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE)); String unpublishedTextDefinitionLine = getComponentLine(ImmutableList. of(unpublishedTextDefinitionId, "", "1", MODULE_SCT_CORE, conceptId, "en", - Concepts.TEXT_DEFINITION, "Description term", CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.getConceptId())); + Concepts.TEXT_DEFINITION, "Description term", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE)); final Multimap> fileToLinesMap = ArrayListMultimap.>create(); @@ -725,12 +721,12 @@ public void exportAlwaysCreatesTextDef_DescAndLangRefsetFiles() throws Exception createVersion(codeSystemShortName, "v1", versionEffectiveTime).statusCode(201); getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(200) - .body("definitionStatus", equalTo(DefinitionStatus.PRIMITIVE.name())); + .body("definitionStatusId", equalTo(Concepts.PRIMITIVE)); changeToDefining(branchPath, conceptId); getComponent(branchPath, SnomedComponentType.CONCEPT, conceptId).statusCode(200) - .body("definitionStatus", equalTo(DefinitionStatus.FULLY_DEFINED.name())); + .body("definitionStatusId", equalTo(Concepts.FULLY_DEFINED)); // create new version final String newVersionEffectiveTime = "20170302"; @@ -982,7 +978,7 @@ public void exportLangRefset_acceptabilityAndDescChanges() throws Exception { createVersion(codeSystemShortName, "v1", versionEffectiveTime).statusCode(201); Map caseSignificanceChangeRequestBody = ImmutableMap.builder() - .put("caseSignificance", CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE) + .put("caseSignificance", Concepts.ENTIRE_TERM_CASE_SENSITIVE) .put("commitComment", "Updated description case significance") .build(); Map acceptabilityChangeRequestBody = ImmutableMap.builder() @@ -1024,17 +1020,17 @@ public void exportLangRefset_acceptabilityAndDescChanges() throws Exception { final File exportArchive = getExportFile(exportId); String descriptionLineA = createDescriptionLine(descriptionIdA, "", conceptId, "en", Concepts.SYNONYM, DEFAULT_TERM, - CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.getConceptId()); + Concepts.ENTIRE_TERM_CASE_SENSITIVE); String descriptionLineB = createDescriptionLine(descriptionIdB, "", conceptId, "da", Concepts.SYNONYM, DEFAULT_TERM, - CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.getConceptId()); + Concepts.ENTIRE_TERM_CASE_SENSITIVE); String descriptionLineC = createDescriptionLine(descriptionIdC, versionEffectiveTime, conceptId, "en", Concepts.SYNONYM, DEFAULT_TERM); String descriptionLineD = createDescriptionLine(descriptionIdD, versionEffectiveTime, conceptId, "da", Concepts.SYNONYM, DEFAULT_TERM); String descriptionLineE = createDescriptionLine(descriptionIdE, "", conceptId, "en", Concepts.SYNONYM, DEFAULT_TERM, - CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.getConceptId()); + Concepts.ENTIRE_TERM_CASE_SENSITIVE); String descriptionLineF = createDescriptionLine(descriptionIdF, "", conceptId, "da", Concepts.SYNONYM, DEFAULT_TERM, - CaseSignificance.ENTIRE_TERM_CASE_SENSITIVE.getConceptId()); + Concepts.ENTIRE_TERM_CASE_SENSITIVE); String languageMemberLineA = createLanguageRefsetMemberLine(branchPath, descriptionIdA, "", Concepts.REFSET_LANGUAGE_TYPE_UK, Acceptability.PREFERRED.getConceptId()); @@ -1081,9 +1077,9 @@ public void exportConceptsAndRelationshipsOnly() throws Exception { final String conceptId = createNewConcept(branchPath); createNewDescription(branchPath, conceptId, Concepts.SYNONYM, UK_ACCEPTABLE_MAP, "en"); - String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.STATED_RELATIONSHIP); - String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.INFERRED_RELATIONSHIP); - String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, CharacteristicType.ADDITIONAL_RELATIONSHIP); + String statedRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.STATED_RELATIONSHIP); + String inferredRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.INFERRED_RELATIONSHIP); + String additionalRelationshipId = createNewRelationship(branchPath, Concepts.ROOT_CONCEPT, Concepts.PART_OF, Concepts.NAMESPACE_ROOT, Concepts.ADDITIONAL_RELATIONSHIP); createNewRefSet(branchPath, SnomedRefSetType.OWL_AXIOM, Concepts.REFSET_OWL_AXIOM); @@ -1111,17 +1107,17 @@ public void exportConceptsAndRelationshipsOnly() throws Exception { final String exportId = getExportId(createExport(config)); final File exportArchive = getExportFile(exportId); - String conceptLine = TAB_JOINER.join(conceptId, "", "1", Concepts.MODULE_SCT_CORE, DefinitionStatus.PRIMITIVE.getConceptId()); + String conceptLine = TAB_JOINER.join(conceptId, "", "1", Concepts.MODULE_SCT_CORE, Concepts.PRIMITIVE); String statedLine = TAB_JOINER.join(statedRelationshipId, "", "1", Concepts.MODULE_SCT_CORE, Concepts.ROOT_CONCEPT, Concepts.NAMESPACE_ROOT, - "0", Concepts.PART_OF, CharacteristicType.STATED_RELATIONSHIP.getConceptId(), Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); + "0", Concepts.PART_OF, Concepts.STATED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String inferredLine = TAB_JOINER.join(inferredRelationshipId, "", "1", Concepts.MODULE_SCT_CORE, Concepts.ROOT_CONCEPT, - Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, CharacteristicType.INFERRED_RELATIONSHIP.getConceptId(), + Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, Concepts.INFERRED_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String additionalLine = TAB_JOINER.join(additionalRelationshipId, "", "1", Concepts.MODULE_SCT_CORE, Concepts.ROOT_CONCEPT, - Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, CharacteristicType.ADDITIONAL_RELATIONSHIP.getConceptId(), + Concepts.NAMESPACE_ROOT, "0", Concepts.PART_OF, Concepts.ADDITIONAL_RELATIONSHIP, Concepts.EXISTENTIAL_RESTRICTION_MODIFIER); String owlMemberLine = TAB_JOINER.join(memberId, "", "1", Concepts.MODULE_SCT_CORE, Concepts.REFSET_OWL_AXIOM, Concepts.ROOT_CONCEPT, @@ -1353,7 +1349,7 @@ private static String getLanguageRefsetMemberId(IBranchPath branchPath, String d } private static String createDescriptionLine(String id, String effectiveTime, String conceptId, String languageCode, String type, String term) { - return createDescriptionLine(id, effectiveTime, conceptId, languageCode, type, term, CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE.getConceptId()); + return createDescriptionLine(id, effectiveTime, conceptId, languageCode, type, term, Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE); } private static String createDescriptionLine(String id, String effectiveTime, String conceptId, String languageCode, String type, String term, String caseSignificance) { diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportApiTest.java index 1acc8a8a2b7..24a7e58e304 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,7 +49,6 @@ import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; -import com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests; import com.b2international.snowowl.snomed.core.rest.SnomedComponentType; import com.google.common.collect.ImmutableMap; @@ -493,7 +492,7 @@ public void import28ImportConceptAsInactive() { private void validateBranchHeadtimestampUpdate(IBranchPath branch, String importArchiveFileName, boolean createVersions) { - ValidatableResponse response = SnomedBranchingRestRequests.getBranch(branch); + ValidatableResponse response = branching.getBranch(branch); String baseTimestamp = response.extract().jsonPath().getString("baseTimestamp"); String headTimestamp = response.extract().jsonPath().getString("headTimestamp"); @@ -505,7 +504,7 @@ private void validateBranchHeadtimestampUpdate(IBranchPath branch, String import importArchive(importArchiveFileName, branch, createVersions, Rf2ReleaseType.DELTA); - ValidatableResponse response2 = SnomedBranchingRestRequests.getBranch(branch); + ValidatableResponse response2 = branching.getBranch(branch); String baseTimestampAfterImport = response2.extract().jsonPath().getString("baseTimestamp"); String headTimestampAfterImport = response2.extract().jsonPath().getString("headTimestamp"); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportRowValidatorTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportRowValidatorTest.java index 88046ae6300..76ce90bb37d 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportRowValidatorTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/io/SnomedImportRowValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,8 +33,8 @@ import com.b2international.snowowl.core.ApplicationContext; import com.b2international.snowowl.core.attachments.AttachmentRegistry; import com.b2international.snowowl.snomed.core.domain.ISnomedImportConfiguration.ImportStatus; -import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; import com.b2international.snowowl.snomed.core.domain.Rf2ReleaseType; +import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import com.b2international.snowowl.snomed.datastore.request.rf2.Rf2ImportResponse; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedConceptCreatePerformanceTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedConceptCreatePerformanceTest.java index ad320f2a558..eb3a90c71e6 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedConceptCreatePerformanceTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedConceptCreatePerformanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedMergePerformanceTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedMergePerformanceTest.java index aa7a99ee07c..90c23ff652e 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedMergePerformanceTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/perf/SnomedMergePerformanceTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.core.rest.perf; -import static com.b2international.snowowl.snomed.core.rest.SnomedBranchingRestRequests.createBranch; import static org.assertj.core.api.Assertions.assertThat; import java.util.Set; @@ -35,7 +34,6 @@ import com.b2international.snowowl.datastore.request.CommitResult; import com.b2international.snowowl.datastore.request.RepositoryRequests; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; import com.b2international.snowowl.snomed.core.rest.AbstractSnomedApiTest; @@ -78,7 +76,7 @@ public static void deleteBranch() { @Test public void testPerf() throws Exception { IBranchPath branch = BranchPathUtils.createPath(branchPath, "merge-test"); - createBranch(branch).statusCode(201); + branching.createBranch(branch).statusCode(201); BulkRequestBuilder bulk = BulkRequest.create(); final int numberOfConceptsToWorkWith = 10_000; for (int i = 0; i < numberOfConceptsToWorkWith; i++) { @@ -100,7 +98,7 @@ public void testPerf() throws Exception { .preferredIn(Concepts.REFSET_LANGUAGE_TYPE_UK)) .addRelationship(SnomedRequests.prepareNewRelationship() .setIdFromNamespace(null /*INT*/) - .setCharacteristicType(CharacteristicType.STATED_RELATIONSHIP) + .setCharacteristicTypeId(Concepts.STATED_RELATIONSHIP) .setTypeId(Concepts.IS_A) .setDestinationId(Concepts.ROOT_CONCEPT))); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/versioning/SnomedVersioningApiTest.java b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/versioning/SnomedVersioningApiTest.java index ee2e9b7f076..ef648a68dbf 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/versioning/SnomedVersioningApiTest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest.tests/src/com/b2international/snowowl/snomed/core/rest/versioning/SnomedVersioningApiTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/META-INF/MANIFEST.MF b/snomed/com.b2international.snowowl.snomed.core.rest/META-INF/MANIFEST.MF index fc39e50cc4d..a695bd0b90d 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/META-INF/MANIFEST.MF +++ b/snomed/com.b2international.snowowl.snomed.core.rest/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT REST Services Bundle-SymbolicName: com.b2international.snowowl.snomed.core.rest;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.snowowl.core.rest Automatic-Module-Name: com.b2international.snowowl.rest.snomed diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/pom.xml b/snomed/com.b2international.snowowl.snomed.core.rest/pom.xml index fe6407bd2cf..1a02412afc8 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.core.rest/pom.xml @@ -5,7 +5,7 @@ com.b2international.snowowl snomed-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT com.b2international.snowowl.snomed.core.rest diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/core/rest/SnomedApiConfig.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/core/rest/SnomedApiConfig.java index 3ee2d591eb2..53c001a37af 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/core/rest/SnomedApiConfig.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/core/rest/SnomedApiConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import org.springframework.context.annotation.Configuration; import com.b2international.snowowl.core.config.SnowOwlConfiguration; +import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; import com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration; import springfox.documentation.spring.web.plugins.Docket; @@ -31,6 +32,8 @@ @ComponentScan("com.b2international.snowowl.snomed.core.rest") public class SnomedApiConfig extends BaseApiConfig { + public static final String REPOSITORY_ID = SnomedDatastoreActivator.REPOSITORY_UUID; + @Override public String getApiBaseUrl() { return "/snomed-ct/v3"; diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedRestService.java index cf8b770f680..b3b3a3208f7 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/AbstractSnomedRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ import java.util.Set; import com.b2international.snowowl.core.rest.AbstractRestService; -import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; +import com.b2international.snowowl.core.rest.SnomedApiConfig; /** * @since 7.2 */ public abstract class AbstractSnomedRestService extends AbstractRestService { - protected String repositoryId = SnomedDatastoreActivator.REPOSITORY_UUID; + protected final String repositoryId = SnomedApiConfig.REPOSITORY_ID; public AbstractSnomedRestService() { super(); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedClassificationRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedClassificationRestService.java index 6befca795b3..39dd9c3953e 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedClassificationRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedClassificationRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,14 +81,6 @@ public SnomedClassificationRestService() { @RequestParam(value="userId", required=false) final String userId, - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value = "The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -106,8 +98,6 @@ public SnomedClassificationRestService() { .filterByUserId(userId) .filterByStatus(status) .sortBy(extractSortFields(sort)) - .setScroll(scrollKeepAlive) - .setScrollId(scrollId) .setSearchAfter(searchAfter) .setLimit(limit) .build(SnomedDatastoreActivator.REPOSITORY_UUID) @@ -182,14 +172,6 @@ public Promise> beginClassification( @PathVariable(value="classificationId") final String classificationId, - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value = "The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -207,8 +189,6 @@ public Promise> beginClassification( .filterByClassificationId(classificationId) .setExpand("equivalentConcepts(expand(pt()))") .setLocales(extendedLocales) - .setScroll(scrollKeepAlive) - .setScrollId(scrollId) .setSearchAfter(searchAfter) .setLimit(limit) .build(SnomedDatastoreActivator.REPOSITORY_UUID) @@ -236,14 +216,6 @@ public Promise> beginClassification( @RequestParam(value="expand", required=false) final String expand, - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - @ApiParam(value = "The search key to use for retrieving the next page of results") @RequestParam(value="searchAfter", required=false) final String searchAfter, @@ -262,8 +234,6 @@ public Promise> beginClassification( return ClassificationRequests.prepareSearchRelationshipChange() .filterByClassificationId(classificationId) .setExpand(expandWithRelationship) - .setScroll(scrollKeepAlive) - .setScrollId(scrollId) .setSearchAfter(searchAfter) .setLimit(limit) .build(SnomedDatastoreActivator.REPOSITORY_UUID) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedConceptRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedConceptRestService.java index 010d5b1704c..4e454258670 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedConceptRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedConceptRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.core.rest; -import java.net.URI; import java.util.Collections; import java.util.List; import java.util.Map; @@ -28,7 +27,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.StringUtils; import com.b2international.commons.http.ExtendedLocale; @@ -43,10 +41,10 @@ import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; -import com.b2international.snowowl.snomed.core.rest.domain.ChangeRequest; import com.b2international.snowowl.snomed.core.rest.domain.SnomedConceptRestInput; import com.b2international.snowowl.snomed.core.rest.domain.SnomedConceptRestSearch; import com.b2international.snowowl.snomed.core.rest.domain.SnomedConceptRestUpdate; +import com.b2international.snowowl.snomed.core.rest.domain.SnomedResourceRequest; import com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionSearchRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import com.google.common.collect.ImmutableMap; @@ -113,8 +111,6 @@ public SnomedConceptRestService() { return SnomedRequests .prepareSearchConcept() .setLimit(params.getLimit()) - .setScroll(params.getScrollKeepAlive()) - .setScrollId(params.getScrollId()) .setSearchAfter(params.getSearchAfter()) .filterByIds(params.getId()) .filterByEffectiveTime(params.getEffectiveTime()) @@ -230,7 +226,7 @@ public ResponseEntity create( @ApiParam(value = "Concept parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -246,7 +242,7 @@ public ResponseEntity create( .getResultAs(String.class); - return ResponseEntity.created(getConceptLocationURI(branchPath, createdConceptId)).build(); + return ResponseEntity.created(getResourceLocationURI(branchPath, createdConceptId)).build(); } @ApiOperation( @@ -281,7 +277,7 @@ public void update( @ApiParam(value = "Updated Concept parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -335,10 +331,6 @@ public void delete( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS); } - private URI getConceptLocationURI(String branchPath, String conceptId) { - return MvcUriComponentsBuilder.fromController(SnomedConceptRestService.class).pathSegment(branchPath, conceptId).build().toUri(); - } - @Override protected Sort toSort(String field, boolean ascending, String branch, List extendedLocales) { switch (field) { diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedDescriptionRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedDescriptionRestService.java index a2ff6f5637a..641d72fe1ae 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedDescriptionRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedDescriptionRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.core.rest; -import java.net.URI; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -25,7 +24,6 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.StringUtils; import com.b2international.commons.http.ExtendedLocale; @@ -38,10 +36,10 @@ import com.b2international.snowowl.snomed.core.domain.Acceptability; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; import com.b2international.snowowl.snomed.core.domain.SnomedDescriptions; -import com.b2international.snowowl.snomed.core.rest.domain.ChangeRequest; import com.b2international.snowowl.snomed.core.rest.domain.SnomedDescriptionRestInput; import com.b2international.snowowl.snomed.core.rest.domain.SnomedDescriptionRestSearch; import com.b2international.snowowl.snomed.core.rest.domain.SnomedDescriptionRestUpdate; +import com.b2international.snowowl.snomed.core.rest.domain.SnomedResourceRequest; import com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionSearchRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import com.google.common.collect.ImmutableSet; @@ -132,8 +130,6 @@ public Promise searchByGet( return req .setLocales(extendedLocales) .setLimit(params.getLimit()) - .setScroll(params.getScrollKeepAlive()) - .setScrollId(params.getScrollId()) .setSearchAfter(params.getSearchAfter()) .setExpand(params.getExpand()) .sortBy(sorts) @@ -183,7 +179,7 @@ public ResponseEntity create( @ApiParam(value = "Description parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -198,7 +194,7 @@ public ResponseEntity create( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS) .getResultAs(String.class); - return ResponseEntity.created(getDescriptionLocation(branchPath, createdDescriptionId)).build(); + return ResponseEntity.created(getResourceLocationURI(branchPath, createdDescriptionId)).build(); } @ApiOperation( @@ -250,7 +246,7 @@ public void update( @ApiParam(value = "Update Description parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -301,7 +297,4 @@ public void delete( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS); } - private URI getDescriptionLocation(final String branchPath, final String descriptionId) { - return MvcUriComponentsBuilder.fromController(SnomedDescriptionRestService.class).pathSegment(branchPath, descriptionId).build().toUri(); - } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestService.java index 9e0477d7c1f..c033c6bd30c 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedExportRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.exceptions.BadRequestException; +import com.b2international.commons.exceptions.NotFoundException; import com.b2international.commons.validation.ApiValidation; import com.b2international.snowowl.core.ApplicationContext; import com.b2international.snowowl.core.attachments.AttachmentRegistry; @@ -50,17 +51,16 @@ import com.b2international.snowowl.core.branch.Branch; import com.b2international.snowowl.core.date.DateFormats; import com.b2international.snowowl.core.date.Dates; +import com.b2international.snowowl.core.domain.ExportResult; import com.b2international.snowowl.core.rest.AbstractRestService; import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.datastore.request.RepositoryRequests; import com.b2international.snowowl.eventbus.IEventBus; import com.b2international.snowowl.snomed.cis.SnomedIdentifiers; -import com.b2international.snowowl.snomed.core.domain.Rf2ExportResult; import com.b2international.snowowl.snomed.core.domain.Rf2RefSetExportLayout; import com.b2international.snowowl.snomed.core.domain.Rf2ReleaseType; import com.b2international.snowowl.snomed.core.rest.domain.SnomedExportRestConfiguration; import com.b2international.snowowl.snomed.core.rest.domain.SnomedExportRestRun; -import com.b2international.snowowl.snomed.core.rest.exceptions.ExportRunNotFoundException; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; import com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; @@ -215,7 +215,7 @@ public SnomedExportRestRun getExport( final SnomedExportRestRun restRun = exports.get(exportId); if (restRun == null) { - throw new ExportRunNotFoundException(exportId.toString()); + throw new NotFoundException("Export run", exportId.toString()); } else { return restRun; } @@ -240,7 +240,7 @@ public SnomedExportRestRun getExport( final Rf2RefSetExportLayout refSetExportLayout = ApplicationContext.getServiceForClass(SnomedCoreConfiguration.class).getExport().getRefSetExportLayout(); - final Rf2ExportResult exportedFile = SnomedRequests.rf2().prepareExport() + final ExportResult exportedFile = SnomedRequests.rf2().prepareExport() .setReleaseType(export.getType()) .setCodeSystem(export.getCodeSystemShortName()) .setExtensionOnly(export.isExtensionOnly()) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedImportRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedImportRestService.java index 0acc882a440..e702c58b2db 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedImportRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedImportRestService.java @@ -155,13 +155,14 @@ private SnomedImportDetails convertToDetails(final UUID importId, final ISnomedImportConfiguration configuration) { final SnomedImportDetails details = new SnomedImportDetails(); - details.setCompletionDate(configuration.getCompletionDate()); - details.setCreateVersions(configuration.shouldCreateVersion()); details.setId(importId); - details.setStartDate(configuration.getStartDate()); - details.setStatus(SnomedImportStatus.getImportStatus(configuration.getStatus())); details.setType(configuration.getRf2ReleaseType()); details.setBranchPath(configuration.getBranchPath()); + details.setCodeSystemShortName(configuration.getCodeSystemShortName()); + details.setCreateVersions(configuration.shouldCreateVersion()); + details.setStartDate(configuration.getStartDate()); + details.setCompletionDate(configuration.getCompletionDate()); + details.setStatus(SnomedImportStatus.getImportStatus(configuration.getStatus())); return details; } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetMemberRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetMemberRestService.java index 4d2f2e10fa2..b0debc63172 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetMemberRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetMemberRestService.java @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.core.rest; -import java.net.URI; import java.util.List; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -24,7 +23,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.http.ExtendedLocale; import com.b2international.commons.options.Options; @@ -34,10 +32,10 @@ import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; -import com.b2international.snowowl.snomed.core.rest.domain.ChangeRequest; import com.b2international.snowowl.snomed.core.rest.domain.SnomedMemberRestUpdate; import com.b2international.snowowl.snomed.core.rest.domain.SnomedRefSetMemberRestInput; import com.b2international.snowowl.snomed.core.rest.domain.SnomedReferenceSetMemberRestSearch; +import com.b2international.snowowl.snomed.core.rest.domain.SnomedResourceRequest; import com.b2international.snowowl.snomed.core.rest.request.RefSetMemberRequestResolver; import com.b2international.snowowl.snomed.core.rest.request.RequestResolver; import com.b2international.snowowl.snomed.core.rest.request.RestRequest; @@ -88,8 +86,6 @@ public SnomedReferenceSetMemberRestService() { final SnomedRefSetMemberSearchRequestBuilder req = SnomedRequests.prepareSearchMember() .setLimit(params.getLimit()) - .setScroll(params.getScrollKeepAlive()) - .setScrollId(params.getScrollId()) .setSearchAfter(params.getSearchAfter()) .filterByIds(params.getId()) .filterByActive(params.getActive()) @@ -190,7 +186,7 @@ public ResponseEntity create( @ApiParam(value = "Reference set member parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -209,7 +205,7 @@ public ResponseEntity create( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS) .getResultAs(String.class); - return ResponseEntity.created(getRefSetMemberLocationURI(branchPath, createdRefSetMemberId)).build(); + return ResponseEntity.created(getResourceLocationURI(branchPath, createdRefSetMemberId)).build(); } @ApiOperation( @@ -272,7 +268,7 @@ public void update( @ApiParam(value = "Updated Reference Set parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @ApiParam(value = "Force update flag") @RequestParam(defaultValue="false", required=false) @@ -321,7 +317,7 @@ public void update( @ApiParam(value = "Reference set member action") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -344,7 +340,4 @@ public void update( .getSync(); } - private URI getRefSetMemberLocationURI(String branchPath, String memberId) { - return MvcUriComponentsBuilder.fromController(SnomedReferenceSetMemberRestService.class).pathSegment(branchPath, memberId).build().toUri(); - } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetRestService.java index d30b586ff00..98707680807 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedReferenceSetRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,17 +17,16 @@ import static com.google.common.collect.Sets.newHashSetWithExpectedSize; -import java.net.URI; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.concurrent.TimeUnit; +import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.exceptions.BadRequestException; import com.b2international.commons.http.ExtendedLocale; @@ -35,13 +34,15 @@ import com.b2international.snowowl.core.events.bulk.BulkRequest; import com.b2international.snowowl.core.events.bulk.BulkRequestBuilder; import com.b2international.snowowl.core.events.util.Promise; +import com.b2international.snowowl.core.request.SearchResourceRequest.Sort; import com.b2international.snowowl.core.rest.AbstractRestService; import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSets; -import com.b2international.snowowl.snomed.core.rest.domain.ChangeRequest; import com.b2international.snowowl.snomed.core.rest.domain.SnomedRefSetRestInput; +import com.b2international.snowowl.snomed.core.rest.domain.SnomedReferenceSetRestSearch; +import com.b2international.snowowl.snomed.core.rest.domain.SnomedResourceRequest; import com.b2international.snowowl.snomed.core.rest.request.BulkRestRequest; import com.b2international.snowowl.snomed.core.rest.request.RefSetMemberRequestResolver; import com.b2international.snowowl.snomed.core.rest.request.RefSetRequestResolver; @@ -70,53 +71,70 @@ public SnomedReferenceSetRestService() { @ApiOperation( value="Retrieve Reference Sets from a branch", - notes="Returns a list with all reference sets from a branch." + notes="Returns a list with all/filtered Reference Sets from a branch." + + "

The following properties can be expanded:" + + "

" + + "• members() – members currently available in the reference set
" ) @ApiResponses({ @ApiResponse(code = 200, message = "OK", response = SnomedReferenceSets.class), + @ApiResponse(code = 400, message = "Invalid search config", response = RestApiError.class), @ApiResponse(code = 404, message = "Branch not found", response = RestApiError.class) }) @GetMapping(produces = { AbstractRestService.JSON_MEDIA_TYPE }) - public @ResponseBody Promise search( + public @ResponseBody Promise searchByGet( @ApiParam(value = "The branch path", required = true) @PathVariable(value="path") - final String branchPath, - - @ApiParam(value = "The reference set type to match") - @RequestParam(value="refSetTypes", required=false) - final String[] refSetTypes, + final String branch, - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - @RequestParam(value="scrollKeepAlive", required=false) - final String scrollKeepAlive, + final SnomedReferenceSetRestSearch params, - @ApiParam(value = "A scrollId to continue scrolling a previous query") - @RequestParam(value="scrollId", required=false) - final String scrollId, - - @ApiParam(value = "The search key to use for retrieving the next page of results") - @RequestParam(value="searchAfter", required=false) - final String searchAfter, + @ApiParam(value = "Accepted language tags, in order of preference") + @RequestHeader(value=HttpHeaders.ACCEPT_LANGUAGE, defaultValue="en-US;q=0.8,en-GB;q=0.6", required=false) + final String acceptLanguage) { + + final List extendedLocales = getExtendedLocales(acceptLanguage); - @ApiParam(value = "The maximum number of items to return", defaultValue = "50") - @RequestParam(value="limit", required=false) - final int limit, - - @ApiParam(value = "Sort keys") - @RequestParam(value="sort", required=false) - final List sortKeys) { + List sorts = extractSortFields(params.getSort(), branch, extendedLocales); return SnomedRequests.prepareSearchRefSet() - .filterByTypes(getRefSetTypes(refSetTypes)) - .setScroll(scrollKeepAlive) - .setScrollId(scrollId) - .setSearchAfter(searchAfter) - .setLimit(limit) - .sortBy(extractSortFields(sortKeys)) - .build(repositoryId, branchPath) + .filterByTypes(getRefSetTypes(params.getRefSetTypes())) + .setLimit(params.getLimit()) + .setSearchAfter(params.getSearchAfter()) + .setLocales(extendedLocales) + .sortBy(sorts) + .build(repositoryId, branch) .execute(getBus()); } + @ApiOperation( + value="Retrieve Reference Sets from a branch", + notes="Returns a list with all/filtered Reference Sets from a branch." + + "

The following properties can be expanded:" + + "

" + + "• members() – members currently available in the reference set
" + ) + @ApiResponses({ + @ApiResponse(code = 200, message = "OK", response = SnomedReferenceSets.class), + @ApiResponse(code = 400, message = "Invalid search config", response = RestApiError.class), + @ApiResponse(code = 404, message = "Branch not found", response = RestApiError.class) + }) + @PostMapping(value="/search", produces = { AbstractRestService.JSON_MEDIA_TYPE }) + public @ResponseBody Promise searchByPost( + @ApiParam(value = "The branch path", required = true) + @PathVariable(value="path") + final String branch, + + @RequestBody(required = false) + final SnomedReferenceSetRestSearch body, + + @ApiParam(value = "Accepted language tags, in order of preference") + @RequestHeader(value=HttpHeaders.ACCEPT_LANGUAGE, defaultValue="en-US;q=0.8,en-GB;q=0.6", required=false) + final String acceptLanguage) { + + return searchByGet(branch, body, acceptLanguage); + } + private Collection getRefSetTypes(String[] refSetTypes) { if (refSetTypes == null) { return null; @@ -201,7 +219,7 @@ public ResponseEntity create( @ApiParam(value = "Reference set parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -216,7 +234,7 @@ public ResponseEntity create( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS) .getResultAs(String.class); - return ResponseEntity.created(getRefSetLocationURI(branchPath, createdRefSetId)).build(); + return ResponseEntity.created(getResourceLocationURI(branchPath, createdRefSetId)).build(); } @ApiOperation( @@ -243,7 +261,7 @@ public void executeAction( @ApiParam(value = "Reference set action") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR) final String author) { @@ -288,7 +306,7 @@ public void updateMembers( @ApiParam(value = "The reference set member changes") @RequestBody - final ChangeRequest request, + final SnomedResourceRequest request, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -350,7 +368,4 @@ public void delete( .getSync(); } - private URI getRefSetLocationURI(String branchPath, String refSetId) { - return MvcUriComponentsBuilder.fromController(SnomedReferenceSetRestService.class).pathSegment(branchPath, refSetId).build().toUri(); - } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRelationshipRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRelationshipRestService.java index 42e5f2e8c9f..4033792abdf 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRelationshipRestService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRelationshipRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,14 +15,12 @@ */ package com.b2international.snowowl.snomed.core.rest; -import java.net.URI; import java.util.List; import java.util.concurrent.TimeUnit; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import com.b2international.commons.http.ExtendedLocale; import com.b2international.snowowl.core.events.util.Promise; @@ -30,10 +28,10 @@ import com.b2international.snowowl.core.rest.RestApiError; import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; import com.b2international.snowowl.snomed.core.domain.SnomedRelationships; -import com.b2international.snowowl.snomed.core.rest.domain.ChangeRequest; import com.b2international.snowowl.snomed.core.rest.domain.SnomedRelationshipRestInput; import com.b2international.snowowl.snomed.core.rest.domain.SnomedRelationshipRestSearch; import com.b2international.snowowl.snomed.core.rest.domain.SnomedRelationshipRestUpdate; +import com.b2international.snowowl.snomed.core.rest.domain.SnomedResourceRequest; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import io.swagger.annotations.Api; @@ -94,8 +92,6 @@ public Promise searchByGet( .filterByGroup(params.getGroup()) .filterByUnionGroup(params.getUnionGroup()) .setLimit(params.getLimit()) - .setScroll(params.getScrollKeepAlive()) - .setScrollId(params.getScrollId()) .setSearchAfter(params.getSearchAfter()) .setExpand(params.getExpand()) .setLocales(extendedLocales) @@ -150,7 +146,7 @@ public ResponseEntity create( @ApiParam(value = "Relationship parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -165,7 +161,7 @@ public ResponseEntity create( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS) .getResultAs(String.class); - return ResponseEntity.created(getRelationshipLocation(branchPath, createdRelationshipId)).build(); + return ResponseEntity.created(getResourceLocationURI(branchPath, createdRelationshipId)).build(); } @ApiOperation( @@ -212,7 +208,7 @@ public void update( @ApiParam(value = "Update Relationship parameters") @RequestBody - final ChangeRequest body, + final SnomedResourceRequest body, @RequestHeader(value = X_AUTHOR, required = false) final String author) { @@ -225,10 +221,10 @@ public void update( .prepareUpdateRelationship(relationshipId) .setActive(update.isActive()) .setModuleId(update.getModuleId()) - .setCharacteristicType(update.getCharacteristicType()) + .setCharacteristicTypeId(update.getCharacteristicTypeId()) .setGroup(update.getGroup()) .setUnionGroup(update.getUnionGroup()) - .setModifier(update.getModifier()) + .setModifierId(update.getModifierId()) .setTypeId(update.getTypeId()) .setDestinationId(update.getDestinationId()) .build(repositoryId, branchPath, author, commitComment, defaultModuleId) @@ -275,7 +271,4 @@ public void delete( .getSync(COMMIT_TIMEOUT, TimeUnit.MILLISECONDS); } - private URI getRelationshipLocation(final String branchPath, final String relationshipId) { - return MvcUriComponentsBuilder.fromController(SnomedRelationshipRestService.class).pathSegment(branchPath, relationshipId).build().toUri(); - } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchCompareRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchCompareRestService.java new file mode 100644 index 00000000000..f7b54a7e34a --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchCompareRestService.java @@ -0,0 +1,33 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.rest; + +import org.springframework.web.bind.annotation.RestController; + +import com.b2international.snowowl.core.rest.SnomedApiConfig; +import com.b2international.snowowl.core.rest.compare.RepositoryBranchCompareRestService; + +/** + * @since 7.3 + */ +@RestController +public class SnomedRepositoryBranchCompareRestService extends RepositoryBranchCompareRestService { + + public SnomedRepositoryBranchCompareRestService() { + super(SnomedApiConfig.REPOSITORY_ID); + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeCollectionComparator.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchMergeRestService.java similarity index 51% rename from snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeCollectionComparator.java rename to snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchMergeRestService.java index f3a0fef9615..045b6f8d946 100644 --- a/snomed/com.b2international.snowowl.snomed.semanticengine/src/com/b2international/snowowl/semanticengine/utils/AttributeCollectionComparator.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchMergeRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,20 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.semanticengine.utils; +package com.b2international.snowowl.snomed.core.rest; -import com.b2international.snowowl.dsl.scg.Attribute; +import org.springframework.web.bind.annotation.RestController; +import com.b2international.snowowl.core.rest.SnomedApiConfig; +import com.b2international.snowowl.core.rest.branch.RepositoryBranchMergeRestService; /** - * {@link CollectionComparator} implementation to handle collections of {@link Attribute}s. - * + * @since 7.3 */ -public class AttributeCollectionComparator extends CollectionComparator { +@RestController +public class SnomedRepositoryBranchMergeRestService extends RepositoryBranchMergeRestService { - @Override - protected boolean itemsEqual(Attribute expected, Attribute actual) { - // TODO: handle single-concept expressions - return expected.toString().equals(actual.toString()); + public SnomedRepositoryBranchMergeRestService() { + super(SnomedApiConfig.REPOSITORY_ID); } -} \ No newline at end of file + +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatusProvider.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchRestService.java similarity index 52% rename from snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatusProvider.java rename to snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchRestService.java index dba716c71ee..e5104b39475 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatusProvider.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchRestService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,16 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.b2international.snowowl.snomed.core.domain; +package com.b2international.snowowl.snomed.core.rest; + +import org.springframework.web.bind.annotation.RestController; + +import com.b2international.snowowl.core.rest.SnomedApiConfig; +import com.b2international.snowowl.core.rest.branch.RepositoryBranchRestService; /** - * Holds a SNOMED CT concept's definition status. + * @since 7.3 */ -public interface DefinitionStatusProvider { +@RestController +public class SnomedRepositoryBranchRestService extends RepositoryBranchRestService { + + public SnomedRepositoryBranchRestService() { + super(SnomedApiConfig.REPOSITORY_ID); + } - /** - * @return the definition status of this concept (either {@link DefinitionStatus#PRIMITIVE PRIMITIVE} or - * {@link DefinitionStatus#FULLY_DEFINED FULLY_DEFINED}) - */ - DefinitionStatus getDefinitionStatus(); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchReviewRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchReviewRestService.java new file mode 100644 index 00000000000..ae5b27c5748 --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryBranchReviewRestService.java @@ -0,0 +1,33 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.rest; + +import org.springframework.web.bind.annotation.RestController; + +import com.b2international.snowowl.core.rest.SnomedApiConfig; +import com.b2international.snowowl.core.rest.branch.RepositoryBranchReviewRestService; + +/** + * @since 7.3 + */ +@RestController +public class SnomedRepositoryBranchReviewRestService extends RepositoryBranchReviewRestService { + + public SnomedRepositoryBranchReviewRestService() { + super(SnomedApiConfig.REPOSITORY_ID); + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryCommitRestService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryCommitRestService.java new file mode 100644 index 00000000000..e3fe9baed55 --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/SnomedRepositoryCommitRestService.java @@ -0,0 +1,33 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.rest; + +import org.springframework.web.bind.annotation.RestController; + +import com.b2international.snowowl.core.rest.SnomedApiConfig; +import com.b2international.snowowl.core.rest.commit.RepositoryCommitRestService; + +/** + * @since 7.3 + */ +@RestController +public class SnomedRepositoryCommitRestService extends RepositoryCommitRestService { + + public SnomedRepositoryCommitRestService() { + super(SnomedApiConfig.REPOSITORY_ID); + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/AbstractSnomedComponentRestUpdate.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/AbstractSnomedComponentRestUpdate.java index 2251f9b4937..8fef4205062 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/AbstractSnomedComponentRestUpdate.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/AbstractSnomedComponentRestUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,6 +15,8 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; +import com.b2international.snowowl.snomed.core.domain.InactivationProperties; + /** * @since 4.0 */ @@ -22,7 +24,8 @@ public abstract class AbstractSnomedComponentRestUpdate { private String moduleId; private Boolean active; - + private InactivationProperties inactivationProperties; + public Boolean isActive() { return active; } @@ -38,5 +41,13 @@ public String getModuleId() { public void setModuleId(final String moduleId) { this.moduleId = moduleId; } + + public InactivationProperties getInactivationProperties() { + return inactivationProperties; + } + + public void setInactivationProperties(InactivationProperties inactivationProperties) { + this.inactivationProperties = inactivationProperties; + } } \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ChangeRequest.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ChangeRequest.java deleted file mode 100644 index cb216da88cb..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ChangeRequest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.domain; - -import com.fasterxml.jackson.annotation.JsonUnwrapped; - -public class ChangeRequest { - - private T change; - private String commitComment; - private String defaultModuleId; - - @JsonUnwrapped - public T getChange() { - return change; - } - - public String getCommitComment() { - return commitComment; - } - - public String getDefaultModuleId() { - return defaultModuleId; - } - - public void setChange(final T change) { - this.change = change; - } - - public void setCommitComment(final String commitComment) { - this.commitComment = commitComment; - } - - public void setDefaultModuleId(final String defaultModuleId) { - this.defaultModuleId = defaultModuleId; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("ChangeRequest [change="); - builder.append(change); - builder.append(", commitComment="); - builder.append(commitComment); - builder.append(", defaultModuleId="); - builder.append(defaultModuleId); - builder.append("]"); - return builder.toString(); - } -} \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ExpandableSnomedRelationship.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ExpandableSnomedRelationship.java deleted file mode 100644 index 6fd4ada18cc..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/ExpandableSnomedRelationship.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.domain; - -import java.util.Date; - -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; -import com.b2international.snowowl.snomed.core.domain.SnomedConcept; -import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; -import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; -import com.fasterxml.jackson.annotation.JsonIgnore; -/** - * @since 7.0 - */ -public class ExpandableSnomedRelationship { - - private SnomedRelationship wrappedRelationship; - private SnomedConceptMini source; - private SnomedConceptMini type; - - public ExpandableSnomedRelationship(SnomedRelationship wrappedRelationship, String[] expand) { - this.wrappedRelationship = wrappedRelationship; - final SnomedConcept source = wrappedRelationship.getSource(); - for (String expandParam : expand) { - if ("source.fsn".equals(expandParam)) { - if (source.getFsn() != null) { - setSource(new SnomedConceptMini(source.getId(), source.getFsn().getTerm())); - } else { - setSource(new SnomedConceptMini(source.getId())); - } - } else if ("type.fsn".equals(expandParam)) { - final SnomedConcept type = wrappedRelationship.getType(); - if (type.getFsn() != null) { - setType(new SnomedConceptMini(type.getId(), type.getFsn().getTerm())); - } else { - setType(new SnomedConceptMini(type.getId())); - } - } - } - } - - @JsonIgnore - public long getStorageKey() { - return -1; - } - - public SnomedReferenceSetMembers getMembers() { - return null; - } - - public SnomedConcept getDestinationConcept() { - return null; - } - - public SnomedConcept getSourceConcept() { - return null; - } - - public SnomedConcept getTypeConcept() { - return null; - } - - public void setSource(SnomedConceptMini source) { - this.source = source; - } - - public SnomedConceptMini getSource() { - return source; - } - - public void setType(SnomedConceptMini type) { - this.type = type; - } - - public SnomedConceptMini getType() { - return type; - } - - public Boolean isActive() { - return wrappedRelationship.isActive(); - } - - public Date getEffectiveTime() { - return wrappedRelationship.getEffectiveTime(); - } - - public String getModuleId() { - return wrappedRelationship.getModuleId(); - } - - public String getId() { - return wrappedRelationship.getId(); - } - - public Boolean isReleased() { - return wrappedRelationship.isReleased(); - } - - public String getSourceId() { - return wrappedRelationship.getSourceId(); - } - - public String getDestinationId() { - return wrappedRelationship.getDestinationId(); - } - - public boolean isDestinationNegated() { - return wrappedRelationship.isDestinationNegated(); - } - - public String getTypeId() { - return wrappedRelationship.getTypeId(); - } - - public Integer getGroup() { - return wrappedRelationship.getGroup(); - } - - public Integer getUnionGroup() { - return wrappedRelationship.getUnionGroup(); - } - - public CharacteristicType getCharacteristicType() { - return wrappedRelationship.getCharacteristicType(); - } - - public RelationshipModifier getModifier() { - return wrappedRelationship.getModifier(); - } - - public String getIconId() { - return wrappedRelationship.getIconId(); - } - - public Float getScore() { - return wrappedRelationship.getScore(); - } - -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestSearch.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestSearch.java index d58e6336f95..a271cea544a 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestSearch.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,19 +15,16 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import java.util.List; -import java.util.Set; +import com.b2international.snowowl.core.rest.domain.ResourceRestSearch; import io.swagger.annotations.ApiParam; /** * @since 6.16 */ -public final class SnomedConceptRestSearch { +public final class SnomedConceptRestSearch extends ResourceRestSearch { // concept filters - @ApiParam(value = "The Concept identifier(s) to match") - private Set id; @ApiParam(value = "The effective time to match (yyyyMMdd, exact matches only)") private String effectiveTime; @@ -66,28 +63,6 @@ public final class SnomedConceptRestSearch { @ApiParam(value = "The stated ancestor(s) to match") private String[] statedAncestor; - // scrolling/paging/expansion/sorting - @ApiParam(value = "Expansion parameters") - private String expand; - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - private String scrollKeepAlive; - @ApiParam(value = "A scrollId to continue scrolling a previous query") - private String scrollId; - @ApiParam(value = "The search key to use for retrieving the next page of results") - private String searchAfter; - @ApiParam(value = "Sort keys") - private List sort; - @ApiParam(value = "The maximum number of items to return", defaultValue = "50") - private int limit = 50; - - public Set getId() { - return id; - } - - public void setId(Set id) { - this.id = id; - } - public Boolean getActive() { return active; } @@ -208,52 +183,4 @@ public void setDescriptionType(String descriptionType) { this.descriptionType = descriptionType; } - public String getExpand() { - return expand; - } - - public void setExpand(String expand) { - this.expand = expand; - } - - public String getScrollKeepAlive() { - return scrollKeepAlive; - } - - public void setScrollKeepAlive(String scrollKeepAlive) { - this.scrollKeepAlive = scrollKeepAlive; - } - - public String getScrollId() { - return scrollId; - } - - public void setScrollId(String scrollId) { - this.scrollId = scrollId; - } - - public String getSearchAfter() { - return searchAfter; - } - - public void setSearchAfter(String searchAfter) { - this.searchAfter = searchAfter; - } - - public List getSort() { - return sort; - } - - public void setSort(List sort) { - this.sort = sort; - } - - public int getLimit() { - return limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } - } \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestUpdate.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestUpdate.java index 2d0a88e9531..936889cf994 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestUpdate.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptRestUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,87 +15,40 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import java.util.List; -import java.util.Map; - -import com.b2international.snowowl.snomed.core.domain.AssociationType; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; -import com.b2international.snowowl.snomed.core.domain.InactivationIndicator; import com.b2international.snowowl.snomed.core.domain.SnomedDescriptions; import com.b2international.snowowl.snomed.core.domain.SnomedRelationships; import com.b2international.snowowl.snomed.core.domain.SubclassDefinitionStatus; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; import com.b2international.snowowl.snomed.datastore.request.SnomedConceptUpdateRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; -import com.google.common.collect.ImmutableListMultimap; /** * @since 4.0 */ public class SnomedConceptRestUpdate extends AbstractSnomedComponentRestUpdate { - private DefinitionStatus definitionStatus; + private String definitionStatusId; private SubclassDefinitionStatus subclassDefinitionStatus; - private Map> associationTargets; - private InactivationIndicator inactivationIndicator; private SnomedDescriptions descriptions; private SnomedRelationships relationships; private SnomedReferenceSetMembers members; - public DefinitionStatus getDefinitionStatus() { - return definitionStatus; + public String getDefinitionStatusId() { + return definitionStatusId; } public SubclassDefinitionStatus getSubclassDefinitionStatus() { return subclassDefinitionStatus; } - public void setDefinitionStatus(final DefinitionStatus definitionStatus) { - this.definitionStatus = definitionStatus; + public void setDefinitionStatusId(final String definitionStatusId) { + this.definitionStatusId = definitionStatusId; } public void setSubclassDefinitionStatus(final SubclassDefinitionStatus subclassDefinitionStatus) { this.subclassDefinitionStatus = subclassDefinitionStatus; } - /** - * Returns with the associations between the current component and other SNOMED CT concepts. - * The associations are represented as a multimap where the keys are the {@link AssociationType association type}s - * and the values are the referred associations. - * @return a multimap of associations. - */ - public Map> getAssociationTargets() { - return associationTargets; - } - - /** - * Sets the associations for the current concept. - *
Counterpart of {@link #getAssociationTargets()}. - * @param associationTargets the multimap of associations. - */ - public void setAssociationTargets(final Map> associationTargets) { - this.associationTargets = associationTargets; - } - - /** - * Returns with the concept inactivation reason (if any). May return with {@code null} - * if the concept is active or no reason was specified during the concept inactivation process. - * @return the inactivation process. Can be {@code null} if the concept is not retired or no - * reason was specified. - */ - public InactivationIndicator getInactivationIndicator() { - return inactivationIndicator; - } - - /** - * Counterpart of the {@link #getInactivationIndicator()}. - *
Sets the inactivation reason for the concept update. - * @param inactivationIndicator the desired inactivation reason for the concept update. - */ - public void setInactivationIndicator(final InactivationIndicator inactivationIndicator) { - this.inactivationIndicator = inactivationIndicator; - } - public SnomedDescriptions getDescriptions() { return descriptions; } @@ -121,21 +74,13 @@ public void setRelationships(SnomedRelationships relationships) { } public SnomedConceptUpdateRequestBuilder toRequestBuilder(String conceptId) { - final ImmutableListMultimap.Builder targets; - if (associationTargets != null) { - targets = ImmutableListMultimap.builder(); - associationTargets.forEach(targets::putAll); - } else { - targets = null; - } return SnomedRequests .prepareUpdateConcept(conceptId) .setActive(isActive()) .setModuleId(getModuleId()) - .setAssociationTargets(targets == null ? null : targets.build()) - .setDefinitionStatus(getDefinitionStatus()) - .setInactivationIndicator(getInactivationIndicator()) + .setDefinitionStatusId(getDefinitionStatusId()) .setSubclassDefinitionStatus(getSubclassDefinitionStatus()) + .setInactivationProperties(getInactivationProperties()) .setMembers(getMembers()) .setRelationships(getRelationships()) .setDescriptions(getDescriptions()); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestInput.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestInput.java index c2324625988..cc60ab3cd68 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestInput.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestInput.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ import java.util.Map; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; import com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionCreateRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; @@ -31,7 +31,7 @@ public class SnomedDescriptionRestInput extends AbstractSnomedComponentRestInput private String term; private String languageCode; private String conceptId; - private CaseSignificance caseSignificance = CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE; + private String caseSignificanceId = Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE; private Map acceptability; /** @@ -65,8 +65,8 @@ public String getConceptId() { /** * @return */ - public CaseSignificance getCaseSignificance() { - return caseSignificance; + public String getCaseSignificanceId() { + return caseSignificanceId; } public Map getAcceptability() { @@ -89,8 +89,8 @@ public void setConceptId(final String conceptId) { this.conceptId = conceptId; } - public void setCaseSignificance(final CaseSignificance caseSignificance) { - this.caseSignificance = caseSignificance; + public void setCaseSignificanceId(final String caseSignificanceId) { + this.caseSignificanceId = caseSignificanceId; } public void setAcceptability(final Map acceptability) { @@ -108,7 +108,7 @@ protected SnomedDescriptionCreateRequestBuilder createRequestBuilder() { @Override public SnomedDescriptionCreateRequestBuilder toRequestBuilder() { return super.toRequestBuilder() - .setCaseSignificance(getCaseSignificance()) + .setCaseSignificanceId(getCaseSignificanceId()) .setConceptId(getConceptId()) .setLanguageCode(getLanguageCode()) .setTerm(getTerm()) @@ -127,8 +127,8 @@ public String toString() { builder.append(languageCode); builder.append(", conceptId="); builder.append(conceptId); - builder.append(", caseSignificance="); - builder.append(caseSignificance); + builder.append(", caseSignificanceId="); + builder.append(caseSignificanceId); builder.append(", acceptability="); builder.append(acceptability); builder.append("]"); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestSearch.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestSearch.java index a66fa9e028f..eab28ac6261 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestSearch.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,9 +15,7 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import java.util.List; -import java.util.Set; - +import com.b2international.snowowl.core.rest.domain.ResourceRestSearch; import com.b2international.snowowl.snomed.core.domain.Acceptability; import io.swagger.annotations.ApiParam; @@ -25,10 +23,7 @@ /** * @since 6.16 */ -public final class SnomedDescriptionRestSearch { - - @ApiParam(value = "The Description identifier(s) to match") - private Set id; +public final class SnomedDescriptionRestSearch extends ResourceRestSearch { @ApiParam(value = "The effective time to match (yyyyMMdd, exact matches only)") private String effectiveTime; @@ -72,32 +67,6 @@ public final class SnomedDescriptionRestSearch { @ApiParam(value = "Any membership to match in these language refsets") private String[] languageRefSet; - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - private String scrollKeepAlive; - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - private String scrollId; - - @ApiParam(value = "The search key to use for retrieving the next page of results") - private String searchAfter; - - @ApiParam(value = "The maximum number of items to return", defaultValue = "50") - private int limit = 50; - - @ApiParam(value = "Expansion parameters") - private String expand; - - @ApiParam(value = "Sort keys") - private List sort; - - public Set getId() { - return id; - } - - public void setId(Set id) { - this.id = id; - } - public String getEffectiveTime() { return effectiveTime; } @@ -210,52 +179,4 @@ public void setLanguageRefSet(String[] languageRefSet) { this.languageRefSet = languageRefSet; } - public String getScrollKeepAlive() { - return scrollKeepAlive; - } - - public void setScrollKeepAlive(String scrollKeepAlive) { - this.scrollKeepAlive = scrollKeepAlive; - } - - public String getScrollId() { - return scrollId; - } - - public void setScrollId(String scrollId) { - this.scrollId = scrollId; - } - - public String getSearchAfter() { - return searchAfter; - } - - public void setSearchAfter(String searchAfter) { - this.searchAfter = searchAfter; - } - - public int getLimit() { - return limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } - - public String getExpand() { - return expand; - } - - public void setExpand(String expand) { - this.expand = expand; - } - - public List getSort() { - return sort; - } - - public void setSort(List sort) { - this.sort = sort; - } - } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestUpdate.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestUpdate.java index 3e9168462aa..0af1a3bcdd4 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestUpdate.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedDescriptionRestUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,46 +15,31 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import java.util.List; import java.util.Map; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.AssociationType; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.DescriptionInactivationIndicator; import com.b2international.snowowl.snomed.datastore.request.SnomedDescriptionUpdateRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; -import com.google.common.collect.ImmutableListMultimap; /** * @since 1.0 */ public class SnomedDescriptionRestUpdate extends AbstractSnomedComponentRestUpdate { - private CaseSignificance caseSignificance; + private String caseSignificanceId; private Map acceptability; - private DescriptionInactivationIndicator inactivationIndicator; - private Map> associationTargets; private String typeId; private String term; private String languageCode; - public CaseSignificance getCaseSignificance() { - return caseSignificance; + public String getCaseSignificanceId() { + return caseSignificanceId; } public Map getAcceptability() { return acceptability; } - public DescriptionInactivationIndicator getInactivationIndicator() { - return inactivationIndicator; - } - - public Map> getAssociationTargets() { - return associationTargets; - } - public String getLanguageCode() { return languageCode; } @@ -67,22 +52,14 @@ public String getTypeId() { return typeId; } - public void setCaseSignificance(final CaseSignificance caseSignificance) { - this.caseSignificance = caseSignificance; + public void setCaseSignificance(final String caseSignificanceId) { + this.caseSignificanceId = caseSignificanceId; } public void setAcceptability(final Map acceptability) { this.acceptability = acceptability; } - public void setInactivationIndicator(DescriptionInactivationIndicator inactivationIndicator) { - this.inactivationIndicator = inactivationIndicator; - } - - public void setAssociationTargets(Map> associationTargets) { - this.associationTargets = associationTargets; - } - public void setLanguageCode(String languageCode) { this.languageCode = languageCode; } @@ -96,20 +73,11 @@ public void setTypeId(String typeId) { } public SnomedDescriptionUpdateRequestBuilder toRequestBuilder(final String descriptionId) { - final ImmutableListMultimap.Builder targets; - if (associationTargets != null) { - targets = ImmutableListMultimap.builder(); - associationTargets.forEach(targets::putAll); - } else { - targets = null; - } - return SnomedRequests - .prepareUpdateDescription(descriptionId) + return SnomedRequests.prepareUpdateDescription(descriptionId) .setActive(isActive()) .setModuleId(getModuleId()) - .setAssociationTargets(targets == null ? null : targets.build()) - .setInactivationIndicator(getInactivationIndicator()) - .setCaseSignificance(getCaseSignificance()) + .setInactivationProperties(getInactivationProperties()) + .setCaseSignificanceId(getCaseSignificanceId()) .setAcceptability(getAcceptability()) .setTypeId(getTypeId()) .setTerm(getTerm()) diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedInboundRelationships.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedInboundRelationships.java deleted file mode 100644 index 661fdff89bc..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedInboundRelationships.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.domain; - -import java.util.List; - -/** - * @since 1.0 - */ -public class SnomedInboundRelationships { - - private static String[] expandable = {"source.fsn, type.fsn"}; - - private List inboundRelationships; - private int total; - - public List getInboundRelationships() { - return inboundRelationships; - } - - public int getTotal() { - return total; - } - - public String[] getExpandable() { - return expandable; - } - - public void setInboundRelationships(final List inboundRelationships) { - this.inboundRelationships = inboundRelationships; - } - - public void setTotal(final int total) { - this.total = total; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("SnomedInboundRelationships [inboundRelationships="); - builder.append(inboundRelationships); - builder.append(", total="); - builder.append(total); - builder.append("]"); - return builder.toString(); - } -} \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedOutboundRelationships.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedOutboundRelationships.java deleted file mode 100644 index a6b69b389cd..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedOutboundRelationships.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.domain; - -import java.util.List; - -import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; - -/** - * @since 1.0 - */ -public class SnomedOutboundRelationships { - - private List outboundRelationships; - private int total; - - public List getOutboundRelationships() { - return outboundRelationships; - } - - public int getTotal() { - return total; - } - - public void setOutboundRelationships(final List outboundRelationships) { - this.outboundRelationships = outboundRelationships; - } - - public void setTotal(final int total) { - this.total = total; - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("SnomedOutboundRelationships [outboundRelationships="); - builder.append(outboundRelationships); - builder.append(", total="); - builder.append(total); - builder.append("]"); - return builder.toString(); - } -} \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetMemberRestSearch.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetMemberRestSearch.java index b8ee87ac9f2..cf38c1b7e52 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetMemberRestSearch.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetMemberRestSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,11 +16,11 @@ package com.b2international.snowowl.snomed.core.rest.domain; import java.util.List; -import java.util.Set; import com.b2international.commons.CompareUtils; import com.b2international.commons.options.Options; import com.b2international.commons.options.OptionsBuilder; +import com.b2international.snowowl.core.rest.domain.ResourceRestSearch; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.datastore.request.SnomedRefSetMemberSearchRequestBuilder; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -30,11 +30,8 @@ /** * @since 6.16 */ -public final class SnomedReferenceSetMemberRestSearch { +public final class SnomedReferenceSetMemberRestSearch extends ResourceRestSearch { - @ApiParam(value = "Member UUID(s) to match") - private Set id; - @ApiParam(value="The effective time to match (yyyyMMdd, exact matches only)") private String effectiveTime; @@ -99,32 +96,6 @@ public final class SnomedReferenceSetMemberRestSearch { @ApiParam(value="Special filters for owlExpression axiom values") private SnomedOwlExpressionFilters owlExpression; - @ApiParam(value="The scrollKeepAlive to start a scroll using this query") - private String scrollKeepAlive; - - @ApiParam(value="A scrollId to continue scrolling a previous query") - private String scrollId; - - @ApiParam(value="The search key to use for retrieving the next page of results") - private String searchAfter; - - @ApiParam(value="The maximum number of items to return", defaultValue = "50") - private int limit = 50; - - @ApiParam(value="Expansion parameters") - private String expand; - - @ApiParam(value="Sort keys") - private List sort; - - public Set getId() { - return id; - } - - public void setId(Set id) { - this.id = id; - } - public String getEffectiveTime() { return effectiveTime; } @@ -293,54 +264,6 @@ public void setOwlExpression(SnomedOwlExpressionFilters owlExpression) { this.owlExpression = owlExpression; } - public String getScrollKeepAlive() { - return scrollKeepAlive; - } - - public void setScrollKeepAlive(String scrollKeepAlive) { - this.scrollKeepAlive = scrollKeepAlive; - } - - public String getScrollId() { - return scrollId; - } - - public void setScrollId(String scrollId) { - this.scrollId = scrollId; - } - - public String getSearchAfter() { - return searchAfter; - } - - public void setSearchAfter(String searchAfter) { - this.searchAfter = searchAfter; - } - - public int getLimit() { - return limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } - - public String getExpand() { - return expand; - } - - public void setExpand(String expand) { - this.expand = expand; - } - - public List getSort() { - return sort; - } - - public void setSort(List sort) { - this.sort = sort; - } - @JsonIgnore public Options toPropsFilter() { OptionsBuilder propFilter = Options.builder(); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptMini.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetRestSearch.java similarity index 57% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptMini.java rename to snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetRestSearch.java index c03b48a39e5..91d0270ff42 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedConceptMini.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedReferenceSetRestSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,33 +15,24 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; +import com.b2international.snowowl.core.rest.domain.ResourceRestSearch; + +import io.swagger.annotations.ApiParam; + /** - * @since 7.0 + * @since 7.3 */ -public class SnomedConceptMini { - - private String id; - private String fsn; - - public SnomedConceptMini(String id) { - this(id, id); - } - - public SnomedConceptMini(String id, String fsn) { - this.id = id; - this.fsn = fsn; - } +public final class SnomedReferenceSetRestSearch extends ResourceRestSearch { - public void setFsn(String fsn) { - this.fsn = fsn; - } + @ApiParam(value = "The reference set type to match") + private String[] refSetTypes; - public String getId() { - return id; + public String[] getRefSetTypes() { + return refSetTypes; } - public String getFsn() { - return fsn; + public void setRefSetTypes(String[] refSetTypes) { + this.refSetTypes = refSetTypes; } } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestInput.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestInput.java index 0901591f96d..551c58da210 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestInput.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestInput.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,7 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.datastore.request.SnomedRelationshipCreateRequestBuilder; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; @@ -25,17 +24,17 @@ */ public class SnomedRelationshipRestInput extends AbstractSnomedComponentRestInput { - private CharacteristicType characteristicType = CharacteristicType.STATED_RELATIONSHIP; + private String characteristicTypeId = Concepts.STATED_RELATIONSHIP; private String destinationId; private boolean destinationNegated = false; private int group = 0; - private RelationshipModifier modifier = RelationshipModifier.EXISTENTIAL; + private String modifierId = Concepts.EXISTENTIAL_RESTRICTION_MODIFIER; private String sourceId; private String typeId; private int unionGroup = 0; - public CharacteristicType getCharacteristicType() { - return characteristicType; + public String getCharacteristicTypeId() { + return characteristicTypeId; } public String getDestinationId() { @@ -50,8 +49,8 @@ public int getGroup() { return group; } - public RelationshipModifier getModifier() { - return modifier; + public String getModifierId() { + return modifierId; } public String getSourceId() { @@ -66,8 +65,8 @@ public int getUnionGroup() { return unionGroup; } - public void setCharacteristicType(final CharacteristicType characteristicType) { - this.characteristicType = characteristicType; + public void setCharacteristicTypeId(final String characteristicTypeId) { + this.characteristicTypeId = characteristicTypeId; } public void setDestinationId(final String destinationId) { @@ -82,8 +81,8 @@ public void setGroup(final int group) { this.group = group; } - public void setModifier(final RelationshipModifier modifier) { - this.modifier = modifier; + public void setModifierId(final String modifierId) { + this.modifierId = modifierId; } public void setSourceId(final String sourceId) { @@ -106,11 +105,11 @@ protected SnomedRelationshipCreateRequestBuilder createRequestBuilder() { @Override public SnomedRelationshipCreateRequestBuilder toRequestBuilder() { return super.toRequestBuilder() - .setCharacteristicType(getCharacteristicType()) + .setCharacteristicTypeId(getCharacteristicTypeId()) .setDestinationId(getDestinationId()) .setDestinationNegated(isDestinationNegated()) .setGroup(getGroup()) - .setModifier(getModifier()) + .setModifierId(getModifierId()) .setSourceId(getSourceId()) .setTypeId(getTypeId()) .setUnionGroup(getUnionGroup()); @@ -123,16 +122,16 @@ public String toString() { builder.append(getId()); builder.append(", getModuleId()="); builder.append(getModuleId()); - builder.append(", getCharacteristicType()="); - builder.append(getCharacteristicType()); + builder.append(", getCharacteristicTypeId()="); + builder.append(getCharacteristicTypeId()); builder.append(", getDestinationId()="); builder.append(getDestinationId()); builder.append(", isDestinationNegated()="); builder.append(isDestinationNegated()); builder.append(", getGroup()="); builder.append(getGroup()); - builder.append(", getModifier()="); - builder.append(getModifier()); + builder.append(", getModifierId()="); + builder.append(getModifierId()); builder.append(", getSourceId()="); builder.append(getSourceId()); builder.append(", getTypeId()="); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestSearch.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestSearch.java index 505954b2d49..4f837c7ee85 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestSearch.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2019-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,15 +15,14 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import java.util.List; -import java.util.Set; +import com.b2international.snowowl.core.rest.domain.ResourceRestSearch; import io.swagger.annotations.ApiParam; -public final class SnomedRelationshipRestSearch { - - @ApiParam(value = "The Relationship ID(s) to match") - private Set id; +/** + * @since 6.16 + */ +public final class SnomedRelationshipRestSearch extends ResourceRestSearch { @ApiParam(value = "The effective time to match (yyyyMMdd, exact matches only)") private String effectiveTime; @@ -55,32 +54,6 @@ public final class SnomedRelationshipRestSearch { @ApiParam(value = "The union group to match") private Integer unionGroup; - @ApiParam(value = "The scrollKeepAlive to start a scroll using this query") - private String scrollKeepAlive; - - @ApiParam(value = "A scrollId to continue scrolling a previous query") - private String scrollId; - - @ApiParam(value = "The search key to use for retrieving the next page of results") - private String searchAfter; - - @ApiParam(value = "The maximum number of items to return", defaultValue = "50") - private int limit = 50; - - @ApiParam(value = "Expansion parameters") - private String expand; - - @ApiParam(value = "Sort keys") - private List sort; - - public Set getId() { - return id; - } - - public void setId(Set id) { - this.id = id; - } - public String getEffectiveTime() { return effectiveTime; } @@ -161,52 +134,4 @@ public void setUnionGroup(Integer unionGroup) { this.unionGroup = unionGroup; } - public String getScrollKeepAlive() { - return scrollKeepAlive; - } - - public void setScrollKeepAlive(String scrollKeepAlive) { - this.scrollKeepAlive = scrollKeepAlive; - } - - public String getScrollId() { - return scrollId; - } - - public void setScrollId(String scrollId) { - this.scrollId = scrollId; - } - - public String getSearchAfter() { - return searchAfter; - } - - public void setSearchAfter(String searchAfter) { - this.searchAfter = searchAfter; - } - - public int getLimit() { - return limit; - } - - public void setLimit(int limit) { - this.limit = limit; - } - - public String getExpand() { - return expand; - } - - public void setExpand(String expand) { - this.expand = expand; - } - - public List getSort() { - return sort; - } - - public void setSort(List sort) { - this.sort = sort; - } - } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestUpdate.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestUpdate.java index c3a9689d3e9..c37fb85e17d 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestUpdate.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedRelationshipRestUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,6 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; - - /** * @since 1.0 */ @@ -26,8 +22,8 @@ public class SnomedRelationshipRestUpdate extends AbstractSnomedComponentRestUpd private Integer group; private Integer unionGroup; - private CharacteristicType characteristicType; - private RelationshipModifier modifier; + private String characteristicTypeId; + private String modifierId; private String destinationId; private String typeId; @@ -47,20 +43,20 @@ public void setUnionGroup(final Integer unionGroup) { this.unionGroup = unionGroup; } - public CharacteristicType getCharacteristicType() { - return characteristicType; + public String getCharacteristicTypeId() { + return characteristicTypeId; } - public void setCharacteristicType(final CharacteristicType characteristicType) { - this.characteristicType = characteristicType; + public void setCharacteristicTypeId(final String characteristicTypeId) { + this.characteristicTypeId = characteristicTypeId; } - public RelationshipModifier getModifier() { - return modifier; + public String getModifierId() { + return modifierId; } - public void setModifier(final RelationshipModifier modifier) { - this.modifier = modifier; + public void setModifierId(final String modifierId) { + this.modifierId = modifierId; } public String getDestinationId() { diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedIdentifierRequest.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedResourceRequest.java similarity index 50% rename from snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedIdentifierRequest.java rename to snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedResourceRequest.java index 945451db1e1..c8b835969ce 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedIdentifierRequest.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/domain/SnomedResourceRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,27 @@ */ package com.b2international.snowowl.snomed.core.rest.domain; -import com.b2international.snowowl.core.terminology.ComponentCategory; - +import com.b2international.snowowl.core.rest.domain.ResourceRequest; +import com.google.common.base.MoreObjects.ToStringHelper; /** * @since 1.0 + * @param - the actual resource request body */ -public class SnomedIdentifierRequest { +public final class SnomedResourceRequest extends ResourceRequest { - private ComponentCategory type; - private String namespace; - - public ComponentCategory getType() { - return type; - } - - public void setType(ComponentCategory componentCategory) { - this.type = componentCategory; + private String defaultModuleId; + + public String getDefaultModuleId() { + return defaultModuleId; } - - public String getNamespace() { - return namespace; + + public void setDefaultModuleId(final String defaultModuleId) { + this.defaultModuleId = defaultModuleId; } - - public void setNamespace(String namespace) { - this.namespace = namespace; + + @Override + protected void doToString(ToStringHelper toStringHelper) { + toStringHelper.add("defaultModuleId", defaultModuleId); } - -} +} \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ClassificationRunNotFoundException.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ClassificationRunNotFoundException.java deleted file mode 100644 index f7218e684e4..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ClassificationRunNotFoundException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.exceptions; - -import com.b2international.commons.exceptions.NotFoundException; - -/** - * Thrown when details of a classification run can not be retrieved. - */ -public class ClassificationRunNotFoundException extends NotFoundException { - - private static final long serialVersionUID = 1L; - - /** - * Creates a new exception instance with the specified argument. - * - * @param key the identifier of the classification run which was not found - */ - public ClassificationRunNotFoundException(final String key) { - super("Classification run", key); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ExportRunNotFoundException.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ExportRunNotFoundException.java deleted file mode 100644 index 0230cc89321..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/ExportRunNotFoundException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.exceptions; - -import com.b2international.commons.exceptions.NotFoundException; - -/** - * Thrown when details of an export run can not be retrieved. - */ -public class ExportRunNotFoundException extends NotFoundException { - - private static final long serialVersionUID = 1L; - - /** - * Creates a new exception instance with the specified argument. - * - * @param key the identifier of the export run which was not found - */ - public ExportRunNotFoundException(final String key) { - super("Export run", key); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/FullySpecifiedNameNotFoundException.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/FullySpecifiedNameNotFoundException.java deleted file mode 100644 index 5ffffde839d..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/FullySpecifiedNameNotFoundException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.exceptions; - -import com.b2international.commons.exceptions.NotFoundException; - -/** - * Thrown when a fully specified name can not be retrieved. - */ -public class FullySpecifiedNameNotFoundException extends NotFoundException { - - private static final long serialVersionUID = 1L; - - /** - * Creates a new exception instance with the specified argument. - * - * @param key the identifier of the concept for which a fully specified name could not be retrieved - */ - public FullySpecifiedNameNotFoundException(final String key) { - super("Fully specified name for concept", key); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/PreferredTermNotFoundException.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/PreferredTermNotFoundException.java deleted file mode 100644 index 9d342438fe5..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/PreferredTermNotFoundException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.exceptions; - -import com.b2international.commons.exceptions.NotFoundException; - -/** - * Thrown when a preferred term can not be retrieved using the given language preferences. - */ -public class PreferredTermNotFoundException extends NotFoundException { - - private static final long serialVersionUID = 1L; - - /** - * Creates a new exception instance with the specified argument. - * - * @param key the identifier of the concept for which a preferred term could not be retrieved - */ - public PreferredTermNotFoundException(final String key) { - super("Preferred term for concept", key); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedExportException.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedExportException.java deleted file mode 100644 index 9c67bbb00f8..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedExportException.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.exceptions; - -import static com.google.common.base.Strings.nullToEmpty; - -/** - * Runtime exception indicating the failure of the SNOMED CT export process. - */ -public class SnomedExportException extends RuntimeException { - - private static final long serialVersionUID = 3399575806529622257L; - - /** - * Creates a new exception instance with the given message. - * - * @param message the message for the exception to describe the cause of the problem - */ - public SnomedExportException(final String message) { - super(nullToEmpty(message)); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedImportConfigurationNotFoundException.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedImportConfigurationNotFoundException.java deleted file mode 100644 index b1e12f42f88..00000000000 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/exceptions/SnomedImportConfigurationNotFoundException.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.rest.exceptions; - -import static com.google.common.base.Preconditions.checkNotNull; - -import java.util.UUID; - -import com.b2international.commons.exceptions.NotFoundException; - -/** - * Thrown when a SNOMED CT import configuration with a particular identifier could not be found. - */ -public class SnomedImportConfigurationNotFoundException extends NotFoundException { - - private static final long serialVersionUID = 4991544292465337742L; - - /** - * Creates a new exception instance with the specified parameters. - * - * @param importId the identifier of the import configuration - */ - public SnomedImportConfigurationNotFoundException(final UUID importId) { - super("SNOMED CT import configuration", checkNotNull(importId, "importId").toString()); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/FsnJoinerOperation.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/FsnJoinerOperation.java index 7342763cd02..8fc24f749f8 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/FsnJoinerOperation.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/FsnJoinerOperation.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ public final List run() { } private Map initDescriptionsByConcept(Iterable conceptEntries) { - final Set conceptIds = FluentIterable.from(conceptEntries).transform(IComponent.ID_FUNCTION).toSet(); + final Set conceptIds = FluentIterable.from(conceptEntries).transform(IComponent::getId).toSet(); return descriptionService.getFullySpecifiedNames(conceptIds, locales); } diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/ISnomedRf2ImportService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/ISnomedRf2ImportService.java index c3927528906..5ac044559a7 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/ISnomedRf2ImportService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/ISnomedRf2ImportService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,10 @@ import java.util.UUID; import com.b2international.commons.exceptions.BadRequestException; +import com.b2international.commons.exceptions.NotFoundException; import com.b2international.snowowl.core.domain.exceptions.CodeSystemNotFoundException; import com.b2international.snowowl.core.domain.exceptions.CodeSystemVersionNotFoundException; import com.b2international.snowowl.snomed.core.domain.ISnomedImportConfiguration; -import com.b2international.snowowl.snomed.core.rest.exceptions.SnomedImportConfigurationNotFoundException; /** * Implementations allow importing SNOMED CT content from RF2 release archives. @@ -36,7 +36,7 @@ public interface ISnomedRf2ImportService { * * @return the configuration object describing import details * - * @throws SnomedImportConfigurationNotFoundException if the specified import run does not exist + * @throws NotFoundException if the specified import run does not exist */ ISnomedImportConfiguration getImportDetails(UUID importId); @@ -55,9 +55,6 @@ public interface ISnomedRf2ImportService { * * @param importId the identifier of the import run to begin * @param inputStream the input stream opened on a valid RF2 release archive - * - * @throws SnomedImportException if the import can not start for some reason (import errors are only - * reflected in the import run's status flag) */ void startImport(UUID importId, InputStream inputStream); diff --git a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/SnomedRf2ImportService.java b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/SnomedRf2ImportService.java index a2a5de4ad2e..2a0d9c1be55 100644 --- a/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/SnomedRf2ImportService.java +++ b/snomed/com.b2international.snowowl.snomed.core.rest/src/com/b2international/snowowl/snomed/core/rest/services/SnomedRf2ImportService.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,6 @@ import com.b2international.snowowl.snomed.core.domain.ISnomedImportConfiguration.ImportStatus; import com.b2international.snowowl.snomed.core.domain.Rf2ReleaseType; import com.b2international.snowowl.snomed.core.rest.domain.SnomedImportConfiguration; -import com.b2international.snowowl.snomed.core.rest.exceptions.SnomedImportConfigurationNotFoundException; import com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import com.b2international.snowowl.terminologyregistry.core.request.CodeSystemRequests; @@ -82,7 +81,7 @@ public ISnomedImportConfiguration getImportDetails(final UUID importId) { final ISnomedImportConfiguration configuration = configurationMapping.get(importId); if (null == configuration) { - throw new SnomedImportConfigurationNotFoundException(importId); + throw new NotFoundException("SNOMED CT import configuration", importId.toString()); } return configuration; diff --git a/snomed/com.b2international.snowowl.snomed.datastore.tests/.launch/snomed-core-unit-tests.launch b/snomed/com.b2international.snowowl.snomed.datastore.tests/.launch/snomed-core-unit-tests.launch index a2f61a8e4a2..cfd422d0110 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore.tests/.launch/snomed-core-unit-tests.launch +++ b/snomed/com.b2international.snowowl.snomed.datastore.tests/.launch/snomed-core-unit-tests.launch @@ -33,11 +33,12 @@ + - - + + diff --git a/snomed/com.b2international.snowowl.snomed.datastore.tests/META-INF/MANIFEST.MF b/snomed/com.b2international.snowowl.snomed.datastore.tests/META-INF/MANIFEST.MF index 13a48533fce..7fd392d73f9 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore.tests/META-INF/MANIFEST.MF +++ b/snomed/com.b2international.snowowl.snomed.datastore.tests/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT Datastore Tests Bundle-SymbolicName: com.b2international.snowowl.snomed.datastore.tests;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Vendor: B2i Healthcare Fragment-Host: com.b2international.snowowl.snomed.datastore Bundle-RequiredExecutionEnvironment: JavaSE-11 diff --git a/snomed/com.b2international.snowowl.snomed.datastore.tests/pom.xml b/snomed/com.b2international.snowowl.snomed.datastore.tests/pom.xml index e104578b933..4af84da3cf1 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore.tests/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.datastore.tests/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.b2international.snowowl - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT snomed-parent com.b2international.snowowl.snomed.datastore.tests @@ -46,9 +46,8 @@ org.eclipse.tycho tycho-surefire-plugin - ${tycho.version} - ${tycho.testArgLine} -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml + ${tycho.testArgLine} -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -Dlogback.configurationFile=${basedir}/src/configuration/logback-maven.xml **/AllSnomedDatastoreTests.java diff --git a/snomed/com.b2international.snowowl.snomed.datastore.tests/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntrySerializationTest.java b/snomed/com.b2international.snowowl.snomed.datastore.tests/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntrySerializationTest.java index b311fee9784..100e9160ce0 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore.tests/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntrySerializationTest.java +++ b/snomed/com.b2international.snowowl.snomed.datastore.tests/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntrySerializationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,8 +27,6 @@ import com.b2international.index.revision.BaseRevisionIndexTest; import com.b2international.index.revision.RevisionBranch; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.datastore.id.RandomSnomedIdentiferGenerator; import com.fasterxml.jackson.databind.ObjectMapper; @@ -59,8 +57,8 @@ public void indexRelationship() throws Exception { .sourceId(Concepts.ROOT_CONCEPT) .destinationId(Concepts.ROOT_CONCEPT) .typeId(Concepts.IS_A) - .characteristicTypeId(CharacteristicType.STATED_RELATIONSHIP.getConceptId()) - .modifierId(RelationshipModifier.EXISTENTIAL.getConceptId()) + .characteristicTypeId(Concepts.STATED_RELATIONSHIP) + .modifierId(Concepts.EXISTENTIAL_RESTRICTION_MODIFIER) .destinationNegated(true) .group(1) .unionGroup(1) diff --git a/snomed/com.b2international.snowowl.snomed.datastore/META-INF/MANIFEST.MF b/snomed/com.b2international.snowowl.snomed.datastore/META-INF/MANIFEST.MF index dc8e7a8654b..e9611cb8083 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/META-INF/MANIFEST.MF +++ b/snomed/com.b2international.snowowl.snomed.datastore/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Snow Owl SNOMED CT Datastore Bundle-SymbolicName: com.b2international.snowowl.snomed.datastore;singleton:=true -Bundle-Version: 7.3.0.qualifier +Bundle-Version: 7.4.0.qualifier Bundle-Activator: com.b2international.snowowl.snomed.datastore.SnomedDatastoreActivator Bundle-Vendor: B2i Healthcare Bundle-RequiredExecutionEnvironment: JavaSE-11 @@ -24,7 +24,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.9.0", com.b2international.snowowl.snomed.icons;bundle-version="6.15.0", com.b2international.snowowl.snomed.ql, com.b2international.snowowl.datastore;visibility:=reexport -Export-Package: com.b2international.snowowl.snomed.core.domain, +Export-Package: com.b2international.snowowl.snomed.core, + com.b2international.snowowl.snomed.core.domain, com.b2international.snowowl.snomed.core.domain.constraint, com.b2international.snowowl.snomed.core.domain.refset, com.b2international.snowowl.snomed.core.ecl, diff --git a/snomed/com.b2international.snowowl.snomed.datastore/pom.xml b/snomed/com.b2international.snowowl.snomed.datastore/pom.xml index a5d86e50b6b..4f64ee0c8a8 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/pom.xml +++ b/snomed/com.b2international.snowowl.snomed.datastore/pom.xml @@ -11,6 +11,6 @@ com.b2international.snowowl snomed-parent - 7.3.0-SNAPSHOT + 7.4.0-SNAPSHOT diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/cli/SnomedCommand.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/cli/SnomedCommand.java index b599771f413..3a37d9b24e0 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/cli/SnomedCommand.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/cli/SnomedCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,9 +95,9 @@ public void run(CommandLineStream out) { out.println("Unrecognized import format: '%s'. Supported formats are: %s", format, SUPPORTED_FORMAT); } - final User user = out.authenticate(); + final User user = out.authenticate(getBus()); - if (user == null || !user.hasPermission(new Permission(Permission.IMPORT, SnomedDatastoreActivator.REPOSITORY_UUID, ""))) { + if (user == null || !user.hasPermission(new Permission(Permission.IMPORT, Permission.asResource(SnomedDatastoreActivator.REPOSITORY_UUID, branch), ""))) { out.println("User is unauthorized to import SNOMED CT content."); return; } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AcceptabilityMembership.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AcceptabilityMembership.java new file mode 100644 index 00000000000..ecf66eb2a88 --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AcceptabilityMembership.java @@ -0,0 +1,66 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.domain; + +import java.io.Serializable; +import java.util.Objects; + +/** + * @since 7.4 + */ +public final class AcceptabilityMembership implements Comparable, Serializable { + + private SnomedConcept languageRefSet; + private SnomedConcept acceptability; + + public AcceptabilityMembership() { + } + + public AcceptabilityMembership(String languageRefSetId, String acceptabilityId) { + setLanguageRefSet(new SnomedConcept(languageRefSetId)); + setAcceptability(new SnomedConcept(acceptabilityId)); + } + + public SnomedConcept getAcceptability() { + return acceptability; + } + + public void setAcceptability(SnomedConcept acceptability) { + this.acceptability = acceptability; + } + + public String getAcceptabilityId() { + return acceptability == null ? null : acceptability.getId(); + } + + public SnomedConcept getLanguageRefSet() { + return languageRefSet; + } + + public void setLanguageRefSet(SnomedConcept languageRefSet) { + this.languageRefSet = languageRefSet; + } + + public String getLanguageRefSetId() { + return languageRefSet == null ? null : languageRefSet.getId(); + } + + @Override + public int compareTo(AcceptabilityMembership o) { + return Objects.equals(getAcceptabilityId(), o.getAcceptabilityId()) ? 0 : getAcceptabilityId().compareTo(o.getAcceptabilityId()); + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationTarget.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationTarget.java new file mode 100644 index 00000000000..89c3151e57b --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationTarget.java @@ -0,0 +1,72 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.domain; + +import java.io.Serializable; + +/** + * Represents a historical association to another concept in a historical association reference set. + * + * @since 7.4 + */ +public final class AssociationTarget implements Serializable { + + private static final long serialVersionUID = 1L; + + private SnomedConcept referenceSet; + private SnomedCoreComponent targetComponent; + + public AssociationTarget() { + } + + public AssociationTarget(String referenceSetId, String targetComponentId) { + setReferenceSetId(referenceSetId); + setTargetComponentId(targetComponentId); + } + + public SnomedConcept getReferenceSet() { + return referenceSet; + } + + public String getReferenceSetId() { + return referenceSet == null ? null : referenceSet.getId(); + } + + public SnomedCoreComponent getTargetComponent() { + return targetComponent; + } + + public String getTargetComponentId() { + return targetComponent == null ? null : targetComponent.getId(); + } + + public void setReferenceSet(SnomedConcept referenceSet) { + this.referenceSet = referenceSet; + } + + public void setReferenceSetId(String referenceSetId) { + setReferenceSet(new SnomedConcept(referenceSetId)); + } + + public void setTargetComponent(SnomedCoreComponent targetComponent) { + this.targetComponent = targetComponent; + } + + public void setTargetComponentId(String targetComponentId) { + setTargetComponent(SnomedCoreComponent.create(targetComponentId)); + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationType.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationType.java deleted file mode 100644 index e4aaf132ca3..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/AssociationType.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.google.common.base.Strings; - -/** - * Enumerates known historical association reference sets and their corresponding identifier concepts. - * - * @see Historical Association Reference Sets - * (Technical Implementation Guide) - */ -public enum AssociationType { - - /** - * Points to an active concept replacing the referenced inactive concept derived from ICD-9, Chapter XVI. - */ - ALTERNATIVE(Concepts.REFSET_ALTERNATIVE_ASSOCIATION), - - /** - * Points to the original component counterpart of the referenced component, before the move to a new namespace - */ - MOVED_FROM(Concepts.REFSET_MOVED_FROM_ASSOCIATION), - - /** - * Points to the target namespace concept, when the referenced component is moved from its original namespace - */ - MOVED_TO(Concepts.REFSET_MOVED_TO_ASSOCIATION), - - /** - * Points to one of the suggested replacements of the referenced inactive ("ambiguous") concept - */ - POSSIBLY_EQUIVALENT_TO(Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION), - - /** - * Points to a concept that the referenced inactive ("inappropriate") description describes more properly - */ - REFERS_TO(Concepts.REFSET_REFERS_TO_ASSOCIATION), - - /** - * Points to the single replacement concept of the referenced inactive ("erroneous") concept - */ - REPLACED_BY(Concepts.REFSET_REPLACED_BY_ASSOCIATION), - - /** - * Points to the unique equivalent of the referenced inactive (duplicate) concept - */ - SAME_AS(Concepts.REFSET_SAME_AS_ASSOCIATION), - - SIMILAR_TO(Concepts.REFSET_SIMILAR_TO_ASSOCIATION), - - /** - * Points to the closest active supertype of the referenced inactive (NOS or "otherwise specified") concept - */ - WAS_A(Concepts.REFSET_WAS_A_ASSOCIATION); - - private final String conceptId; - - private AssociationType(final String conceptId) { - this.conceptId = conceptId; - } - - /** - * Retrieves the concept identifier for this association reference set. - * - * @return the concept identifier corresponding to the association constant - */ - public String getConceptId() { - return conceptId; - } - - /** - * Performs a reverse lookup by concept identifier and returns the matching association type. - * - * @param conceptId the concept identifier to look for - * - * @return the resolved {@link AssociationType}, or {@code null} if {@code conceptId} is null - * or empty, or no matching enum literal is found - */ - public static AssociationType getByConceptId(final String conceptId) { - if (Strings.isNullOrEmpty(conceptId)) { - return null; - } - - for (final AssociationType candidate : values()) { - if (candidate.getConceptId().equals(conceptId)) { - return candidate; - } - } - - return null; - } -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CaseSignificance.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CaseSignificance.java deleted file mode 100644 index 186148feb98..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CaseSignificance.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import java.text.MessageFormat; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.google.common.base.Strings; - -/** - * Enumerates allowed description case significance values and their SNOMED CT concept counterparts. - * - * @see Concept enumerations for caseSignificanceId - * (Technical Implementation Guide) - */ -public enum CaseSignificance implements ConceptEnum { - - /** - * The description term case must be preserved in its entirety - */ - ENTIRE_TERM_CASE_SENSITIVE(Concepts.ENTIRE_TERM_CASE_SENSITIVE), - - /** - * The description term is case insensitive - */ - CASE_INSENSITIVE(Concepts.ENTIRE_TERM_CASE_INSENSITIVE), - - /** - * The initial character of the term is case insensitive - */ - INITIAL_CHARACTER_CASE_INSENSITIVE(Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE); - - private final String conceptId; - - private CaseSignificance(final String conceptId) { - this.conceptId = conceptId; - } - - /** - * Retrieves the concept identifier for this case significance value. - * - * @return the concept identifier corresponding to the case significance constant - */ - @Override - public String getConceptId() { - return conceptId; - } - - /** - * Performs a reverse lookup by concept identifier and returns the matching case significance. - * - * @param conceptId the concept identifier to look for - * - * @return the resolved {@link CaseSignificance}, or {@code null} if {@code conceptId} is null or empty - * @throws IllegalArgumentException if no case significance matches the specified concept identifier - */ - public static CaseSignificance getByConceptId(final String conceptId) { - if (Strings.isNullOrEmpty(conceptId)) { - return null; - } - - for (final CaseSignificance candidate : values()) { - if (candidate.getConceptId().equals(conceptId)) { - return candidate; - } - } - - throw new IllegalArgumentException(MessageFormat.format("No case significance value found for identifier ''{0}''.", conceptId)); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicType.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicType.java deleted file mode 100644 index e07b8e5bc4c..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicType.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import java.text.MessageFormat; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.google.common.base.Strings; - -/** - * Enumerates allowed relationship characteristic types and their corresponding concept identifiers. - * - * @see Concept enumerations for - * characteristicTypeId (Technical Implementation Guide) - */ -public enum CharacteristicType implements ConceptEnum { - - /** - * The relationship is used as part of the description logic (DL) definition - */ - DEFINING_RELATIONSHIP(Concepts.DEFINING_RELATIONSHIP), - - /** - * The relationship is defining, and was created by an author (manually) - */ - STATED_RELATIONSHIP(Concepts.STATED_RELATIONSHIP), - - /** - * The relationship is defining, and was created by the reasoner (automatically) - */ - INFERRED_RELATIONSHIP(Concepts.INFERRED_RELATIONSHIP), - - /** - * When creating postcoordinated expressions based on the concept, this relationship can be included as a qualifier - */ - QUALIFYING_RELATIONSHIP(Concepts.QUALIFYING_RELATIONSHIP), - - /** - * The relationship is not part of the DL definition; it only provides supplementary information - */ - ADDITIONAL_RELATIONSHIP(Concepts.ADDITIONAL_RELATIONSHIP); - - private final String conceptId; - - private CharacteristicType(final String conceptId) { - this.conceptId = conceptId; - } - - /** - * Retrieves the concept identifier for this characteristic type. - * - * @return the concept identifier corresponding to the characteristic type constant - */ - @Override - public String getConceptId() { - return conceptId; - } - - /** - * Performs a reverse lookup by concept identifier and returns the matching characteristic type. - * - * @param conceptId the concept identifier to look for - * - * @return the resolved {@link CharacteristicType}, or {@code null} if {@code conceptId} is null or empty - * @throws IllegalArgumentException if no characteristic type matches the specified concept identifier - */ - public static CharacteristicType getByConceptId(final String conceptId) { - if (Strings.isNullOrEmpty(conceptId)) { - return null; - } - - for (final CharacteristicType candidate : values()) { - if (candidate.getConceptId().equals(conceptId)) { - return candidate; - } - } - - throw new IllegalArgumentException(MessageFormat.format("No characteristic type value found for identifier ''{0}''.", conceptId)); - } - - public boolean isDefining() { - return this == DEFINING_RELATIONSHIP || this == INFERRED_RELATIONSHIP || this == STATED_RELATIONSHIP; - } - -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicTypePredicates.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicTypePredicates.java deleted file mode 100644 index b24a69f0778..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/CharacteristicTypePredicates.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import java.util.Set; - -import com.b2international.snowowl.core.ApplicationContext; -import com.b2international.snowowl.core.api.IComponent; -import com.b2international.snowowl.snomed.datastore.config.SnomedCoreConfiguration; -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Sets; - -/** - * Predicates regarding {@link CharacteristicType}s. - * @author endre - * - */ -public class CharacteristicTypePredicates { - - private static ImmutableList MANUALLY_ALLOWED_CHARACTERISTIC_TYPES = ImmutableList. of(CharacteristicType.ADDITIONAL_RELATIONSHIP.getConceptId(), CharacteristicType.STATED_RELATIONSHIP.getConceptId()); - private static boolean inferredEditingEnabled = ApplicationContext.getInstance().getServiceChecked(SnomedCoreConfiguration.class).isInferredEditingEnabled(); - - /** - * Predicate for {@link CharacteristicType} IDs. - */ - public static class CharacteristicTypeByIdPredicate implements Predicate { - - private Set ids = Sets.newHashSet(); - - public CharacteristicTypeByIdPredicate(String... characteristicTypesIDs) { - for (String id : characteristicTypesIDs) { - ids.add(id); - } - - //manual override - if (inferredEditingEnabled) { - ids.add(CharacteristicType.INFERRED_RELATIONSHIP.getConceptId()); - } - } - - public CharacteristicTypeByIdPredicate(CharacteristicType... characteristicTypes) { - for (CharacteristicType characteristicType : characteristicTypes) { - ids.add(characteristicType.getConceptId()); - } - //manual override - if (inferredEditingEnabled) { - ids.add(CharacteristicType.INFERRED_RELATIONSHIP.getConceptId()); - } - } - - @Override - public boolean apply(String input) { - return ids.contains(input); - } - - } - - /** - * Predicate for {@link CharacteristicType} {@link IComponent}s - */ - public static class CharacteristicTypeIComponentPredicate implements Predicate> { - - private Set ids = Sets.newHashSet(); - - public CharacteristicTypeIComponentPredicate(String... characteristicTypeIDs) { - for (String id : characteristicTypeIDs) { - ids.add(id); - } - //manual override - if (inferredEditingEnabled) { - ids.add(CharacteristicType.INFERRED_RELATIONSHIP.getConceptId()); - } - } - - public CharacteristicTypeIComponentPredicate(CharacteristicType... characteristicTypes) { - for (CharacteristicType characteristicType : characteristicTypes) { - ids.add(characteristicType.getConceptId()); - } - //manual override - if (inferredEditingEnabled) { - ids.add(CharacteristicType.INFERRED_RELATIONSHIP.getConceptId()); - } - } - - @Override - public boolean apply(IComponent input) { - return ids.contains(input.getId()); - } - } - - - /** - * Returns a {@link Predicate} that selects only those {@link CharacteristicType}s that are allowed to be created by the user. - * @return - */ - public static Predicate> manuallyCreatableCharacteristicTypesIComponentPredicate() { - return new CharacteristicTypeIComponentPredicate(MANUALLY_ALLOWED_CHARACTERISTIC_TYPES.toArray(new String[0])); - } - - - /** - * Returns a {@link Predicate} that selects only those {@link CharacteristicType}s that are allowed to be created by the user. - * @return - */ - public static Predicate manuallyCreatableCharacteristicTypesIDsPredicate() { - return new CharacteristicTypeByIdPredicate(MANUALLY_ALLOWED_CHARACTERISTIC_TYPES.toArray(new String[0])); - } - -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatus.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatus.java deleted file mode 100644 index 8d07612e2cb..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DefinitionStatus.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import java.text.MessageFormat; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.google.common.base.Strings; - -/** - * Enumerates allowed concept definition status values and their corresponding concept identifiers. - * - * @see Concept enumerations for - * definitionStatusId (Technical Implementation Guide) - */ -public enum DefinitionStatus implements ConceptEnum { - - /** - * The concept's defining relationships do not define the concept in full; the missing parts are not known, not - * expressible in SNOMED CT's terms or are otherwise not present. - */ - PRIMITIVE(Concepts.PRIMITIVE), - - /** - * The concept's defining relationships make up a complete definition of the concept. - */ - FULLY_DEFINED(Concepts.FULLY_DEFINED); - - private final String conceptId; - - private DefinitionStatus(final String conceptId) { - this.conceptId = conceptId; - } - - /** - * Retrieves the concept identifier for this definition status. - * - * @return the concept identifier corresponding to the definition status constant - */ - @Override - public String getConceptId() { - return conceptId; - } - - @JsonIgnore - public boolean isPrimitive() { - return PRIMITIVE.equals(this); - } - - public static DefinitionStatus getByConceptId(String conceptId) { - if (Strings.isNullOrEmpty(conceptId)) { - return null; - } - - for (DefinitionStatus status : values()) { - if (status.getConceptId().equals(conceptId)) { - return status; - } - } - - throw new IllegalArgumentException(MessageFormat.format("No definition status value found for identifier ''{0}''.", conceptId)); - } - -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DescriptionInactivationIndicator.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DescriptionInactivationIndicator.java deleted file mode 100644 index bb86523722f..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/DescriptionInactivationIndicator.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.google.common.base.Strings; - -/** - * Enumeration to specify the reason of the inactivation of SNOMED CT descriptions. - * - * @see Component Inactivation Reference Sets - * (Technical Implementation Guide) - */ -public enum DescriptionInactivationIndicator implements ConceptEnum { - - /** - * The description duplicates another description. - */ - DUPLICATE(Concepts.DUPLICATE), - - /** - * The description is outdated, and should not be used. - */ - OUTDATED(Concepts.OUTDATED), - - /** - * The description contains mistakes in its text, or was otherwise added in error. - */ - ERRONEOUS(Concepts.ERRONEOUS), - - /** - * The description refers to a limited concept. - */ - LIMITED(Concepts.LIMITED), - - /** - * The description was moved to another namespace. - */ - MOVED_ELSEWHERE(Concepts.MOVED_ELSEWHERE), - - /** - * The description is still active, but will be moved to another namespace. - */ - PENDING_MOVE(Concepts.PENDING_MOVE), - - /** - * The description does not describe the concept properly. - */ - INAPPROPRIATE(Concepts.INAPPROPRIATE), - - /** - * The description is still active, but it refers to an inactive concept. - */ - CONCEPT_NON_CURRENT(Concepts.CONCEPT_NON_CURRENT), - - /** - * The description fails to comply with the current editorial guidance - */ - NONCONFORMANCE_TO_EDITORIAL_POLICY(Concepts.NONCONFORMANCE_TO_EDITORIAL_POLICY), - - /** - * The description does not represent the same meaning as the concept's Fully Specified Name (FSN) - */ - NOT_SEMANTICALLY_EQUIVALENT(Concepts.NOT_SEMANTICALLY_EQUIVALENT), - - /** - * The description has been retired without any particular indication. - */ - RETIRED(""); - - private String conceptId; - - private DescriptionInactivationIndicator(final String conceptId) { - this.conceptId = conceptId; - } - - /** - * Returns the identifier of the concept that represents the inactivation reason. - * - * @return the concept identifier of the inactivation reason - */ - @Override - public String getConceptId() { - return conceptId; - } - - /** - * Returns with the description inactivation indication for the specified concept identifier. - * - * @param conceptId the concept identifier to look up - * - * @return the resolved description inactivation indicator, or {@code null} if {@code conceptId} is null or empty, - * or a suitable enum literal cannot be found for the identifier - */ - public static DescriptionInactivationIndicator getInactivationIndicatorByValueId(final String conceptId) { - if (Strings.isNullOrEmpty(conceptId)) { - return null; - } - - for (final DescriptionInactivationIndicator candidate : values()) { - if (candidate.getConceptId().equals(conceptId)) { - return candidate; - } - } - - return null; - } -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationIndicator.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationIndicator.java deleted file mode 100644 index c0409ae922c..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationIndicator.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Enumeration to specify the reason of the inactivation of SNOMED CT concepts. - * - * @see Component Inactivation Reference Sets - * (Technical Implementation Guide) - */ -public enum InactivationIndicator implements ConceptEnum { - - /** - * The concept duplicates the definition of another concept. - */ - DUPLICATE(InactivationReason.DUPLICATE), - - /** - * The concept is outdated, and no longer used. - */ - OUTDATED(InactivationReason.OUTDATED), - - /** - * The concept is ambiguous. - */ - AMBIGUOUS(InactivationReason.AMBIGUOUS), - - /** - * The concept contains an error. - */ - ERRONEOUS(InactivationReason.ERRONEOUS), - - /** - * The concept is of limited value as it contains classification categories which do not have a stable meaning. - */ - LIMITED(InactivationReason.LIMITED), - - /** - * The concept was moved to another namespace. - */ - MOVED_ELSEWHERE(InactivationReason.MOVED_ELSEWEHERE), - - /** - * The concept is still active, but is in the process of being moved to another namespace. - */ - PENDING_MOVE(InactivationReason.PENDING_MOVE), - - /** - * Applies to a concept which does not adhere to the Editorial guidelines - */ - NONCONFORMANCE_TO_EDITORIAL_POLICY(InactivationReason.NONCONFORMANCE_TO_EDITORIAL_POLICY), - - /** - * The concept has been retired without any particular indication. - */ - RETIRED(InactivationReason.RETIRED); - - private final InactivationReason inactivationReason; - - private InactivationIndicator(final InactivationReason inactivationReason) { - this.inactivationReason = inactivationReason; - } - - /** - * Retrieves the concept identifier for this inactivation indicator. - * - * @return the concept identifier corresponding to the inactivation indicator constant - */ - @Override - public String getConceptId() { - return inactivationReason.getInactivationReasonConceptId(); - } - - /** - * Returns with the concept inactivation indication for the specified concept identifier. - * - * @param conceptId the concept identifier to look up (may not be {@code null} or empty) - * - * @return the resolved concept inactivation indicator, or {@code #RETIRED} if one cannot be found for the - * specified identifier - */ - public static InactivationIndicator getByConceptId(final String conceptId) { - checkNotNull(conceptId, "Concept identifier may not be null."); - checkArgument(!conceptId.isEmpty(), "Concept identifier may not be empty."); - - for (final InactivationIndicator candidate : values()) { - if (candidate.getConceptId().equals(conceptId)) { - return candidate; - } - } - - return RETIRED; - } - - /** - * Converts this enumeration to its {@link InactivationReason} counterpart (for internal use). - * - * @return the converted inactivation reason value - */ - public InactivationReason toInactivationReason() { - return inactivationReason; - } -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationProperties.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationProperties.java new file mode 100644 index 00000000000..aaace9ae571 --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationProperties.java @@ -0,0 +1,74 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.domain; + +import java.io.Serializable; +import java.util.List; + +/** + * @since 7.4 + */ +public final class InactivationProperties implements Serializable { + + private static final long serialVersionUID = 1L; + + private SnomedConcept inactivationIndicator; + private List associationTargets; + + public InactivationProperties() { + } + + public InactivationProperties(String inactivationIndicatorId, List associationTargets) { + setInactivationIndicatorId(inactivationIndicatorId); + setAssociationTargets(associationTargets); + } + + /** + * Returns the component's corresponding active inactivation indicator member value. In case of multiple values present in the corresponding + * inactivation indicator reference set this value will return the first active occurrence from that refset. + * + * @return the inactivation indicator value, or {@code null} if the component does not have an inactivation indicator + */ + public SnomedConcept getInactivationIndicator() { + return inactivationIndicator; + } + + public String getInactivationIndicatorId() { + return inactivationIndicator == null ? null : inactivationIndicator.getId(); + } + + public void setInactivationIndicator(SnomedConcept inactivationIndicator) { + this.inactivationIndicator = inactivationIndicator; + } + + public void setInactivationIndicatorId(String inactivationIndicatorId) { + setInactivationIndicator(inactivationIndicatorId == null ? null : new SnomedConcept(inactivationIndicatorId)); + } + + /** + * Returns all active association targets. + * + * @return related association targets, or empty {@link List} if there are no association targets present for this component. + */ + public List getAssociationTargets() { + return associationTargets; + } + + public void setAssociationTargets(List associationTargets) { + this.associationTargets = associationTargets; + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationReason.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationReason.java deleted file mode 100644 index c3f2d8c6659..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/InactivationReason.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; - -/** - * Enumeration representing the reason of the SNOMED CT concept inactivation. - *

- * The following reasons are available: - *

    - *
  • {@link #DUPLICATE Duplicate}
  • - *
  • {@link #OUTDATED Outdated}
  • - *
  • {@link #AMBIGUOUS Ambiguous}
  • - *
  • {@link #ERRONEOUS Erroneous}
  • - *
  • {@link #LIMITED Limited}
  • - *
  • {@link #MOVED_ELSEWEHERE Moved elsewhere}
  • - *
  • {@link #PENDING_MOVE Pending move}
  • - *
  • {@link #RETIRED Retired}
  • - *
- *

- *

- * Note that "Pending move" is present for completeness, however the process requires the concept to stay active, and so can not be handled by - * component inactivation correctly at this time. - *

- */ -public enum InactivationReason { - - /** - * Duplicate.
- * SNOMED CT reference set: SAME AS (ID: 900000000000527005)
- * SNOMED CT concept of the inactivation reason: DUPLICATE (ID: 900000000000482003) - * - * @see InactivationReason - */ - DUPLICATE("Duplicate", Concepts.REFSET_SAME_AS_ASSOCIATION, Concepts.DUPLICATE), // SAME AS - - /** - * Outdated.
- * SNOMED CT reference set: REPLACED BY (ID: 900000000000526001)
- * SNOMED CT concept of the inactivation reason: OUTDATED (ID: 900000000000483008) - * - * @see InactivationReason - */ - OUTDATED("Outdated", Concepts.REFSET_REPLACED_BY_ASSOCIATION, Concepts.OUTDATED), // REPLACED BY - - /** - * Ambiguous.
- * SNOMED CT reference set: POSSIBLY EQUIVALENT TO (ID: 900000000000523009)
- * SNOMED CT concept of the inactivation reason: AMBIGUOUS (ID: 900000000000484002) - * - * @see InactivationReason - */ - AMBIGUOUS("Ambiguous", Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION, Concepts.AMBIGUOUS), // POSSIBLY EQUIVALENT TO - - /** - * Erroneous.
- * SNOMED CT reference set: REPLACED BY (ID: 900000000000526001)
- * SNOMED CT concept of the inactivation reason: ERRONEOUS (ID: 900000000000485001) - * - * @see InactivationReason - */ - ERRONEOUS("Erroneous", Concepts.REFSET_REPLACED_BY_ASSOCIATION, Concepts.ERRONEOUS), // REPLACED BY - - /** - * Limited.
- * SNOMED CT reference set: WAS A (ID: 900000000000528000)
- * SNOMED CT concept of the inactivation reason: LIMITED (ID: 900000000000486000) - * - * @see InactivationReason - */ - LIMITED("Limited", Concepts.REFSET_WAS_A_ASSOCIATION, Concepts.LIMITED), // WAS A (may not be applicable universally) - - /** - * Moved elsewhere.
- * SNOMED CT reference set: MOVED TO (ID: 900000000000524003)
- * SNOMED CT concept of the inactivation reason: MOVED_ELSEWHERE (ID: 900000000000487009) - * - * @see InactivationReason - */ - MOVED_ELSEWEHERE("Moved elsewhere", Concepts.REFSET_MOVED_TO_ASSOCIATION, Concepts.MOVED_ELSEWHERE), // MOVED TO - - /** - * Pending move.
- * SNOMED CT reference set: MOVED TO (ID: 900000000000524003)
- * SNOMED CT concept of the inactivation reason: PENDING_MOVE (ID: 900000000000492006) - * - * @see InactivationReason - */ - PENDING_MOVE("Pending move", Concepts.REFSET_MOVED_TO_ASSOCIATION, Concepts.PENDING_MOVE), // MOVED TO - - /** - * Nonconformance to editorial policy. No historical association reference set - * member is required.
- * SNOMED CT concept of the inactivation reason: - * NONCONFORMANCE_TO_EDITORIAL_POLICY (ID: 723277005) - * - * @see InactivationReason - */ - NONCONFORMANCE_TO_EDITORIAL_POLICY("Nonconformance to editorial policy", "", Concepts.NONCONFORMANCE_TO_EDITORIAL_POLICY), - - /** - * Retired ("inactive with no reason given for inactivation"). Neither a historical association reference set member nor a component inactivation - * reference set member is required. - * - * @see InactivationReason - */ - RETIRED("Retired", "", ""); - - private final String name; - private final String associatedRefSetId; - private final String inactivationReasonConceptId; - - private InactivationReason(final String name, final String associatedRefSetId, final String inactivationReasonConceptId) { - this.name = name; - this.associatedRefSetId = associatedRefSetId; - this.inactivationReasonConceptId = inactivationReasonConceptId; - } - - /** - * Returns with the human readable name of the inactivation reason. - * - * @return the human readable reason. - */ - public String getName() { - return name; - } - - /** - * Returns with the associated SNOMED CT reference set concept identifier. - *

- * Note: can be empty string if the inactivation reason is {@link #RETIRED retired}. - * - * @return the associated reference set concept identifier. - */ - public String getAssociatedRefSetId() { - return associatedRefSetId; - } - - /** - * Returns with the ID of the inactivation reason SNOMED CT concept. - *

- * Note: can be empty string if the inactivation reason is {@link #RETIRED retired}. - * - * @return the ID of the inactivation reason. - */ - public String getInactivationReasonConceptId() { - return inactivationReasonConceptId; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Enum#toString() - */ - @Override - public String toString() { - return getName(); - } - -} \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/RelationshipModifier.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/RelationshipModifier.java deleted file mode 100644 index 3f36c48090a..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/RelationshipModifier.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.core.domain; - -import java.text.MessageFormat; - -import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.google.common.base.Strings; - -/** - * Enumerates allowed relationship modifiers and maps them to concept identifiers. - * - * @see Concept enumerations for modifierId - * (Technical Implementation Guide) - */ -public enum RelationshipModifier implements ConceptEnum { - - /** - * Existential restriction (∃) - */ - EXISTENTIAL(Concepts.EXISTENTIAL_RESTRICTION_MODIFIER), - - /** - * Universal restriction (∀) - */ - UNIVERSAL(Concepts.UNIVERSAL_RESTRICTION_MODIFIER); - - private final String conceptId; - - private RelationshipModifier(final String conceptId) { - this.conceptId = conceptId; - } - - /** - * Retrieves the concept identifier for this relationship modifier value. - * - * @return the concept identifier corresponding to the modifier constant - */ - @Override - public String getConceptId() { - return conceptId; - } - - /** - * Performs a reverse lookup by concept identifier and returns the matching modifier value. - * - * @param conceptId the concept identifier to look for - * @return the resolved {@link RelationshipModifier}, or {@code null} if {@code conceptId} is null or empty - * @throws IllegalArgumentException if no known relationship modifier matches the specified concept identifier - */ - public static RelationshipModifier getByConceptId(final String conceptId) { - if (Strings.isNullOrEmpty(conceptId)) { - return null; - } - - for (final RelationshipModifier candidate : values()) { - if (candidate.getConceptId().equals(conceptId)) { - return candidate; - } - } - - throw new IllegalArgumentException(MessageFormat.format("No relationship modifier value found for identifier ''{0}''.", conceptId)); - } -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedComponent.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedComponent.java index ff102854e14..f0226fcad83 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedComponent.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,13 @@ */ public abstract class SnomedComponent extends BaseComponent { + /** + * @since 7.4 + */ + public static abstract class Expand { + public static final String MODULE = "module"; + } + /** * @since 6.16 */ @@ -49,6 +56,8 @@ public static abstract class Fields extends BaseComponent.Fields { private String moduleId; private String iconId; private Float score; + + private SnomedConcept module; /** * Returns the component's current status as a boolean value. @@ -94,6 +103,13 @@ public String getIconId() { public Float getScore() { return score; } + + /** + * @return the expanded module of a SNOMED CT Concept + */ + public SnomedConcept getModule() { + return module; + } public void setActive(final Boolean active) { this.active = active; @@ -116,6 +132,10 @@ public void setScore(Float score) { this.score = score; } + public void setModule(SnomedConcept module) { + this.module = module; + } + /** * Creates an update {@link Request} to update the component to the state represented by this instance. * @return diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcept.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcept.java index c14dc931a8e..9cf0525deec 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcept.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcept.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,8 @@ import static com.google.common.collect.Sets.newHashSet; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.Set; import java.util.stream.Collectors; @@ -30,6 +28,7 @@ import com.b2international.snowowl.core.terminology.ComponentCategory; import com.b2international.snowowl.core.terminology.MapTargetTypes; import com.b2international.snowowl.core.terminology.TerminologyComponent; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet; @@ -39,10 +38,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Function; -import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; /** * Represents a SNOMED CT concept. @@ -63,6 +59,8 @@ *

  • {@code statedAncestors(direct:true|false)} - returns the all or the only the direct ancestors of the concept based on the stated tree.
  • *
  • {@code members()} - returns the reference set members referencing this component
  • *
  • {@code preferredDescriptions()} - expands the preferred descriptions for each matching concept
  • + *
  • {@code module()} - expands the module concept of the concept
  • + *
  • {@code definitionStatus()} - expands the definition status concept of the concept
  • * * * The number of expanded fields can be controlled with the {@code limit:} directive. @@ -93,14 +91,17 @@ MapTargetTypes.SIMPLE_MAP_WITH_DESCRIPTION, MapTargetTypes.ATTRIBUTE_VALUE, MapTargetTypes.COMPLEX_MAP, - MapTargetTypes.EXTENDED_MAP + MapTargetTypes.EXTENDED_MAP, + // XXX: Not really SNOMED CT reference set types + MapTargetTypes.VALUE_SET, + MapTargetTypes.MAPPING_SET }, supportedMapTargetTypes = { - "SIMPLE_MAP", - "SIMPLE_MAP_WITH_DESCRIPTION" + MapTargetTypes.SIMPLE_MAP, + MapTargetTypes.SIMPLE_MAP_WITH_DESCRIPTION } ) -public final class SnomedConcept extends SnomedCoreComponent implements DefinitionStatusProvider { +public final class SnomedConcept extends SnomedCoreComponent { private static final long serialVersionUID = 1L; @@ -112,7 +113,6 @@ public final class SnomedConcept extends SnomedCoreComponent implements Definiti public static final class Expand extends SnomedCoreComponent.Expand { public static final String REFERENCE_SET = "referenceSet"; - public static final String INACTIVATION_PROPERTIES = "inactivationProperties"; public static final String STATED_ANCESTORS = "statedAncestors"; public static final String ANCESTORS = "ancestors"; public static final String STATED_DESCENDANTS = "statedDescendants"; @@ -122,7 +122,8 @@ public static final class Expand extends SnomedCoreComponent.Expand { public static final String DESCRIPTIONS = "descriptions"; public static final String FULLY_SPECIFIED_NAME = "fsn"; public static final String PREFERRED_TERM = "pt"; - public static final Object PREFERRED_DESCRIPTIONS = "preferredDescriptions"; + public static final String PREFERRED_DESCRIPTIONS = "preferredDescriptions"; + public static final String DEFINITION_STATUS = "definitionStatus"; } @@ -179,10 +180,8 @@ public static final class Fields extends SnomedCoreComponent.Fields { return ancestors; }; - private DefinitionStatus definitionStatus; + private SnomedConcept definitionStatus; private SubclassDefinitionStatus subclassDefinitionStatus; - private InactivationIndicator inactivationIndicator; - private Multimap associationTargets; private SnomedDescription fsn; private SnomedDescription pt; private SnomedDescriptions descriptions; @@ -211,18 +210,12 @@ public short getTerminologyComponentId() { return SnomedTerminologyComponentConstants.CONCEPT_NUMBER; } - /** - * @deprecated - get the definitionStatusId from {@link #getDefinitionStatusId()} method - */ - @JsonProperty - @Override - public DefinitionStatus getDefinitionStatus() { + public SnomedConcept getDefinitionStatus() { return definitionStatus; } - @JsonProperty public String getDefinitionStatusId() { - return definitionStatus == null ? null : definitionStatus.getConceptId(); + return getDefinitionStatus() == null ? null : getDefinitionStatus().getId(); } /** @@ -235,46 +228,6 @@ public SubclassDefinitionStatus getSubclassDefinitionStatus() { return subclassDefinitionStatus; } - /** - * Returns the concept's corresponding inactivation indicator member value. - * - * @return the inactivation indicator value, or {@code null} if the concept does not have an inactivation indicator - */ - public InactivationIndicator getInactivationIndicator() { - return inactivationIndicator; - } - - /** - * Returns association reference set member targets keyed by the association type. - * - * @return related association targets, or {@code null} if the concept does not have any association targets - */ - @JsonIgnore - public Multimap getAssociationTargets() { - return associationTargets; - } - - /** - * Returns association reference set member targets keyed by the association type as a {@link java.util.Map}. - * - * @return related association targets, or {@code null} if the concept does not have any association targets - */ - @JsonProperty("associationTargets") - public Map> getAssociationTargetsAsMap() { - if (associationTargets == null) { - return null; - } else { - final Map> targets = Maps.newHashMapWithExpectedSize(associationTargets.size()); - associationTargets.forEach((key, value) -> { - if (!targets.containsKey(key)) { - targets.put(key, new ArrayList<>(associationTargets.get(key).size())); - } - targets.get(key).add(value); - }); - return targets; - } - } - /** * Returns the descriptions of the SNOMED CT Concept. * @@ -419,39 +372,18 @@ public List getStatedParentIdsAsString() { return statedParentIds == null ? null : Arrays.stream(statedParentIds).mapToObj(Long::toString).collect(Collectors.toList()); } - @JsonIgnore - public void setDefinitionStatus(final DefinitionStatus definitionStatus) { + public void setDefinitionStatus(SnomedConcept definitionStatus) { this.definitionStatus = definitionStatus; } - public void setDefinitionStatusId(final String definitionStatusId) { - this.definitionStatus = DefinitionStatus.getByConceptId(definitionStatusId); + public void setDefinitionStatusId(String definitionStatusId) { + setDefinitionStatus(new SnomedConcept(definitionStatusId)); } - public void setSubclassDefinitionStatus(final SubclassDefinitionStatus subclassDefinitionStatus) { + public void setSubclassDefinitionStatus(SubclassDefinitionStatus subclassDefinitionStatus) { this.subclassDefinitionStatus = subclassDefinitionStatus; } - public void setInactivationIndicator(final InactivationIndicator inactivationIndicator) { - this.inactivationIndicator = inactivationIndicator; - } - - @JsonIgnore - public void setAssociationTargets(final Multimap associationTargets) { - this.associationTargets = associationTargets; - } - - @JsonProperty("associationTargets") - public void setAssociationTargets(final Map> associationTargets) { - if (associationTargets == null) { - this.associationTargets = null; - } else { - final ImmutableListMultimap.Builder targets = ImmutableListMultimap.builder(); - associationTargets.forEach(targets::putAll); - this.associationTargets = targets.build(); - } - } - public void setDescriptions(SnomedDescriptions descriptions) { this.descriptions = descriptions; } @@ -539,6 +471,11 @@ public void setReferenceSet(SnomedReferenceSet referenceSet) { public SnomedReferenceSet getReferenceSet() { return referenceSet; } + + @JsonIgnore + public boolean isPrimitive() { + return Concepts.PRIMITIVE.equals(getDefinitionStatusId()); + } @Override public Request toCreateRequest(String containerId) { @@ -547,7 +484,7 @@ public Request toCreateRequest(String containerId) { .addMembers(getMembers()) .addRelationships(getRelationships()) .addDescriptions(getDescriptions()) - .setDefinitionStatus(getDefinitionStatus()) + .setDefinitionStatusId(getDefinitionStatusId()) .setId(getId()) .setModuleId(getModuleId()) .setSubclassDefinitionStatus(getSubclassDefinitionStatus()) @@ -558,9 +495,8 @@ public Request toCreateRequest(String containerId) { public Request toUpdateRequest() { return SnomedRequests.prepareUpdateConcept(getId()) .setActive(isActive()) - .setAssociationTargets(getAssociationTargets()) - .setDefinitionStatus(getDefinitionStatus()) - .setInactivationIndicator(getInactivationIndicator()) + .setInactivationProperties(getInactivationProperties()) + .setDefinitionStatusId(getDefinitionStatusId()) .setModuleId(getModuleId()) .setSubclassDefinitionStatus(getSubclassDefinitionStatus()) .setDescriptions(getDescriptions()) @@ -582,15 +518,14 @@ public String toString() { builder.append(getId()); builder.append(", isReleased()="); builder.append(isReleased()); - builder.append(", getDefinitionStatus()="); - builder.append(getDefinitionStatus()); + builder.append(", getDefinitionStatusId()="); + builder.append(getDefinitionStatusId()); builder.append(", getSubclassDefinitionStatus()="); builder.append(getSubclassDefinitionStatus()); - builder.append(", getInactivationIndicator()="); - builder.append(getInactivationIndicator()); - builder.append(", getAssociationTargets()="); - builder.append(getAssociationTargets()); + builder.append(", getInactivationProperties()="); + builder.append(getInactivationProperties()); builder.append("]"); return builder.toString(); } + } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcepts.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcepts.java index 5b2c8f0d0dc..f6382003a20 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcepts.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedConcepts.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,13 +46,12 @@ public List apply(SnomedConcepts input) { * @param total - total number of items in the resultset */ public SnomedConcepts(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } /** * Instantiates a pageable collection of SNOMED CT concepts. * @param items - list of @link {@link SnomedConcept}s - * @param scrollId - scrollId for paging the result set continuously * @param searchAfter - searchAfter for paging the result set with a live cursor * @param limit - limit of items for a single page * @param total - total number of items in the result set @@ -60,10 +59,9 @@ public SnomedConcepts(int limit, int total) { @JsonCreator public SnomedConcepts( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedCoreComponent.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedCoreComponent.java index f8b0ff3fa0f..95b770dd3ec 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedCoreComponent.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedCoreComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,9 @@ */ package com.b2international.snowowl.snomed.core.domain; +import com.b2international.snowowl.core.api.SnowowlRuntimeException; import com.b2international.snowowl.snomed.cis.SnomedIdentifiers; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.JsonTypeInfo.Id; @@ -24,6 +26,8 @@ import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver; import com.fasterxml.jackson.databind.jsontype.TypeIdResolver; import com.fasterxml.jackson.databind.type.TypeFactory; +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; /** * @since 4.6 @@ -32,12 +36,53 @@ @JsonTypeIdResolver(SnomedCoreComponent.SnomedComponentCategoryResolver.class) public abstract class SnomedCoreComponent extends SnomedComponent { + /** + * @since 6.16 + */ + public static abstract class Expand extends SnomedComponent.Expand { + public static final String INACTIVATION_PROPERTIES = "inactivationProperties"; + public static final String REFERRING_MEMBERS = "members"; + } + + /** + * @since 6.16 + */ + public static abstract class Fields extends SnomedComponent.Fields { + } + + /** + * The preferred association targets for the concept inactivation indicators in the SNOMED CT International Edition. + *

    + * Note that "Pending move" is present for completeness, however the process requires the concept to stay active, and so can not be handled by + * component inactivation correctly at this time. + *

    + * + * @since 7.4 + */ + public static final Multimap PREFERRED_INDICATOR_ASSOCIATION_TARGETS = ImmutableMultimap.builder() + .put(Concepts.DUPLICATE, Concepts.REFSET_SAME_AS_ASSOCIATION) + .put(Concepts.OUTDATED, Concepts.REFSET_REPLACED_BY_ASSOCIATION) + .put(Concepts.AMBIGUOUS, Concepts.REFSET_POSSIBLY_EQUIVALENT_TO_ASSOCIATION) + .put(Concepts.ERRONEOUS, Concepts.REFSET_REPLACED_BY_ASSOCIATION) + .put(Concepts.LIMITED, Concepts.REFSET_WAS_A_ASSOCIATION) + .put(Concepts.MOVED_ELSEWHERE, Concepts.REFSET_MOVED_TO_ASSOCIATION) + .put(Concepts.PENDING_MOVE, Concepts.REFSET_MOVED_TO_ASSOCIATION) + .put(Concepts.NOT_SEMANTICALLY_EQUIVALENT, Concepts.REFSET_REFERS_TO_ASSOCIATION) + .put(Concepts.NONCONFORMANCE_TO_EDITORIAL_POLICY, "") // No historical association reference set + .build(); + + private InactivationProperties inactivationProperties; private SnomedReferenceSetMembers members; - public void setMembers(SnomedReferenceSetMembers members) { - this.members = members; + /** + * Returns the available inactivation properties of this concept. Requires expansion parameter 'inactivationProperties()' in read requests. + * + * @return the expanded inactivation properties or null if expansion was not requested + */ + public InactivationProperties getInactivationProperties() { + return inactivationProperties; } - + /** * Returns the expanded reference set members if any, otherwise it returns a null {@link SnomedReferenceSetMembers}. * @return @@ -45,18 +90,13 @@ public void setMembers(SnomedReferenceSetMembers members) { public SnomedReferenceSetMembers getMembers() { return members; } - - /** - * @since 6.16 - */ - public static abstract class Expand { - public static final String REFERRING_MEMBERS = "members"; + + public void setInactivationProperties(InactivationProperties inactivationProperties) { + this.inactivationProperties = inactivationProperties; } - /** - * @since 6.16 - */ - public static abstract class Fields extends SnomedComponent.Fields { + public void setMembers(SnomedReferenceSetMembers members) { + this.members = members; } /** @@ -101,22 +141,42 @@ public String getDescForKnownTypeIds() { @Override public JavaType typeFromId(DatabindContext context, String type) { - final Class clazz; - switch (SnomedIdentifiers.getComponentCategory(type)) { - case CONCEPT: - clazz = SnomedConcept.class; - break; - case DESCRIPTION: - clazz = SnomedDescription.class; - break; - case RELATIONSHIP: - clazz = SnomedRelationship.class; - break; - default: throw new IllegalArgumentException("Unknown core component type: " + type); - } + final Class clazz = getCoreComponentClass(type); return TypeFactory.defaultInstance().constructSpecializedType(baseType, clazz); } } + + /** + * Creates an empty {@link SnomedCoreComponent} subclass instance based on the componentId. Only the {@link SnomedComponent#getId()} will be set + * on the returned instance. + * + * @param componentId + * @return + */ + public static SnomedCoreComponent create(String componentId) { + try { + return getCoreComponentClass(componentId).getConstructor(String.class).newInstance(componentId); + } catch (Exception e) { + throw new SnowowlRuntimeException(e); + } + } + + /** + * @param componentId + * @return the core component class type based on the component category digit in the given componentId + */ + public static Class getCoreComponentClass(String componentId) { + switch (SnomedIdentifiers.getComponentCategory(componentId)) { + case CONCEPT: + return SnomedConcept.class; + case DESCRIPTION: + return SnomedDescription.class; + case RELATIONSHIP: + return SnomedRelationship.class; + default: + throw new IllegalArgumentException("Unknown core component type: " + componentId); + } + } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescription.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescription.java index 236b1b118e9..dee59846e5d 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescription.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.core.domain; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; @@ -34,10 +33,7 @@ import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import com.google.common.collect.ImmutableListMultimap; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; /** * Represents a SNOMED CT description. @@ -50,6 +46,7 @@ *
      *
    • {@code type()} - returns the concept representing the type of the description
    • *
    • {@code members()} - returns the reference set members referencing this component
    • + *
    • {@code acceptabilities()} - returns the acceptability membership for this description
    • *
    * * Expand parameters can be nested to further expand or filter the details returned. @@ -110,10 +107,9 @@ public static final class Fields extends SnomedCoreComponent.Fields { private String term; private String semanticTag; private String languageCode; - private CaseSignificance caseSignificance; - private DescriptionInactivationIndicator inactivationIndicator; + private SnomedConcept caseSignificance; private Map acceptabilityMap; - private Multimap associationTargets; + private List acceptabilities; private SnomedConcept concept; private SnomedConcept type; @@ -194,64 +190,43 @@ public String getLanguageCode() { } /** - * Returns the description's case significance attribute, indicating whether character case within the term should + * Returns the description's case significance concept, indicating whether character case within the term should * be preserved or is interchangeable. * - * @return the case significance of this description + * @return the case significance concept of this description */ - public CaseSignificance getCaseSignificance() { + public SnomedConcept getCaseSignificance() { return caseSignificance; } - - /** - * Returns language reference set member acceptability values for this description, keyed by language reference set identifier. - * - * @return the acceptability map for this description - */ - public Map getAcceptabilityMap() { - return acceptabilityMap; - } - + /** - * Returns the inactivation indicator (if any) of the description that can be used to identify the reason why the - * current description has been deactivated. + * Returns the identifier of the description's case significance concept. * - * @return the inactivation reason for this description, or {@code null} if the description does not have an inactivation indicator set + * @return the identifier of the case significance concept of this description */ - public DescriptionInactivationIndicator getInactivationIndicator() { - return inactivationIndicator; + public String getCaseSignificanceId() { + return getCaseSignificance() == null ? null : getCaseSignificance().getId(); } /** - * Returns association reference set member targets keyed by the association type. + * Returns language reference set member acceptability values for this description, keyed by language reference set identifier. * - * @return related association targets, or {@code null} if the description does not have any association targets + * @return all acceptability values from each available language refset for this description + * @deprecated - expand {@link #getAcceptabilities()} instead of relying on {@link #getAcceptabilityMap()} */ - public Multimap getAssociationTargets() { - return associationTargets; + public Map getAcceptabilityMap() { + return acceptabilityMap; } /** - * Returns association reference set member targets keyed by the association type as a {@link java.util.Map}. + * Returns language reference set member acceptability values for this description, keyed by language reference set identifier. * - * @return related association targets, or {@code null} if the description does not have any association targets + * @return all acceptability values from each available language refset for this description */ - @JsonProperty("associationTargets") - public Map> getAssociationTargetsAsMap() { - if (associationTargets == null) { - return null; - } else { - final Map> targets = Maps.newHashMapWithExpectedSize(associationTargets.size()); - associationTargets.forEach((key, value) -> { - if (!targets.containsKey(key)) { - targets.put(key, new ArrayList<>(associationTargets.get(key).size())); - } - targets.get(key).add(value); - }); - return targets; - } + public List getAcceptabilities() { + return acceptabilities; } - + @JsonIgnore public void setConceptId(final String conceptId) { setConcept(new SnomedConcept(conceptId)); @@ -282,33 +257,22 @@ public void setLanguageCode(final String languageCode) { this.languageCode = languageCode; } - public void setCaseSignificance(final CaseSignificance caseSignificance) { + public void setCaseSignificanceId(final String caseSignificanceId) { + setCaseSignificance(new SnomedConcept(caseSignificanceId)); + } + + public void setCaseSignificance(final SnomedConcept caseSignificance) { this.caseSignificance = caseSignificance; } + @Deprecated @JsonProperty("acceptability") public void setAcceptabilityMap(final Map acceptabilityMap) { this.acceptabilityMap = acceptabilityMap; } - public void setInactivationIndicator(final DescriptionInactivationIndicator descriptionInactivationIndicator) { - this.inactivationIndicator = descriptionInactivationIndicator; - } - - @JsonIgnore - public void setAssociationTargets(final Multimap associationTargets) { - this.associationTargets = associationTargets; - } - - @JsonProperty("associationTargets") - public void setAssociationTargets(final Map> associationTargets) { - if (associationTargets == null) { - this.associationTargets = null; - } else { - final ImmutableListMultimap.Builder targets = ImmutableListMultimap.builder(); - associationTargets.forEach(targets::putAll); - this.associationTargets = targets.build(); - } + public void setAcceptabilities(List acceptabilities) { + this.acceptabilities = acceptabilities; } @Override @@ -316,9 +280,8 @@ public Request toUpdateRequest() { return SnomedRequests.prepareUpdateDescription(getId()) .setAcceptability(getAcceptabilityMap()) .setActive(isActive()) - .setAssociationTargets(getAssociationTargets()) - .setCaseSignificance(getCaseSignificance()) - .setInactivationIndicator(getInactivationIndicator()) + .setInactivationProperties(getInactivationProperties()) + .setCaseSignificanceId(getCaseSignificanceId()) .setModuleId(getModuleId()) .setTypeId(getTypeId()) .setTerm(getTerm()) @@ -331,10 +294,9 @@ public Request toCreateRequest(final String conceptI return SnomedRequests.prepareNewDescription() .setActive(isActive()) .setAcceptability(getAcceptabilityMap()) - .setCaseSignificance(getCaseSignificance()) + .setCaseSignificanceId(getCaseSignificanceId()) // ensure that the description's conceptId property is the right one .setConceptId(conceptId) - .setInactivationIndicator(inactivationIndicator) // XXX assuming that the ID is always set in this case .setId(getId()) .setLanguageCode(getLanguageCode()) @@ -367,13 +329,11 @@ public String toString() { builder.append(getCaseSignificance()); builder.append(", getAcceptabilityMap()="); builder.append(getAcceptabilityMap()); - if (null != inactivationIndicator) { - builder.append(", getDescriptionInactivationIndicator()=") - .append(inactivationIndicator); + if (null != getInactivationProperties()) { + builder.append(", getInactivationProperties()=") + .append(getInactivationProperties()); } - builder.append(", getAssociationTargets()="); - builder.append(getAssociationTargets()); builder.append("]"); return builder.toString(); } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescriptions.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescriptions.java index c605921e073..c61133ff65b 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescriptions.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedDescriptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ public final class SnomedDescriptions extends PageableCollectionResource { public SnomedDescriptions(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } @JsonCreator public SnomedDescriptions( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationship.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationship.java index 1ac1857157f..2958771599d 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationship.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationship.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,6 +76,8 @@ public static final class Expand { public static final String SOURCE = "source"; public static final String TYPE = "type"; public static final String DESTINATION = "destination"; + public static final String CHARACTERISTIC_TYPE = "characteristicType"; + public static final String MODIFIER = "modifier"; } /* @@ -112,8 +114,8 @@ public static final class Fields extends SnomedCoreComponent.Fields { private boolean destinationNegated; private Integer group; private Integer unionGroup; - private CharacteristicType characteristicType; - private RelationshipModifier modifier; + private SnomedConcept characteristicType; + private SnomedConcept modifier; private SnomedConcept source; private SnomedConcept destination; private SnomedConcept type; @@ -208,10 +210,8 @@ public Integer getUnionGroup() { * Returns the characteristic type of the relationship. * * @return the relationship's characteristic type - * @deprecated - get the characteristicTypeId from {@link #getCharacteristicTypeId()} method */ - @JsonProperty - public CharacteristicType getCharacteristicType() { + public SnomedConcept getCharacteristicType() { return characteristicType; } @@ -219,17 +219,16 @@ public CharacteristicType getCharacteristicType() { * @return the characteristicType ID of the relationship */ public String getCharacteristicTypeId() { - return getCharacteristicType() == null ? null : getCharacteristicType().getConceptId(); + return getCharacteristicType() == null ? null : getCharacteristicType().getId(); } /** * Returns the relationship's modifier value. * * @return the modifier of this relationship - * @deprecated - get the modifierId from {@link #getModifierId()} method */ @JsonProperty - public RelationshipModifier getModifier() { + public SnomedConcept getModifier() { return modifier; } @@ -237,7 +236,7 @@ public RelationshipModifier getModifier() { * @return the modifierId of the relationship. */ public String getModifierId() { - return getModifier() == null ? null : getModifier().getConceptId(); + return getModifier() == null ? null : getModifier().getId(); } public void setSource(SnomedConcept source) { @@ -281,10 +280,8 @@ public void setUnionGroup(final Integer unionGroup) { /** * @param characteristicType - * @deprecated - set characteristicTypeId via {@link #setCharacteristicTypeId(String)} method */ - @JsonIgnore - public void setCharacteristicType(final CharacteristicType characteristicType) { + public void setCharacteristicType(final SnomedConcept characteristicType) { this.characteristicType = characteristicType; } @@ -292,15 +289,13 @@ public void setCharacteristicType(final CharacteristicType characteristicType) { * @param characteristicTypeId */ public void setCharacteristicTypeId(final String characteristicTypeId) { - this.characteristicType = CharacteristicType.getByConceptId(characteristicTypeId); + setCharacteristicType(new SnomedConcept(characteristicTypeId)); } /** * @param modifier - * @deprecated - set modifierId via {@link #setModifierId(String)} method */ - @JsonIgnore - public void setModifier(final RelationshipModifier modifier) { + public void setModifier(final SnomedConcept modifier) { this.modifier = modifier; } @@ -308,19 +303,19 @@ public void setModifier(final RelationshipModifier modifier) { * @param modifierId */ public void setModifierId(final String modifierId) { - this.modifier = RelationshipModifier.getByConceptId(modifierId); + setModifier(new SnomedConcept(modifierId)); } @Override public Request toCreateRequest(String containerId) { return SnomedRequests.prepareNewRelationship() .setActive(isActive()) - .setCharacteristicType(getCharacteristicType()) + .setCharacteristicTypeId(getCharacteristicTypeId()) .setDestinationId(getDestinationId()) .setDestinationNegated(isDestinationNegated()) .setGroup(getGroup()) .setId(getId()) - .setModifier(getModifier()) + .setModifierId(getModifierId()) .setModuleId(getModuleId()) .setSourceId(containerId) .setTypeId(getTypeId()) @@ -332,9 +327,9 @@ public Request toCreateRequest(String containerId) { public Request toUpdateRequest() { return SnomedRequests.prepareUpdateRelationship(getId()) .setActive(isActive()) - .setCharacteristicType(getCharacteristicType()) .setGroup(getGroup()) - .setModifier(getModifier()) + .setCharacteristicTypeId(getCharacteristicTypeId()) + .setModifierId(getModifierId()) .setModuleId(getModuleId()) .setUnionGroup(getUnionGroup()) .setTypeId(getTypeId()) diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationships.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationships.java index 7efac297648..0e356b167b4 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationships.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/SnomedRelationships.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ public final class SnomedRelationships extends PageableCollectionResource { public SnomedRelationships(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } @JsonCreator public SnomedRelationships( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/constraint/SnomedConstraints.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/constraint/SnomedConstraints.java index 6e06a896f62..7fad5658e7d 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/constraint/SnomedConstraints.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/constraint/SnomedConstraints.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,15 +26,14 @@ public final class SnomedConstraints extends PageableCollectionResource { public SnomedConstraints(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } public SnomedConstraints( List items, - String scrollId, String searchAfter, int limit, int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChange.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChange.java index 428096bbd74..8e7da29f110 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChange.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChange.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ public interface MemberChange extends Comparable, Serializable { public enum MemberChangeKind { - ADD, REMOVE + ADD, REMOVE, CHANGE } MemberChangeKind getChangeKind(); @@ -34,4 +34,9 @@ public enum MemberChangeKind { String getMemberId(); + default boolean isAdded() { + return getChangeKind() == MemberChangeKind.ADD + || getChangeKind() == MemberChangeKind.CHANGE; + } + } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChangeImpl.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChangeImpl.java index a3efd183df6..51a3361fab8 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChangeImpl.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/MemberChangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -89,5 +89,9 @@ public static MemberChange added(SnomedConcept referencedComponent) { public static MemberChange removed(SnomedConcept referencedComponent, String memberId) { return new MemberChangeImpl(MemberChangeKind.REMOVE, referencedComponent, memberId); } - + + public static MemberChange changed(SnomedConcept referencedComponent, String memberId) { + return new MemberChangeImpl(MemberChangeKind.CHANGE, referencedComponent, memberId); + } + } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedRefSetType.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedRefSetType.java index bf499a939a1..d76661d1c45 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedRefSetType.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedRefSetType.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,7 @@ public enum SnomedRefSetType { * @ordered */ COMPLEX_MAP(5, "COMPLEX_MAP", "COMPLEX_MAP"), - + /** * Description type. * @see #DESCRIPTION_TYPE_VALUE @@ -114,14 +114,18 @@ public enum SnomedRefSetType { * @see #OWL_AXIOM_VALUE * @ordered */ - OWL_AXIOM(12, "OWL_AXIOM", "OWL_AXIOM"), /** + OWL_AXIOM(12, "OWL_AXIOM", "OWL_AXIOM"), + + /** * The 'OWL ONTOLOGY' literal object. * * * @see #OWL_ONTOLOGY_VALUE * @ordered */ - OWL_ONTOLOGY(13, "OWL_ONTOLOGY", "OWL_ONTOLOGY"), /** + OWL_ONTOLOGY(13, "OWL_ONTOLOGY", "OWL_ONTOLOGY"), + + /** * The 'MRCM DOMAIN' literal object. * * @@ -164,7 +168,15 @@ public enum SnomedRefSetType { * @see #ANNOTATION_VALUE * @ordered */ - ANNOTATION(18, "ANNOTATION", "ANNOTATION"); + ANNOTATION(18, "ANNOTATION", "ANNOTATION"), + + /** + * Complex map with map block type. + * @see #COMPLEX_BLOCK_MAP_VALUE + * @ordered + */ + COMPLEX_BLOCK_MAP(19, "COMPLEX_BLOCK_MAP", "COMPLEX_BLOCK_MAP"); + /** * The 'SIMPLE' literal value. @@ -371,6 +383,20 @@ public enum SnomedRefSetType { * @ordered */ public static final int ANNOTATION_VALUE = 18; + + /** + * The 'COMPLEX_BLOCK_MAP' literal value. + * + *

    + * If the meaning of 'COMPLEX_BLOCK_MAP' literal object isn't clear, + * there really should be more of a description here... + *

    + * + * @see #COMPLEX_BLOCK_MAP + * @model + * @ordered + */ + public static final int COMPLEX_BLOCK_MAP_VALUE = 19; /** * An array of all the 'Type' enumerators. @@ -398,6 +424,7 @@ public enum SnomedRefSetType { MRCM_ATTRIBUTE_RANGE, MRCM_MODULE_SCOPE, ANNOTATION, + COMPLEX_BLOCK_MAP, }; /** @@ -457,6 +484,7 @@ public static SnomedRefSetType get(int value) { case MRCM_ATTRIBUTE_RANGE_VALUE: return MRCM_ATTRIBUTE_RANGE; case MRCM_MODULE_SCOPE_VALUE: return MRCM_MODULE_SCOPE; case ANNOTATION_VALUE: return ANNOTATION; + case COMPLEX_BLOCK_MAP_VALUE: return COMPLEX_BLOCK_MAP; } return null; } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMember.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMember.java index 56abb8474d6..a1f69ad5807 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMember.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMember.java @@ -143,6 +143,13 @@ public SnomedRefSetType type() { public SnomedCoreComponent getReferencedComponent() { return referencedComponent; } + + /** + * @return the referenced component's identifier or null if this is a partially loaded member. + */ + public String getReferencedComponentId() { + return referencedComponent == null ? null : referencedComponent.getId(); + } /** * Returns the identifier of the SNOMED CT Reference Set this SNOMED CT Reference Set Member belongs to. diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMembers.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMembers.java index 0c3e0783951..ed1e42debb0 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMembers.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSetMembers.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,16 +38,15 @@ public Set apply(SnomedReferenceSetMembers input) { }; public SnomedReferenceSetMembers(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } @JsonCreator public SnomedReferenceSetMembers( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSets.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSets.java index 2683f6b3031..ba188b9e8f4 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSets.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/domain/refset/SnomedReferenceSets.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,15 @@ public final class SnomedReferenceSets extends PageableCollectionResource { public SnomedReferenceSets(int limit, int total) { - super(Collections.emptyList(), null, null, limit, total); + super(Collections.emptyList(), null, limit, total); } @JsonCreator public SnomedReferenceSets( @JsonProperty("items") List items, - @JsonProperty("scrollId") String scrollId, @JsonProperty("searchAfter") String searchAfter, @JsonProperty("limit") int limit, @JsonProperty("total") int total) { - super(items, scrollId, searchAfter, limit, total); + super(items, searchAfter, limit, total); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/DefaultEclSerializer.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/DefaultEclSerializer.java index e937eb59e36..13af2d2ce82 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/DefaultEclSerializer.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/DefaultEclSerializer.java @@ -18,7 +18,7 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.serializer.ISerializer; -import com.b2international.snowowl.snomed.ecl.ecl.ConceptReference; +import com.b2international.snowowl.snomed.ecl.ecl.EclConceptReference; import com.b2international.snowowl.snomed.ecl.ecl.ExpressionConstraint; /** @@ -46,8 +46,8 @@ public String serializeWithoutTerms(ExpressionConstraint expression) { } private void removeTerms(EObject expression) { - if (expression instanceof ConceptReference) { - ((ConceptReference) expression).setTerm(null); + if (expression instanceof EclConceptReference) { + ((EclConceptReference) expression).setTerm(null); } else { for (EObject object : expression.eContents()) { removeTerms(object); diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclEvaluationRequest.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclEvaluationRequest.java index 54589902420..bd2f87a0791 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclEvaluationRequest.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclEvaluationRequest.java @@ -110,10 +110,10 @@ protected Promise eval(BranchContext context, Any any) { } /** - * Handles ConceptReference/Self simple expression constraints + * Handles EclConceptReference/Self simple expression constraints * @see https://confluence.ihtsdotools.org/display/DOCECL/6.1+Simple+Expression+Constraints */ - protected Promise eval(BranchContext context, ConceptReference concept) { + protected Promise eval(BranchContext context, EclConceptReference concept) { return Promise.immediate(id(concept.getId())); } @@ -123,8 +123,8 @@ protected Promise eval(BranchContext context, ConceptReference conce */ protected Promise eval(BranchContext context, MemberOf memberOf) { final ExpressionConstraint inner = memberOf.getConstraint(); - if (inner instanceof ConceptReference) { - final ConceptReference concept = (ConceptReference) inner; + if (inner instanceof EclConceptReference) { + final EclConceptReference concept = (EclConceptReference) inner; return Promise.immediate(activeMemberOf(concept.getId())); } else if (inner instanceof Any) { return Promise.immediate(Expressions.exists(ACTIVE_MEMBER_OF)); diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRefinementEvaluator.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRefinementEvaluator.java index d9770966107..545f08609dd 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRefinementEvaluator.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRefinementEvaluator.java @@ -100,11 +100,11 @@ public SnomedEclRefinementEvaluator(EclExpression focusConcepts) { this.expressionForm = focusConcepts.getExpressionForm(); } - public Promise evaluate(BranchContext context, Refinement refinement) { + public Promise evaluate(BranchContext context, EclRefinement refinement) { return refinementDispatcher.invoke(context, refinement); } - protected Promise eval(BranchContext context, Refinement refinement) { + protected Promise eval(BranchContext context, EclRefinement refinement) { return SnomedEclEvaluationRequest.throwUnsupported(refinement); } @@ -175,7 +175,7 @@ protected Promise eval(final BranchContext context, NestedRefinement * Handles evaluation of attribute refinements with groups * @see https://confluence.ihtsdotools.org/display/DOCECL/6.2+Refinements */ - protected Promise eval(final BranchContext context, AttributeGroup group) { + protected Promise eval(final BranchContext context, EclAttributeGroup group) { final Cardinality cardinality = group.getCardinality(); final boolean isUnbounded = cardinality == null ? true : cardinality.getMax() == UNBOUNDED_CARDINALITY; final long min = cardinality == null ? 1 : cardinality.getMin(); @@ -205,11 +205,11 @@ protected Promise eval(final BranchContext context, AttributeGroup g /** * Evaluates refinement parts inside attribute group based refinements. */ - protected Promise> evaluateGroup(BranchContext context, Range groupCardinality, Refinement refinement) { + protected Promise> evaluateGroup(BranchContext context, Range groupCardinality, EclRefinement refinement) { return groupRefinementDispatcher.invoke(context, groupCardinality, refinement); } - protected Promise> evalGroup(final BranchContext context, final Range groupCardinality, final Refinement refinement) { + protected Promise> evalGroup(final BranchContext context, final Range groupCardinality, final EclRefinement refinement) { return SnomedEclEvaluationRequest.throwUnsupported(refinement); } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRewriter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRewriter.java index 039d9b7be1b..bc15e038c38 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRewriter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ecl/SnomedEclRewriter.java @@ -22,7 +22,6 @@ import com.b2international.snowowl.snomed.ecl.ecl.AndExpressionConstraint; import com.b2international.snowowl.snomed.ecl.ecl.AndRefinement; import com.b2international.snowowl.snomed.ecl.ecl.AttributeConstraint; -import com.b2international.snowowl.snomed.ecl.ecl.AttributeGroup; import com.b2international.snowowl.snomed.ecl.ecl.AttributeValueEquals; import com.b2international.snowowl.snomed.ecl.ecl.AttributeValueNotEquals; import com.b2international.snowowl.snomed.ecl.ecl.ChildOf; @@ -30,7 +29,9 @@ import com.b2international.snowowl.snomed.ecl.ecl.DescendantOf; import com.b2international.snowowl.snomed.ecl.ecl.DescendantOrSelfOf; import com.b2international.snowowl.snomed.ecl.ecl.DottedExpressionConstraint; +import com.b2international.snowowl.snomed.ecl.ecl.EclAttributeGroup; import com.b2international.snowowl.snomed.ecl.ecl.EclFactory; +import com.b2international.snowowl.snomed.ecl.ecl.EclRefinement; import com.b2international.snowowl.snomed.ecl.ecl.ExclusionExpressionConstraint; import com.b2international.snowowl.snomed.ecl.ecl.ExpressionConstraint; import com.b2international.snowowl.snomed.ecl.ecl.MemberOf; @@ -40,7 +41,6 @@ import com.b2international.snowowl.snomed.ecl.ecl.OrRefinement; import com.b2international.snowowl.snomed.ecl.ecl.ParentOf; import com.b2international.snowowl.snomed.ecl.ecl.RefinedExpressionConstraint; -import com.b2international.snowowl.snomed.ecl.ecl.Refinement; /** * @since 5.4 @@ -56,8 +56,8 @@ public class SnomedEclRewriter { public T rewrite(T eclObject) { if (eclObject instanceof ExpressionConstraint) { return (T) rewriteExpression((ExpressionConstraint) eclObject); - } else if (eclObject instanceof Refinement) { - return (T) rewriteRefinement((Refinement) eclObject); + } else if (eclObject instanceof EclRefinement) { + return (T) rewriteRefinement((EclRefinement) eclObject); } else if (eclObject instanceof Comparison) { return (T) rewriteComparison((Comparison) eclObject); } else { @@ -170,44 +170,44 @@ private ExpressionConstraint rewriteExpression(NestedExpression it) { // REFINEMENT hierarchy - private Refinement rewriteRefinement(Refinement it) { + private EclRefinement rewriteRefinement(EclRefinement it) { if (it instanceof AndRefinement) { return rewriteRefinement((AndRefinement) it); } else if (it instanceof OrRefinement) { return rewriteRefinement((OrRefinement) it); } else if (it instanceof NestedRefinement) { return rewriteRefinement((NestedRefinement) it); - } else if (it instanceof AttributeGroup) { - return rewriteRefinement((AttributeGroup) it); + } else if (it instanceof EclAttributeGroup) { + return rewriteRefinement((EclAttributeGroup) it); } else if (it instanceof AttributeConstraint) { return rewriteRefinement((AttributeConstraint) it); } return it; } - private Refinement rewriteRefinement(AndRefinement it) { + private EclRefinement rewriteRefinement(AndRefinement it) { it.setLeft(rewrite(it.getLeft())); it.setRight(rewrite(it.getRight())); return it; } - private Refinement rewriteRefinement(OrRefinement it) { + private EclRefinement rewriteRefinement(OrRefinement it) { it.setLeft(rewrite(it.getLeft())); it.setRight(rewrite(it.getRight())); return it; } - private Refinement rewriteRefinement(NestedRefinement it) { + private EclRefinement rewriteRefinement(NestedRefinement it) { it.setNested(rewrite(it.getNested())); return it; } - private Refinement rewriteRefinement(AttributeGroup it) { + private EclRefinement rewriteRefinement(EclAttributeGroup it) { it.setRefinement(rewriteRefinement(it.getRefinement())); return it; } - private Refinement rewriteRefinement(AttributeConstraint it) { + private EclRefinement rewriteRefinement(AttributeConstraint it) { it.setComparison(rewrite(it.getComparison())); return it; } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmCommand.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmCommand.java index b30b558252b..deee72f51d4 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmCommand.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/mrcm/io/MrcmCommand.java @@ -1,5 +1,5 @@ /* - * Copyright 2018-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2018-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,6 @@ import com.b2international.commons.extension.Component; import com.b2international.snowowl.core.ApplicationContext; import com.b2international.snowowl.core.console.Command; -import com.b2international.snowowl.core.console.CommandLineAuthenticator; import com.b2international.snowowl.core.console.CommandLineStream; import com.b2international.snowowl.core.date.Dates; import com.b2international.snowowl.identity.domain.Permission; @@ -74,9 +73,9 @@ private static final class ImportCommand extends Command { @Override public void run(CommandLineStream out) { - final User user = out.authenticate(); + final User user = out.authenticate(getBus()); - if (!user.hasPermission(new Permission(Permission.IMPORT, SnomedDatastoreActivator.REPOSITORY_UUID, ""))) { + if (user == null || !user.hasPermission(new Permission(Permission.IMPORT, SnomedDatastoreActivator.REPOSITORY_UUID, ""))) { out.println("User is unauthorized to import MRCM rules."); return; } @@ -106,14 +105,9 @@ private static final class ExportCommand extends Command { @Override public void run(CommandLineStream out) { - final CommandLineAuthenticator authenticator = new CommandLineAuthenticator(); + final User user = out.authenticate(getBus()); - if (!authenticator.authenticate(out)) { - return; - } - - final User user = authenticator.getUser(); - if (!user.hasPermission(new Permission(Permission.EXPORT, SnomedDatastoreActivator.REPOSITORY_UUID, ""))) { + if (user == null || !user.hasPermission(new Permission(Permission.EXPORT, SnomedDatastoreActivator.REPOSITORY_UUID, ""))) { out.println("User is unauthorized to export MRCM rules."); return; } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ql/SnomedQueryEvaluationRequest.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ql/SnomedQueryEvaluationRequest.java index 1e8a9c123f0..0845bcb6403 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ql/SnomedQueryEvaluationRequest.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/ql/SnomedQueryEvaluationRequest.java @@ -254,7 +254,7 @@ protected Promise eval(BranchContext context, final LanguageCodeFilt return Promise.immediate(SnomedDescriptionIndexEntry.Expressions.languageCode(languageCodeFilter.getLanguageCode())); } - protected Promise eval(BranchContext context, final Conjunction conjunction) { + protected Promise eval(BranchContext context, final ConjunctionFilter conjunction) { return Promise.all(evaluate(context, conjunction.getLeft()), evaluate(context, conjunction.getRight())) .then(results -> { Expression left = (Expression) results.get(0); @@ -266,7 +266,7 @@ protected Promise eval(BranchContext context, final Conjunction conj }); } - protected Promise eval(BranchContext context, final Disjunction disjunction) { + protected Promise eval(BranchContext context, final DisjunctionFilter disjunction) { return Promise.all(evaluate(context, disjunction.getLeft()), evaluate(context, disjunction.getRight())) .then(results -> { Expression left = (Expression) results.get(0); @@ -278,7 +278,7 @@ protected Promise eval(BranchContext context, final Disjunction disj }); } - protected Promise eval(BranchContext context, final Exclusion exclusion) { + protected Promise eval(BranchContext context, final ExclusionFilter exclusion) { return Promise.all(evaluate(context, exclusion.getLeft()), evaluate(context, exclusion.getRight())) .then(results -> { Expression left = (Expression) results.get(0); diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComplexBlockMapReferenceSetMemberBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComplexBlockMapReferenceSetMemberBuilder.java new file mode 100644 index 00000000000..aeaa1b5eb7e --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComplexBlockMapReferenceSetMemberBuilder.java @@ -0,0 +1,96 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.core.store; + +import com.b2international.snowowl.core.domain.TransactionContext; +import com.b2international.snowowl.snomed.common.SnomedRf2Headers; +import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry; + +/** + * @since 7.4 + */ +public final class SnomedComplexBlockMapReferenceSetMemberBuilder extends SnomedMemberBuilder { + + private String mapTargetId; + private String mapTargetDescription; + private String mapRule; + private String mapAdvice; + private int group = 1; + private int priority = 1; + private String correlationId; + private String mapCategoryId; + private int block = 1; + + public SnomedComplexBlockMapReferenceSetMemberBuilder withMapTargetId(String mapTargetId) { + this.mapTargetId = mapTargetId; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withMapTargetDescription(String mapTargetDescription) { + this.mapTargetDescription = mapTargetDescription; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withMapRule(String mapRule) { + this.mapRule = mapRule; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withMapAdvice(String mapAdvice) { + this.mapAdvice = mapAdvice; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withGroup(int group) { + this.group = group; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withPriority(int priority) { + this.priority = priority; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withCorrelationId(String correlationId) { + this.correlationId = correlationId; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withMapCategoryId(String mapCategoryId) { + this.mapCategoryId = mapCategoryId; + return getSelf(); + } + + public SnomedComplexBlockMapReferenceSetMemberBuilder withBlock(int block) { + this.block = block; + return getSelf(); + } + + @Override + public void init(SnomedRefSetMemberIndexEntry.Builder component, TransactionContext context) { + super.init(component, context); + component + .field(SnomedRf2Headers.FIELD_MAP_TARGET, mapTargetId) + .field(SnomedRf2Headers.FIELD_MAP_TARGET_DESCRIPTION, mapTargetDescription) + .field(SnomedRf2Headers.FIELD_MAP_RULE, mapRule) + .field(SnomedRf2Headers.FIELD_MAP_ADVICE, mapAdvice) + .field(SnomedRf2Headers.FIELD_MAP_GROUP, group) + .field(SnomedRf2Headers.FIELD_MAP_PRIORITY, priority) + .field(SnomedRf2Headers.FIELD_CORRELATION_ID, correlationId) + .field(SnomedRf2Headers.FIELD_MAP_CATEGORY_ID, mapCategoryId) + .field(SnomedRf2Headers.FIELD_MAP_BLOCK, block); + } +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComponents.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComponents.java index 40bbf87bed1..00d518f9cb9 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComponents.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedComponents.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -183,4 +183,13 @@ public static SnomedMRCMAttributeRangeReferenceSetMemberBuilder newMRCMAttribute public static SnomedMRCMModuleScopeReferenceSetMemberBuilder newMRCMModuleScopeReferenceSetMember() { return new SnomedMRCMModuleScopeReferenceSetMemberBuilder(); } + + /** + * Creates and returns a new {@link SnomedComplexBlockMapReferenceSetMemberBuilder SNOMED CT Complex Block Map Reference set member builder}. + * + * @return + */ + public static SnomedComplexBlockMapReferenceSetMemberBuilder newComplexBlockMapMember() { + return new SnomedComplexBlockMapReferenceSetMemberBuilder(); + } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConceptBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConceptBuilder.java index b9d7559d816..567d4e8a317 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConceptBuilder.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConceptBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package com.b2international.snowowl.snomed.core.store; import com.b2international.snowowl.core.domain.TransactionContext; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument; /** @@ -24,7 +24,7 @@ */ public final class SnomedConceptBuilder extends SnomedComponentBuilder { - private DefinitionStatus definitionStatus = DefinitionStatus.PRIMITIVE; + private String definitionStatusId = Concepts.PRIMITIVE; private boolean exhaustive = false; /** @@ -41,12 +41,12 @@ public final SnomedConceptBuilder withExhaustive(boolean exhaustive) { /** * Specifies the {@link DefinitionStatus} to use for the new concept. * - * @param definitionStatus - * - the definition status to use + * @param definitionStatusId + * - the definition status ID to use * @return */ - public final SnomedConceptBuilder withDefinitionStatus(DefinitionStatus definitionStatus) { - this.definitionStatus = definitionStatus; + public final SnomedConceptBuilder withDefinitionStatusId(String definitionStatusId) { + this.definitionStatusId = definitionStatusId; return getSelf(); } @@ -59,8 +59,8 @@ protected SnomedConceptDocument.Builder create() { public void init(SnomedConceptDocument.Builder component, TransactionContext context) { super.init(component, context); // check that the definitionStatus concept does exist before using it in this concept - context.lookup(definitionStatus.getConceptId(), SnomedConceptDocument.class); - component.primitive(definitionStatus.isPrimitive()); + context.lookup(definitionStatusId, SnomedConceptDocument.class); + component.primitive(Concepts.PRIMITIVE.equals(definitionStatusId)); component.exhaustive(exhaustive); } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConcreteDomainReferenceSetMemberBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConcreteDomainReferenceSetMemberBuilder.java index cb159e7cf24..10d71b83636 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConcreteDomainReferenceSetMemberBuilder.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedConcreteDomainReferenceSetMemberBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package com.b2international.snowowl.snomed.core.store; import com.b2international.snowowl.core.domain.TransactionContext; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry; /** @@ -28,7 +28,7 @@ public final class SnomedConcreteDomainReferenceSetMemberBuilder extends SnomedM private int group; private String typeId; private String serializedValue; - private CharacteristicType characteristicType = CharacteristicType.STATED_RELATIONSHIP; + private String characteristicTypeId = Concepts.STATED_RELATIONSHIP; public SnomedConcreteDomainReferenceSetMemberBuilder withGroup(int group) { this.group = group; @@ -45,8 +45,8 @@ public SnomedConcreteDomainReferenceSetMemberBuilder withSerializedValue(String return getSelf(); } - public SnomedConcreteDomainReferenceSetMemberBuilder withCharacteristicType(CharacteristicType characteristicType) { - this.characteristicType = characteristicType; + public SnomedConcreteDomainReferenceSetMemberBuilder withCharacteristicTypeId(String characteristicTypeId) { + this.characteristicTypeId = characteristicTypeId; return getSelf(); } @@ -57,7 +57,7 @@ public void init(SnomedRefSetMemberIndexEntry.Builder component, TransactionCont .field(SnomedRf2Headers.FIELD_RELATIONSHIP_GROUP, group) .field(SnomedRf2Headers.FIELD_TYPE_ID, typeId) .field(SnomedRf2Headers.FIELD_VALUE, serializedValue) - .field(SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID, characteristicType.getConceptId()); + .field(SnomedRf2Headers.FIELD_CHARACTERISTIC_TYPE_ID, characteristicTypeId); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedDescriptionBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedDescriptionBuilder.java index e3da29c31b0..4cf7b08c7c6 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedDescriptionBuilder.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedDescriptionBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package com.b2international.snowowl.snomed.core.store; import com.b2international.snowowl.core.domain.TransactionContext; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry; @@ -25,7 +25,7 @@ */ public final class SnomedDescriptionBuilder extends SnomedComponentBuilder { - private CaseSignificance caseSignificance = CaseSignificance.INITIAL_CHARACTER_CASE_INSENSITIVE; + private String caseSignificanceId = Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE; private String type; private String term; private String languageCode = "en"; @@ -45,11 +45,11 @@ public SnomedDescriptionBuilder withType(String type) { /** * Specifies the case significance of the new SNOMED CT Description. * - * @param caseSignificance + * @param caseSignificanceId * @return */ - public SnomedDescriptionBuilder withCaseSignificance(CaseSignificance caseSignificance) { - this.caseSignificance = caseSignificance; + public SnomedDescriptionBuilder withCaseSignificanceId(String caseSignificanceId) { + this.caseSignificanceId = caseSignificanceId; return getSelf(); } @@ -89,7 +89,7 @@ public SnomedDescriptionBuilder withConcept(String concept) { @Override public void init(SnomedDescriptionIndexEntry.Builder component, TransactionContext context) { super.init(component, context); - component.caseSignificanceId(context.lookup(caseSignificance.getConceptId(), SnomedConceptDocument.class).getId()); + component.caseSignificanceId(context.lookup(caseSignificanceId, SnomedConceptDocument.class).getId()); component.typeId(context.lookup(type, SnomedConceptDocument.class).getId()); component.term(term); component.languageCode(languageCode); diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedRelationshipBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedRelationshipBuilder.java index 6da78f1a4eb..3d5c20b6df2 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedRelationshipBuilder.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/core/store/SnomedRelationshipBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,6 @@ import com.b2international.snowowl.core.domain.TransactionContext; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry; @@ -27,8 +25,8 @@ */ public final class SnomedRelationshipBuilder extends SnomedComponentBuilder { - private CharacteristicType characteristicType = CharacteristicType.STATED_RELATIONSHIP; - private RelationshipModifier modifier = RelationshipModifier.EXISTENTIAL; + private String characteristicTypeId = Concepts.STATED_RELATIONSHIP; + private String modifierId = Concepts.EXISTENTIAL_RESTRICTION_MODIFIER; private String type; private String source; private String destination; @@ -39,24 +37,24 @@ public final class SnomedRelationshipBuilder extends SnomedComponentBuilderAvailable values: - *
      - *
    • {@link #ENTIRE_TERM_CASE_SENSITIVE Case sensitive}
    • - *
    • {@link #ENTIRE_TERM_CASE_INSENSITIVE Case insensitive}
    • - *
    • {@link #ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE Initial character case insensitive}
    • - *
    - *

    - */ -public enum CaseSignificance { - - /** - * Case sensitive. Concept ID: {@code 900000000000017005}. - *

    - * The text of the Description.term must be presented in the case in which it is specified. - * @see CaseSignificance - */ - ENTIRE_TERM_CASE_SENSITIVE("Case sensitive", Concepts.ENTIRE_TERM_CASE_SENSITIVE), - - /** - * Case insensitive. Concept ID: {@code 900000000000448009}. - *

    - * The entire Description.term is case insensitive and can be can be changed from upper to lower case - * (or vice-versa) if appropriate to the context in which it is used. - * @see CaseSignificance - */ - ENTIRE_TERM_CASE_INSENSITIVE("Case insensitive", Concepts.ENTIRE_TERM_CASE_INSENSITIVE), - - /** - * Initial character case insensitive. Concept ID: {@code 900000000000020002}. - *

    - * The initial character of the Description.term is case insensitive and can be changed - * from upper to lower case (or vice-versa) if appropriate to the context in which it is used. - * @see CaseSignificance - */ - ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE("Initial character case insensitive", Concepts.ONLY_INITIAL_CHARACTER_CASE_INSENSITIVE); - - private final String name; - private final String id; - - private CaseSignificance(final String name, final String id) { - this.name = name; - this.id = id; - } - - /** - * Returns with the associated metadata concept ID. - * @return the unique identifier of the case significance metadata concept. - */ - public String getId() { - return id; - } - - /** - * Returns with the human readable name of the case significance enumeration. - * @return the name of the case significance. - */ - public String getName() { - return name; - } - - /* - * (non-Javadoc) - * @see java.lang.Enum#toString() - */ - @Override - public String toString() { - return name; - } - - /** - * Returns with the proper case significance instance identified by the specified SNOMED CT ID. - * @param conceptId the case significance concept ID. - * @return the case significance enumeration. - */ - public static CaseSignificance getById(final String conceptId) { - Preconditions.checkNotNull(conceptId, "Case significance metadata concept ID argument cannot be null."); - for (CaseSignificance caseSignificance : values()) { - if (conceptId.equals(caseSignificance.getId())) { - return caseSignificance; - } - } - throw new IllegalArgumentException("Case significance metadata does not exists for ID: " + conceptId); - } - - /** - * Returns with the proper case significance instance identified by the specified SNOMED CT ID. - * @param conceptId the case significance concept ID. - * @return the case significance enumeration. - */ - public static CaseSignificance getById(final long conceptId) { - return getById(String.valueOf(conceptId)); - } - - /** - * Returns with the proper case significance instance based on the specified description index entry's case significance concept. - * @param description SNOMED CT description index entry. - * @return the case significance enumeration. - */ - public static CaseSignificance getForDescriptionIndexEntry(final SnomedDescriptionIndexEntry description) { - return getById(description.getCaseSignificanceId()); - } -} \ No newline at end of file diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/SnomedRefSetUtil.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/SnomedRefSetUtil.java index c07f3cac6f2..cdba5305e91 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/SnomedRefSetUtil.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/SnomedRefSetUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,10 +15,7 @@ */ package com.b2international.snowowl.snomed.datastore; -import static com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType.COMPLEX_MAP; -import static com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType.EXTENDED_MAP; -import static com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType.SIMPLE_MAP; -import static com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType.SIMPLE_MAP_WITH_DESCRIPTION; +import static com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType.*; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static java.util.stream.Collectors.collectingAndThen; @@ -100,6 +97,7 @@ public static final BiMap getConcreteDomainRefSetMap() { SnomedRefSetType.SIMPLE_MAP, SnomedRefSetType.SIMPLE_MAP_WITH_DESCRIPTION, SnomedRefSetType.COMPLEX_MAP, + SnomedRefSetType.COMPLEX_BLOCK_MAP, SnomedRefSetType.EXTENDED_MAP) .putAll(SnomedRF2Folder.METADATA, SnomedRefSetType.MRCM_DOMAIN, @@ -187,6 +185,8 @@ public static SnomedRefSetType getByConceptId(String conceptId) { return SnomedRefSetType.SIMPLE; case Concepts.REFSET_COMPLEX_MAP_TYPE: return SnomedRefSetType.COMPLEX_MAP; + case Concepts.REFSET_COMPLEX_BLOCK_MAP_TYPE: + return SnomedRefSetType.COMPLEX_BLOCK_MAP; case Concepts.EXTENDED_MAP_TYPE: return SnomedRefSetType.EXTENDED_MAP; case Concepts.REFSET_DESCRIPTION_TYPE: @@ -218,7 +218,9 @@ public static SnomedRefSetType getByConceptId(String conceptId) { * @return {@code true} if the reference set type is complex or extended map type, otherwise returns with {@code false}. */ public static boolean isComplexMapping(final SnomedRefSetType type) { - return COMPLEX_MAP.equals(type) || EXTENDED_MAP.equals(type); + return COMPLEX_MAP.equals(type) + || COMPLEX_BLOCK_MAP.equals(type) + || EXTENDED_MAP.equals(type); } /** @@ -230,6 +232,7 @@ public static boolean isMapping(final SnomedRefSetType type) { return SIMPLE_MAP.equals(type) || SIMPLE_MAP_WITH_DESCRIPTION.equals(type) || COMPLEX_MAP.equals(type) + || COMPLEX_BLOCK_MAP.equals(type) || EXTENDED_MAP.equals(type); } @@ -249,6 +252,7 @@ public static String getTypeLabel(SnomedRefSetType type) { case SIMPLE_MAP_WITH_DESCRIPTION: return "Simple map type with map target description"; case SIMPLE: return "Simple type reference set"; case COMPLEX_MAP: return "Complex map type reference set"; + case COMPLEX_BLOCK_MAP: return "Complex map with map block type reference set"; case EXTENDED_MAP: return "Extended map type reference set"; case DESCRIPTION_TYPE: return "Description type reference set"; case ASSOCIATION: return "Association type reference set"; @@ -288,6 +292,8 @@ public static String getParentConceptId(SnomedRefSetType type) { return Concepts.REFSET_SIMPLE_TYPE; case COMPLEX_MAP: return Concepts.REFSET_COMPLEX_MAP_TYPE; + case COMPLEX_BLOCK_MAP: + return Concepts.REFSET_COMPLEX_BLOCK_MAP_TYPE; case DESCRIPTION_TYPE: return Concepts.REFSET_DESCRIPTION_TYPE; case CONCRETE_DATA_TYPE: diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationExpander.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationExpander.java deleted file mode 100644 index 783ec2a8212..00000000000 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationExpander.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2011-2016 B2i Healthcare Pte Ltd, http://b2i.sg - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.b2international.snowowl.snomed.datastore.converter; - -import static com.google.common.collect.Lists.newArrayList; - -import java.util.Collection; -import java.util.List; -import java.util.Set; - -import com.b2international.snowowl.core.domain.BranchContext; -import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.AssociationType; -import com.b2international.snowowl.snomed.core.domain.SnomedComponent; -import com.b2international.snowowl.snomed.core.domain.SnomedCoreComponent; -import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; -import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; -import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; -import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; -import com.google.common.base.Function; -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Multimap; -import com.google.common.collect.Multimaps; - -public abstract class InactivationExpander { - - private BranchContext context; - private String inactivationIndicatorId; - - public InactivationExpander(BranchContext context, String inactivationIndicatorId) { - this.context = context; - this.inactivationIndicatorId = inactivationIndicatorId; - } - - void expand(List results, Set componentIds) { - - if (componentIds.isEmpty()) { - return; - } - - final List refSetIds = newArrayList(); - for (final AssociationType associationType : AssociationType.values()) { - refSetIds.add(associationType.getConceptId()); - } - - refSetIds.add(inactivationIndicatorId); - - final SnomedReferenceSetMembers members = SnomedRequests.prepareSearchMember() - .all() - .filterByRefSet(refSetIds) - .filterByReferencedComponent(componentIds) - .filterByActive(true) - .build() - .execute(context); - - if (members.getItems().isEmpty()) { - return; - } - - final Multimap membersByReferencedComponentId = Multimaps.index(members, new Function() { - @Override - public String apply(SnomedReferenceSetMember input) { - return input.getReferencedComponent().getId(); - } - }); - - for (T result : results) { - final Collection referringMembers = membersByReferencedComponentId.get(result.getId()); - final List associationMembers = newArrayList(); - final List inactivationMembers = newArrayList(); - - for (SnomedReferenceSetMember referringMember : referringMembers) { - if (SnomedRefSetType.ASSOCIATION.equals(referringMember.type())) { - associationMembers.add(referringMember); - } else if (SnomedRefSetType.ATTRIBUTE_VALUE.equals(referringMember.type())) { - inactivationMembers.add(referringMember); - } - } - - if (!inactivationMembers.isEmpty()) { - final String valueId = (String) Iterables.getFirst(inactivationMembers, null).getProperties().get(SnomedRf2Headers.FIELD_VALUE_ID); - setInactivationIndicator(result, valueId); - } - - Multimap associationTargets = HashMultimap.create(); - for (SnomedReferenceSetMember associationMember : associationMembers) { - AssociationType type = AssociationType.getByConceptId(associationMember.getReferenceSetId()); - final SnomedCoreComponent target = (SnomedCoreComponent) associationMember.getProperties().get(SnomedRf2Headers.FIELD_TARGET_COMPONENT); - associationTargets.put(type, target.getId()); - } - - if (!associationTargets.isEmpty()) { - setAssociationTargets(result, associationTargets); - } - } - } - - protected abstract void setInactivationIndicator(T result, final String valueId); - - protected abstract void setAssociationTargets(T result, Multimap associationTargets); -} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationPropertiesExpander.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationPropertiesExpander.java new file mode 100644 index 00000000000..b0b84d46dcf --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/InactivationPropertiesExpander.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.datastore.converter; + +import java.util.Collection; +import java.util.List; +import java.util.Set; + +import com.b2international.commons.http.ExtendedLocale; +import com.b2international.commons.options.Options; +import com.b2international.snowowl.core.domain.BranchContext; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; +import com.b2international.snowowl.snomed.common.SnomedRf2Headers; +import com.b2international.snowowl.snomed.core.domain.AssociationTarget; +import com.b2international.snowowl.snomed.core.domain.InactivationProperties; +import com.b2international.snowowl.snomed.core.domain.SnomedCoreComponent; +import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; +import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; +import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMembers; +import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Iterables; +import com.google.common.collect.Multimap; +import com.google.common.collect.Multimaps; +import com.google.common.collect.Sets; + +/** + * @since 7.4 + * @param + */ +public final class InactivationPropertiesExpander { + + private final BranchContext context; + private final Options expand; + private final List locales; + private final String inactivationIndicatorRefSetId; + + public InactivationPropertiesExpander(BranchContext context, Options expand, List locales, String inactivationIndicatorRefSetId) { + this.context = context; + this.expand = expand; + this.locales = locales; + this.inactivationIndicatorRefSetId = inactivationIndicatorRefSetId; + } + + void expand(List results, Set referencedComponentIds) { + if (!expand.containsKey(SnomedCoreComponent.Expand.INACTIVATION_PROPERTIES)) { + return; + } + + final SnomedReferenceSetMembers members = SnomedRequests.prepareSearchMember() + .all() + .filterByActive(true) + // all association type refsets and the indicator + .filterByRefSet(String.format("<%s OR %s", Concepts.REFSET_ASSOCIATION_TYPE, inactivationIndicatorRefSetId)) + .filterByReferencedComponent(referencedComponentIds) + .build() + .execute(context); + + final Multimap membersByReferencedComponentId = Multimaps.index(members, SnomedReferenceSetMember::getReferencedComponentId); + + for (SnomedCoreComponent result : results) { + final Collection referringMembers = membersByReferencedComponentId.get(result.getId()); + final ImmutableList.Builder associationTargets = ImmutableList.builder(); + final Set inactivationIndicatorIds = Sets.newHashSet(); + + for (SnomedReferenceSetMember referringMember : referringMembers) { + if (SnomedRefSetType.ASSOCIATION.equals(referringMember.type())) { + final AssociationTarget associationTarget = new AssociationTarget(); + associationTarget.setReferenceSetId(referringMember.getReferenceSetId()); + associationTarget.setTargetComponent((SnomedCoreComponent) referringMember.getProperties().get(SnomedRf2Headers.FIELD_TARGET_COMPONENT)); + associationTargets.add(associationTarget); + } else if (SnomedRefSetType.ATTRIBUTE_VALUE.equals(referringMember.type())) { + inactivationIndicatorIds.add((String) referringMember.getProperties().get(SnomedRf2Headers.FIELD_VALUE_ID)); + } + } + + InactivationProperties inactivationProperties = new InactivationProperties(); + inactivationProperties.setInactivationIndicatorId(Iterables.getFirst(inactivationIndicatorIds, null)); + inactivationProperties.setAssociationTargets(associationTargets.build()); + result.setInactivationProperties(inactivationProperties); + } + + // TODO further expand the inactivationProperties nested properties if requested + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/MembersExpander.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/MembersExpander.java index b50b457acea..ad76a9fd675 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/MembersExpander.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/MembersExpander.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ void expand(List results, Set componentId for (SnomedCoreComponent component : results) { final Collection members = membersByReferencedComponentId.get(component.getId()); - ((SnomedCoreComponent) component).setMembers(new SnomedReferenceSetMembers(ImmutableList.copyOf(members), null, null, members.size(), members.size())); + ((SnomedCoreComponent) component).setMembers(new SnomedReferenceSetMembers(ImmutableList.copyOf(members), null, members.size(), members.size())); } } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/ModuleExpander.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/ModuleExpander.java new file mode 100644 index 00000000000..1b25f833c74 --- /dev/null +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/ModuleExpander.java @@ -0,0 +1,67 @@ +/* + * Copyright 2020 B2i Healthcare Pte Ltd, http://b2i.sg + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.b2international.snowowl.snomed.datastore.converter; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import com.b2international.commons.http.ExtendedLocale; +import com.b2international.commons.options.Options; +import com.b2international.snowowl.core.domain.BranchContext; +import com.b2international.snowowl.snomed.core.domain.SnomedComponent; +import com.b2international.snowowl.snomed.core.domain.SnomedConcept; +import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; + +/** + * @since 7.4 + */ +final class ModuleExpander { + + private final BranchContext context; + private final Options expand; + private final List locales; + + public ModuleExpander(BranchContext context, Options expand, List locales) { + this.context = context; + this.expand = expand; + this.locales = locales; + } + + void expand(List results) { + if (expand.containsKey(SnomedComponent.Expand.MODULE)) { + final Options moduleOptions = expand.get(SnomedComponent.Expand.MODULE, Options.class); + + final Set moduleIds = results.stream().map(SnomedComponent::getModuleId).collect(Collectors.toSet()); + + final Map modulesById = SnomedRequests.prepareSearchConcept() + .all() + .filterByIds(moduleIds) + .setExpand(moduleOptions.getOptions("expand")) + .setLocales(locales) + .build() + .execute(context) + .stream() + .collect(Collectors.toMap(SnomedConcept::getId, c -> c)); + + for (SnomedComponent component : results) { + component.setModule(modulesById.get(component.getModuleId())); + } + } + } + +} diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConceptConverter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConceptConverter.java index e5ed195c139..aed73d99c71 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConceptConverter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConceptConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.b2international.snowowl.snomed.datastore.converter; -import static com.b2international.snowowl.core.domain.IComponent.ID_FUNCTION; import static com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument.Expressions.ancestors; import static com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument.Expressions.parents; import static com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument.Expressions.statedAncestors; @@ -47,17 +46,7 @@ import com.b2international.snowowl.core.domain.IComponent; import com.b2international.snowowl.datastore.request.BaseRevisionResourceConverter; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.AssociationType; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; -import com.b2international.snowowl.snomed.core.domain.InactivationIndicator; -import com.b2international.snowowl.snomed.core.domain.SnomedConcept; -import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; -import com.b2international.snowowl.snomed.core.domain.SnomedDescription; -import com.b2international.snowowl.snomed.core.domain.SnomedDescriptions; -import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; -import com.b2international.snowowl.snomed.core.domain.SnomedRelationships; -import com.b2international.snowowl.snomed.core.domain.SubclassDefinitionStatus; +import com.b2international.snowowl.snomed.core.domain.*; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSet; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument; import com.b2international.snowowl.snomed.datastore.request.DescriptionRequestHelper; @@ -92,15 +81,15 @@ private SnomedReferenceSetConverter getReferenceSetConverter() { } @Override - protected SnomedConcepts createCollectionResource(List results, String scrollId, String searchAfter, int limit, int total) { - return new SnomedConcepts(results, scrollId, searchAfter, limit, total); + protected SnomedConcepts createCollectionResource(List results, String searchAfter, int limit, int total) { + return new SnomedConcepts(results, searchAfter, limit, total); } @Override protected SnomedConcept toResource(final SnomedConceptDocument input) { final SnomedConcept result = new SnomedConcept(); result.setActive(input.isActive()); - result.setDefinitionStatus(toDefinitionStatus(input.isPrimitive())); + result.setDefinitionStatusId(toDefinitionStatus(input.isPrimitive())); result.setEffectiveTime(toEffectiveTime(input.getEffectiveTime())); result.setId(input.getId()); result.setModuleId(input.getModuleId()); @@ -139,7 +128,7 @@ protected SnomedConcept toResource(final SnomedConceptDocument input) { preferredDescription.setAcceptabilityMap(Maps.toMap(description.getLanguageRefSetIds(), any -> Acceptability.PREFERRED)); return preferredDescription; }).collect(Collectors.toList()); - result.setPreferredDescriptions(new SnomedDescriptions(preferredDescriptions, null, null, preferredDescriptions.size(), preferredDescriptions.size())); + result.setPreferredDescriptions(new SnomedDescriptions(preferredDescriptions, null, preferredDescriptions.size(), preferredDescriptions.size())); } return result; @@ -151,11 +140,13 @@ protected void expand(List results) { return; } - final Set conceptIds = FluentIterable.from(results).transform(ID_FUNCTION).toSet(); + final Set conceptIds = FluentIterable.from(results).transform(SnomedConcept::getId).toSet(); expandReferenceSet(results); - expandInactivationProperties(results, conceptIds); + new InactivationPropertiesExpander(context(), expand(), locales(), Concepts.REFSET_CONCEPT_INACTIVITY_INDICATOR).expand(results, conceptIds); new MembersExpander(context(), expand(), locales()).expand(results, conceptIds); + new ModuleExpander(context(), expand(), locales()).expand(results); + expandDefinitionStatus(results); expandPreferredTerm(results, conceptIds); expandFullySpecifiedName(results, conceptIds); @@ -179,6 +170,32 @@ protected void expand(List results) { } } + private void expandDefinitionStatus(List results) { + if (!expand().containsKey(SnomedConcept.Expand.DEFINITION_STATUS)) { + return; + } + + final Options definitionStatusExpand = expand().getOptions(SnomedConcept.Expand.DEFINITION_STATUS).getOptions("expand"); + + Set definitionStatusIds = results.stream() + .map(SnomedConcept::getDefinitionStatusId) + .collect(Collectors.toSet()); + + Map definitionStatusesById = SnomedRequests.prepareSearchConcept() + .filterByIds(definitionStatusIds) + .setLimit(definitionStatusIds.size()) + .setExpand(definitionStatusExpand) + .setLocales(locales()) + .build() + .execute(context()) + .stream() + .collect(Collectors.toMap(SnomedConcept::getId, c -> c)); + + for (SnomedConcept result : results) { + result.setDefinitionStatus(definitionStatusesById.get(result.getDefinitionStatusId())); + } + } + private void expandReferenceSet(List results) { if (!expand().containsKey(SnomedConcept.Expand.REFERENCE_SET)) { return; @@ -192,24 +209,6 @@ private void expandReferenceSet(List results) { getReferenceSetConverter().expand(referenceSets); } - private void expandInactivationProperties(List results, Set conceptIds) { - if (!expand().containsKey(SnomedConcept.Expand.INACTIVATION_PROPERTIES)) { - return; - } - - new InactivationExpander(context(), Concepts.REFSET_CONCEPT_INACTIVITY_INDICATOR) { - @Override - protected void setAssociationTargets(SnomedConcept result, Multimap associationTargets) { - result.setAssociationTargets(associationTargets); - } - - @Override - protected void setInactivationIndicator(SnomedConcept result, String valueId) { - result.setInactivationIndicator(InactivationIndicator.getByConceptId(valueId)); - } - }.expand(results, conceptIds); - } - private void expandPreferredTerm(List results, final Set conceptIds) { if (!expand().containsKey(SnomedConcept.Expand.PREFERRED_TERM)) { return; @@ -281,7 +280,7 @@ private void expandDescriptions(List results, final Set c for (SnomedConcept concept : results) { final List conceptDescriptions = descriptionsByConceptId.get(concept.getId()); - concept.setDescriptions(new SnomedDescriptions(conceptDescriptions, null, null, conceptDescriptions.size(), conceptDescriptions.size())); + concept.setDescriptions(new SnomedDescriptions(conceptDescriptions, null, conceptDescriptions.size(), conceptDescriptions.size())); } } @@ -295,7 +294,7 @@ private void expandRelationships(List results, final Set .prepareSearchRelationship() .all() .filterByActive(expandOptions.containsKey("active") ? expandOptions.getBoolean("active") : null) - .filterByCharacteristicType(expandOptions.containsKey("characteristicType") ? expandOptions.getString("characteristicType") : null) + .filterByCharacteristicType(expandOptions.containsKey("characteristicTypeId") ? expandOptions.getString("characteristicTypeId") : null) .filterByType(expandOptions.containsKey("typeId") ? expandOptions.getCollection("typeId", String.class) : null) .filterByDestination(expandOptions.containsKey("destinationId") ? expandOptions.getCollection("destinationId", String.class) : null) .filterBySource(conceptIds) @@ -309,7 +308,7 @@ private void expandRelationships(List results, final Set for (SnomedConcept concept : results) { final List conceptRelationships = relationshipsByConceptId.get(concept.getId()); - concept.setRelationships(new SnomedRelationships(conceptRelationships, null, null, conceptRelationships.size(), conceptRelationships.size())); + concept.setRelationships(new SnomedRelationships(conceptRelationships, null, conceptRelationships.size(), conceptRelationships.size())); } } @@ -327,7 +326,7 @@ private void expandInboundRelationships(List results, final Set results, final Set conceptInboundRelationships = inboundRelationshipsByConceptId.get(concept.getId()); - concept.setInboundRelationships(new SnomedRelationships(conceptInboundRelationships, null, null, conceptInboundRelationships.size(), conceptInboundRelationships.size())); + concept.setInboundRelationships(new SnomedRelationships(conceptInboundRelationships, null, conceptInboundRelationships.size(), conceptInboundRelationships.size())); } } @@ -438,11 +437,11 @@ private void expandDescendants(List results, final Set co .build().execute(context()); final Map descendantsById = newHashMap(); - descendantsById.putAll(Maps.uniqueIndex(descendants, ID_FUNCTION)); + descendantsById.putAll(Maps.uniqueIndex(descendants, SnomedConcept::getId)); for (SnomedConcept concept : results) { final Collection descendantIds = descendantsByAncestor.get(concept.getId()); final List currentDescendants = FluentIterable.from(descendantIds).skip(offset).limit(limit).transform(Functions.forMap(descendantsById)).toList(); - final SnomedConcepts descendantConcepts = new SnomedConcepts(currentDescendants, null, null, limit, descendantIds.size()); + final SnomedConcepts descendantConcepts = new SnomedConcepts(currentDescendants, null, limit, descendantIds.size()); if (stated) { concept.setStatedDescendants(descendantConcepts); } else { @@ -519,11 +518,11 @@ private void expandAncestors(List results, Set conceptIds .build().execute(context()); final Map ancestorsById = newHashMap(); - ancestorsById.putAll(Maps.uniqueIndex(ancestors, ID_FUNCTION)); + ancestorsById.putAll(Maps.uniqueIndex(ancestors, SnomedConcept::getId)); for (SnomedConcept concept : results) { final Collection ancestorIds = ancestorsByDescendant.get(concept.getId()); final List conceptAncestors = FluentIterable.from(ancestorIds).skip(offset).limit(limit).transform(Functions.forMap(ancestorsById)).toList(); - final SnomedConcepts ancestorConcepts = new SnomedConcepts(conceptAncestors, null, null, limit, ancestorIds.size()); + final SnomedConcepts ancestorConcepts = new SnomedConcepts(conceptAncestors, null, limit, ancestorIds.size()); if (stated) { concept.setStatedAncestors(ancestorConcepts); } else { @@ -543,8 +542,8 @@ private void expandAncestors(List results, Set conceptIds } } - private DefinitionStatus toDefinitionStatus(final boolean primitive) { - return primitive ? DefinitionStatus.PRIMITIVE : DefinitionStatus.FULLY_DEFINED; + private String toDefinitionStatus(final boolean primitive) { + return primitive ? Concepts.PRIMITIVE : Concepts.FULLY_DEFINED; } private SubclassDefinitionStatus toSubclassDefinitionStatus(final boolean exhaustive) { diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConstraintConverter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConstraintConverter.java index adf9b7b26a3..ce863cfda63 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConstraintConverter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedConstraintConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,8 +62,8 @@ protected SnomedConstraintConverter(RepositoryContext context, Options expand, L } @Override - protected SnomedConstraints createCollectionResource(List results, String scrollId, String searchAfter, int limit, int total) { - return new SnomedConstraints(results, scrollId, searchAfter, limit, total); + protected SnomedConstraints createCollectionResource(List results, String searchAfter, int limit, int total) { + return new SnomedConstraints(results, searchAfter, limit, total); } @Override diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedDescriptionConverter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedDescriptionConverter.java index 57443fa6618..cc75e8ab4eb 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedDescriptionConverter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedDescriptionConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,31 +15,27 @@ */ package com.b2international.snowowl.snomed.datastore.converter; -import static com.b2international.snowowl.core.domain.IComponent.ID_FUNCTION; - +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; +import com.b2international.commons.CompareUtils; import com.b2international.commons.http.ExtendedLocale; import com.b2international.commons.options.Options; import com.b2international.snowowl.core.domain.BranchContext; -import com.b2international.snowowl.core.domain.IComponent; import com.b2international.snowowl.datastore.request.BaseRevisionResourceConverter; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; -import com.b2international.snowowl.snomed.core.domain.AssociationType; -import com.b2international.snowowl.snomed.core.domain.CaseSignificance; -import com.b2international.snowowl.snomed.core.domain.DescriptionInactivationIndicator; +import com.b2international.snowowl.snomed.core.domain.AcceptabilityMembership; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; import com.b2international.snowowl.snomed.core.domain.SnomedDescription; import com.b2international.snowowl.snomed.core.domain.SnomedDescriptions; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedDescriptionIndexEntry; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; -import com.google.common.base.Function; import com.google.common.collect.FluentIterable; import com.google.common.collect.Maps; -import com.google.common.collect.Multimap; /** * @since 4.0 @@ -51,8 +47,8 @@ final class SnomedDescriptionConverter extends BaseRevisionResourceConverter results, String scrollId, String searchAfter, int limit, int total) { - return new SnomedDescriptions(results, scrollId, searchAfter, limit, total); + protected SnomedDescriptions createCollectionResource(List results, String searchAfter, int limit, int total) { + return new SnomedDescriptions(results, searchAfter, limit, total); } @Override @@ -60,7 +56,7 @@ protected SnomedDescription toResource(final SnomedDescriptionIndexEntry input) final SnomedDescription result = new SnomedDescription(); result.setAcceptabilityMap(input.getAcceptabilityMap()); result.setActive(input.isActive()); - result.setCaseSignificance(toCaseSignificance(input.getCaseSignificanceId())); + result.setCaseSignificanceId(input.getCaseSignificanceId()); result.setConceptId(input.getConceptId()); result.setEffectiveTime(toEffectiveTime(input.getEffectiveTime())); result.setId(input.getId()); @@ -82,28 +78,111 @@ protected void expand(List results) { return; } - final Set descriptionIds = FluentIterable.from(results).transform(IComponent.ID_FUNCTION).toSet(); + final Set descriptionIds = FluentIterable.from(results).transform(SnomedDescription::getId).toSet(); - expandInactivationProperties(results, descriptionIds); + new InactivationPropertiesExpander(context(), expand(), locales(), Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR).expand(results, descriptionIds); new MembersExpander(context(), expand(), locales()).expand(results, descriptionIds); + new ModuleExpander(context(), expand(), locales()).expand(results); + expandCaseSignificance(results); expandConcept(results, descriptionIds); expandType(results, descriptionIds); + expandAcceptabilities(results); + } + + private void expandCaseSignificance(List results) { + if (!expand().containsKey("caseSignificance")) { + return; + } + + final Set caseSignificanceIds = results.stream().map(SnomedDescription::getCaseSignificanceId).collect(Collectors.toSet()); + final Options caseSignificanceExpand = expand().get("caseSignificance", Options.class); + + final Map caseSignificancesById = SnomedRequests.prepareSearchConcept() + .filterByIds(caseSignificanceIds) + .setLimit(caseSignificanceIds.size()) + .setExpand(caseSignificanceExpand.getOptions("expand")) + .setLocales(locales()) + .build() + .execute(context()) + .stream() + .collect(Collectors.toMap(SnomedConcept::getId, c -> c)); + + for (SnomedDescription result : results) { + result.setCaseSignificance(caseSignificancesById.get(result.getCaseSignificanceId())); + } + } + + private void expandAcceptabilities(List results) { + if (!expand().containsKey("acceptabilities")) { + return; + } + + // expand the acceptability objects first + for (SnomedDescription result : results) { + if (!CompareUtils.isEmpty(result.getAcceptabilityMap())) { + List acceptabilities = result.getAcceptabilityMap().entrySet().stream() + .map(entry -> new AcceptabilityMembership(entry.getKey(), entry.getValue().getConceptId())) + .sorted() + .collect(Collectors.toList()); + result.setAcceptabilities(acceptabilities); + } else { + result.setAcceptabilities(Collections.emptyList()); + } + } + + // additional expansions supported inside the acceptabilities() expand + final Options expandOptions = expand().get("acceptabilities", Options.class).getOptions("expand"); + + if (expandOptions.containsKey("acceptability")) { + final Options acceptabilityExpand = expandOptions.get("acceptability", Options.class); + final Set acceptabilityIds = results.stream().flatMap(d -> d.getAcceptabilities().stream().map(AcceptabilityMembership::getAcceptabilityId)).collect(Collectors.toSet()); + final Map acceptabilitiesById = SnomedRequests.prepareSearchConcept() + .filterByIds(acceptabilityIds) + .setLimit(acceptabilityIds.size()) + .setExpand(acceptabilityExpand.getOptions("expand")) + .setLocales(locales()) + .build() + .execute(context()) + .stream() + .collect(Collectors.toMap(SnomedConcept::getId, c -> c)); + for (SnomedDescription result : results) { + result.getAcceptabilities().forEach(acceptabilityMembership -> { + acceptabilityMembership.setAcceptability(acceptabilitiesById.get(acceptabilityMembership.getAcceptabilityId())); + }); + } + } + + if (expandOptions.containsKey("languageRefSet")) { + final Options languageRefSetExpand = expandOptions.get("languageRefSet", Options.class); + final Set languageRefSetIds = results.stream().flatMap(d -> d.getAcceptabilities().stream().map(AcceptabilityMembership::getLanguageRefSetId)).collect(Collectors.toSet()); + final Map languageRefSetsById = SnomedRequests.prepareSearchConcept() + .filterByIds(languageRefSetIds) + .setLimit(languageRefSetIds.size()) + .setExpand(languageRefSetExpand.getOptions("expand")) + .setLocales(locales()) + .build() + .execute(context()) + .stream() + .collect(Collectors.toMap(SnomedConcept::getId, c -> c)); + for (SnomedDescription result : results) { + result.getAcceptabilities().forEach(acceptabilityMembership -> { + acceptabilityMembership.setLanguageRefSet(languageRefSetsById.get(acceptabilityMembership.getLanguageRefSetId())); + }); + } + } + + } private void expandConcept(List results, final Set descriptionIds) { if (expand().containsKey("concept")) { final Options expandOptions = expand().get("concept", Options.class); - final Set conceptIds = FluentIterable.from(results) - .transform(new Function() { - @Override public String apply(SnomedDescription input) { return input.getConceptId(); } - }) - .toSet(); + final Set conceptIds = FluentIterable.from(results).transform(SnomedDescription::getConceptId).toSet(); final Map conceptsById = getConceptMap(expandOptions, conceptIds); for (SnomedDescription description : results) { - final SnomedConcept concept = conceptsById.get(description.getConceptId()); - ((SnomedDescription) description).setConcept(concept); + ((SnomedDescription) description).setConcept(conceptsById.get(description.getConceptId())); } } } @@ -111,17 +190,12 @@ private void expandConcept(List results, final Set de private void expandType(List results, final Set descriptionIds) { if (expand().containsKey("type")) { final Options expandOptions = expand().get("type", Options.class); - final Set conceptIds = FluentIterable.from(results) - .transform(new Function() { - @Override public String apply(SnomedDescription input) { return input.getTypeId(); } - }) - .toSet(); + final Set typeIds = FluentIterable.from(results).transform(SnomedDescription::getTypeId).toSet(); - final Map conceptsById = getConceptMap(expandOptions, conceptIds); + final Map typesById = getConceptMap(expandOptions, typeIds); for (SnomedDescription description : results) { - final SnomedConcept type = conceptsById.get(description.getTypeId()); - ((SnomedDescription) description).setType(type); + ((SnomedDescription) description).setType(typesById.get(description.getTypeId())); } } } @@ -136,27 +210,7 @@ private Map getConceptMap(final Options expandOptions, fi .build() .execute(context()); - final Map conceptsById = Maps.uniqueIndex(types, ID_FUNCTION); - return conceptsById; + return Maps.uniqueIndex(types, SnomedConcept::getId); } - private void expandInactivationProperties(List results, final Set descriptionIds) { - if (expand().containsKey("inactivationProperties")) { - new InactivationExpander(context(), Concepts.REFSET_DESCRIPTION_INACTIVITY_INDICATOR) { - @Override - protected void setAssociationTargets(SnomedDescription result,Multimap associationTargets) { - ((SnomedDescription) result).setAssociationTargets(associationTargets); - } - - @Override - protected void setInactivationIndicator(SnomedDescription result, String valueId) { - ((SnomedDescription) result).setInactivationIndicator(DescriptionInactivationIndicator.getInactivationIndicatorByValueId(valueId)); - } - }.expand(results, descriptionIds); - } - } - - private CaseSignificance toCaseSignificance(final String caseSignificanceId) { - return CaseSignificance.getByConceptId(caseSignificanceId); - } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetConverter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetConverter.java index 5febd26847c..f504c2139cb 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetConverter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,12 +39,13 @@ protected SnomedReferenceSetConverter(BranchContext context, Options expand, Lis } @Override - protected SnomedReferenceSets createCollectionResource(List results, String scrollId, String searchAfter, int limit, int total) { - return new SnomedReferenceSets(results, scrollId, searchAfter, limit, total); + protected SnomedReferenceSets createCollectionResource(List results, String searchAfter, int limit, int total) { + return new SnomedReferenceSets(results, searchAfter, limit, total); } @Override protected void expand(List results) { + new ModuleExpander(context(), expand(), locales()).expand(results); expandMembers(results); } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetMemberConverter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetMemberConverter.java index d9257ea9f69..9a1085cc4dc 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetMemberConverter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedReferenceSetMemberConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,14 +66,15 @@ final class SnomedReferenceSetMemberConverter extends BaseRevisionResourceConver } @Override - protected SnomedReferenceSetMembers createCollectionResource(List results, String scrollId, String searchAfter, int limit, int total) { - return new SnomedReferenceSetMembers(results, scrollId, searchAfter, limit, total); + protected SnomedReferenceSetMembers createCollectionResource(List results, String searchAfter, int limit, int total) { + return new SnomedReferenceSetMembers(results, searchAfter, limit, total); } @Override protected void expand(List results) { expandReferencedComponent(results); expandTargetComponent(results); + new ModuleExpander(context(), expand(), locales()).expand(results); } private void expandTargetComponent(List results) { @@ -97,7 +98,7 @@ public ComponentCategory apply(String id) { for (ComponentCategory category : targetComponentIdsByCategory.keySet()) { final Collection targetComponentIds = targetComponentIdsByCategory.get(category); - final Map componentsById = Maps.uniqueIndex(getComponents(category, targetComponentIds, expandOptions.get("expand", Options.class)), IComponent.ID_FUNCTION); + final Map componentsById = Maps.uniqueIndex(getComponents(category, targetComponentIds, expandOptions.get("expand", Options.class)), IComponent::getId); for (String targetComponentId : targetComponentIds) { final SnomedCoreComponent targetComponent = componentsById.get(targetComponentId); if (targetComponent != null) { diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedRelationshipConverter.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedRelationshipConverter.java index 9291cda69b4..720e7d1f449 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedRelationshipConverter.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/converter/SnomedRelationshipConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,8 +15,6 @@ */ package com.b2international.snowowl.snomed.datastore.converter; -import static com.b2international.snowowl.core.domain.IComponent.ID_FUNCTION; - import java.util.List; import java.util.Map; import java.util.Set; @@ -25,16 +23,13 @@ import com.b2international.commons.options.Options; import com.b2international.snowowl.core.domain.BranchContext; import com.b2international.snowowl.datastore.request.BaseRevisionResourceConverter; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; import com.b2international.snowowl.snomed.core.domain.SnomedRelationships; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRelationshipIndexEntry; import com.b2international.snowowl.snomed.datastore.request.SnomedRequests; -import com.google.common.base.Function; -import com.google.common.base.Strings; import com.google.common.collect.FluentIterable; import com.google.common.collect.Maps; @@ -45,19 +40,19 @@ final class SnomedRelationshipConverter extends BaseRevisionResourceConverter results, String scrollId, String searchAfter, int limit, int total) { - return new SnomedRelationships(results, scrollId, searchAfter, limit, total); + protected SnomedRelationships createCollectionResource(List results, String searchAfter, int limit, int total) { + return new SnomedRelationships(results, searchAfter, limit, total); } @Override protected SnomedRelationship toResource(final SnomedRelationshipIndexEntry input) { final SnomedRelationship result = new SnomedRelationship(); result.setActive(input.isActive()); - result.setCharacteristicType(toCharacteristicType(input.getCharacteristicTypeId())); + result.setCharacteristicTypeId(input.getCharacteristicTypeId()); result.setDestinationNegated(input.isDestinationNegated()); result.setEffectiveTime(toEffectiveTime(input.getEffectiveTime())); result.setId(input.getId()); - result.setModifier(toRelationshipModifier(input.isUniversal())); + result.setModifierId(toRelationshipModifier(input.isUniversal())); result.setModuleId(input.getModuleId()); result.setIconId(input.getIconId()); result.setReleased(input.isReleased()); @@ -76,66 +71,58 @@ protected void expand(List results) { return; } - final Set relationshipIds = FluentIterable.from(results).transform(ID_FUNCTION).toSet(); + final Set relationshipIds = FluentIterable.from(results).transform(SnomedRelationship::getId).toSet(); new MembersExpander(context(), expand(), locales()).expand(results, relationshipIds); - if (expand().containsKey(SnomedRelationship.Expand.SOURCE)) { - final Options sourceOptions = expand().get(SnomedRelationship.Expand.SOURCE, Options.class); - final Set sourceConceptIds = FluentIterable.from(results).transform(new Function() { - @Override - public String apply(SnomedRelationship input) { - return input.getSourceId(); - } - }).toSet(); - final SnomedConcepts sourceConcepts = SnomedRequests + new ModuleExpander(context(), expand(), locales()).expand(results); + expandSource(results); + expandDestination(results); + expandType(results); + expandCharacteristicType(results); + expandModifier(results); + } + + private void expandCharacteristicType(List results) { + if (expand().containsKey(SnomedRelationship.Expand.CHARACTERISTIC_TYPE)) { + final Options characteristicTypeOptions = expand().get(SnomedRelationship.Expand.CHARACTERISTIC_TYPE, Options.class); + final Set characteristicTypeConceptIds = FluentIterable.from(results).transform(SnomedRelationship::getCharacteristicTypeId).toSet(); + final SnomedConcepts typeConcepts = SnomedRequests .prepareSearchConcept() - .filterByIds(sourceConceptIds) - .setLimit(sourceConceptIds.size()) - .setExpand(sourceOptions.get("expand", Options.class)) + .filterByIds(characteristicTypeConceptIds) + .setLimit(characteristicTypeConceptIds.size()) + .setExpand(characteristicTypeOptions.get("expand", Options.class)) .setLocales(locales()) .build() .execute(context()); - final Map sourceConceptsById = Maps.uniqueIndex(sourceConcepts, ID_FUNCTION); + final Map characteristicTypesById = Maps.uniqueIndex(typeConcepts, SnomedConcept::getId); for (SnomedRelationship relationship : results) { - final String sourceId = relationship.getSourceId(); - if (sourceConceptsById.containsKey(sourceId)) { - final SnomedConcept sourceConcept = sourceConceptsById.get(sourceId); - ((SnomedRelationship) relationship).setSource(sourceConcept); - } + ((SnomedRelationship) relationship).setCharacteristicType(characteristicTypesById.get(relationship.getCharacteristicTypeId())); } } - if (expand().containsKey(SnomedRelationship.Expand.DESTINATION)) { - final Options destinationOptions = expand().get(SnomedRelationship.Expand.DESTINATION, Options.class); - final Set destinationConceptIds = FluentIterable.from(results).transform(new Function() { - @Override - public String apply(SnomedRelationship input) { - return input.getDestinationId(); - } - }).toSet(); - final SnomedConcepts destinationConcepts = SnomedRequests + } + + private void expandModifier(List results) { + if (expand().containsKey(SnomedRelationship.Expand.MODIFIER)) { + final Options modifierOptions = expand().get(SnomedRelationship.Expand.MODIFIER, Options.class); + final Set modifierIds = FluentIterable.from(results).transform(SnomedRelationship::getModifierId).toSet(); + final SnomedConcepts typeConcepts = SnomedRequests .prepareSearchConcept() - .filterByIds(destinationConceptIds) - .setLimit(destinationConceptIds.size()) - .setExpand(destinationOptions.get("expand", Options.class)) + .filterByIds(modifierIds) + .setLimit(modifierIds.size()) + .setExpand(modifierOptions.get("expand", Options.class)) .setLocales(locales()) .build() .execute(context()); - final Map destinationConceptsById = Maps.uniqueIndex(destinationConcepts, ID_FUNCTION); + final Map modifiersById = Maps.uniqueIndex(typeConcepts, SnomedConcept::getId); for (SnomedRelationship relationship : results) { - final String destinationId = relationship.getDestinationId(); - if (destinationConceptsById.containsKey(destinationId)) { - final SnomedConcept destinationConcept = destinationConceptsById.get(destinationId); - ((SnomedRelationship) relationship).setDestination(destinationConcept); - } + ((SnomedRelationship) relationship).setModifier(modifiersById.get(relationship.getModifierId())); } } + } + + private void expandType(List results) { if (expand().containsKey(SnomedRelationship.Expand.TYPE)) { final Options typeOptions = expand().get(SnomedRelationship.Expand.TYPE, Options.class); - final Set typeConceptIds = FluentIterable.from(results).transform(new Function() { - @Override - public String apply(SnomedRelationship input) { - return input.getTypeId(); - } - }).toSet(); + final Set typeConceptIds = FluentIterable.from(results).transform(SnomedRelationship::getTypeId).toSet(); final SnomedConcepts typeConcepts = SnomedRequests .prepareSearchConcept() .filterByIds(typeConceptIds) @@ -144,7 +131,7 @@ public String apply(SnomedRelationship input) { .setLocales(locales()) .build() .execute(context()); - final Map typeConceptsById = Maps.uniqueIndex(typeConcepts, ID_FUNCTION); + final Map typeConceptsById = Maps.uniqueIndex(typeConcepts, SnomedConcept::getId); for (SnomedRelationship relationship : results) { final String typeId = relationship.getTypeId(); if (typeConceptsById.containsKey(typeId)) { @@ -154,16 +141,54 @@ public String apply(SnomedRelationship input) { } } } - - private CharacteristicType toCharacteristicType(final String characteristicTypeId) { - if (Strings.isNullOrEmpty(characteristicTypeId)) { - return null; - } else { - return CharacteristicType.getByConceptId(characteristicTypeId); + + private void expandDestination(List results) { + if (expand().containsKey(SnomedRelationship.Expand.DESTINATION)) { + final Options destinationOptions = expand().get(SnomedRelationship.Expand.DESTINATION, Options.class); + final Set destinationConceptIds = FluentIterable.from(results).transform(SnomedRelationship::getDestinationId).toSet(); + final SnomedConcepts destinationConcepts = SnomedRequests + .prepareSearchConcept() + .filterByIds(destinationConceptIds) + .setLimit(destinationConceptIds.size()) + .setExpand(destinationOptions.get("expand", Options.class)) + .setLocales(locales()) + .build() + .execute(context()); + final Map destinationConceptsById = Maps.uniqueIndex(destinationConcepts, SnomedConcept::getId); + for (SnomedRelationship relationship : results) { + final String destinationId = relationship.getDestinationId(); + if (destinationConceptsById.containsKey(destinationId)) { + final SnomedConcept destinationConcept = destinationConceptsById.get(destinationId); + ((SnomedRelationship) relationship).setDestination(destinationConcept); + } + } } } - private RelationshipModifier toRelationshipModifier(final boolean universal) { - return universal ? RelationshipModifier.UNIVERSAL : RelationshipModifier.EXISTENTIAL; + private void expandSource(List results) { + if (expand().containsKey(SnomedRelationship.Expand.SOURCE)) { + final Options sourceOptions = expand().get(SnomedRelationship.Expand.SOURCE, Options.class); + final Set sourceConceptIds = FluentIterable.from(results).transform(SnomedRelationship::getSourceId).toSet(); + final SnomedConcepts sourceConcepts = SnomedRequests + .prepareSearchConcept() + .filterByIds(sourceConceptIds) + .setLimit(sourceConceptIds.size()) + .setExpand(sourceOptions.get("expand", Options.class)) + .setLocales(locales()) + .build() + .execute(context()); + final Map sourceConceptsById = Maps.uniqueIndex(sourceConcepts, SnomedConcept::getId); + for (SnomedRelationship relationship : results) { + final String sourceId = relationship.getSourceId(); + if (sourceConceptsById.containsKey(sourceId)) { + final SnomedConcept sourceConcept = sourceConceptsById.get(sourceId); + ((SnomedRelationship) relationship).setSource(sourceConcept); + } + } + } + } + + private String toRelationshipModifier(final boolean universal) { + return universal ? Concepts.UNIVERSAL_RESTRICTION_MODIFIER : Concepts.EXISTENTIAL_RESTRICTION_MODIFIER; } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/change/SnomedRepositoryPreCommitHook.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/change/SnomedRepositoryPreCommitHook.java index 7631b0c23f3..a1485f199c7 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/change/SnomedRepositoryPreCommitHook.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/change/SnomedRepositoryPreCommitHook.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ import java.io.IOException; import java.util.Collection; +import java.util.Collections; import java.util.Set; import java.util.stream.Stream; @@ -40,7 +41,6 @@ import com.b2international.snowowl.datastore.request.BranchRequest; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.core.domain.refset.SnomedRefSetType; import com.b2international.snowowl.snomed.datastore.index.constraint.SnomedConstraintDocument; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedConceptDocument; @@ -88,10 +88,10 @@ protected Collection getChangeSetProcessors(StagingArea stag final Set inferredSourceIds = Sets.newHashSet(); final Set inferredDestinationIds = Sets.newHashSet(); - collectIds(statedSourceIds, statedDestinationIds, staging.getNewObjects(SnomedRelationshipIndexEntry.class), CharacteristicType.STATED_RELATIONSHIP); - collectIds(statedSourceIds, statedDestinationIds, staging.getChangedRevisions(SnomedRelationshipIndexEntry.class).map(diff -> (SnomedRelationshipIndexEntry) diff.newRevision), CharacteristicType.STATED_RELATIONSHIP); - collectIds(inferredSourceIds, inferredDestinationIds, staging.getNewObjects(SnomedRelationshipIndexEntry.class), CharacteristicType.INFERRED_RELATIONSHIP); - collectIds(inferredSourceIds, inferredDestinationIds, staging.getChangedRevisions(SnomedRelationshipIndexEntry.class).map(diff -> (SnomedRelationshipIndexEntry) diff.newRevision), CharacteristicType.INFERRED_RELATIONSHIP); + collectIds(statedSourceIds, statedDestinationIds, staging.getNewObjects(SnomedRelationshipIndexEntry.class), Concepts.STATED_RELATIONSHIP); + collectIds(statedSourceIds, statedDestinationIds, staging.getChangedRevisions(SnomedRelationshipIndexEntry.class).map(diff -> (SnomedRelationshipIndexEntry) diff.newRevision), Concepts.STATED_RELATIONSHIP); + collectIds(inferredSourceIds, inferredDestinationIds, staging.getNewObjects(SnomedRelationshipIndexEntry.class), Concepts.INFERRED_RELATIONSHIP); + collectIds(inferredSourceIds, inferredDestinationIds, staging.getChangedRevisions(SnomedRelationshipIndexEntry.class).map(diff -> (SnomedRelationshipIndexEntry) diff.newRevision), Concepts.INFERRED_RELATIONSHIP); collectIds(statedSourceIds, statedDestinationIds, staging.getNewObjects(SnomedRefSetMemberIndexEntry.class), expressionConverter); collectIds(statedSourceIds, statedDestinationIds, staging.getChangedRevisions(SnomedRefSetMemberIndexEntry.class).map(diff -> (SnomedRefSetMemberIndexEntry) diff.newRevision), expressionConverter); @@ -209,8 +209,6 @@ protected Collection getChangeSetProcessors(StagingArea stag final Taxonomy inferredTaxonomy = Taxonomies.inferred(index, expressionConverter, staging, inferredConceptIds, checkCycles); final Taxonomy statedTaxonomy = Taxonomies.stated(index, expressionConverter, staging, statedConceptIds, checkCycles); - final long branchBaseTimestamp = index.get(RevisionBranch.class, staging.getBranchPath()).getBaseTimestamp(); - // XXX change processor execution order is important!!! return ImmutableList.builder() // execute description change processor to get proper acceptabilityMap values before executing other change processors @@ -218,10 +216,19 @@ protected Collection getChangeSetProcessors(StagingArea stag .add(new DescriptionChangeProcessor()) .add(new ConceptChangeProcessor(DoiDataProvider.INSTANCE, SnomedIconProvider.INSTANCE.getAvailableIconIds(), statedTaxonomy, inferredTaxonomy)) .add(new RelationshipChangeProcessor()) - // effective time restore should be the last processing unit before we send the changes to commit - .add(new ComponentEffectiveTimeRestoreChangeProcessor(log, branchBaseTimestamp)) .build(); - + } + + @Override + protected void postUpdateDocuments(StagingArea staging, RevisionSearcher index) throws IOException { + final RepositoryContext context = ClassUtils.checkAndCast(staging.getContext(), RepositoryContext.class); + final FeatureToggles featureToggles = context.service(FeatureToggles.class); + final boolean importRunning = featureToggles.isEnabled(Features.getImportFeatureToggle(context.id(), index.branch())); + if (!importRunning) { + final long branchBaseTimestamp = index.get(RevisionBranch.class, staging.getBranchPath()).getBaseTimestamp(); + // XXX effective time restore should be the last processing unit before we send the changes to commit + doProcess(Collections.singleton(new ComponentEffectiveTimeRestoreChangeProcessor(log, branchBaseTimestamp)), staging, index); + } } @Override @@ -240,10 +247,10 @@ protected short getTerminologyComponentId(RevisionDocument revision) { throw new UnsupportedOperationException("Unsupported revision document: " + revision); } - private void collectIds(final Set sourceIds, final Set destinationIds, Stream newRelationships, CharacteristicType characteristicType) { + private void collectIds(final Set sourceIds, final Set destinationIds, Stream newRelationships, String characteristicTypeId) { newRelationships .filter(newRelationship -> Concepts.IS_A.equals(newRelationship.getTypeId())) - .filter(newRelationship -> newRelationship.getCharacteristicTypeId().equals(characteristicType.getConceptId())) + .filter(newRelationship -> newRelationship.getCharacteristicTypeId().equals(characteristicTypeId)) .forEach(newRelationship -> { sourceIds.add(newRelationship.getSourceId()); destinationIds.add(newRelationship.getDestinationId()); diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedConceptDocument.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedConceptDocument.java index a1b3d9eef3f..a3d49b532a9 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedConceptDocument.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedConceptDocument.java @@ -21,6 +21,7 @@ import static com.b2international.index.query.Expressions.matchAnyInt; import static com.b2international.index.query.Expressions.matchAnyLong; import static com.google.common.base.Preconditions.checkArgument; +import static com.google.common.collect.Sets.newHashSetWithExpectedSize; import java.util.Collection; import java.util.Collections; @@ -31,7 +32,7 @@ import com.b2international.collections.longs.LongSet; import com.b2international.commons.StringUtils; import com.b2international.commons.collections.Collections3; -import com.b2international.commons.functions.StringToLongFunction; +import com.b2international.commons.exceptions.BadRequestException; import com.b2international.index.Doc; import com.b2international.index.Script; import com.b2international.index.query.Expression; @@ -127,20 +128,32 @@ public final static class Expressions extends SnomedComponentDocument.Expression private Expressions() { } + private static Iterable toLongValues(Collection values) { + final Set result = newHashSetWithExpectedSize(values.size()); + for (String value : values) { + try { + result.add(Long.valueOf(value)); + } catch (NumberFormatException e) { + throw new BadRequestException("'%s' value is not a valid SNOMED CT identifier", value); + } + } + return result; + } + public static Expression parents(Collection parentIds) { - return matchAnyLong(Fields.PARENTS, StringToLongFunction.copyOf(parentIds)); + return matchAnyLong(Fields.PARENTS, toLongValues(parentIds)); } public static Expression ancestors(Collection ancestorIds) { - return matchAnyLong(Fields.ANCESTORS, StringToLongFunction.copyOf(ancestorIds)); + return matchAnyLong(Fields.ANCESTORS, toLongValues(ancestorIds)); } public static Expression statedParents(Collection statedParentIds) { - return matchAnyLong(Fields.STATED_PARENTS, StringToLongFunction.copyOf(statedParentIds)); + return matchAnyLong(Fields.STATED_PARENTS, toLongValues(statedParentIds)); } public static Expression statedAncestors(Collection statedAncestorIds) { - return matchAnyLong(Fields.STATED_ANCESTORS, StringToLongFunction.copyOf(statedAncestorIds)); + return matchAnyLong(Fields.STATED_ANCESTORS, toLongValues(statedAncestorIds)); } public static Expression primitive() { @@ -241,7 +254,7 @@ public static Builder builder(SnomedConcept input) { .released(input.isReleased()) .effectiveTime(EffectiveTimes.getEffectiveTime(input.getEffectiveTime())) .iconId(input.getIconId()) - .primitive(input.getDefinitionStatus().isPrimitive()) + .primitive(input.isPrimitive()) .exhaustive(input.getSubclassDefinitionStatus().isExhaustive()) .parents(PrimitiveSets.newLongOpenHashSet(input.getParentIds())) .ancestors(PrimitiveSets.newLongOpenHashSet(input.getAncestorIds())) diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedDescriptionIndexEntry.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedDescriptionIndexEntry.java index 9e1c491e943..12c47259811 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedDescriptionIndexEntry.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedDescriptionIndexEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,7 +111,7 @@ public static Builder builder(final SnomedDescription input) { .active(input.isActive()) .typeId(input.getTypeId()) .conceptId(input.getConceptId()) - .caseSignificanceId(input.getCaseSignificance().getConceptId()) + .caseSignificanceId(input.getCaseSignificanceId()) .effectiveTime(EffectiveTimes.getEffectiveTime(input.getEffectiveTime())); // TODO add back scoring @@ -130,23 +130,6 @@ public static Builder builder(final SnomedDescription input) { return builder; } -// public static Builder builder(Description description) { -// String id = description.getId(); -// return builder() -// .storageKey(CDOIDUtils.asLong(description.cdoID())) -// .id(id) -// .namespace(!Strings.isNullOrEmpty(id) ? SnomedIdentifiers.getNamespace(id) : null) -// .term(description.getTerm()) -// .moduleId(description.getModule().getId()) -// .released(description.isReleased()) -// .active(description.isActive()) -// .typeId(description.getType().getId()) -// .caseSignificanceId(description.getCaseSignificance().getId()) -// .conceptId(description.getConcept().getId()) -// .languageCode(description.getLanguageCode()) -// .effectiveTime(description.isSetEffectiveTime() ? description.getEffectiveTime().getTime() : EffectiveTimes.UNSET_EFFECTIVE_TIME); -// } - /** * Creates a new {@link Builder} from the given {@link SnomedDescriptionIndexEntry}. The acceptability map is not copied over to the * {@link Builder} instance, if you need that, manually modify the returned {@link Builder} to represent the desired acceptability state. diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRefSetMemberIndexEntry.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRefSetMemberIndexEntry.java index d9aaae78f41..deb8c125691 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRefSetMemberIndexEntry.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRefSetMemberIndexEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,7 +50,6 @@ import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.common.SnomedTerminologyComponentConstants; import com.b2international.snowowl.snomed.core.domain.Acceptability; -import com.b2international.snowowl.snomed.core.domain.InactivationIndicator; import com.b2international.snowowl.snomed.core.domain.RelationshipRefinability; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedCoreComponent; @@ -120,7 +119,8 @@ SnomedRefSetMemberIndexEntry.Fields.MRCM_CONTENT_TYPE_ID, SnomedRefSetMemberIndexEntry.Fields.MRCM_RANGE_CONSTRAINT, SnomedRefSetMemberIndexEntry.Fields.MRCM_ATTRIBUTE_RULE, - SnomedRefSetMemberIndexEntry.Fields.MRCM_RULE_REFSET_ID + SnomedRefSetMemberIndexEntry.Fields.MRCM_RULE_REFSET_ID, + SnomedRefSetMemberIndexEntry.Fields.MAP_BLOCK, } ) @JsonDeserialize(builder = SnomedRefSetMemberIndexEntry.Builder.class) @@ -204,6 +204,9 @@ public static class Fields extends SnomedDocument.Fields { public static final String MRCM_RULE_REFSET_ID = SnomedRf2Headers.FIELD_MRCM_RULE_REFSET_ID; public static final String CLASS_AXIOM_RELATIONSHIP = "classAxiomRelationships"; public static final String GCI_AXIOM_RELATIONSHIP = "gciAxiomRelationships"; + + // Complex map with map block + public static final String MAP_BLOCK = "mapBlock"; } public static Builder builder() { @@ -310,6 +313,10 @@ public static Expression mapTargetDescriptions(Collection mapTargetDescr public static Expression mapGroups(Collection mapGroups) { return matchAnyInt(Fields.MAP_GROUP, mapGroups); } + + public static Expression mapPriority(Collection mapPriorities) { + return matchAnyInt(Fields.MAP_PRIORITY, mapPriorities); + } public static Expression referencedComponentTypes(Collection referencedComponentTypes) { return matchAnyInt(Fields.REFERENCED_COMPONENT_TYPE, referencedComponentTypes.stream().map(Short::intValue).collect(Collectors.toSet())); @@ -549,6 +556,8 @@ public static final class Builder extends SnomedDocument.Builder getAdditionalFields() { putIfPresent(builder, Fields.MRCM_ATTRIBUTE_RULE, getAttributeRule()); // MRCM Module Scope putIfPresent(builder, Fields.MRCM_RULE_REFSET_ID, getMrcmRuleRefsetId()); + // Complex map with map block + putIfPresent(builder, Fields.MAP_BLOCK, getMapBlock()); return builder.build(); } @@ -1456,7 +1479,9 @@ protected ToStringHelper doToString() { .add("rangeConstraint", rangeConstraint) .add("attributeRule", attributeRule) - .add("mrcmRuleRefsetId", mrcmRuleRefsetId); + .add("mrcmRuleRefsetId", mrcmRuleRefsetId) + + .add("mapBlock", mapBlock); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntry.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntry.java index 4ce907fdae9..1f498c7346c 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntry.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/entry/SnomedRelationshipIndexEntry.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ import com.b2international.snowowl.core.date.EffectiveTimes; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -78,12 +77,12 @@ public static Builder builder(final SnomedRelationship input) { .sourceId(input.getSourceId()) .typeId(input.getTypeId()) .destinationId(input.getDestinationId()) - .characteristicTypeId(input.getCharacteristicType().getConceptId()) + .characteristicTypeId(input.getCharacteristicTypeId()) .group(input.getGroup()) .unionGroup(input.getUnionGroup()) .active(input.isActive()) .released(input.isReleased()) - .modifierId(input.getModifier().getConceptId()) + .modifierId(input.getModifierId()) .destinationNegated(input.isDestinationNegated()) .moduleId(input.getModuleId()) .effectiveTime(EffectiveTimes.getEffectiveTime(input.getEffectiveTime())); @@ -435,14 +434,6 @@ public boolean isExistential() { return Concepts.EXISTENTIAL_RESTRICTION_MODIFIER.equals(modifierId); } - /** - * @return the {@link CharacteristicType} value for this relationship, based on the stored characteristic type identifier - */ - @JsonIgnore - public CharacteristicType getCharacteristicType() { - return CharacteristicType.getByConceptId(characteristicTypeId); - } - /** * @return the relationship group */ diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/taxonomy/ReasonerTaxonomyBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/taxonomy/ReasonerTaxonomyBuilder.java index 2eead482f9d..257454633f4 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/taxonomy/ReasonerTaxonomyBuilder.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/index/taxonomy/ReasonerTaxonomyBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,9 +62,6 @@ import com.b2international.index.revision.RevisionSearcher; import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.CharacteristicType; -import com.b2international.snowowl.snomed.core.domain.DefinitionStatus; -import com.b2international.snowowl.snomed.core.domain.RelationshipModifier; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedRelationship; import com.b2international.snowowl.snomed.core.domain.SubclassDefinitionStatus; @@ -205,7 +202,7 @@ public ReasonerTaxonomyBuilder addActiveConceptIds(final Stream c final Collection definedConceptIds = newArrayListWithCapacity(chunk.size()); for (SnomedConcept concept : chunk) { conceptIds.add(concept.getId()); - if (!concept.getDefinitionStatus().isPrimitive()) { + if (!concept.isPrimitive()) { definedConceptIds.add(concept.getId()); } } @@ -347,7 +344,7 @@ public ReasonerTaxonomyBuilder addActiveStatedEdges(final Stream filteredRelationships = relationships.filter(r -> r.isActive() && Concepts.IS_A.equals(r.getTypeId()) - && CharacteristicType.STATED_RELATIONSHIP.equals(r.getCharacteristicType()) + && Concepts.STATED_RELATIONSHIP.equals(r.getCharacteristicTypeId()) && !excludedModuleIds.contains(r.getModuleId())); final List sourceIds = newArrayListWithExpectedSize(SCROLL_LIMIT); @@ -415,10 +412,9 @@ public ReasonerTaxonomyBuilder addConceptFlags(final Stream conce entering("Registering active concept flags (exhaustive, fully defined) using concept ID stream"); Stream filteredConcepts = concepts.filter(c -> { - final boolean fullyDefined = DefinitionStatus.FULLY_DEFINED.equals(c.getDefinitionStatus()); final boolean exhaustive = SubclassDefinitionStatus.DISJOINT_SUBCLASSES.equals(c.getSubclassDefinitionStatus()); return c.isActive() - && (fullyDefined || exhaustive) + && (!c.isPrimitive() || exhaustive) && !excludedModuleIds.contains(c.getModuleId()); }); @@ -459,7 +455,7 @@ public ReasonerTaxonomyBuilder addActiveStatedNonIsARelationships(final Stream predicate = relationship -> relationship.isActive() - && CharacteristicType.STATED_RELATIONSHIP.equals(relationship.getCharacteristicType()) + && Concepts.STATED_RELATIONSHIP.equals(relationship.getCharacteristicTypeId()) && !Concepts.IS_A.equals(relationship.getTypeId()) && !excludedModuleIds.contains(relationship.getModuleId()); @@ -497,7 +493,7 @@ public ReasonerTaxonomyBuilder addActiveAdditionalGroupedRelationships(final Str entering("Registering active additional grouped relationships using relationship stream"); Predicate predicate = relationship -> relationship.isActive() - && CharacteristicType.ADDITIONAL_RELATIONSHIP.equals(relationship.getCharacteristicType()) + && Concepts.ADDITIONAL_RELATIONSHIP.equals(relationship.getCharacteristicTypeId()) && relationship.getGroup() > 0 && !excludedModuleIds.contains(relationship.getModuleId()); @@ -623,7 +619,7 @@ public ReasonerTaxonomyBuilder addActiveInferredRelationships(final Stream predicate = relationship -> relationship.isActive() - && CharacteristicType.INFERRED_RELATIONSHIP.equals(relationship.getCharacteristicType()) + && Concepts.INFERRED_RELATIONSHIP.equals(relationship.getCharacteristicTypeId()) && !excludedModuleIds.contains(relationship.getModuleId()); addRelationships(sortedRelationships.filter(predicate), existingInferredRelationships::putAll); @@ -748,7 +744,7 @@ private void addRelationships(final Stream sortedRelationshi final boolean destinationNegated = relationship.isDestinationNegated(); final int group = relationship.getGroup(); final int unionGroup = relationship.getUnionGroup(); - final boolean universal = RelationshipModifier.UNIVERSAL.equals(relationship.getModifier()); + final boolean universal = Concepts.UNIVERSAL_RESTRICTION_MODIFIER.equals(relationship.getModifierId()); final StatementFragment statement = new StatementFragment( typeId, diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/internal/rf2/SnomedDsvExportItemType.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/internal/rf2/SnomedDsvExportItemType.java index 65da8d62f29..84676f2b351 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/internal/rf2/SnomedDsvExportItemType.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/internal/rf2/SnomedDsvExportItemType.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,8 @@ public enum SnomedDsvExportItemType { MAP_ADVICE("Map advice"), CORRELATION("Correlation ID"), MAP_CATEGORY("Map category"), - SDD_CLASS("SDD Class"); + SDD_CLASS("SDD Class"), + MAP_BLOCK("Map block"); private final String displayName; diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/BaseSnomedComponentUpdateRequestBuilder.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/BaseSnomedComponentUpdateRequestBuilder.java index 47efcfa6243..ab44417f6ab 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/BaseSnomedComponentUpdateRequestBuilder.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/BaseSnomedComponentUpdateRequestBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2017 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.b2international.snowowl.core.domain.TransactionContext; import com.b2international.snowowl.core.events.BaseRequestBuilder; import com.b2international.snowowl.core.events.Request; +import com.b2international.snowowl.snomed.core.domain.InactivationProperties; /** * @since 4.5 @@ -30,6 +31,7 @@ public abstract class BaseSnomedComponentUpdateRequestBuilder doBuild() { final R req = create(componentId); @@ -59,6 +66,7 @@ protected final Request doBuild() { protected void init(R req) { req.setActive(active); req.setModuleId(moduleId); + req.setInactivationProperties(inactivationProperties); } protected abstract R create(String componentId); diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/EvaluateQueryRefSetMemberRequest.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/EvaluateQueryRefSetMemberRequest.java index aacfaf15380..6943cee7571 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/EvaluateQueryRefSetMemberRequest.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/EvaluateQueryRefSetMemberRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,14 +36,12 @@ import com.b2international.snowowl.snomed.common.SnomedRf2Headers; import com.b2international.snowowl.snomed.core.domain.SnomedConcept; import com.b2international.snowowl.snomed.core.domain.SnomedConcepts; -import com.b2international.snowowl.snomed.core.domain.SnomedCoreComponent; import com.b2international.snowowl.snomed.core.domain.refset.MemberChange; import com.b2international.snowowl.snomed.core.domain.refset.MemberChangeImpl; import com.b2international.snowowl.snomed.core.domain.refset.QueryRefSetMemberEvaluation; import com.b2international.snowowl.snomed.core.domain.refset.QueryRefSetMemberEvaluationImpl; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.datastore.index.entry.SnomedRefSetMemberIndexEntry; -import com.google.common.base.Function; import com.google.common.collect.FluentIterable; import com.google.common.collect.Maps; @@ -95,7 +93,7 @@ public QueryRefSetMemberEvaluation execute(BranchContext context) { final Map conceptsToAdd = newHashMap(); final Collection membersToRemove = newHashSet(); - final Map conceptsToActivate = Maps.newHashMap(); + final Collection conceptsToActivate = newHashSet(); // add all matching first for (SnomedConcept matchedConcept : matchingConcepts.getItems()) { @@ -114,25 +112,24 @@ public QueryRefSetMemberEvaluation execute(BranchContext context) { final String referencedComponentId = currentMember.getReferencedComponent().getId(); if (conceptsToAdd.containsKey(referencedComponentId)) { if (!currentMember.isActive()) { - // TODO fix reactivation label??? - conceptsToActivate.put(referencedComponentId, referencedComponentId); + conceptsToAdd.remove(referencedComponentId); + conceptsToActivate.add(currentMember); } else { conceptsToAdd.remove(referencedComponentId); } } else { - membersToRemove.add(currentMember); + if (currentMember.isActive()) { + membersToRemove.add(currentMember); + } } } // fetch all referenced components final Set referencedConceptIds = newHashSet(); referencedConceptIds.addAll(conceptsToAdd.keySet()); - referencedConceptIds.addAll(FluentIterable.from(membersToRemove).transform(new Function() { - @Override - public SnomedCoreComponent apply(SnomedReferenceSetMember input) { - return input.getReferencedComponent(); - } - }).transform(IComponent.ID_FUNCTION).toSet()); + referencedConceptIds.addAll(FluentIterable.from(membersToRemove).transform(SnomedReferenceSetMember::getReferencedComponent).transform(IComponent::getId).toSet()); + + referencedConceptIds.addAll(FluentIterable.from(conceptsToActivate).transform(SnomedReferenceSetMember::getReferencedComponent).transform(IComponent::getId).toSet()); final Map concepts; if (expand().containsKey("referencedComponent")) { @@ -143,7 +140,7 @@ public SnomedCoreComponent apply(SnomedReferenceSetMember input) { .setExpand(expandOptions.getOptions("expand")) .setLocales(locales()) .build() - .execute(context), IComponent.ID_FUNCTION); + .execute(context), IComponent::getId); } else { // initialize with empty SnomedConcept resources concepts = newHashMap(); @@ -162,10 +159,9 @@ public SnomedCoreComponent apply(SnomedReferenceSetMember input) { changes.add(MemberChangeImpl.removed(concepts.get(memberToRemove.getReferencedComponent().getId()), memberToRemove.getId())); } - // TODO reactivation??? -// for (String id : conceptsToActivate.keySet()) { -// changes.add(new Diff(MemberChangeKind.ACTIVATE, id, conceptsToActivate.get(id))); -// } + for (SnomedReferenceSetMember conceptToActivate : conceptsToActivate) { + changes.add(MemberChangeImpl.changed(concepts.get(conceptToActivate.getReferencedComponent().getId()), conceptToActivate.getId())); + } return new QueryRefSetMemberEvaluationImpl(memberId, targetReferenceSet, changes); } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/QueryRefSetMemberUpdateRequest.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/QueryRefSetMemberUpdateRequest.java index 405eb604bd4..5e361cb3076 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/QueryRefSetMemberUpdateRequest.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/QueryRefSetMemberUpdateRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,6 +85,18 @@ public Boolean execute(TransactionContext context) { .execute(context); } break; + case CHANGE: + final SnomedReferenceSetMember memberToChange = SnomedRequests.prepareGetMember(change.getMemberId()) + .build() + .execute(context); + if(!memberToChange.isActive()) { + SnomedRequests.prepareUpdateMember() + .setMemberId(change.getMemberId()) + .setSource(ImmutableMap.of(SnomedRf2Headers.FIELD_ACTIVE, Boolean.TRUE)) + .build() + .execute(context); + } + break; default: throw new UnsupportedOperationException("Not implemented case: " + change.getChangeKind()); } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/RefSetSupport.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/RefSetSupport.java index eefc728568a..78e2e82259d 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/RefSetSupport.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/RefSetSupport.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ private RefSetSupport() { .put(SnomedRefSetType.ATTRIBUTE_VALUE, SnomedTerminologyComponentConstants.RELATIONSHIP) .put(SnomedRefSetType.CONCRETE_DATA_TYPE, TerminologyRegistry.UNSPECIFIED) .put(SnomedRefSetType.COMPLEX_MAP, SnomedTerminologyComponentConstants.CONCEPT) + .put(SnomedRefSetType.COMPLEX_BLOCK_MAP, SnomedTerminologyComponentConstants.CONCEPT) .put(SnomedRefSetType.DESCRIPTION_TYPE, SnomedTerminologyComponentConstants.CONCEPT) .put(SnomedRefSetType.EXTENDED_MAP, SnomedTerminologyComponentConstants.CONCEPT) .put(SnomedRefSetType.LANGUAGE, SnomedTerminologyComponentConstants.DESCRIPTION) diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedAssociationTargetUpdateRequest.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedAssociationTargetUpdateRequest.java index 832a590a602..d6400a2b40a 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedAssociationTargetUpdateRequest.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/SnomedAssociationTargetUpdateRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg + * Copyright 2011-2020 B2i Healthcare Pte Ltd, http://b2i.sg * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,18 +17,16 @@ import static com.google.common.collect.Lists.newArrayList; -import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map.Entry; -import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.b2international.snowowl.core.domain.TransactionContext; +import com.b2international.snowowl.snomed.common.SnomedConstants.Concepts; import com.b2international.snowowl.snomed.common.SnomedRf2Headers; -import com.b2international.snowowl.snomed.core.domain.AssociationType; import com.b2international.snowowl.snomed.core.domain.SnomedComponent; import com.b2international.snowowl.snomed.core.domain.refset.SnomedReferenceSetMember; import com.b2international.snowowl.snomed.core.store.SnomedComponents; @@ -40,7 +38,7 @@ import com.google.common.collect.Multimap; /** - * Updates association reference set members on the {@link Inactivatable} specified by identifier. + * Updates association reference set members on a core component specified by identifier. *

    * Existing members are removed when: *