From ec978038d19ad819c3a7fb13c475e0fe2b3ccbfa Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Fri, 8 May 2020 23:02:45 +0200 Subject: [PATCH 01/22] Adding Remote energy info in EnergyScan --- ...2020_05_08_EnergyScan_add_remoteEnergy.sql | 61 +++++++++++++++++++ .../common/util/export/ExiPdfRtfExporter.java | 27 ++++++-- .../mx/vos/collections/EnergyScan3VO.java | 44 ++++++++++++- .../client/mx/collection/PdfRtfExporter.java | 19 ++++++ .../collection/ViewSessionSummaryAction.java | 12 ++++ .../js/ispyb/mx/collection/energyScanGrid.js | 27 ++++++++ 6 files changed, 183 insertions(+), 7 deletions(-) create mode 100644 ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql diff --git a/ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql b/ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql new file mode 100644 index 000000000..070397cca --- /dev/null +++ b/ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql @@ -0,0 +1,61 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2020_05_08_EnergyScan_add_remoteEnergy.sql', 'ONGOING'); + +ALTER TABLE `pydb`.`EnergyScan` +ADD COLUMN `remoteEnergy` FLOAT NULL DEFAULT NULL AFTER `blSubSampleId`, +ADD COLUMN `remoteFPrime` FLOAT NULL DEFAULT NULL AFTER `remoteEnergy`, +ADD COLUMN `remoteFDoublePrime` FLOAT NULL DEFAULT NULL AFTER `remoteFPrime`; + +USE `pydb`; +CREATE + OR REPLACE ALGORITHM = MERGE + DEFINER = `pxadmin`@`%` + SQL SECURITY DEFINER +VIEW `v_energyScan` AS + SELECT + `EnergyScan`.`energyScanId` AS `energyScanId`, + `EnergyScan`.`sessionId` AS `sessionId`, + `EnergyScan`.`blSampleId` AS `blSampleId`, + `EnergyScan`.`fluorescenceDetector` AS `fluorescenceDetector`, + `EnergyScan`.`scanFileFullPath` AS `scanFileFullPath`, + `EnergyScan`.`choochFileFullPath` AS `choochFileFullPath`, + `EnergyScan`.`jpegChoochFileFullPath` AS `jpegChoochFileFullPath`, + `EnergyScan`.`element` AS `element`, + `EnergyScan`.`startEnergy` AS `startEnergy`, + `EnergyScan`.`endEnergy` AS `endEnergy`, + `EnergyScan`.`transmissionFactor` AS `transmissionFactor`, + `EnergyScan`.`exposureTime` AS `exposureTime`, + `EnergyScan`.`synchrotronCurrent` AS `synchrotronCurrent`, + `EnergyScan`.`temperature` AS `temperature`, + `EnergyScan`.`peakEnergy` AS `peakEnergy`, + `EnergyScan`.`peakFPrime` AS `peakFPrime`, + `EnergyScan`.`peakFDoublePrime` AS `peakFDoublePrime`, + `EnergyScan`.`inflectionEnergy` AS `inflectionEnergy`, + `EnergyScan`.`inflectionFPrime` AS `inflectionFPrime`, + `EnergyScan`.`inflectionFDoublePrime` AS `inflectionFDoublePrime`, + `EnergyScan`.`xrayDose` AS `xrayDose`, + `EnergyScan`.`startTime` AS `startTime`, + `EnergyScan`.`endTime` AS `endTime`, + `EnergyScan`.`edgeEnergy` AS `edgeEnergy`, + `EnergyScan`.`filename` AS `filename`, + `EnergyScan`.`beamSizeVertical` AS `beamSizeVertical`, + `EnergyScan`.`beamSizeHorizontal` AS `beamSizeHorizontal`, + `EnergyScan`.`crystalClass` AS `crystalClass`, + `EnergyScan`.`comments` AS `comments`, + `EnergyScan`.`flux` AS `flux`, + `EnergyScan`.`flux_end` AS `flux_end`, + `EnergyScan`.`remoteEnergy` AS `remoteEnergy`, + `EnergyScan`.`remoteFPrime` AS `remoteFPrime`, + `EnergyScan`.`remoteFDoublePrime` AS `remoteFDoublePrime`, + `BLSample`.`blSampleId` AS `BLSample_sampleId`, + `BLSample`.`name` AS `name`, + `BLSample`.`code` AS `code`, + `Protein`.`acronym` AS `acronym`, + `BLSession`.`proposalId` AS `BLSession_proposalId` + FROM + ((((`EnergyScan` + LEFT JOIN `BLSample` ON ((`BLSample`.`blSampleId` = `EnergyScan`.`blSampleId`))) + LEFT JOIN `Crystal` ON ((`Crystal`.`crystalId` = `BLSample`.`crystalId`))) + LEFT JOIN `Protein` ON ((`Protein`.`proteinId` = `Crystal`.`proteinId`))) + LEFT JOIN `BLSession` ON ((`BLSession`.`sessionId` = `EnergyScan`.`sessionId`))); + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2020_05_08_EnergyScan_add_remoteEnergy.sql'; \ No newline at end of file diff --git a/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java b/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java index bff3980f6..854b0fe80 100644 --- a/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java +++ b/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java @@ -810,7 +810,10 @@ private void setEnergyScanMapData(Document document, Map energyS + "Pk f'': \n" + "Inflection Energy: \n" + "Ip f': \n" - + "Ip f'': \n" ; + + "Ip f'': \n" + + "Remote Energy: \n" + + "Remote f': \n" + + "Remote f'': \n" ; table.addCell(new Paragraph(parag, FONT_DOC)); @@ -819,9 +822,12 @@ private void setEnergyScanMapData(Document document, Map energyS parag = getCellParam(energyScanMapItem, "peakEnergy", df3) + "keV \n" + getCellParam(energyScanMapItem, "peakFPrime", df2) + " e- \n" + getCellParam(energyScanMapItem, "peakFDoublePrime", df2) + " e- \n" - + "("+ getCellParam(energyScanMapItem, "inflectionEnergy", df2) + "keV \n" + + getCellParam(energyScanMapItem, "inflectionEnergy", df2) + "keV \n" + getCellParam(energyScanMapItem, "inflectionFPrime", df2) + " e- \n" - + getCellParam(energyScanMapItem, "inflectionFDoublePrime", df2) + " e- \n" ; + + getCellParam(energyScanMapItem, "inflectionFDoublePrime", df2) + " e- \n" + + getCellParam(energyScanMapItem, "remoteEnergy", df2) + "keV \n" + + getCellParam(energyScanMapItem, "remoteFPrime", df2) + " e- \n" + + getCellParam(energyScanMapItem, "remoteFDoublePrime", df2) + " e- \n" ;; table.addCell(new Paragraph(parag, FONT_DOC_BOLD)); @@ -1173,7 +1179,7 @@ private void setEnergyScanMapData2(Document document, Map energy String parag = getCellParam(energyScanMapItem, "scanFileFullPath", null) + "\n" ; document.add(new Paragraph(parag, FONT_DOC_SMALL)); - Table table = new Table(9); + Table table = new Table(11); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setBorderWidth(0); table.setBorder(0); @@ -1250,7 +1256,18 @@ private void setEnergyScanMapData2(Document document, Map energy parag = getCellParam(energyScanMapItem, "inflectionEnergy", df2) + "keV \n" + getCellParam(energyScanMapItem, "inflectionFPrime", df2) + " e- \n" + getCellParam(energyScanMapItem, "inflectionFDoublePrime", df2) + " e- \n" ; - + + // Cell 10 + parag = "Remote Energy: \n" + + "Remote f': \n" + + "Remote f'': \n" ; + + table.addCell(new Paragraph(parag, FONT_DOC_SMALL)); + + // Cell 11 + parag = getCellParam(energyScanMapItem, "remoteEnergy", df2) + "keV \n" + + getCellParam(energyScanMapItem, "remoteFPrime", df2) + " e- \n" + + getCellParam(energyScanMapItem, "remoteFDoublePrime", df2) + " e- \n" ; table.addCell(new Paragraph(parag, FONT_DOC_SMALL_BOLD)); document.add(table); diff --git a/ispyb-ejb/src/main/java/ispyb/server/mx/vos/collections/EnergyScan3VO.java b/ispyb-ejb/src/main/java/ispyb/server/mx/vos/collections/EnergyScan3VO.java index 433e1dab1..8cecbf1e9 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/mx/vos/collections/EnergyScan3VO.java +++ b/ispyb-ejb/src/main/java/ispyb/server/mx/vos/collections/EnergyScan3VO.java @@ -149,6 +149,15 @@ public class EnergyScan3VO extends ISPyBValueObject implements Cloneable { @Column(name = "workingDirectory") protected String workingDirectory; + + @Column(name = "remoteEnergy") + protected Double remoteEnergy; + + @Column(name = "remoteFPrime") + protected Double remoteFPrime; + + @Column(name = "remoteFDoublePrime") + protected Double remoteFDoublePrime; @ManyToOne @JoinColumn(name = "blSubSampleId") @@ -169,7 +178,8 @@ public EnergyScan3VO(Integer energyScanId, Session3VO sessionVO, BLSample3VO sam Double inflectionFDoublePrime, Double xrayDose, Date startTime, Date endTime, String edgeEnergy, String filename, Float beamSizeVertical, Float beamSizeHorizontal, - String crystalClass, String comments, Double flux, Double flux_end) { + String crystalClass, String comments, Double flux, Double flux_end, + Double remoteEnergy, Double remoteFPrime, Double remoteFDoublePrime) { super(); this.energyScanId = energyScanId; this.sessionVO = sessionVO; @@ -202,6 +212,9 @@ public EnergyScan3VO(Integer energyScanId, Session3VO sessionVO, BLSample3VO sam this.comments = comments; this.flux = flux; this.flux_end = flux_end; + this.remoteEnergy = remoteEnergy; + this.remoteFPrime = remoteFPrime; + this.remoteFDoublePrime = remoteFDoublePrime; } @@ -238,6 +251,9 @@ public EnergyScan3VO(EnergyScan3VO vo) { this.comments = vo.getComments(); this.flux = vo.getFlux(); this.flux_end = vo.getFlux_end(); + this.remoteEnergy = vo.getRemoteEnergy(); + this.remoteFPrime = vo.getRemoteFPrime(); + this.remoteFDoublePrime = vo.getRemoteFDoublePrime(); } @@ -274,6 +290,9 @@ public void fillVOFromLight(EnergyScanWS3VO vo) { this.comments = vo.getComments(); this.flux = vo.getFlux(); this.flux_end = vo.getFlux_end(); + this.remoteEnergy = vo.getRemoteEnergy(); + this.remoteFPrime = vo.getRemoteFPrime(); + this.remoteFDoublePrime = vo.getRemoteFDoublePrime(); } @@ -555,6 +574,24 @@ public void setFlux_end(Double flux_end) { this.flux_end = flux_end; } + public Double getRemoteEnergy() { return remoteEnergy; } + public void setRemoteEnergy(Double remoteEnergy) { + this.remoteEnergy = remoteEnergy; + } + + public Double getRemoteFPrime() { + return remoteFPrime; + } + public void setRemoteFPrime(Double remoteFPrime) { + this.remoteFPrime = remoteFPrime; + } + + public Double getRemoteFDoublePrime() { + return remoteFDoublePrime; + } + public void setRemoteFDoublePrime(Double remoteFDoublePrime) { + this.remoteFDoublePrime = remoteFDoublePrime; + } /** @@ -637,7 +674,10 @@ public String toWSString(){ "crystalClass="+this.crystalClass+", "+ "comments="+this.comments+", "+ "flux="+this.flux+", "+ - "flux_end="+this.flux_end; + "flux_end="+this.flux_end+", "+ + "remoteEnergy="+this.remoteEnergy+", "+ + "remoteFPrime="+this.remoteFPrime+", "+ + "remoteFDoublePrime="+this.remoteFDoublePrime; return s; } diff --git a/ispyb-ui/src/main/java/ispyb/client/mx/collection/PdfRtfExporter.java b/ispyb-ui/src/main/java/ispyb/client/mx/collection/PdfRtfExporter.java index cc2e0200e..ef124477c 100644 --- a/ispyb-ui/src/main/java/ispyb/client/mx/collection/PdfRtfExporter.java +++ b/ispyb-ui/src/main/java/ispyb/client/mx/collection/PdfRtfExporter.java @@ -871,6 +871,9 @@ private void setEnergyScansTable(Document document) throws Exception { tableES.addCell(new Paragraph("Beam size Hor.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Beam size Ver.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Transm. Factor\n(%)", FONT_DOC_BOLD)); + tableES.addCell(new Paragraph("Remote Energy\n(keV)", FONT_DOC_BOLD)); + tableES.addCell(new Paragraph("Remote f'\n(e)", FONT_DOC_BOLD)); + tableES.addCell(new Paragraph("Remote f''\n(e)", FONT_DOC_BOLD)); // Column crystalClass only for IFX proposal in case of MXPress // experiment if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) @@ -940,6 +943,22 @@ private void setEnergyScansTable(Document document) throws Exception { else tableES.addCell(""); + if (col.getRemoteEnergy() != null) + tableES.addCell(new Paragraph(col.getRemoteEnergy().toString(), FONT_DOC)); + else + tableES.addCell(""); + + if (col.getRemoteFPrime() != null) + tableES.addCell(new Paragraph(col.getRemoteFPrime().toString(), FONT_DOC)); + else + tableES.addCell(""); + + if (col.getRemoteFDoublePrime() != null) + tableES.addCell(new Paragraph(col.getRemoteFDoublePrime().toString(), FONT_DOC)); + else + tableES.addCell(""); + + if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // if (col.getCrystalClass()!= null) tableES.addCell(new // Paragraph(col.getCrystalClass().toString(), diff --git a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java index b6a0d2c86..b22ad108a 100644 --- a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java +++ b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java @@ -171,6 +171,12 @@ public class ViewSessionSummaryAction extends DispatchAction { public final static String KEY_PEAK_ENERGY_DOUBLE_PRIME = "peakEnergyDoublePrime"; + public final static String KEY_REMOTE_ENERGY = "remoteEnergy"; + + public final static String KEY_REMOTE_ENERGY_PRIME = "remoteEnergyPrime"; + + public final static String KEY_REMOTE_ENERGY_DOUBLE_PRIME = "remoteEnergyDoublePrime"; + public final static String KEY_UNIT_CELL = "unitCell"; public final static String KEY_UNIT_CELL_TITLE = "unitCellTitle"; @@ -918,6 +924,12 @@ private static SessionDataObjectInformation getSessionDataObjectForEnergyScan(Se + (energyScan.getPeakFPrime() == null ? "" : energyScan.getPeakFPrime() + ""), false)); listResults.add(new Param(KEY_PEAK_ENERGY_DOUBLE_PRIME, "Peak f''", "" + (energyScan.getPeakFDoublePrime() == null ? "" : energyScan.getPeakFDoublePrime() + ""), false)); + listResults.add(new Param(KEY_REMOTE_ENERGY, "Remote Energy", "" + + (energyScan.getRemoteEnergy() == null ? "" : energyScan.getRemoteEnergy() + " keV"), false)); + listResults.add(new Param(KEY_REMOTE_ENERGY_PRIME, "Remote f'", "" + + (energyScan.getRemoteFPrime() == null ? "" : energyScan.getRemoteFPrime() + ""), false)); + listResults.add(new Param(KEY_REMOTE_ENERGY_DOUBLE_PRIME, "Remote f''", "" + + (energyScan.getRemoteFDoublePrime() == null ? "" : energyScan.getRemoteFDoublePrime() + ""), false)); info.setListResults(listResults); return info; diff --git a/ispyb-ui/src/main/webapp/js/ispyb/mx/collection/energyScanGrid.js b/ispyb-ui/src/main/webapp/js/ispyb/mx/collection/energyScanGrid.js index 88cb5fb2d..41d9fb3d1 100644 --- a/ispyb-ui/src/main/webapp/js/ispyb/mx/collection/energyScanGrid.js +++ b/ispyb-ui/src/main/webapp/js/ispyb/mx/collection/energyScanGrid.js @@ -135,6 +135,15 @@ function EnergyScanGrid(args) { name : 'inflectionFDoublePrime', mapping : 'inflectionFDoublePrime' }, { + name : 'remoteEnergy', + mapping : 'remoteEnergy' + }, { + name : 'remoteFPrime', + mapping : 'remoteFPrime' + }, { + name : 'remoteFDoublePrime', + mapping : 'remoteFDoublePrime' + }, { name : 'xrayDose', mapping : 'xrayDose' }, { @@ -466,6 +475,24 @@ EnergyScanGrid.prototype._getColumns = function () { renderer : renderNumberFormat1, id : 'peakFDoublePrime' }, { + text : 'Remote
Energy
(keV)', + dataIndex : 'remoteEnergy', + flex : 0.05, + renderer : renderNumberFormat3, + id : 'remoteEnergy' + }, { + text : 'Remote
f\'
(e)', + dataIndex : 'remoteFPrime', + flex : 0.05, + renderer : renderNumberFormat1, + id : 'remoteFPrime' + }, { + text : 'Remote
f\'\'
(e)', + dataIndex : 'remoteFDoublePrime', + flex : 0.05, + renderer : renderNumberFormat1, + id : 'remoteFDoublePrime' + }, { text : 'Start Time', dataIndex : 'startTime', renderer : Ext.util.Format.dateRenderer('d-m-Y H:i:s'), From 7848fbc5ca4132c3469379133cd65398244732d9 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 11 May 2020 09:15:05 +0200 Subject: [PATCH 02/22] Updating ESRF library --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 399c31217..96868f4de 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN mvn install:install-file -Dfile=dependencies/securityfilter.jar -DgroupId=se mvn install:install-file -Dfile=dependencies/jhdf5.jar -DgroupId=jhdf5 -DartifactId=jhdf5 -Dversion=1.0 -Dpackaging=jar && \ mvn install:install-file -Dfile=dependencies/jhdf5obj.jar -DgroupId=jhdf5obj -DartifactId=jhdf5obj -Dversion=1.0 -Dpackaging=jar && \ mvn install:install-file -Dfile=dependencies/jhdfobj.jar -DgroupId=jhdfobj -DartifactId=jhdfobj -Dversion=1.0 -Dpackaging=jar && \ - mvn install:install-file -Dfile=dependencies/ispyb-userportal-gen-1.5.jar -DgroupId=ispyb -DartifactId=ispyb-userportal-gen -Dversion=1.5 -Dpackaging=jar && \ + mvn install:install-file -Dfile=dependencies/ispyb-userportal-gen-1.6.jar -DgroupId=ispyb -DartifactId=ispyb-userportal-gen -Dversion=1.6 -Dpackaging=jar && \ mvn install:install-file -Dfile=dependencies/Struts-Layout-1.2.jar -DgroupId=struts-layout -DartifactId=struts-layout -Dversion=1.2 -Dpackaging=jar && \ mvn install -Dispyb.site=MAXIV -Dispyb.env=production && \ cp ispyb-ear/target/ispyb.ear /var/ispyb.ear From 1a83d94a2333ee89d77557a23eac81e60de5faa5 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 18 May 2020 10:37:24 +0200 Subject: [PATCH 03/22] Log the energy scan object from mxCube --- .../java/ispyb/ws/soap/mx/ToolsForCollectionWebService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ispyb-ws/src/main/java/ispyb/ws/soap/mx/ToolsForCollectionWebService.java b/ispyb-ws/src/main/java/ispyb/ws/soap/mx/ToolsForCollectionWebService.java index 691b8c06a..f7a59825b 100644 --- a/ispyb-ws/src/main/java/ispyb/ws/soap/mx/ToolsForCollectionWebService.java +++ b/ispyb-ws/src/main/java/ispyb/ws/soap/mx/ToolsForCollectionWebService.java @@ -843,7 +843,7 @@ public Integer storeOrUpdateXFEFluorescenceSpectrum(@WebParam(name = "xfeFluores public Integer storeOrUpdateEnergyScan(@WebParam(name = "energyScan") EnergyScanWS3VO vo) throws Exception { try { - LOG.debug("storeOrUpdateEnergyScan"); + LOG.debug("storeOrUpdateEnergyScan - " +vo.toWSString()); // if vo is null we return null, no creation if (vo == null) return null; From 07753a0a9368ad37a361eda5f21d0c4dae535da1 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 18 May 2020 10:38:34 +0200 Subject: [PATCH 04/22] Logging ldap env info to try to fix managers login --- .../src/main/java/ispyb/server/security/LdapLoginModule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java b/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java index 5df896a43..0119af035 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java +++ b/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java @@ -283,6 +283,7 @@ private void createLdapInitContext(String username, Object credential) throws Na env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put("jboss.security.security_domain", "ispyb"); env.put("allowEmptyPasswords", "false"); + LOG.debug("Env:" + env); } From c9fb5427c4669c53245178098b8b5cbb00cb0d74 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 18 May 2020 11:21:12 +0200 Subject: [PATCH 05/22] Logging ldap env info to try to fix managers login --- .../main/java/ispyb/server/security/LdapLoginModule.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java b/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java index 0119af035..1c499b20c 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java +++ b/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java @@ -283,7 +283,7 @@ private void createLdapInitContext(String username, Object credential) throws Na env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put("jboss.security.security_domain", "ispyb"); env.put("allowEmptyPasswords", "false"); - LOG.debug("Env:" + env); + LOG.info("Env:" + env); } @@ -295,7 +295,7 @@ private void createLdapInitContext(String username, Object credential) throws Na ctx = new InitialLdapContext(env, null); }catch (Exception ex){ if (username.equals("ispyb")) { - LOG.debug("Env:" + env); + LOG.info("Env:" + env); } throw ex; } @@ -367,12 +367,12 @@ private void createLdapInitContext(String username, Object credential) throws Na Attribute roles = attrs.get(groupAttrName); for (int r = 0; r < roles.size(); r++) { - Object value = roles.get(r); String roleName = null; roleName = value.toString(); // fill roles array if (roleName != null) { + LOG.info("Role found for " +username +":" +roleName); if (roleName.equals("ispyb-manager") || roleName.equals("ispyb-biomax-contacts") || roleName.equals("Information Management") || roleName.equals("biomax")) { userRoles.addMember(new SimplePrincipal(Constants.ROLE_MANAGER)); From e05459211425a808ebe1876d42d11a57c370c286 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 18 May 2020 13:01:52 +0200 Subject: [PATCH 06/22] Logging ldap env info to try to fix managers login --- .../src/main/java/ispyb/server/security/LdapLoginModule.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java b/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java index 1c499b20c..4880c3663 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java +++ b/ispyb-ejb/src/main/java/ispyb/server/security/LdapLoginModule.java @@ -283,7 +283,7 @@ private void createLdapInitContext(String username, Object credential) throws Na env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put("jboss.security.security_domain", "ispyb"); env.put("allowEmptyPasswords", "false"); - LOG.info("Env:" + env); + //LOG.info("Env:" + env); } @@ -294,7 +294,7 @@ private void createLdapInitContext(String username, Object credential) throws Na try { ctx = new InitialLdapContext(env, null); }catch (Exception ex){ - if (username.equals("ispyb")) { + if (Constants.SITE_IS_MAXIV() && username.equals("ispyb")) { LOG.info("Env:" + env); } throw ex; From dc7c6ffe39ebddbfb8bd9676ca6e294dcaea8a20 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 25 May 2020 12:42:16 +0200 Subject: [PATCH 07/22] Fixing view result page for MAXIV energy scan --- .../collection/ViewSessionSummaryAction.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java index b22ad108a..7965d5439 100644 --- a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java +++ b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java @@ -57,6 +57,7 @@ import ispyb.server.mx.vos.sample.BLSample3VO; import java.lang.reflect.Type; +import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; @@ -943,18 +944,26 @@ private static SessionDataObjectInformation getSessionDataObjectForXRFSpectra(Se info.setImagePrefix(""); info.setImageThumbnailPath(""); info.setCrystalSnapshotPath(""); + Float energy = xrfSpectrum.getEnergy(); + String energyValue = Float.toString(energy) +" keV"; + if (Constants.SITE_IS_MAXIV()){ + DecimalFormat decimalFormat = new DecimalFormat("#.##"); + energyValue = decimalFormat.format(energy) +" keV"; + } + // parameters List listParameters = new ArrayList(); - listParameters.add(new Param(KEY_ENERGY, "Energy", xrfSpectrum.getEnergy() == null ? "" : Float - .toString(xrfSpectrum.getEnergy()), false)); + listParameters.add(new Param(KEY_ENERGY, "Energy", xrfSpectrum.getEnergy() == null ? "" : energyValue, false)); listParameters.add(new Param(KEY_EXPOSURE_TIME, "Exposure time", (xrfSpectrum.getExposureTime() == null ? "" : ("" + xrfSpectrum.getExposureTime() + " s")), false)); - listParameters - .add(new Param(KEY_BEAMSIZE_HOR, "Beam size Hor", (xrfSpectrum.getBeamSizeHorizontal() == null ? "" - : ("" + xrfSpectrum.getBeamSizeHorizontal() + " μm")), false)); - listParameters.add(new Param(KEY_BEAMSIZE_VERT, "Beam size Vert", - (xrfSpectrum.getBeamSizeVertical() == null ? "" : ("" + xrfSpectrum.getBeamSizeVertical() + " μm")), - false)); + if (!Constants.SITE_IS_MAXIV()) { + listParameters + .add(new Param(KEY_BEAMSIZE_HOR, "Beam size Hor", (xrfSpectrum.getBeamSizeHorizontal() == null ? "" + : ("" + xrfSpectrum.getBeamSizeHorizontal() + " μm")), false)); + listParameters.add(new Param(KEY_BEAMSIZE_VERT, "Beam size Vert", + (xrfSpectrum.getBeamSizeVertical() == null ? "" : ("" + xrfSpectrum.getBeamSizeVertical() + " μm")), + false)); + } info.setListParameters(listParameters); // comments info.setComments(xrfSpectrum.getComments()); @@ -979,7 +988,7 @@ private static SessionDataObjectInformation getSessionDataObjectForXRFSpectra(Se int annotatedPymcaXfeSpectrumExists = PathUtils.fileExists(xrfSpectrum.getAnnotatedPymcaXfeSpectrum()); String shortFileNameAnnotatedPymcaXfeSpectrum = StringUtils.getShortFilename(xrfSpectrum .getAnnotatedPymcaXfeSpectrum()); - if (annotatedPymcaXfeSpectrumExists == 0) { + if (annotatedPymcaXfeSpectrumExists == 0 && !Constants.SITE_IS_MAXIV()) { result = "Html report not found: " + shortFileNameAnnotatedPymcaXfeSpectrum; } else if (annotatedPymcaXfeSpectrumExists == 1) { result = shortFileNameAnnotatedPymcaXfeSpectrum; From ec3a37c7eb4c73d57b46a9b1bc978f9afef7a655 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 25 May 2020 12:59:23 +0200 Subject: [PATCH 08/22] Fixing view result page for MAXIV energy scan --- .../mx/collection/ViewSessionSummaryAction.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java index 7965d5439..faff14399 100644 --- a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java +++ b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java @@ -883,12 +883,14 @@ private static SessionDataObjectInformation getSessionDataObjectForEnergyScan(Se listParameters.add(new Param(KEY_TRANSMISSION, "Transmission factor", (energyScan.getTransmissionFactor() == null ? "" : ("" + energyScan.getTransmissionFactor() + " %")), false)); - listParameters.add(new Param(KEY_BEAMSIZE_HOR, "Beam size Hor", - (energyScan.getBeamSizeHorizontal() == null ? "" : ("" + energyScan.getBeamSizeHorizontal() + " μm")), - false)); - listParameters.add(new Param(KEY_BEAMSIZE_VERT, "Beam size Vert", - (energyScan.getBeamSizeVertical() == null ? "" : ("" + energyScan.getBeamSizeVertical() + " μm")), - false)); + if (!Constants.SITE_IS_MAXIV()) { + listParameters.add(new Param(KEY_BEAMSIZE_HOR, "Beam size Hor", + (energyScan.getBeamSizeHorizontal() == null ? "" : ("" + energyScan.getBeamSizeHorizontal() + " μm")), + false)); + listParameters.add(new Param(KEY_BEAMSIZE_VERT, "Beam size Vert", + (energyScan.getBeamSizeVertical() == null ? "" : ("" + energyScan.getBeamSizeVertical() + " μm")), + false)); + } info.setListParameters(listParameters); // comments info.setComments(energyScan.getComments()); From 1a98075bcde1175aa40921b2cf8f7cea5d0727e7 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Thu, 11 Jun 2020 13:50:07 +0200 Subject: [PATCH 09/22] Customize spectrum info for MAXIV --- .../mx/collection/ViewSessionSummaryAction.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java index faff14399..7d4264930 100644 --- a/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java +++ b/ispyb-ui/src/main/java/ispyb/client/mx/collection/ViewSessionSummaryAction.java @@ -57,7 +57,6 @@ import ispyb.server.mx.vos.sample.BLSample3VO; import java.lang.reflect.Type; -import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; @@ -872,7 +871,12 @@ private static SessionDataObjectInformation getSessionDataObjectForEnergyScan(Se EnergyScan3VO energyScan = sessionDataObject.getEnergyScan(); // experimentType info.setExperimentType("Energy Scan"); - info.setImagePrefix(""); + if (Constants.SITE_IS_MAXIV()){ + info.setImagePrefix(energyScan.getFilename()); + } else { + info.setImagePrefix(""); + } + info.setImageThumbnailPath(""); info.setCrystalSnapshotPath(""); // parameters @@ -901,7 +905,7 @@ private static SessionDataObjectInformation getSessionDataObjectForEnergyScan(Se info.setProteinAcronym(""); info.setSampleName(""); info.setSampleNameProtein(""); - if (energyScan.getBlSampleVO() != null) { + if (energyScan.getBlSampleVO() != null && !Constants.SITE_IS_MAXIV()) { setSampleAndProteinNames(info, energyScan.getBlSampleVO()); } @@ -943,6 +947,11 @@ private static SessionDataObjectInformation getSessionDataObjectForXRFSpectra(Se XFEFluorescenceSpectrum3VO xrfSpectrum = sessionDataObject.getXrfSpectra(); // experimentType info.setExperimentType("XRFSpectrum"); + if (Constants.SITE_IS_MAXIV()){ + info.setImagePrefix(xrfSpectrum.getFilename()); + } else { + info.setImagePrefix(""); + } info.setImagePrefix(""); info.setImageThumbnailPath(""); info.setCrystalSnapshotPath(""); @@ -976,7 +985,7 @@ private static SessionDataObjectInformation getSessionDataObjectForXRFSpectra(Se info.setProteinAcronym(""); info.setSampleName(""); info.setSampleNameProtein(""); - if (xrfSpectrum.getBlSampleVO() != null) { + if (xrfSpectrum.getBlSampleVO() != null && !Constants.SITE_IS_MAXIV()) { setSampleAndProteinNames(info, xrfSpectrum.getBlSampleVO()); } From 7af3c1b550c2c08dcee71d9a931717d962f70ba4 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Thu, 11 Jun 2020 13:50:33 +0200 Subject: [PATCH 10/22] Getting local contact info from DUO --- .../webservice/smis/util/MAXIVWebService.java | 58 ++++++++++++++++--- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java index cb960d21d..af515a341 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java +++ b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java @@ -2,7 +2,6 @@ import java.io.InputStreamReader; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Date; @@ -37,7 +36,6 @@ import org.json.JSONArray; import org.json.JSONObject; -import generated.ws.smis.FinderException; import generated.ws.smis.Exception_Exception; import generated.ws.smis.ExpSessionInfoLightVO; import generated.ws.smis.FinderException_Exception; @@ -54,8 +52,10 @@ public class MAXIVWebService implements SMISWebService { private String serverUrl = ""; - public MAXIVWebService() { - this.serverUrl = Constants.getProperty("userportal.url"); + public void init() { + if ("".equals(this.serverUrl)) { + this.serverUrl = Constants.getProperty("userportal.url"); + } } public List findNewMXProposalPKs_OLD (String startDateStr, String endDateStr) { @@ -91,6 +91,7 @@ public List findNewMXProposalPKs_OLD (String startDateStr, String endDateS public List findNewMXProposalPKs (String startDateStr, String endDateStr) { List pks = new ArrayList(); + init(); try { StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Sessions/?access_token=") .append(this.getToken()) @@ -261,18 +262,34 @@ public List findParticipantsForProposal(Long pro public List findRecentSessionsInfoLightForProposalPkAndDays(Long propId, Integer days){ List sessions = new ArrayList(); - + init(); JSONObject jsonProposal = getProposalForId(propId); ArrayList jsonSessions = new ArrayList(); + ArrayList jsonLocalContacts = new ArrayList(); + InnerScientistVO localContact = new InnerScientistVO(); + try { jsonSessions = getSessionsForProposal(propId); } catch (Exception ex) { ex.printStackTrace(); } + try { + jsonLocalContacts = getProposalLocalContactForPropid(propId); + localContact.setName((String) jsonLocalContacts.get(0).get("lastname")); + localContact.setFirstName((String) jsonLocalContacts.get(0).get("firstname")); + localContact.setPhone((String) jsonLocalContacts.get(0).get("phone")); + localContact.setEmail((String) jsonLocalContacts.get(0).get("email")); + localContact.setTitle((String) jsonLocalContacts.get(0).get("title")); + } catch (Exception ex) { + ex.printStackTrace(); + localContact.setFirstName("Manager"); + localContact.setName("BioMAX"); + } for(JSONObject jsonSession : jsonSessions){ ExpSessionInfoLightVO session = new ExpSessionInfoLightVO(); - + + try{ ArrayList jsonShifts = getShiftsForSession((Integer)jsonSession.get("sessionid")); if(jsonShifts.size() != 0){ @@ -285,9 +302,6 @@ public List findRecentSessionsInfoLightForProposalPkAndDa session.setExperimentPk(propId); session.setComment("Created by DUO"); session.setPk(new Long((int)jsonSession.get("sessionid"))); - InnerScientistVO localContact = new InnerScientistVO(); - localContact.setName("Muller"); - localContact.setFirstName("Uwe"); session.setFirstLocalContact(localContact); String title = (String)jsonProposal.get("title"); if(title.length() >= 200){ @@ -397,6 +411,7 @@ public long getProposalPK(String arg0, Long arg1) throws FinderException_Excepti private JSONObject getProposalForId(Long propId){ JSONObject proposal = null; + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Proposals/") .append(propId).append("?access_token=").append(this.getToken()); @@ -406,8 +421,27 @@ private JSONObject getProposalForId(Long propId){ return proposal; } + private ArrayList getProposalLocalContactForPropid(Long propId)throws Exception { + ArrayList localContacts = new ArrayList(); + init(); + + StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Proposals/") + .append(propId).append("/localcontacts").append("?access_token=").append(this.getToken()); + + JSONArray jsonLocalContacts = readJsonArrayFromUrl(url.toString()); + + int len = jsonLocalContacts.length(); + for (int i = 0; i < len; i++) { + JSONObject jsonLocalContact = (JSONObject) jsonLocalContacts.get(i); + localContacts.add(jsonLocalContact); + } + + return localContacts; + } + private ArrayList getProposalAuthorsForPropid(Long propId)throws Exception { ArrayList authors = new ArrayList(); + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Proposals/") .append(propId).append("/authors").append("?access_token=").append(this.getToken()); @@ -425,6 +459,7 @@ private ArrayList getProposalAuthorsForPropid(Long propId)throws Exc private ArrayList getBeamlinesForProposal(Long propId){ ArrayList beamlines = new ArrayList(); + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Proposals/") .append(propId).append("/beamlines").append("?access_token=").append(this.getToken()); @@ -442,6 +477,7 @@ private ArrayList getBeamlinesForProposal(Long propId){ private ArrayList getSessionsForProposal(Long propId) throws Exception { ArrayList sessions = new ArrayList(); + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Proposals/") .append(propId).append("/sessions/").append("?access_token=").append(this.getToken()); @@ -460,6 +496,7 @@ private ArrayList getSessionsForProposal(Long propId) throws Excepti private ArrayList getShiftsForSession(Integer sessionId){ ArrayList shifts = new ArrayList(); + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Sessions/") .append(sessionId).append("/shifts").append("?access_token=").append(this.getToken()); @@ -477,6 +514,7 @@ private ArrayList getShiftsForSession(Integer sessionId){ private ArrayList getParticipantsForSession(Integer sessionId){ ArrayList participants = new ArrayList(); + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Sessions/") .append(sessionId).append("/participants").append("?access_token=").append(this.getToken()); @@ -494,6 +532,7 @@ private ArrayList getParticipantsForSession(Integer sessionId){ private JSONObject getUserForId(Integer userId){ JSONObject user = null; + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Clients/") .append(userId).append("?access_token=").append(this.getToken()); @@ -505,6 +544,7 @@ private JSONObject getUserForId(Integer userId){ private JSONObject getLabForId(Integer labId){ JSONObject lab = null; + init(); StringBuilder url = new StringBuilder("https://").append(this.serverUrl).append("/api/Institutes/") .append(labId).append("?access_token=").append(this.getToken()); From 1b03fdd9da5caf2d7029c4a8390768af034f58c2 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 29 Jun 2020 16:22:37 +0200 Subject: [PATCH 11/22] Fixing local contact import during the sychronization process --- .../java/ispyb/server/webservice/smis/util/MAXIVWebService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java index fcf9931e9..ff502deea 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java +++ b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java @@ -280,7 +280,7 @@ public List findRecentSessionsInfoLightForProposalPkAndDa localContact.setFirstName((String) jsonLocalContacts.get(0).get("firstname")); localContact.setPhone((String) jsonLocalContacts.get(0).get("phone")); localContact.setEmail((String) jsonLocalContacts.get(0).get("email")); - localContact.setTitle((String) jsonLocalContacts.get(0).get("title")); + //localContact.setTitle((String) jsonLocalContacts.get(0).get("title")); } catch (Exception ex) { ex.printStackTrace(); localContact.setFirstName("Manager"); From d71d83b5655d60204560abca0491b1fa0b2f6323 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Thu, 2 Jul 2020 09:45:15 +0200 Subject: [PATCH 12/22] Adding a new MAXIV rule for the shipment name --- .../rest/proposal/ShippingRestWebService.java | 51 ++++++++++++++++--- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/ShippingRestWebService.java b/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/ShippingRestWebService.java index ae67225b4..15fe0b4f9 100644 --- a/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/ShippingRestWebService.java +++ b/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/ShippingRestWebService.java @@ -15,10 +15,7 @@ import ispyb.ws.rest.mx.MXRestWebService; import java.lang.reflect.Type; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import javax.annotation.security.RolesAllowed; import javax.ws.rs.FormParam; @@ -174,6 +171,24 @@ public Response getShipping(@PathParam("token") String token, @PathParam("propos } + /*@RolesAllowed({"User", "Manager", "Industrial", "Localcontact"}) + @GET + @Path("{token}/proposal/{proposal}/shipping/find/") + @Produces({ "application/json" }) + public Response getShippingByProposalAndName(@PathParam("token") String token, @PathParam("proposal") String proposal, + @FormParam("name") String name, ) throws Exception { + + long id = this.logInit("getShippingByProposalAndName", logger, token, proposal, name); + try { + List result = this.getShipping3Service().findFiltered(null, name, proposal, null, null, null, null, null, false); + this.logFinish("getShippingByProposalAndName", id, logger); + return sendResponse(result); + } catch (Exception e) { + return this.logError("getShipping", e, id, logger); + } + + }*/ + @RolesAllowed({"User", "Manager", "Industrial", "Localcontact"}) @GET @@ -462,15 +477,39 @@ public Response saveShipping(@PathParam("token") String token, @PathParam("propo Shipping3VO shipping3VO = new Shipping3VO(); - if ((shippingId != null) && (shippingId != "")) { + if ((shippingId != null) && (!"".equals(shippingId))) { try{ - shipping3VO = this.getShipping3Service().findByPk(Integer.parseInt(shippingId), true); + shipping3VO = this.getShipping3Service().findByPk(Integer.parseInt(shippingId), true); } catch(Exception e){ System.out.println("shipping Id is not a number"); } } + if (Constants.SITE_IS_MAXIV()) { + try { + String proposalCode = proposal.substring(0, 2); + String proposalNumber = proposal.substring(proposal.length() - 8); + List results = this.getShipping3Service().findFiltered(null, name, proposalCode, proposalNumber, null, null, null, null, false); + if (results != null && !results.isEmpty()) { + if ((shippingId != null) && (!"".equals(shippingId))) { + for (int i=0;i Date: Tue, 1 Sep 2020 16:17:57 +0200 Subject: [PATCH 13/22] Changing parsed file to show fastdp graphs --- .../utils/reader/AutoProcProgramaAttachmentFileReader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/mx/services/utils/reader/AutoProcProgramaAttachmentFileReader.java b/ispyb-ejb/src/main/java/ispyb/server/mx/services/utils/reader/AutoProcProgramaAttachmentFileReader.java index 5d5115b02..6d09c2b1f 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/mx/services/utils/reader/AutoProcProgramaAttachmentFileReader.java +++ b/ispyb-ejb/src/main/java/ispyb/server/mx/services/utils/reader/AutoProcProgramaAttachmentFileReader.java @@ -35,7 +35,7 @@ public static HashMap readAttachment(AutoProcProgramAttachment3V String fileName = attachment.getFileName(); xscaleFile = (fileName != null && fileName.toLowerCase().endsWith("xscale.lp")); truncateLog = (fileName != null && fileName.toLowerCase().endsWith(".log") && fileName.toLowerCase().contains("truncate")); - noanomAimlessLog = (fileName != null && fileName.toLowerCase().endsWith(".log") && fileName.toLowerCase().contains("noanom_aimless")); + noanomAimlessLog = (fileName != null && fileName.toLowerCase().endsWith(".log") && fileName.toLowerCase().contains("aimless")); // System.out.println(xscaleFile); // System.out.println(truncateLog); From c4407675eb76a10d2f6962cc33654b69709c8d57 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Tue, 1 Sep 2020 16:19:32 +0200 Subject: [PATCH 14/22] Using session name to fill the visit_number with the DUO exp session number (only valid for MAXIV) --- .../src/main/java/ispyb/server/smis/UpdateFromSMIS.java | 5 ++++- .../ispyb/server/webservice/smis/util/MAXIVWebService.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/smis/UpdateFromSMIS.java b/ispyb-ejb/src/main/java/ispyb/server/smis/UpdateFromSMIS.java index 707469b7d..ddf37b6ee 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/smis/UpdateFromSMIS.java +++ b/ispyb-ejb/src/main/java/ispyb/server/smis/UpdateFromSMIS.java @@ -1054,6 +1054,9 @@ private static void retrieveSession(Proposal3VO proplv, ExpSessionInfoLightVO se // number because we // always start // with 0 + if (Constants.SITE_IS_MAXIV()){ + visit_number = Integer.valueOf(sessionVO.getName()); + } Integer nbShifts = sessionVO.getShifts(); Integer startShift = sessionVO.getStartShift(); // startShift equals 1, // 2 or 3 and stands for @@ -1110,7 +1113,7 @@ private static void retrieveSession(Proposal3VO proplv, ExpSessionInfoLightVO se sesv.setExpSessionPk(sessionVO.getPk()); sesv.setOperatorSiteNumber(siteNumber); - if (Constants.SITE_IS_SOLEIL()) { + if (Constants.SITE_IS_SOLEIL() || Constants.SITE_IS_MAXIV()) { sesv.setVisit_number(visit_number); } diff --git a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java index ff502deea..87fb93077 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java +++ b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java @@ -302,11 +302,12 @@ public List findRecentSessionsInfoLightForProposalPkAndDa session.setExperimentPk(propId); session.setComment("Created by DUO"); session.setPk(new Long((int)jsonSession.get("sessionid"))); + session.setName((String)jsonSession.get("sessionnum")); session.setFirstLocalContact(localContact); String title = (String)jsonProposal.get("title"); if(title.length() >= 200){ title = title.substring(0,195).concat("..."); - System.out.println("Truncated Tilte :" + title); + System.out.println("Truncated Title :" + title); } session.setProposalTitle(title); session.setCategCode("MX"); From 37711c6bade7cbc0af548d1669f7ac29374c2d5a Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Tue, 1 Sep 2020 16:24:02 +0200 Subject: [PATCH 15/22] Fixing imported jar file --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 96868f4de..3d5dc25f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN mvn install:install-file -Dfile=dependencies/securityfilter.jar -DgroupId=se mvn install:install-file -Dfile=dependencies/jhdf5.jar -DgroupId=jhdf5 -DartifactId=jhdf5 -Dversion=1.0 -Dpackaging=jar && \ mvn install:install-file -Dfile=dependencies/jhdf5obj.jar -DgroupId=jhdf5obj -DartifactId=jhdf5obj -Dversion=1.0 -Dpackaging=jar && \ mvn install:install-file -Dfile=dependencies/jhdfobj.jar -DgroupId=jhdfobj -DartifactId=jhdfobj -Dversion=1.0 -Dpackaging=jar && \ - mvn install:install-file -Dfile=dependencies/ispyb-userportal-gen-1.6.jar -DgroupId=ispyb -DartifactId=ispyb-userportal-gen -Dversion=1.6 -Dpackaging=jar && \ + mvn install:install-file -Dfile=dependencies/ispyb-userportal-gen-1.7.jar -DgroupId=ispyb -DartifactId=ispyb-userportal-gen -Dversion=1.7 -Dpackaging=jar && \ mvn install:install-file -Dfile=dependencies/Struts-Layout-1.2.jar -DgroupId=struts-layout -DartifactId=struts-layout -Dversion=1.2 -Dpackaging=jar && \ mvn install -Dispyb.site=MAXIV -Dispyb.env=production && \ cp ispyb-ear/target/ispyb.ear /var/ispyb.ear From 380a74d404f3e23640238f0ad53627f8bf66c12f Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Mon, 14 Sep 2020 18:30:33 +0200 Subject: [PATCH 16/22] Fixing DUO-ISPyB synch --- .../ispyb/server/webservice/smis/util/MAXIVWebService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java index 87fb93077..467e9fc55 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java +++ b/ispyb-ejb/src/main/java/ispyb/server/webservice/smis/util/MAXIVWebService.java @@ -291,7 +291,8 @@ public List findRecentSessionsInfoLightForProposalPkAndDa try{ - ArrayList jsonShifts = getShiftsForSession((Integer)jsonSession.get("sessionid")); + Integer sessionId = (Integer)jsonSession.get("sessionid"); + ArrayList jsonShifts = getShiftsForSession(sessionId); if(jsonShifts.size() != 0){ session.setBeamlineName((String)jsonSession.get("beamline")); session.setBeamlinePk(Long.valueOf(12345));//TODO Verify. We dont have a Long id @@ -302,7 +303,7 @@ public List findRecentSessionsInfoLightForProposalPkAndDa session.setExperimentPk(propId); session.setComment("Created by DUO"); session.setPk(new Long((int)jsonSession.get("sessionid"))); - session.setName((String)jsonSession.get("sessionnum")); + session.setName(((Integer)jsonSession.get("sessionnum")).toString()); session.setFirstLocalContact(localContact); String title = (String)jsonProposal.get("title"); if(title.length() >= 200){ @@ -342,6 +343,8 @@ public List findRecentSessionsInfoLightForProposalPkAndDa session.setCancelled(false);//TODO: Check what this means sessions.add(session); + } else { + LOG.info("Empty session found for DUO sessionid" + sessionId.toString()); } } catch(Exception ex){ //TODO: Handle exception From 6e12dc4e0b55537d5fff9cd621adf137f41376f4 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Wed, 7 Oct 2020 20:14:06 +0200 Subject: [PATCH 17/22] Adding a new endpoint for experiment statistics --- .../biosaxs/services/stats/Stats3Service.java | 2 ++ .../services/stats/Stats3ServiceBean.java | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java b/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java index 1afad5e52..6c4a7ef9c 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java +++ b/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java @@ -45,6 +45,8 @@ public interface Stats3Service { List> getDatacollectionStatsByDate(String datacollectionStatisticsType, Date startDate, Date endDate, String[] datacollectionTestProposals, String beamline); + List> getExperimentStatsByDate(Date startDate, Date endDate, String[] datacollectionTestProposals); + List> getExperimentStatsByDate(Date startDate, Date endDate, String[] datacollectionTestProposals, String beamline); } \ No newline at end of file diff --git a/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3ServiceBean.java b/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3ServiceBean.java index 355702438..020edeabd 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3ServiceBean.java +++ b/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3ServiceBean.java @@ -62,6 +62,8 @@ public class Stats3ServiceBean extends WsServiceBean implements Stats3Service, +"and DCG.comments not in (' Data collection failed!\n') " +"and P.proposalNumber not in (:TESTPROPOSALS) "; + private String EXPERIMENTSTATS_QUERY ="select * from v_mx_experiment_stats where startTime >= :START and startTime <= :END and comments not in (' Data collection failed!\\n') and proposalNumber not in (:TESTPROPOSALS) "; + @PersistenceContext(unitName = "ispyb_db") private EntityManager entityManager; @@ -153,4 +155,29 @@ public List> getDatacollectionStatsByDate( query.setParameter("BEAMLINENAME",beamline); return executeSQLQuery(query); } + + @Override + public List> getExperimentStatsByDate( + Date startDate, Date endDate, String[] datacollectionTestProposals) { + Session session = (Session) this.entityManager.getDelegate(); + SQLQuery query = session.createSQLQuery(EXPERIMENTSTATS_QUERY); + SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd"); + query.setParameter("START", dt1.format(startDate)); + query.setParameter("END", dt1.format(endDate)); + query.setParameterList("TESTPROPOSALS", datacollectionTestProposals); + return executeSQLQuery(query); + } + + @Override + public List> getExperimentStatsByDate( + Date startDate, Date endDate, String[] datacollectionTestProposals, String beamline) { + Session session = (Session) this.entityManager.getDelegate(); + SQLQuery query = session.createSQLQuery(EXPERIMENTSTATS_QUERY + " and beamLineName = :BEAMLINENAME "); + SimpleDateFormat dt1 = new SimpleDateFormat("yyyy-MM-dd"); + query.setParameter("START", dt1.format(startDate)); + query.setParameter("END", dt1.format(endDate)); + query.setParameterList("TESTPROPOSALS", datacollectionTestProposals); + query.setParameter("BEAMLINENAME",beamline); + return executeSQLQuery(query); + } } From 1ace187f22a32e6633838d0b17bed8cedca8fae8 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Wed, 7 Oct 2020 20:15:47 +0200 Subject: [PATCH 18/22] Adding a new endpoint to get all the datacollections associated to a sample --- .../DataCollectionGroupRestWsService.java | 2 ++ .../DataCollectionGroupRestWsServiceBean.java | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsService.java b/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsService.java index 2b9120671..0616ca173 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsService.java +++ b/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsService.java @@ -34,6 +34,8 @@ public interface DataCollectionGroupRestWsService { public List> getViewDataCollectionBySessionIdHavingImages(int proposalId, int sessionId); public List> getViewDataCollectionByProteinAcronym(int proposalId, String proteinAcronym); + + public List> getViewDataCollectionBySampleId(int proposalId, int sampleId); public List> getViewDataCollectionBySampleName(int proposalId, String name); diff --git a/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsServiceBean.java b/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsServiceBean.java index 1a5deeedc..f46c5f84d 100644 --- a/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsServiceBean.java +++ b/ispyb-ejb/src/main/java/ispyb/server/mx/services/ws/rest/datacollectiongroup/DataCollectionGroupRestWsServiceBean.java @@ -80,6 +80,18 @@ public List> getViewDataCollectionByProteinAcronym(int propo return executeSQLQuery(query); } + @Override + public List> getViewDataCollectionBySampleId(int proposalId, int sampleId) { + String mySQLQuery = getViewTableQuery() + " where BLSession_proposalId = :proposalId and DataCollectionGroup_blSampleId = :sampleId"; + mySQLQuery = mySQLQuery + " group by v_datacollection_summary.DataCollectionGroup_dataCollectionGroupId, v_datacollection_summary.DataCollectionGroup_dataCollectionGroupId"; + Session session = (Session) this.entityManager.getDelegate(); + SQLQuery query = session.createSQLQuery(mySQLQuery); + query.setParameter("proposalId", proposalId); + query.setParameter("sampleId", sampleId); + query.setResultTransformer(AliasToEntityMapResultTransformer.INSTANCE); + return executeSQLQuery(query); + } + @Override public List> getViewDataCollectionBySampleName(int proposalId, String name) { String mySQLQuery = getViewTableQuery() + " where BLSession_proposalId = :proposalId and BLSample_name = :name"; From 4f7e403d98aa2ea69348c8d5dae918a843473ad6 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Wed, 7 Oct 2020 20:16:20 +0200 Subject: [PATCH 19/22] Adding a new endpoint for experiment statistics --- .../ws/rest/mx/MXStatsRestWebService.java | 82 ++++++++++++++++++- 1 file changed, 79 insertions(+), 3 deletions(-) diff --git a/ispyb-ws/src/main/java/ispyb/ws/rest/mx/MXStatsRestWebService.java b/ispyb-ws/src/main/java/ispyb/ws/rest/mx/MXStatsRestWebService.java index 9702f71aa..73429448c 100644 --- a/ispyb-ws/src/main/java/ispyb/ws/rest/mx/MXStatsRestWebService.java +++ b/ispyb-ws/src/main/java/ispyb/ws/rest/mx/MXStatsRestWebService.java @@ -182,10 +182,86 @@ public Response getCSVDatacollectionStatisticsByDate(@PathParam("imageslimit") S } return null; } - - - + @RolesAllowed({ "Manager", "LocalContact" }) + @GET + @Path("{token}/stats/experimentstatistics/{start}/{end}/{beamlinenames}/json") + @Produces({ "application/json" }) + public Response getExperimentStatisticsByDate(@PathParam("start") Date startDate, + @PathParam("end") Date endDate, + @PathParam("beamlinenames") String beamlinesName, + @QueryParam("testproposals")String datacollectionTestProposals + ) { + + String methodName = "getExperimentStatisticsByDate"; + long id = this.logInit(methodName, logger, startDate, endDate, beamlinesName, datacollectionTestProposals); + try { + String[] testProposals = null; + if (datacollectionTestProposals != null && datacollectionTestProposals != ""){ + testProposals = datacollectionTestProposals.split(","); + } + + List> list = new ArrayList>(); + + if (beamlinesName != null && !beamlinesName.equals("0")){ + List beamlines = this.parseToString(beamlinesName); + if (beamlines.size() > 0){ + for (String beamline : beamlines) { + list.addAll(this.getStatsWSService().getExperimentStatsByDate(startDate, endDate, testProposals, beamline)); + } + } + } + else{ + list.addAll(this.getStatsWSService().getExperimentStatsByDate(startDate, endDate, testProposals)); + } + + return this.sendResponse(list); + + } catch (Exception e) { + this.logError(methodName, e, id, logger); + } + return null; + } + + @RolesAllowed({ "Manager", "LocalContact" }) + @GET + @Path("{token}/stats/experimentstatistics/{start}/{end}/{beamlinenames}/csv") + @Produces({ "application/csv" }) + public Response getCSVDatacollectionStatisticsByDate(@PathParam("start") Date startDate, + @PathParam("end") Date endDate, + @PathParam("beamlinenames") String beamlinesName, + @QueryParam("testproposals") String datacollectionTestProposals + ) { + + String methodName = "getCSVExperimentStatisticsByDate"; + long id = this.logInit(methodName, logger, startDate, endDate, beamlinesName, datacollectionTestProposals); + try { + String[] testProposals = null; + if (datacollectionTestProposals != null && datacollectionTestProposals != ""){ + testProposals = datacollectionTestProposals.split(","); + } + List> list = new ArrayList>(); + + if (beamlinesName != null && !beamlinesName.equals("0")){ + List beamlines = this.parseToString(beamlinesName); + if (beamlines.size() > 0){ + for (String beamline : beamlines) { + list.addAll(this.getStatsWSService().getExperimentStatsByDate(startDate, endDate, testProposals, beamline)); + } + } + } + else{ + list.addAll(this.getStatsWSService().getExperimentStatsByDate( startDate, endDate, testProposals)); + } + + return this.sendResponse(this.parseListToCSV(list)); + + } catch (Exception e) { + this.logError(methodName, e, id, logger); + } + return null; + } + public String parseListToCSV(List> list) { StringWriter output = new StringWriter(); From b8fa13466f386dea8cee054e59e2ab2ef8a771b9 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Wed, 7 Oct 2020 20:17:41 +0200 Subject: [PATCH 20/22] Adding a new endpoint to get all the datacollections associated to a sample --- .../rest/mx/DataCollectionRestWebService.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ispyb-ws/src/main/java/ispyb/ws/rest/mx/DataCollectionRestWebService.java b/ispyb-ws/src/main/java/ispyb/ws/rest/mx/DataCollectionRestWebService.java index b84d3a385..0e6e77e99 100644 --- a/ispyb-ws/src/main/java/ispyb/ws/rest/mx/DataCollectionRestWebService.java +++ b/ispyb-ws/src/main/java/ispyb/ws/rest/mx/DataCollectionRestWebService.java @@ -513,6 +513,28 @@ public Response getViewDataCollectionByProteinAcronym(@PathParam("token") String return this.logError(methodName, e, start, logger); } } + + @RolesAllowed({ "User", "Manager", "Industrial", "Localcontact" }) + @GET + @GZIP + @Path("{token}/proposal/{proposal}/mx/datacollection/sample/{sampleId}/list") + @Produces({ "application/json" }) + public Response getViewDataCollectionBySampleId(@PathParam("token") String token, @PathParam("proposal") String proposal, + @PathParam("sampleId") Integer sampleId) { + + String methodName = "getViewDataCollectionBySampleId"; + long start = this.logInit(methodName, logger, token, proposal, sampleId); + try { + List> dataCollections = new ArrayList>(); + + dataCollections.addAll(this.getWebServiceDataCollectionGroup3Service().getViewDataCollectionBySampleId( + this.getProposalId(proposal), sampleId)); + this.logFinish(methodName, start, logger); + return this.sendResponse(dataCollections, false); + } catch (Exception e) { + return this.logError(methodName, e, start, logger); + } + } @RolesAllowed({"User", "Manager", "Industrial", "Localcontact"}) @GET From ca21c44a495c0a1b143da997ad01d6f67a36300d Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Wed, 7 Oct 2020 20:20:25 +0200 Subject: [PATCH 21/22] Returning an error when if there are 2 dewars with the same name in the same shipment (only valid at MAXIV) --- .../ws/rest/proposal/DewarRestWebService.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/DewarRestWebService.java b/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/DewarRestWebService.java index d8e602529..a5bcbc055 100644 --- a/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/DewarRestWebService.java +++ b/ispyb-ws/src/main/java/ispyb/ws/rest/proposal/DewarRestWebService.java @@ -16,6 +16,7 @@ import ispyb.server.mx.services.ws.rest.dewar.DewarRestWsService; import ispyb.server.mx.vos.collections.Session3VO; import ispyb.ws.rest.RestWebService; +import ispyb.server.common.vos.proposals.ProposalWS3VO; import java.io.ByteArrayOutputStream; import java.sql.Timestamp; @@ -271,6 +272,18 @@ public Response saveDewar( } } + if (Constants.SITE_IS_MAXIV()) { + ArrayList p = StringUtils.GetProposalNumberAndCode(proposal); + String proposalCode = p.get(0); + String proposalNumber = p.get(2); + ProposalWS3VO proposalws3vo = getProposal3Service().findForWSByCodeAndNumber(proposalCode, proposalNumber); + Integer proposalId = proposalws3vo.getProposalId(); + List dewar3vos = getDewar3Service().findFiltered(proposalId, shippingId, null, + code, null, null, null, null, null, null, false, false); + if (dewar3vos != null && dewar3vos.size() > 0){ + return this.sendError("You cannot have 2 dewars with the same name in the same shipment at MAXIV"); + } + } dewar3vo = getDewar3Service().create(dewar3vo); } else { dewar3vo = getDewar3Service().findByPk(dewarId, false, false); @@ -346,7 +359,7 @@ public Response updateStatus( return this.sendResponse(Status.OK); } catch (Exception e) { this.logError("updateStatus", e, start, logger); - return this.sendResponse(Status.NOT_FOUND); + return this.sendResponse(Response.Status.NOT_FOUND); } } From 4282725162674ad994b84448f81b3e77015bd330 Mon Sep 17 00:00:00 2001 From: Alberto Nardella Date: Thu, 8 Oct 2020 16:22:53 +0200 Subject: [PATCH 22/22] Adding a new endpoint for experiment statistics --- .../2020_10_08_experiment_statistics_view.sql | 37 +++++++++++++++++++ ispyb-ejb/pom.xml | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql diff --git a/ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql b/ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql new file mode 100644 index 000000000..ba71584f6 --- /dev/null +++ b/ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql @@ -0,0 +1,37 @@ +INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2020_10_08_experiment_statistics_view.sql', 'ONGOING'); + +CREATE + ALGORITHM = UNDEFINED + DEFINER = `pxadmin`@`%` + SQL SECURITY DEFINER +VIEW `v_mx_experiment_stats` AS + SELECT + `DC`.`startTime` AS `startTime`, + `DC`.`numberOfImages` AS `Images`, + `DC`.`transmission` AS `Transmission`, + `DC`.`resolution` AS `Res. (corner)`, + `DC`.`wavelength` AS `En. (Wave.)`, + `DC`.`omegaStart` AS `Omega start (total)`, + `DC`.`exposureTime` AS `Exposure Time`, + `DC`.`flux` AS `Flux`, + `DC`.`flux_end` AS `Flux End`, + `DC`.`detectorDistance` AS `Detector Distance`, + `DC`.`xBeam` AS `X Beam`, + `DC`.`yBeam` AS `Y Beam`, + `DC`.`kappaStart` AS `Kappa`, + `DC`.`phiStart` AS `Phi`, + `DC`.`axisStart` AS `Axis Start`, + `DC`.`axisEnd` AS `Axis End`, + `DC`.`axisRange` AS `Axis Range`, + `DC`.`beamSizeAtSampleX` AS `Beam Size X`, + `DC`.`beamSizeAtSampleY` AS `Beam Size Y`, + `BLS`.`beamLineName` AS `beamLineName`, + `DCG`.`comments` AS `comments`, + `P`.`proposalNumber` AS `proposalNumber` + FROM + (((`DataCollection` `DC` + JOIN `DataCollectionGroup` `DCG` ON ((`DCG`.`dataCollectionGroupId` = `DC`.`dataCollectionGroupId`))) + JOIN `BLSession` `BLS` ON ((`BLS`.`sessionId` = `DCG`.`sessionId`))) + JOIN `Proposal` `P` ON ((`P`.`proposalId` = `BLS`.`proposalId`))) + +UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2020_10_08_experiment_statistics_view.sql'; \ No newline at end of file diff --git a/ispyb-ejb/pom.xml b/ispyb-ejb/pom.xml index ac08cda2b..031e1be72 100644 --- a/ispyb-ejb/pom.xml +++ b/ispyb-ejb/pom.xml @@ -479,7 +479,7 @@ LDAP database - ldaps://srv-ad-2.maxiv.lu.se/ + ldaps://adauth.maxiv.lu.se/ dc=maxlab,dc=lu,dc=se dc=maxlab,dc=lu,dc=se samaccountname