diff --git a/notes b/notes new file mode 100644 index 0000000..d16ad5f --- /dev/null +++ b/notes @@ -0,0 +1,17 @@ +03/04/2017: +Problème avec le clic sur les liens vers les fichiers xsams pour declencher l'association des requêtes dans le querystore. +Le javascript rafraichissant la page ne fonctionnait pas sous firefox. Les liens ont été remplacés par des boutons. + + +13/02/2017: +SEAM retourne des erreurs d'exécution lorsqu'il est lancé avec java8 : +Could not instantiate Seam component: registration + +Le fichier ~/.mavenrc a été édité pour que JAVA_HOME pointe sur java7 +JAVA_HOME est défini dans deploy.sh pour que jboss utilise java7 + +Autre solution : export JAVA_HOME=~/Applications/jdk1.8.0_152/ + + +Utilise JSF en version 1.x + diff --git a/pom.xml b/pom.xml index 6b5b39a..daced0d 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ 2.2.11 2.2.10 3.3.0.ga - 12.07r2-SNAPSHOT + 12.07r3-SNAPSHOT 12.07 12.07r2-SNAPSHOT UTF-8 @@ -36,7 +36,7 @@ vamdc repository VAMDC repository - http://dev.vamdc.org/nexus/content/groups/public/ + http://nexus.vamdc.org/nexus/content/groups/public/ default @@ -50,17 +50,25 @@ 1.6 - + maven-resources-plugin 2.5 - + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12.4 + + true + + diff --git a/portal.ear/pom.xml b/portal.ear/pom.xml index 96135e9..8b43012 100644 --- a/portal.ear/pom.xml +++ b/portal.ear/pom.xml @@ -33,10 +33,11 @@ org.jboss.el jboss-el - + com.sun.xml.ws jaxws-rt @@ -48,6 +49,21 @@ el-api provided + + + org.drools + drools-core + 5.4.0.Final + + + + + org.drools + drools-compiler + 5.4.0.Final + + + @@ -114,4 +130,4 @@ - \ No newline at end of file + diff --git a/portal.ejb/pom.xml b/portal.ejb/pom.xml index 8c22966..c721e58 100644 --- a/portal.ejb/pom.xml +++ b/portal.ejb/pom.xml @@ -55,11 +55,7 @@ javax.ejb ejb-api provided - - - - - + javax.measure jsr-275 @@ -110,7 +106,23 @@ servlet-api provided - + + org.slf4j + slf4j-log4j12 + 1.4.2 + + + org.apache.httpcomponents + httpclient + 4.5.3 + + + + org.json + json + 20220320 + + @@ -163,4 +175,4 @@ - \ No newline at end of file + diff --git a/portal.ejb/src/main/java/org/vamdc/portal/Settings.java b/portal.ejb/src/main/java/org/vamdc/portal/Settings.java index 259dc47..2fa6dfb 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/Settings.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/Settings.java @@ -11,14 +11,21 @@ */ public enum Settings { + //superseded by values in server/default/deploy/properties-service.xml of jboss server HTTP_CONNECT_TIMEOUT("HTTPConnTimeout", "2000"), HTTP_DATA_TIMEOUT("HTTPDataTimeout","30000"), REGISTRY_URL("registryURL","http://registry.vamdc.eu/registry-12.07/services/RegistryQueryv1_0"), REGISTRY_UPDATE_INTERVAL("registryUpdateInterval","300000"), + QUERYSTORE_ASSOCIATION_URL("querystoreAssociationUrl","https://querystore.vamdc.eu/PortalAssociationService?"), AVAILABILITY_MONITOR_INTERVAL("availabilityMonitorInterval","300000"), REGISTRY_RETRY_INTERVAL("registryRetryInterval","10000"), HTTP_HEAD_TIMEOUT("HTTPHeadTimeout","60000"), PDL_SERVER_URL("pdlServerURL", "http://vm-euhoutestc62.obspm.fr/vamdc/OnlineCode?"), + PORTAL_USER_AGENT("userAgent", "VAMDC Portal Dev"), + PORTAL_VERSION("version", "2017_06"), + QUERYSTORE_MAX_RETRY("querystoreMaxRetry", "10"), + QUERYSTORE_RETRY_TIMER("querystoreRetryTimer", "3000"), + DEFAULT_USER_MAIL("defaultUserMail", "unregistered@portal.vamdc.eu"); ; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/async/FutureTask.java b/portal.ejb/src/main/java/org/vamdc/portal/async/FutureTask.java new file mode 100644 index 0000000..0f7758b --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/async/FutureTask.java @@ -0,0 +1,10 @@ +package org.vamdc.portal.async; + +public interface FutureTask { + public void process(); + public boolean isDone(); + public boolean isProcessing(); + public boolean isOk(); + public boolean isErrorHappened(); + public String getError(); +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityFacade.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityFacade.java index b56f191..07c28b9 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityFacade.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityFacade.java @@ -7,6 +7,7 @@ import javax.persistence.EntityManager; +import org.vamdc.portal.entity.constant.Species; import org.vamdc.portal.entity.species.VamdcSpecies; import org.vamdc.portal.session.queryBuilder.forms.MoleculesForm.MoleculeInfo; @@ -17,52 +18,56 @@ * */ public class EntityFacade { + + private EntityFacade(){} - public static Collection suggestStoichiometricFormula( + public static Collection suggestMoleculeStoichiometricFormula( EntityManager entityManager, String value) { if (!checkValue(value) || entityManager==null) return Collections.emptyList(); - return EntityQuery.suggestStoichForm(entityManager, value.trim()); + return EntityQuery.suggestMoleculeStoichForm(entityManager, value.trim()); } - public static Collection suggestOrdinaryFormula( + public static Collection suggestMoleculeOrdinaryFormula( EntityManager entityManager, String value) { if (!checkValue(value) || entityManager==null) return Collections.emptyList(); - return EntityQuery.suggestStructForm(entityManager, value); + return EntityQuery.suggestMoleculeStructForm(entityManager, value); } - - - public static Collection suggestChemicalName( + + public static Collection suggestMoleculeName( EntityManager entityManager, String value) { if (!checkValue(value) || entityManager==null) return Collections.emptyList(); - return EntityQuery.suggestSpeciesName(entityManager, value.trim()); + return EntityQuery.suggestMoleculeName(entityManager, value.trim()); } public static List loadMoleculesFromName(EntityManager em,String value){ String query = "SELECT distinct vs FROM VamdcSpecies vs " + "INNER JOIN vs.vamdcSpeciesNameses vsn " + - "WHERE vsn.name = :Value"; + "WHERE vsn.name = :Value " + + "AND vs.speciesType = " + Species.MOLECULE.getId(); return loadElements(em,query,value); } public static List loadMoleculesFromStoichForm(EntityManager em,String value){ String query = "SELECT distinct vs FROM VamdcSpecies vs " + - "WHERE vs.stoichiometricFormula = :Value"; + "WHERE vs.stoichiometricFormula = :Value " + + "AND vs.speciesType = "+ Species.MOLECULE.getId(); return loadElements(em,query,value); } public static List loadMoleculesFromOrdForm(EntityManager em, String value) { String query = "SELECT distinct vs FROM VamdcSpecies vs " + "INNER JOIN vs.vamdcSpeciesStructFormulaes vsf " + - "WHERE vsf.formula = :Value"; + "WHERE vsf.formula = :Value " + + "AND vs.speciesType = " + Species.MOLECULE.getId(); return loadElements(em,query,value); } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityQuery.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityQuery.java index 982f890..be1e5e0 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityQuery.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/EntityQuery.java @@ -3,6 +3,9 @@ import java.util.Collection; import javax.persistence.EntityManager; +import javax.persistence.Query; + +import org.vamdc.portal.entity.constant.Species; /** * Collection of static methods to get some species objects @@ -10,6 +13,8 @@ * */ class EntityQuery{ + + private EntityQuery(){} @SuppressWarnings("unchecked") static Collection suggestSpeciesName(EntityManager em, @@ -21,7 +26,32 @@ static Collection suggestSpeciesName(EntityManager em, .getResultList(); } + + static Collection suggestAtomName(EntityManager em, + String name) { + return suggestRestrictedSpeciesName(em, name, Species.ATOM.getId()); + + } + + static Collection suggestMoleculeName(EntityManager em, + String name) { + return suggestRestrictedSpeciesName(em, name, Species.MOLECULE.getId()); + } + + @SuppressWarnings("unchecked") + private static Collection suggestRestrictedSpeciesName(EntityManager em, + String name, Integer speciesType) { + Query q = em.createQuery("SELECT DISTINCT vsn.name from VamdcSpeciesNames vsn JOIN vsn.vamdcSpecies vsp " + + "WHERE vsn.name LIKE :speciesName and vsn.vamdcMarkupTypes.id=1 and vsp.speciesType=:speciesType " + + " order by length(vsn.name), vsn.searchPriority") + .setParameter("speciesName", "%"+name+"%") + .setParameter("speciesType", speciesType) + .setMaxResults(20); + return q.getResultList(); + + } + @SuppressWarnings("unchecked") static Collection suggestStoichForm(EntityManager em, String formula){ return em.createQuery("SELECT distinct vs.stoichiometricFormula from VamdcSpecies vs " + @@ -31,14 +61,33 @@ static Collection suggestStoichForm(EntityManager em, String formula){ .getResultList(); } + + static Collection suggestMoleculeStoichForm(EntityManager em, String formula){ + return suggestRestrictedStoichForm(em, formula, Species.MOLECULE.getId()); + } + @SuppressWarnings("unchecked") - static Collection suggestStructForm(EntityManager em, String formula){ - return em.createQuery("SELECT distinct vssf.formula from VamdcSpeciesStructFormulae vssf " + - "WHERE vssf.formula LIKE :formula and vssf.vamdcMarkupTypes.id=1 order by length(vssf.formula), vssf.searchPriority") + private static Collection suggestRestrictedStoichForm(EntityManager em, String formula, Integer speciesType){ + return em.createQuery("SELECT distinct vs.stoichiometricFormula from VamdcSpecies vs " + + "WHERE vs.stoichiometricFormula LIKE :formula AND vs.speciesType=:speciesType order by length(vs.stoichiometricFormula)") .setParameter("formula", "%"+formula+"%") + .setParameter("speciesType", speciesType) .setMaxResults(20) .getResultList(); } + static Collection suggestMoleculeStructForm(EntityManager em, String formula){ + return suggestRestrictedStructForm(em, formula, Species.MOLECULE.getId()); + } + + @SuppressWarnings("unchecked") + private static Collection suggestRestrictedStructForm(EntityManager em, String formula, Integer speciesType){ + return em.createQuery("SELECT distinct vssf.formula from VamdcSpeciesStructFormulae vssf JOIN vssf.vamdcSpecies vs " + + "WHERE vssf.formula LIKE :formula and vssf.vamdcMarkupTypes.id=1 and vs.speciesType=:speciesType order by length(vssf.formula), vssf.searchPriority") + .setParameter("formula", "%"+formula+"%") + .setParameter("speciesType", speciesType) + .setMaxResults(20) + .getResultList(); + } } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/VamdcSpeciesFacade.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/VamdcSpeciesFacade.java index 07885b9..43b3b43 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/VamdcSpeciesFacade.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/VamdcSpeciesFacade.java @@ -1,5 +1,6 @@ package org.vamdc.portal.entity; +import org.vamdc.portal.entity.constant.Markup; import org.vamdc.portal.entity.species.VamdcSpecies; import org.vamdc.portal.entity.species.VamdcSpeciesNames; import org.vamdc.portal.entity.species.VamdcSpeciesStructFormulae; @@ -16,7 +17,7 @@ public VamdcSpeciesFacade(VamdcSpecies element){ @Override public String getName() { for (VamdcSpeciesNames vsn:element.getVamdcSpeciesNameses()){ - if (vsn.getVamdcMarkupTypes().getId()==1) + if (vsn.getVamdcMarkupTypes().getId() == Markup.TEXT.getId()) return vsn.getName(); } return ""; @@ -28,7 +29,7 @@ public String getName() { @Override public String getOrdinaryFormula() { for (VamdcSpeciesStructFormulae vsff:element.getVamdcSpeciesStructFormulaes()){ - if (vsff.getVamdcMarkupTypes().getId()==1) + if (vsff.getVamdcMarkupTypes().getId() == Markup.TEXT.getId()) return vsff.getFormula(); } return ""; @@ -46,7 +47,7 @@ public String getDescription() { String result = ""; for(VamdcSpeciesStructFormulae vsff: element.getVamdcSpeciesStructFormulaes()){ result=vsff.getFormula(); - if (vsff.getVamdcMarkupTypes().getId()==2) + if (vsff.getVamdcMarkupTypes().getId() == Markup.HTML.getId()) break; } return appendName(result); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/constant/Markup.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/constant/Markup.java new file mode 100644 index 0000000..3f1ec67 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/constant/Markup.java @@ -0,0 +1,19 @@ +package org.vamdc.portal.entity.constant; + +public enum Markup { + TEXT(1), + HTML(2), + RST(3), + LATEX(4); + + private Integer id; + + Markup(Integer id){ + this.id = id; + } + + public Integer getId(){ + return this.id; + } + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/constant/Species.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/constant/Species.java new file mode 100644 index 0000000..4517679 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/constant/Species.java @@ -0,0 +1,16 @@ +package org.vamdc.portal.entity.constant; + +public enum Species { + ATOM(1), + MOLECULE(2); + + private Integer id; + + Species(Integer id){ + this.id = id; + } + + public Integer getId(){ + return this.id; + } +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/query/HttpHeadResponse.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/query/HttpHeadResponse.java index af67d20..f439ab8 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/query/HttpHeadResponse.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/query/HttpHeadResponse.java @@ -30,11 +30,11 @@ public enum Response{ Response(String description){ this.description = description; } - + public String getDescription(){ return this.description; } - + } private String ivoaID; @@ -42,6 +42,7 @@ public String getDescription(){ private Response status; private Date lastmodified; private Query query; + private String requestToken; private Integer recordID; @@ -58,10 +59,10 @@ public HttpHeadResponse(){ } public HttpHeadResponse(String ivoaID, HttpURLConnection connection) { + retrieveHeaders(connection); this.ivoaID = ivoaID; this.fullQueryURL = connection.getURL().toString(); - this.status = retrieveStatus(connection); - retrieveHeaders(connection); + this.status = retrieveStatus(connection); if (truncated>0 && truncated<100) this.status=Response.TRUNCATED; } @@ -76,6 +77,7 @@ private void retrieveHeaders(HttpURLConnection connection) { processes = collisions+radiative+nonRadiative; truncated = getTruncatedValue(connection,"VAMDC-TRUNCATED"); lastmodified = extractLastModified(connection); + requestToken = connection.getHeaderField("VAMDC-REQUEST-TOKEN"); } private Date extractLastModified(HttpURLConnection connection) { @@ -92,7 +94,7 @@ private int getValue( HttpURLConnection connection,String headerName){ return 0; } } - + private int getTruncatedValue( HttpURLConnection connection,String headerName ){ try{ String val = connection.getHeaderField(headerName); @@ -129,11 +131,32 @@ private Response retrieveStatus(HttpURLConnection connection){ @Id @GeneratedValue public Integer getRecordID() { return recordID; } public void setRecordID(Integer recordID) { this.recordID = recordID; } - + public String getIvoaID() { return ivoaID; } public void setIvoaID(String ivoaID) { this.ivoaID = ivoaID; } - - public Response getStatus() { return status; } + + /** + * if a node answers a HEAD request, there is no content and the + * response code can be 204 + * In that case, if data have been found ( processes + species + states > 0 ) + * we return a OK status instead of EMPTY + * @return + */ + public Response getStatus() { + try { + int total = processes + species + states; + if(total > 0) { + return Response.OK; + }else { + return status; + } + }catch(Exception e) { + e.printStackTrace(); + return status; + } + } + + public void setStatus(Response status) { this.status = status; } @Transient public String getStatusDescription() {return status.getDescription();} @@ -152,17 +175,19 @@ public boolean isLastModSet(){ public int getRadiative() { return radiative; } public int getNonRadiative() { return nonRadiative; } public int getCollisions() { return collisions; } + public String getRequestToken(){ return requestToken; } + @Transient public int getTruncated() { return truncated; } - + public void setSpecies(int species) { this.species = species; } public void setStates(int states) { this.states = states; } public void setProcesses(int processes) { this.processes = processes; } public void setRadiative(int radiative) { this.radiative = radiative; } public void setNonRadiative(int nonRadiative) { this.nonRadiative = nonRadiative; } public void setCollisions(int collisions) { this.collisions = collisions; } + public void setRequestToken(String token){ this.requestToken = token; } - @Lob public String getFullQueryURL() { return fullQueryURL; } public void setFullQueryURL(String fullQueryURL) { this.fullQueryURL = fullQueryURL; } @@ -175,6 +200,6 @@ public boolean isLastModSet(){ @Transient public boolean isOk(){ - return this.status==Response.OK || this.status == Response.TRUNCATED; + return this.getStatus()==Response.OK || this.getStatus() == Response.TRUNCATED; } } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcConformers.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcConformers.java deleted file mode 100644 index 9a65036..0000000 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcConformers.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.vamdc.portal.entity.species; - -// Generated 18.09.2012 16:57:53 by Hibernate Tools 3.4.0.CR1 - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import static javax.persistence.GenerationType.IDENTITY; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import org.hibernate.validator.Length; -import org.hibernate.validator.NotNull; - -/** - * VamdcConformers generated by hbm2java - */ -@Entity -@Table(name = "vamdc_conformers", catalog = "vamdc_species") -public class VamdcConformers implements java.io.Serializable { - - private Integer id; - private VamdcSpecies vamdcSpecies; - private String conformerName; - - public VamdcConformers() { - } - - public VamdcConformers(VamdcSpecies vamdcSpecies, String conformerName) { - this.vamdcSpecies = vamdcSpecies; - this.conformerName = conformerName; - } - - @Id - @GeneratedValue(strategy = IDENTITY) - @Column(name = "id", unique = true, nullable = false) - public Integer getId() { - return this.id; - } - - public void setId(Integer id) { - this.id = id; - } - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "species_id", nullable = false) - @NotNull - public VamdcSpecies getVamdcSpecies() { - return this.vamdcSpecies; - } - - public void setVamdcSpecies(VamdcSpecies vamdcSpecies) { - this.vamdcSpecies = vamdcSpecies; - } - - @Column(name = "conformer_name", nullable = false, length = 150) - @NotNull - @Length(max = 150) - public String getConformerName() { - return this.conformerName; - } - - public void setConformerName(String conformerName) { - this.conformerName = conformerName; - } - -} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcInchikeyExceptions.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcInchikeyExceptions.java index 1db481b..d049c03 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcInchikeyExceptions.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcInchikeyExceptions.java @@ -6,18 +6,21 @@ import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; + import static javax.persistence.GenerationType.IDENTITY; + import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; + import org.hibernate.validator.NotNull; /** * VamdcInchikeyExceptions generated by hbm2java */ @Entity -@Table(name = "vamdc_inchikey_exceptions", catalog = "vamdc_species") +@Table(name = "vamdc_inchikey_exceptions", catalog = "vamdc_species_dev") public class VamdcInchikeyExceptions implements java.io.Serializable { private Integer id; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMarkupTypes.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMarkupTypes.java index 736d7bb..a4c3a23 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMarkupTypes.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMarkupTypes.java @@ -17,7 +17,7 @@ * VamdcMarkupTypes generated by hbm2java */ @Entity -@Table(name = "vamdc_markup_types", catalog = "vamdc_species") +@Table(name = "vamdc_markup_types", catalog = "vamdc_species_dev") public class VamdcMarkupTypes implements java.io.Serializable { private int id; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabaseIdentifiers.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabaseIdentifiers.java index 628b62e..e645ccc 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabaseIdentifiers.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabaseIdentifiers.java @@ -19,7 +19,7 @@ * VamdcMemberDatabaseIdentifiers generated by hbm2java */ @Entity -@Table(name = "vamdc_member_database_identifiers", catalog = "vamdc_species", uniqueConstraints = @UniqueConstraint(columnNames = { +@Table(name = "vamdc_node_species", catalog = "vamdc_species_dev", uniqueConstraints = @UniqueConstraint(columnNames = { "species_id", "database_species_id", "member_database_id" })) public class VamdcMemberDatabaseIdentifiers implements java.io.Serializable { diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabases.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabases.java index 9a4a605..0526ce3 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabases.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcMemberDatabases.java @@ -19,7 +19,7 @@ * VamdcMemberDatabases generated by hbm2java */ @Entity -@Table(name = "vamdc_member_databases", catalog = "vamdc_species") +@Table(name = "vamdc_nodes", catalog = "vamdc_species_dev") public class VamdcMemberDatabases implements java.io.Serializable { private Integer id; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpecies.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpecies.java index 128d214..d5c9910 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpecies.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpecies.java @@ -21,14 +21,13 @@ * VamdcSpecies generated by hbm2java */ @Entity -@Table(name = "vamdc_species", catalog = "vamdc_species", uniqueConstraints = @UniqueConstraint(columnNames = { - "inchikey", "inchikey_duplicate_counter" })) +@Table(name = "vamdc_species", catalog = "vamdc_species_dev", uniqueConstraints = @UniqueConstraint(columnNames = { + "inchikey" })) public class VamdcSpecies implements java.io.Serializable { private String id; private String inchi; private String inchikey; - private int inchikeyDuplicateCounter; private String stoichiometricFormula; private int massNumber; private int charge; @@ -45,10 +44,10 @@ public class VamdcSpecies implements java.io.Serializable { 0); private Set vamdcSpeciesStructFormulaes = new HashSet( 0); - private Set vamdcSpeciesResourceses = new HashSet( - 0); - private Set vamdcConformerses = new HashSet( - 0); + /*private Set vamdcSpeciesResourceses = new HashSet( + 0);*/ + /*private Set vamdcConformerses = new HashSet( + 0);*/ private Set vamdcSpeciesNameses = new HashSet( 0); @@ -62,7 +61,7 @@ public VamdcSpecies(String id, String inchi, String inchikey, this.id = id; this.inchi = inchi; this.inchikey = inchikey; - this.inchikeyDuplicateCounter = inchikeyDuplicateCounter; + //this.inchikeyDuplicateCounter = inchikeyDuplicateCounter; this.stoichiometricFormula = stoichiometricFormula; this.massNumber = massNumber; this.charge = charge; @@ -89,28 +88,28 @@ public VamdcSpecies( Set vamdcMemberDatabaseIdentifierses, Set vamdcInchikeyExceptionses, Set vamdcSpeciesStructFormulaes, - Set vamdcSpeciesResourceses, - Set vamdcConformerses, + //Set vamdcSpeciesResourceses, + /*Set vamdcConformerses,*/ Set vamdcSpeciesNameses) { this.id = id; this.inchi = inchi; this.inchikey = inchikey; - this.inchikeyDuplicateCounter = inchikeyDuplicateCounter; + /*this.inchikeyDuplicateCounter = inchikeyDuplicateCounter;*/ this.stoichiometricFormula = stoichiometricFormula; this.massNumber = massNumber; this.charge = charge; this.speciesType = speciesType; this.cml = cml; this.mol = mol; - this.image = image; + //this.image = image; this.smiles = smiles; this.created = created; this.memberDatabasesId = memberDatabasesId; this.vamdcMemberDatabaseIdentifierses = vamdcMemberDatabaseIdentifierses; this.vamdcInchikeyExceptionses = vamdcInchikeyExceptionses; this.vamdcSpeciesStructFormulaes = vamdcSpeciesStructFormulaes; - this.vamdcSpeciesResourceses = vamdcSpeciesResourceses; - this.vamdcConformerses = vamdcConformerses; + //this.vamdcSpeciesResourceses = vamdcSpeciesResourceses; + /*this.vamdcConformerses = vamdcConformerses;*/ this.vamdcSpeciesNameses = vamdcSpeciesNameses; } @@ -147,14 +146,14 @@ public void setInchikey(String inchikey) { this.inchikey = inchikey; } - @Column(name = "inchikey_duplicate_counter", nullable = false) + /*@Column(name = "inchikey_duplicate_counter", nullable = false) public int getInchikeyDuplicateCounter() { return this.inchikeyDuplicateCounter; } public void setInchikeyDuplicateCounter(int inchikeyDuplicateCounter) { this.inchikeyDuplicateCounter = inchikeyDuplicateCounter; - } + }*/ @Column(name = "stoichiometric_formula", nullable = false, length = 150) @NotNull @@ -185,7 +184,7 @@ public void setCharge(int charge) { this.charge = charge; } - @Column(name = "species_type", nullable = false) + @Column(name = "species_type_id", nullable = false) public int getSpeciesType() { return this.speciesType; } @@ -212,7 +211,7 @@ public void setMol(String mol) { this.mol = mol; } - @Column(name = "image") + @Column(name = "imageURL") public String getImage() { return this.image; } @@ -280,7 +279,7 @@ public void setVamdcSpeciesStructFormulaes( this.vamdcSpeciesStructFormulaes = vamdcSpeciesStructFormulaes; } - @OneToMany(fetch = FetchType.LAZY, mappedBy = "vamdcSpecies") + /*@OneToMany(fetch = FetchType.LAZY, mappedBy = "vamdcSpecies") public Set getVamdcSpeciesResourceses() { return this.vamdcSpeciesResourceses; } @@ -288,16 +287,16 @@ public Set getVamdcSpeciesResourceses() { public void setVamdcSpeciesResourceses( Set vamdcSpeciesResourceses) { this.vamdcSpeciesResourceses = vamdcSpeciesResourceses; - } + }*/ - @OneToMany(fetch = FetchType.LAZY, mappedBy = "vamdcSpecies") + /*@OneToMany(fetch = FetchType.LAZY, mappedBy = "vamdcSpecies") public Set getVamdcConformerses() { return this.vamdcConformerses; } public void setVamdcConformerses(Set vamdcConformerses) { this.vamdcConformerses = vamdcConformerses; - } + }*/ @OneToMany(fetch = FetchType.LAZY, mappedBy = "vamdcSpecies") public Set getVamdcSpeciesNameses() { diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesNames.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesNames.java index f3f88fa..d555c38 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesNames.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesNames.java @@ -22,10 +22,14 @@ * VamdcSpeciesNames generated by hbm2java */ @Entity -@Table(name = "vamdc_species_names", catalog = "vamdc_species", uniqueConstraints = @UniqueConstraint(columnNames = { +@Table(name = "vamdc_species_names", catalog = "vamdc_species_dev", uniqueConstraints = @UniqueConstraint(columnNames = { "species_id", "name", "markup_type_id" })) public class VamdcSpeciesNames implements java.io.Serializable { + /** + * + */ + private static final long serialVersionUID = 3162094765495447143L; private Integer id; private VamdcSpecies vamdcSpecies; private VamdcMarkupTypes vamdcMarkupTypes; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesResources.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesResources.java deleted file mode 100644 index f47e57e..0000000 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesResources.java +++ /dev/null @@ -1,111 +0,0 @@ -package org.vamdc.portal.entity.species; - -// Generated 18.09.2012 16:57:53 by Hibernate Tools 3.4.0.CR1 - -import java.util.Date; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import static javax.persistence.GenerationType.IDENTITY; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; -import javax.persistence.UniqueConstraint; -import org.hibernate.validator.Length; -import org.hibernate.validator.NotNull; - -/** - * VamdcSpeciesResources generated by hbm2java - */ -@Entity -@Table(name = "vamdc_species_resources", catalog = "vamdc_species", uniqueConstraints = @UniqueConstraint(columnNames = { - "species_id", "url" })) -public class VamdcSpeciesResources implements java.io.Serializable { - - private Integer id; - private VamdcSpecies vamdcSpecies; - private String url; - private String description; - private int searchPriority; - private Date created; - - public VamdcSpeciesResources() { - } - - public VamdcSpeciesResources(VamdcSpecies vamdcSpecies, String url, - String description, int searchPriority, Date created) { - this.vamdcSpecies = vamdcSpecies; - this.url = url; - this.description = description; - this.searchPriority = searchPriority; - this.created = created; - } - - @Id - @GeneratedValue(strategy = IDENTITY) - @Column(name = "id", unique = true, nullable = false) - public Integer getId() { - return this.id; - } - - public void setId(Integer id) { - this.id = id; - } - - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "species_id", nullable = false) - @NotNull - public VamdcSpecies getVamdcSpecies() { - return this.vamdcSpecies; - } - - public void setVamdcSpecies(VamdcSpecies vamdcSpecies) { - this.vamdcSpecies = vamdcSpecies; - } - - @Column(name = "url", nullable = false) - @NotNull - public String getUrl() { - return this.url; - } - - public void setUrl(String url) { - this.url = url; - } - - @Column(name = "description", nullable = false, length = 150) - @NotNull - @Length(max = 150) - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.description = description; - } - - @Column(name = "search_priority", nullable = false) - public int getSearchPriority() { - return this.searchPriority; - } - - public void setSearchPriority(int searchPriority) { - this.searchPriority = searchPriority; - } - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "created", nullable = false, length = 19) - @NotNull - public Date getCreated() { - return this.created; - } - - public void setCreated(Date created) { - this.created = created; - } - -} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesStructFormulae.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesStructFormulae.java index 16064eb..de3fc6a 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesStructFormulae.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesStructFormulae.java @@ -22,7 +22,7 @@ * VamdcSpeciesStructFormulae generated by hbm2java */ @Entity -@Table(name = "vamdc_species_struct_formulae", catalog = "vamdc_species", uniqueConstraints = @UniqueConstraint(columnNames = { +@Table(name = "vamdc_species_struct_formulae", catalog = "vamdc_species_dev", uniqueConstraints = @UniqueConstraint(columnNames = { "species_id", "formula", "markup_type_id" })) public class VamdcSpeciesStructFormulae implements java.io.Serializable { diff --git a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesTypes.java b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesTypes.java index b16d27f..d6c0d99 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesTypes.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/entity/species/VamdcSpeciesTypes.java @@ -13,7 +13,7 @@ * VamdcSpeciesTypes generated by hbm2java */ @Entity -@Table(name = "vamdc_species_types", catalog = "vamdc_species") +@Table(name = "vamdc_species_types", catalog = "vamdc_species_dev") public class VamdcSpeciesTypes implements java.io.Serializable { private int id; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/registry/EmptyRegistry.java b/portal.ejb/src/main/java/org/vamdc/portal/registry/EmptyRegistry.java index e105c95..3335fdd 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/registry/EmptyRegistry.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/registry/EmptyRegistry.java @@ -59,4 +59,10 @@ public List getProcessors(String ivoaid) { return null; } + @Override + public Collection getInactiveIVOAIDs(Service standard) { + // TODO Auto-generated method stub + return null; + } + } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/registry/Nodes.java b/portal.ejb/src/main/java/org/vamdc/portal/registry/Nodes.java index e175d6b..8c708bf 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/registry/Nodes.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/registry/Nodes.java @@ -4,8 +4,6 @@ import java.util.Collection; import java.util.Collections; import java.util.List; - - import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; @@ -19,26 +17,44 @@ public class Nodes { private Registry registry; + + private enum NodeStatus{ + ACTIVE, INACTIVE + } public Nodes(){ this.registry=Client.INSTANCE.get(); } - + public List getNodes(){ + return this.getNodes(NodeStatus.ACTIVE); + } + + public List getInactiveNodes(){ + return this.getNodes(NodeStatus.INACTIVE); + } + + private List getNodes(NodeStatus status){ if (registry==null) return Collections.emptyList(); - Collection ivoaIDs=registry.getIVOAIDs(Service.VAMDC_TAP); + Collection ivoaIDs = null; + + if(status == NodeStatus.ACTIVE){ + ivoaIDs=registry.getIVOAIDs(Service.VAMDC_TAP); + }else if(status == NodeStatus.INACTIVE){ + ivoaIDs=registry.getInactiveIVOAIDs(Service.VAMDC_TAP); + } if (ivoaIDs==null) return Collections.emptyList(); List result = new ArrayList(); - for (String id:ivoaIDs){ result.add(new VamdcNode(id)); } + Collections.sort(result); return result; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/Consumer.java b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/Consumer.java new file mode 100644 index 0000000..9c5e154 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/Consumer.java @@ -0,0 +1,11 @@ +package org.vamdc.portal.session.consumers; + +public interface Consumer { + public void process(); + public String getLocation(); + public boolean isDone(); + public boolean isProcessing(); + public boolean isOk(); + public boolean isErrorHappened(); + public String getError(); +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/ConsumerProcessor.java b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/ConsumerProcessor.java new file mode 100644 index 0000000..d0fd3ff --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/ConsumerProcessor.java @@ -0,0 +1,99 @@ +package org.vamdc.portal.session.consumers; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.jboss.seam.Component; +import org.vamdc.portal.async.FutureTask; +import org.vamdc.portal.registry.RegistryFacade; + +public class ConsumerProcessor implements Consumer, FutureTask{ + + RegistryFacade registryFacade; + private URL consumer; + private URL data; + private Future location; + + + public ConsumerProcessor(String consumer, String data){ + registryFacade = (RegistryFacade) Component.getInstance("registryFacade"); + try { + this.consumer = registryFacade.getConsumerServiceURL(consumer); + this.data = new URL(data); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + + } + + /** + * execute consumer + */ + public void process() { + List nodes = new ArrayList(); + nodes.add(data); + if (consumer != null) { + ExecutorService executor = Executors.newSingleThreadExecutor(); + location = executor + .submit(new PostRequest(consumer, nodes)); + executor.shutdown(); + } + } + + /** + * return consumer result url as a string + */ + public String getLocation(){ + String result = ""; + try { + result = this.location.get().toExternalForm(); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + + return result; + } + + public boolean isDone() { + return (location != null && location.isDone() && !location + .isCancelled()); + } + + public boolean isProcessing() { + return (location != null && !location.isDone()); + } + + public boolean isOk() { + return (isDone() && !isErrorHappened()); + } + + public boolean isErrorHappened() { + if (isDone()) { + try { + location.get(); + } catch (Exception e) { + return true; + } + } + return false; + } + + public String getError() { + if (isDone()) { + try { + location.get(); + } catch (Exception e) { + return e.getMessage(); + } + } + return ""; + } +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/ConsumerRequestRegistry.java b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/ConsumerRequestRegistry.java new file mode 100644 index 0000000..0505ce2 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/ConsumerRequestRegistry.java @@ -0,0 +1,127 @@ +package org.vamdc.portal.session.consumers; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import javax.faces.component.UIOutput; +import javax.faces.event.ActionEvent; +import javax.faces.model.SelectItem; + +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.In; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; +import org.vamdc.portal.registry.RegistryFacade; +import org.vamdc.portal.session.queryLog.EmptyResponse; + +@Name("consumers") +@Scope(ScopeType.PAGE) +public class ConsumerRequestRegistry implements Serializable { + + private static final long serialVersionUID = -4206391044359168710L; + + @In(create = true) + RegistryFacade registryFacade; + + /** + * map of consumers for each node + */ + private Map> nodeConsumers; + + /** + * Map of the last called consumer for each node + */ + private Map processedConsumers = new ConcurrentHashMap(); + + /** + * selected consumer ivoaid + */ + private String selectedConsumer = null; + + /** + * Returns map of all consumers for each node + * @return + */ + public Map> getNodeConsumers(){ + if(this.nodeConsumers == null){ + initNodeConsumers(); + } + return this.nodeConsumers; + } + + /** + * populates nodeConsumers Map + * + * @return + */ + private void initNodeConsumers() { + Collection nodes = registryFacade.getTapIvoaIDs(); + this.nodeConsumers = new HashMap>(); + this.nodeConsumers.put(EmptyResponse.IVOA_ID, new ArrayList()); + for (String node : nodes) { + List consumers = new ArrayList(); + + // search processors for selected nodes + Collection visibleConsumers = new ArrayList( + registryFacade.getConsumerIvoaIDs()); + // Retain available consumers + visibleConsumers.retainAll(registryFacade.getNodeConsumers(node)); + + // recommended consumers + for (String ivoaID : visibleConsumers) { + consumers.add(new SelectItem(ivoaID, registryFacade.getResourceTitle(ivoaID))); + } + + // other consumers + for (String ivoaID : registryFacade.getConsumerIvoaIDs()) { + if (!visibleConsumers.contains(ivoaID)) { + consumers.add(new SelectItem(ivoaID, " " + registryFacade + .getResourceTitle(ivoaID))); + } + } + this.nodeConsumers.put(node, consumers); + + } + } + + /** + * changes the currently selected consumer when user change selection in list + * @param event + */ + public void changeConsumerSelected(ActionEvent event) { + if (event.getComponent().getParent() != null) { + UIOutput el = (UIOutput) event.getComponent().getParent(); + this.setSelectedConsumer((String) el.getValue()); + } + } + + + public void setSelectedConsumer(String ivoaID) { + this.selectedConsumer = ivoaID; + } + + public String getSelectedConsumer() { + return selectedConsumer; + } + + /** + * ask consumer execution for nodeIvoaID on data at nodeQueryUrl + * @param nodeQueryUrl + * @param nodeIvoaID + */ + public void process(String nodeQueryUrl, String nodeIvoaID) { + Consumer consumer = new ConsumerProcessor(selectedConsumer, nodeQueryUrl); + this.processedConsumers.put(nodeIvoaID, consumer); + this.processedConsumers.get(nodeIvoaID).process(); + + } + + public Map getConsumersByNode(){ + return this.processedConsumers; + } +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/Consumers.java b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/Consumers.java deleted file mode 100644 index 5db61da..0000000 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/Consumers.java +++ /dev/null @@ -1,223 +0,0 @@ -package org.vamdc.portal.session.consumers; - -import java.io.Serializable; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.Future; - -import javax.faces.model.SelectItem; -import org.jboss.seam.ScopeType; -import org.jboss.seam.annotations.In; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Scope; -import org.vamdc.portal.registry.RegistryFacade; - - -@Name("consumers") -@Scope(ScopeType.PAGE) -public class Consumers implements Serializable{ - - private static final long serialVersionUID = -4206391044359168710L; - - @In(create=true) RegistryFacade registryFacade; - - private String selectedIvoaID = null; - private Boolean consumerSelected = false; - - //selected nodes requests - private Map queries = new HashMap(); - - // selected nodes ids - private Map selectedNodes = new HashMap(); - - private Future consumerLocation; - - //list of processors - private List consumers = new ArrayList(); - - - public List getConsumers(){ - return consumers; - } - - public Integer getConsumersCount(){ - return consumers.size(); - } - - /** - * update list of processors and returns its size - * @return - */ - public Integer getConsumersUpdatedCount(){ - return getConsumersUpdated().size(); - } - - private void clearConsumerSelection(){ - consumerSelected = false; - consumers.clear(); - consumerLocation = null; - selectedIvoaID = null; - } - - /** - * update list of processors for the currently selected nodes - * @return - */ - public List getConsumersUpdated(){ - - List result = new ArrayList(); - if(getSelectedNodesCount() > 0){ - //search processors for selected nodes - Collection visibleConsumers = new ArrayList(registryFacade.getConsumerIvoaIDs()); - for (Map.Entry node : selectedNodes.entrySet()){ - if (node.getValue()){ - //Retain available consumers - visibleConsumers.retainAll(registryFacade.getNodeConsumers(node.getKey())); - } - } - - //recommended consumers - for (String ivoaID:visibleConsumers){ - result.add(new SelectItem(ivoaID," ** "+registryFacade.getResourceTitle(ivoaID))); - } - - //other consumers - for(String ivoaID : registryFacade.getConsumerIvoaIDs()){ - if(visibleConsumers.contains(ivoaID) == false){ - result.add(new SelectItem(ivoaID,registryFacade.getResourceTitle(ivoaID))); - } - } - } - this.consumers = result; - return this.consumers; - } - - public Integer getSelectedNodesCount(){ - int result = 0; - for (Map.Entry entry : this.queries.entrySet()){ - if((Boolean)entry.getValue()) - result++; - } - return result; - } - - public String getSelectedNodes(){ - StringBuilder ret=new StringBuilder(); - for (Map.Entry entry : this.queries.entrySet()){ - if((Boolean)entry.getValue()) - ret.append(entry.getKey()+";"); - } - return ret.toString(); - } - - public boolean getConsumerSelected(){ - return this.consumerSelected; - } - - public void setSelectedConsumer(String ivoaID){ - this.consumerSelected = true; - this.selectedIvoaID = ivoaID; - } - - public String getSelectedConsumer(){ - return selectedIvoaID; - } - - - public Integer getSelectedConsumerNumberOfInput(){ - return registryFacade.getConsumerNumberOfInputs(selectedIvoaID); - } - - public Map getQueries() { - return queries; - } - - public void setQueries(Map queries) { - this.queries = queries; - } - - public void process(){ - List nodes = new ArrayList(); - for (String req:queries.keySet()){ - if (queries.get(req)){ - try { - nodes.add(new URL(req)); - } catch (MalformedURLException e) {} - } - } - - URL consumer = registryFacade.getConsumerServiceURL(selectedIvoaID); - - if (nodes.size()>0 && consumer!=null){ - ExecutorService executor = Executors.newSingleThreadExecutor(); - consumerLocation = executor.submit(new PostRequest(consumer,nodes)); - executor.shutdown(); - } - } - - public boolean isDone(){ - return (consumerLocation!=null && consumerLocation.isDone() && !consumerLocation.isCancelled()); - } - - public boolean isProcessing(){ - return ((consumerLocation!=null && !consumerLocation.isDone())); - } - - public boolean isOk(){ - return (isDone() && !isErrorHappened()); - } - - public boolean isErrorHappened(){ - if (isDone()){ - try{ - consumerLocation.get(); - } catch (Exception e) { - return true; - } - } - return false; - } - - public String getError(){ - if (isDone()){ - try{ - consumerLocation.get(); - } catch (Exception e) { - return e.getMessage(); - } - } - return ""; - } - - public String getLocation(){ - URL result = null; - if (isDone()) - try { - result= consumerLocation.get(); - } catch (InterruptedException e) { - } catch (ExecutionException e) { - e.printStackTrace(); - } - if (result!=null) - return result.toExternalForm(); - return ""; - } - - public void updateNodeIds(String text){ - clearConsumerSelection(); - if(selectedNodes.containsKey(text)){ - selectedNodes.put(text, !selectedNodes.get(text)); - }else{ - selectedNodes.put(text, true); - } - } - -} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/PostRequest.java b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/PostRequest.java index 1149432..178b862 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/PostRequest.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/consumers/PostRequest.java @@ -12,59 +12,55 @@ import org.vamdc.portal.Settings; - - -public class PostRequest implements Callable{ +public class PostRequest implements Callable { private URL consumer; private Collection nodes; - public PostRequest(URL consumer, Collection nodes){ + + public PostRequest(URL consumer, Collection nodes) { this.consumer = consumer; this.nodes = nodes; } - + @Override public URL call() throws Exception { - + HttpURLConnection connection = setupConnection(); - + return processResponse(connection); } - private URL processResponse(HttpURLConnection connection) - throws IOException, MalformedURLException { - URL result=null; + private URL processResponse(HttpURLConnection connection) throws IOException, MalformedURLException { + URL result = null; int resultCode = connection.getResponseCode(); - - if (resultCode== HttpURLConnection.HTTP_MOVED_TEMP || resultCode== HttpURLConnection.HTTP_SEE_OTHER || resultCode==HttpURLConnection.HTTP_MOVED_PERM){ + if (resultCode == HttpURLConnection.HTTP_MOVED_TEMP || resultCode == HttpURLConnection.HTTP_SEE_OTHER + || resultCode == HttpURLConnection.HTTP_MOVED_PERM) { result = new URL(connection.getHeaderField("Location")); - }else{ - throw new IOException("XSAMS processor service returned "+resultCode+" status code."); + } else { + throw new IOException("XSAMS processor service returned " + resultCode + " status code."); } return result; } - private HttpURLConnection setupConnection() throws IOException, - ProtocolException { + private HttpURLConnection setupConnection() throws IOException, ProtocolException { HttpURLConnection connection = (HttpURLConnection) consumer.openConnection(); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("POST"); connection.setReadTimeout(Settings.HTTP_DATA_TIMEOUT.getInt()); connection.setDoOutput(true); - - String data=""; - for (URL node:nodes){ - if (data.length()>0) - data+="&"; - data+=URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode(node.toString(), "UTF-8"); - - }; + + String data = ""; + for (URL node : nodes) { + if (data.length() > 0) + data += "&"; + data += URLEncoder.encode("url", "UTF-8") + "=" + URLEncoder.encode(node.toString(), "UTF-8"); + } OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream()); wr.write(data); wr.flush(); wr.close(); - + return connection; } - + } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewManager.java b/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewManager.java index 2ac24b6..aae7079 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewManager.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewManager.java @@ -23,60 +23,66 @@ import org.vamdc.portal.entity.query.HttpHeadResponse; import org.vamdc.portal.entity.query.HttpHeadResponse.Response; import org.vamdc.portal.registry.RegistryFacade; -import org.vamdc.portal.session.consumers.Consumers; +import org.vamdc.portal.session.consumers.ConsumerRequestRegistry; import org.vamdc.portal.session.queryBuilder.QueryData; @Name("preview") @Scope(ScopeType.PAGE) -public class PreviewManager implements Serializable{ +public class PreviewManager implements Serializable { - //TODO: create meaningful test to check the serializability private static final long serialVersionUID = 2029452631857959114L; @Logger Log log; - @In transient QueryData queryData; + @In + transient QueryData queryData; + + @In(create = true) + transient RegistryFacade registryFacade; + + @In(create = true) + transient ConsumerRequestRegistry consumers; + + //private volatile boolean completeEventCalled = false; - @In(create=true) transient RegistryFacade registryFacade; - - @In(create=true) transient Consumers consumers; - - private volatile boolean completeEventCalled=false; - private Collection> nodeFutureResponses = new ArrayList>(); private long startTime; - + private long percentDone; - - public void initiate(){ - - if (nodeFutureResponses.size()>0) + private Boolean securedProtocolsAreSet = false; + + public void initiate() { + this.setSSLProtocols(); + if (!nodeFutureResponses.isEmpty()) return; Collection activeNodes = queryData.getActiveNodes(); - if (activeNodes.size()==0) + if (activeNodes.isEmpty()) return; - - ExecutorService executor = Executors.newFixedThreadPool(activeNodes.size()); - for (String ivoaID:activeNodes){ - try{ - nodeFutureResponses.add(executor.submit(new PreviewThread(ivoaID,registryFacade.getVamdcTapMirrors(ivoaID),queryData.getQueryString()))); - }catch (IllegalArgumentException e){ + ExecutorService executor = Executors.newFixedThreadPool(activeNodes + .size()); + + for (String ivoaID : activeNodes) { + try { + nodeFutureResponses.add(executor.submit(new PreviewThread( + ivoaID, registryFacade.getVamdcTapMirrors(ivoaID), + queryData.getQueryString()))); + } catch (IllegalArgumentException e) { } } - + executor.shutdown(); startTime = new Date().getTime(); } - - public List getNodes(){ - TreeSet nodes = new TreeSet(new HttpHeadResponseComparator()); - for (Future task:nodeFutureResponses){ - if (task.isDone()&& !task.isCancelled()){ + public List getNodes() { + TreeSet nodes = new TreeSet( + new HttpHeadResponseComparator()); + for (Future task : nodeFutureResponses) { + if (task.isDone() && !task.isCancelled()) { try { HttpHeadResponse response = task.get(); nodes.add(response); @@ -92,104 +98,91 @@ public List getNodes(){ return new ArrayList(nodes); } - private class HttpHeadResponseComparator implements Comparator{ + private class HttpHeadResponseComparator implements + Comparator { @Override public int compare(HttpHeadResponse o1, HttpHeadResponse o2) { - if (o1==null || o2==null) + if (o1 == null || o2 == null) return 0; Integer value1 = Integer.valueOf(o1.getStatus().ordinal()); Integer value2 = Integer.valueOf(o2.getStatus().ordinal()); int compare = value1.compareTo(value2); - if (compare!=0) - return compare; - else if(o1.getProcesses()!=o2.getProcesses()) - return o2.getProcesses()-o1.getProcesses(); - else - return o1.getIvoaID().compareTo(o2.getIvoaID()); - + if (compare != 0) + return compare; + else if (o1.getProcesses() != o2.getProcesses()) + return o2.getProcesses() - o1.getProcesses(); + else + return o1.getIvoaID().compareTo(o2.getIvoaID()); + } - - } - - public boolean isDone(){ - if(this.percentDone <= 100){ - for (Future task:nodeFutureResponses){ - if (!task.isDone()){ + public boolean isDone() { + if (this.percentDone <= 100) { + for (Future task : nodeFutureResponses) { + if (!task.isDone()) { return false; } } } - - if (!completeEventCalled) - completeEvent(); - + return true; } - - public Long getPercentsDone(){ - Long result=0L; - if (isDone()){ - result=101L; - } else{ + + public Long getPercentsDone() { + Long result; + if (isDone()) { + result = 101L; + } else { Long now = new Date().getTime(); - result = (100L*(now-startTime)/Settings.HTTP_HEAD_TIMEOUT.getInt()); + result = (100L * (now - startTime) / Settings.HTTP_HEAD_TIMEOUT + .getInt()); } this.percentDone = result; return result; } - public String getStringStatus(){ + public String getStringStatus() { if (isDone()) return "Done"; - return ""+getNodes().size()+" nodes of "+nodeFutureResponses.size()+" responded"; + return "" + getNodes().size() + " nodes of " + + nodeFutureResponses.size() + " responded"; } - - public void cancel(){ - for (Future task:nodeFutureResponses){ + + public void cancel() { + for (Future task : nodeFutureResponses) { if (!task.isDone()) task.cancel(true); } } - - public void clear(){ + + public void clear() { cancel(); - nodeFutureResponses=new ArrayList>(); + nodeFutureResponses = new ArrayList>(); } - - public String refine(){ + + public String refine() { clear(); - if(!queryData.isGuidedQuery()) + if (!queryData.isGuidedQuery()) return RedirectPage.QUERY; else return RedirectPage.QUERYTREE; } - + /** - * Action that is called when the preview is complete. + * Set SSL protocols to be used. + * Fix a bug found when switching from java 7 to 8 : + * If this list is not set, the HTTPS request failed with java 8 but not + * with java 7 + * */ - public void completeEvent(){ - this.completeEventCalled=true; - List results = getNodes(); - int numActive=0; - String nodeId = null; - - - for (HttpHeadResponse node:results){ - if (node.isOk() && node.getStatus()==Response.OK){ - nodeId = node.getIvoaID(); - numActive++; - } - } - - if (numActive==1){ - consumers.updateNodeIds(nodeId); - consumers.getQueries().put(results.get(0).getFullQueryURL(), true); + private void setSSLProtocols() { + if (!securedProtocolsAreSet) { + System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2"); + this.securedProtocolsAreSet = true; } - } - + } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewThread.java b/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewThread.java index 3da24f5..c2e8109 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewThread.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PreviewThread.java @@ -1,5 +1,6 @@ package org.vamdc.portal.session.preview; +import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; @@ -8,47 +9,85 @@ import java.util.Collection; import java.util.concurrent.Callable; +import javax.net.ssl.HttpsURLConnection; + +import org.jboss.seam.annotations.Logger; +import org.jboss.seam.log.Log; import org.vamdc.portal.Settings; import org.vamdc.portal.entity.query.HttpHeadResponse; +public class PreviewThread implements Callable { + -public class PreviewThread implements Callable{ + @Logger + Log log; private String ivoaID; private String query; private Collection mirrors; - - public PreviewThread(String ivoaID, Collection mirrors, String query){ + + public PreviewThread(String ivoaID, Collection mirrors, String query) { this.ivoaID = ivoaID; this.query = query; - this.mirrors = mirrors; + this.mirrors = mirrors; } - + private URL getQuery(URL mirror) { - URL result=null; + URL result = null; try { - result = new URL(mirror+"sync?LANG=VSS2&REQUEST=doQuery&FORMAT=XSAMS&QUERY="+URLEncoder.encode(query,"UTF-8")); + result = new URL(mirror + + "sync?LANG=VSS2&REQUEST=doQuery&FORMAT=XSAMS&QUERY=" + + URLEncoder.encode(query, "UTF-8")); } catch (MalformedURLException e) { + log.info(e); } catch (UnsupportedEncodingException e) { + log.info(e); } return result; } + private HttpURLConnection getHttpURLConnection(URL url) throws IOException { + HttpURLConnection connection = null; + + + //http request + if (!url.getProtocol().equals("https")) { + connection = (HttpURLConnection) url.openConnection(); + } + //https request + else { + connection = (HttpsURLConnection) url.openConnection(); + } + + return connection; + } + + /** + * Send a HEAD request to a node by testing its mirrors + */ @Override public HttpHeadResponse call() throws Exception { - HttpHeadResponse response =null; - for (URL mirror:mirrors){ - URL queryURL = getQuery(mirror); - HttpURLConnection connection = (HttpURLConnection) queryURL.openConnection(); - + HttpHeadResponse response = null; + for (URL mirror : mirrors) { + HttpURLConnection connection = null; + connection = this.getHttpURLConnection(getQuery(mirror)); connection.setRequestMethod("HEAD"); connection.setReadTimeout(Settings.HTTP_HEAD_TIMEOUT.getInt()); - - response = new HttpHeadResponse(ivoaID,connection); + /*if(connection.getResponseCode() == 301 || connection.getResponseCode() == 302) { + connection.disconnect(); + String newUrl = connection.getHeaderField("Location"); + System.out.println("### try new url : " + newUrl); + connection = this.getHttpURLConnection(new URL(newUrl)); + connection.setRequestMethod("HEAD"); + connection.setReadTimeout(Settings.HTTP_HEAD_TIMEOUT.getInt()); + }*/ + response = new HttpHeadResponse(ivoaID, connection); + if (response.isOk()) return response; } + return response; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/FormHolder.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/FormHolder.java index 53e52c8..0765f09 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/FormHolder.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/FormHolder.java @@ -28,5 +28,7 @@ public interface FormHolder { void setComments(String comments); void setRequest(Collection requestFor); + + Integer getFormTypeCount(Form form); } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryController.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryController.java index 8b6ee33..37c55c3 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryController.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryController.java @@ -63,7 +63,6 @@ public String saveQuery(){ if (queryData.isValid()){ persistQuery(); conversation.endAndRedirect(); - log.info("Save action"); return RedirectPage.QUERY_LOG; }else{ return RedirectPage.QUERY; @@ -85,38 +84,10 @@ public String asyncQuery(){ private void persistQuery() { QueryPersister p = new QueryPersister(this); - Query query = p.constructQuery();//constructQuery(); + Query query = p.constructQuery(); queryLog.save(query,queryData.getEditQueryId()); } - - /*private Query constructQuery(){ - Query result=null; - if (queryData.getEditQueryId()!=null) - result = queryLog.getQuery(queryData.getEditQueryId()); - else - result = new Query(); - result.setComments(queryData.getComments()); - result.setQueryString(queryData.getQueryString()); - result.setResponses(selectRespondedNodes()); - result.setUser(auth.getUser()); - result.setDate(new Date()); - return result; - } - - - - private List selectRespondedNodes() { - ArrayList responses = new ArrayList(); - for (HttpHeadResponse response:preview.getNodes()){ - if (response.getStatus()==Response.OK) - responses.add(response); - } - return responses; - }*/ - - - public String preview(){ if (queryData.isValid()){ diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryData.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryData.java index 643dced..d71c14f 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryData.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryData.java @@ -106,13 +106,13 @@ private Collection loadActiveNodes() { Collection activeKeywords = getActiveKeywords(); - if (activeKeywords.size()==0 && request!=null && request.size()>0){ + if (activeKeywords.isEmpty() && request!=null && request.size() > 0){ result=ivoaIDs; return result; } for (String ivoaID:ivoaIDs){ - if (activeKeywords.size()>0 && registryFacade.getRestrictables(ivoaID).containsAll(activeKeywords)) + if (activeKeywords.size() > 0 && registryFacade.getRestrictables(ivoaID).containsAll(activeKeywords)) result.add(ivoaID); } return result; @@ -217,7 +217,7 @@ private boolean quickAddForm(Form form){ if(form.getOrder() == Order.GuidedSpeciesType) this.speciesFormPosition = forms.size()-1; - if (form instanceof SpeciesForm) + if (form instanceof SpeciesForm) // speciesForms.add((SpeciesForm) form); else unsortedFormsList.add(form); @@ -251,20 +251,21 @@ public Integer getFormTypeCount(Form form){ return 0; } - public void deleteForm(Form form){ - if(form instanceof SpeciesForm){//Decrease form positions only for species forms - Integer position = form.getPosition(); - for (SpeciesForm currentForm:speciesForms) { - if(currentForm.getClass() == form.getClass()&¤tForm.getPosition()>position){ - currentForm.decreasePosition(); - } - } - } + public void deleteForm(Form form){ formCounts.put(form.getOrder(), getFormTypeCount(form)-1); forms.remove(form); unsortedFormsList.remove(form); - if (form.getOrder()position){ + currentForm.decreasePosition(); + } + } + } + } rebuildLists(); } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeController.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeController.java index 73e51c0..43c15c7 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeController.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeController.java @@ -1,8 +1,6 @@ package org.vamdc.portal.session.queryBuilder; import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; import java.util.List; import org.jboss.seam.Component; @@ -20,13 +18,10 @@ import org.vamdc.portal.entity.security.User; import org.vamdc.portal.session.preview.PersistableQueryInterface; import org.vamdc.portal.session.preview.PreviewManager; -import org.vamdc.portal.session.queryBuilder.fields.AbstractField; import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; import org.vamdc.portal.session.queryBuilder.forms.Form; import org.vamdc.portal.session.queryBuilder.forms.Order; -import org.vamdc.portal.session.queryBuilder.formsTree.AtomsTreeForm; import org.vamdc.portal.session.queryBuilder.formsTree.RootForm; -import org.vamdc.portal.session.queryBuilder.formsTree.SearchMode; import org.vamdc.portal.session.queryBuilder.formsTree.TreeFormInterface; import org.vamdc.portal.session.queryLog.QueryLog; import org.vamdc.portal.session.security.UserInfo; @@ -38,12 +33,10 @@ public class QueryTreeController implements QueryTreeInterface, PersistableQuer @In(create=true) @Out QueryData queryData; @In(create=true) UserInfo auth; @Logger - transient private Log log; + private Log log; @In(create=true) private PreviewManager preview; - @In(create=true) private QueryLog queryLog; - - private SearchMode searchMode = SearchMode.species; - + @In(create=true) private QueryLog queryLog; + public QueryTreeController(){ this.addForm(new RootForm(this)); } @@ -52,8 +45,6 @@ public QueryTreeController(){ public String saveQuery(){ if (queryData.isValid()){ persistQuery(); - //conversation.endAndRedirect(); - log.info("Save action"); return RedirectPage.QUERY_LOG; }else{ return RedirectPage.QUERYTREE; @@ -93,59 +84,9 @@ private Integer requestableFormsCount(){ public List
getForms() { List forms= new ArrayList(); forms = this.getQueryData().getOrderedGuidedForm(); - /* - switch(searchMode){ - case collision : - forms = this.getCollisionForms(); - break; - case radiative : - forms = this.getQueryData().getOrderedGuidedForm(); - break; - case species : - forms = this.getQueryData().getOrderedGuidedForm(); - break; - } */ - //return queryData.getUnsortedForms(); return forms; } - - private List getRadiativeForms(){ - List formsList = this.getQueryData().getForms(); - List result = new ArrayList(); - - for(Form f : formsList){ - if(f.getOrder() == Order.GuidedRoot) - result.add(0, f); - if(f.getOrder() == Order.GuidedStates) - result.add(1, f); - } - - return formsList; - } - - private List getCollisionForms(){ - List formsList = this.getQueryData().getForms(); - return formsList; - } - - private List getSpeciesForms(){ - List formsList = this.getQueryData().getForms(); - List result = new ArrayList(); - - for(Form f : formsList){ - if(!isRequestable(f)){ - result.add(f); - } - } - - for(Form f : formsList){ - if(isRequestable(f)){ - result.add(f); - } - } - return result; - } - + public boolean isDone() { return true; @@ -158,21 +99,26 @@ public String preview() { } else return RedirectPage.QUERYTREE; } - - + @Override public void addForm(T form) { this.getQueryData().addForm(form); } + + public QueryData getQueryData(){ if(queryData == null){ - queryData = (QueryData)Component.getInstance("queryData"); - queryData.setGuidedQuery(true); + try{ + queryData = (QueryData)Component.getInstance("queryData"); + queryData.setGuidedQuery(true); + }catch(IllegalStateException e){ // + queryData = new QueryData(); + queryData.setGuidedQuery(true); + } } return queryData; - } - + } @Override public Integer getFormCount() { @@ -203,9 +149,8 @@ public QueryLog getQueryLog() { } @Override - public void setSelectionMode(SearchMode searchMode) { - this.searchMode = searchMode; + public void removeForm(T form) { + this.queryData.deleteForm(form); } - } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeInterface.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeInterface.java index dbb2309..7434e35 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeInterface.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeInterface.java @@ -1,7 +1,6 @@ package org.vamdc.portal.session.queryBuilder; import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; -import org.vamdc.portal.session.queryBuilder.formsTree.SearchMode; import org.vamdc.portal.session.queryBuilder.formsTree.TreeFormInterface; @@ -9,7 +8,6 @@ public interface QueryTreeInterface { public void addForm( T form); public Boolean getSubmitable(); -//public void removeForm(AbstractForm form); +public void removeForm(T form); public Integer getFormCount(); -public void setSelectionMode(SearchMode searchMode); } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/ProxyRangeField.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/ProxyRangeField.java index 1fcc4a4..96a1647 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/ProxyRangeField.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/ProxyRangeField.java @@ -12,7 +12,7 @@ import org.vamdc.portal.session.queryBuilder.unitConv.UnitConverter; /** - * Field that proxies several range fields and does intercorversion into the primary one + * Field that proxies several range fields and does interconversion into the primary one * @author doronin * */ diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionImpl.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionImpl.java index fca92a9..fd721fa 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionImpl.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionImpl.java @@ -11,8 +11,8 @@ public abstract class SuggestionImpl implements SuggestionField.Suggestion{ * @return a collection that will be used for suggestion lookup */ protected abstract Collection loadValues(); - - protected final Collection values; + protected Collection values; + public SuggestionImpl(){ this.values= loadValues(); } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AtomsForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AtomsForm.java index 4f28f45..d1ee312 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AtomsForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AtomsForm.java @@ -10,7 +10,7 @@ import java.lang.Integer; import java.util.List; -public class AtomsForm extends SpeciesForm implements Form { +public class AtomsForm extends AbstractForm implements SpeciesForm { private static final long serialVersionUID = -795296288400049729L; @@ -19,18 +19,16 @@ public class AtomsForm extends SpeciesForm implements Form { @Override public Integer getOrder() { return Order.Atoms; } @Override - public String getView() { return "/xhtml/query/forms/standardForm.xhtml"; } + public String getView() { return "/xhtml/query/forms/atomsForm.xhtml"; } public AtomsForm(){ - super(); addField(new SimpleField(Restrictable.AtomSymbol,"Atom symbol")); addField(new RangeField(Restrictable.AtomMassNumber,"Mass number")); addField(new RangeField(Restrictable.AtomNuclearCharge,"Nuclear charge")); addField(new RangeField(Restrictable.IonCharge,"Ion charge")); addField(new TextField(Restrictable.InchiKey,"InChIKey")); addField(new UnitConvRangeField( - Restrictable.StateEnergy, "State energy", new EnergyUnitConverter())); - + Restrictable.StateEnergy, "State energy", new EnergyUnitConverter())); } public List getFields(){ diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/CollisionsForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/CollisionsForm.java index 9828fcd..7a88895 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/CollisionsForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/CollisionsForm.java @@ -98,8 +98,9 @@ public class ProcessNameSuggest extends SuggestionImpl{ @Override protected Collection loadValues() { Collection result = new ArrayList(); - for (XsamsProcessCode code:XsamsProcessCode.values()) + for (XsamsProcessCode code:XsamsProcessCode.values()){; result.add(code.getProcessName()); + } return result; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/EnvironmentForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/EnvironmentForm.java index 20b3c18..32c65bc 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/EnvironmentForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/EnvironmentForm.java @@ -15,7 +15,7 @@ public class EnvironmentForm extends AbstractForm implements Form{ @Override public Integer getOrder() { return Order.Environment; } @Override - public String getView() { return "/xhtml/query/forms/standardForm.xhtml"; } + public String getView() { return "/xhtml/query/forms/environmentForm.xhtml"; } public EnvironmentForm(){ addField( diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Form.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Form.java index c13aff7..cc1c2ed 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Form.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Form.java @@ -29,7 +29,6 @@ public interface Form extends Serializable{ */ public void setQueryData(QueryData data); - public void clear(); public void delete(); public void setPrefix(String prefix); @@ -37,6 +36,7 @@ public interface Form extends Serializable{ public Integer getOrder(); public Integer getPosition(); + public void decreasePosition(); public void setPrefixIndex(Integer integer); public int loadFromQuery(LogicNode branch); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/MoleculesForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/MoleculesForm.java index c8dc0bf..8d3f66b 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/MoleculesForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/MoleculesForm.java @@ -17,7 +17,7 @@ import org.vamdc.portal.session.queryBuilder.fields.SuggestionImpl; import org.vamdc.portal.session.queryBuilder.fields.TextField; -public class MoleculesForm extends SpeciesForm implements Form{ +public class MoleculesForm extends AbstractForm implements SpeciesForm{ /** * Molecule info from species database @@ -57,7 +57,6 @@ public MoleculesForm(){ } protected void init(){ - molChemName = new SuggestionField(null,"Chemical name", new ChemNameSuggestion()); addField(molChemName); @@ -81,11 +80,7 @@ public void clear(){ super.clear(); resetInchiKeys(); molecules = Collections.emptyList(); - } - - public String info(){ - return "test"; - } + } public List getMolecules() { return molecules; } @@ -154,7 +149,7 @@ public class ChemNameSuggestion implements SuggestionField.Suggestion{ @Override public Collection options(Object input) { EntityManager em= (EntityManager) Component.getInstance("entityManager"); - return EntityFacade.suggestChemicalName(em,(String)input); + return EntityFacade.suggestMoleculeName(em,(String)input); } @Override @@ -180,7 +175,7 @@ public class StoichFormSuggestion implements SuggestionField.Suggestion{ @Override public Collection options(Object input) { EntityManager em = (EntityManager) Component.getInstance("entityManager"); - return EntityFacade.suggestStoichiometricFormula(em,(String)input); + return EntityFacade.suggestMoleculeStoichiometricFormula(em,(String)input); } @Override @@ -190,7 +185,7 @@ public String getIllegalLabel() { @Override public void selected() { - EntityManager em = (EntityManager) Component.getInstance("entityManager"); + EntityManager em = (EntityManager) Component.getInstance("entityManager"); molecules = EntityFacade.loadMoleculesFromStoichForm(em, molStoichForm.getValue()); fillFromMolecules(); resetInchiKeys(); @@ -204,7 +199,7 @@ public class StructFormSuggestion implements SuggestionField.Suggestion{ @Override public Collection options(Object input) { EntityManager em = (EntityManager) Component.getInstance("entityManager"); - return EntityFacade.suggestOrdinaryFormula(em,(String)input); + return EntityFacade.suggestMoleculeOrdinaryFormula(em,(String)input); } @Override @@ -237,6 +232,7 @@ private void fillFromMolecules(){ this.molChemName.setValue(""); } this.molStoichForm.setValue(molecules.get(0).getFormula()); + if (molecules.size()==1) this.molOrdForm.setValue(molecules.get(0).getOrdinaryFormula()); else diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/ParticlesForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/ParticlesForm.java index 71e413c..429b874 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/ParticlesForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/ParticlesForm.java @@ -7,7 +7,7 @@ import org.vamdc.portal.session.queryBuilder.fields.SuggestionField; import org.vamdc.portal.session.queryBuilder.fields.SuggestionImpl; -public class ParticlesForm extends SpeciesForm implements Form{ +public class ParticlesForm extends AbstractForm implements SpeciesForm{ private static final long serialVersionUID = 6076734404479237682L; @@ -16,7 +16,7 @@ public class ParticlesForm extends SpeciesForm implements Form{ @Override public Integer getOrder() { return Order.Particles; } @Override - public String getView() { return "/xhtml/query/forms/standardForm.xhtml"; } + public String getView() { return "/xhtml/query/forms/particlesForm.xhtml"; } public ParticlesForm(){ super(); @@ -42,6 +42,5 @@ protected Collection loadValues() { }}; return result; } - } - + } } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/RadiativeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/RadiativeForm.java index 7ec39cb..64790aa 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/RadiativeForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/RadiativeForm.java @@ -19,7 +19,7 @@ public class RadiativeForm extends AbstractForm implements Form{ @Override public Integer getOrder() { return Order.Process; } @Override - public String getView() { return "/xhtml/query/forms/standardForm.xhtml"; } + public String getView() { return "/xhtml/query/forms/radiativeForm.xhtml"; } public RadiativeForm(){ super(); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/SpeciesForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/SpeciesForm.java index 0ee4ba0..aa6a342 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/SpeciesForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/SpeciesForm.java @@ -1,13 +1,7 @@ package org.vamdc.portal.session.queryBuilder.forms; -/** - * - * @author doronin - */ -public abstract class SpeciesForm extends AbstractForm{ - private static final long serialVersionUID = 2775326654582002862L; - public SpeciesForm(){ - super(); - } - +public interface SpeciesForm extends Form{ + //replaces SpeciesForm abstract cleass to group Atom/Molecule/Particle form + //when the forms were deleted, the remaining ones could have wrong ids in some cases + //which is not the case with this interface } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/UtilForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/UtilForm.java index 458773a..537ef8d 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/UtilForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/UtilForm.java @@ -12,7 +12,7 @@ public class UtilForm extends AbstractForm{ public String getTitle() { return "Misc."; } @Override - public String getView() { return "/xhtml/query/forms/standardForm.xhtml"; } + public String getView() { return "/xhtml/query/forms/utilForm.xhtml"; } @Override public Integer getOrder() { return Order.Util; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AtomsTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AtomsTreeForm.java index 88826c9..da1382c 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AtomsTreeForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AtomsTreeForm.java @@ -1,7 +1,6 @@ package org.vamdc.portal.session.queryBuilder.formsTree; import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; -import org.vamdc.portal.session.queryBuilder.fields.AbstractField; import org.vamdc.portal.session.queryBuilder.forms.FormForFields; import org.vamdc.portal.session.queryBuilder.forms.AtomsForm; import org.vamdc.portal.session.queryBuilder.forms.Order; @@ -13,14 +12,13 @@ public class AtomsTreeForm extends AtomsForm implements FormForFields, TreeFormI private static final long serialVersionUID = 5992593235932991330L; protected Integer position; private QueryTreeInterface tree; + public AtomsTreeForm(QueryTreeInterface tree) { - //super(tree); this.tree = tree; position = tree.getFormCount(); } public AtomsTreeForm(QueryTreeInterface tree, String prefix) { - //super(tree); this.tree = tree; this.setPrefix(prefix); position = tree.getFormCount(); @@ -30,32 +28,20 @@ public String getObject(){ return this.toString(); } - /*@Override - public String getView() { - return "/xhtml/query/queryTree/atomsForm.xhtml"; - }*/ @Override public void validate() { - // TODO Auto-generated method stub tree.addForm(this); } - - @Override - public void fieldUpdated(AbstractField field) { - // TODO Auto-generated method stub - } @Override public Integer getOrder() { - // TODO Auto-generated method stub return Order.Atoms; } @Override public Boolean getQueryable() { - // TODO Auto-generated method stub return true; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/CollisionTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/CollisionTreeForm.java index b56f8d4..cebe06e 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/CollisionTreeForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/CollisionTreeForm.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.List; +import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; import org.vamdc.dictionary.Restrictable; @@ -35,6 +36,8 @@ public class CollisionTreeForm extends CollisionsForm implements FormForFields, private Boolean queryable = true; private SearchMode selectedMode = SearchMode.withoutReaction; private QueryTreeInterface tree; + private String defaultSubmitButtonValue = "Select targets and colliders"; + private String submitButtonValue = defaultSubmitButtonValue; private enum SearchMode{ @@ -124,4 +127,22 @@ public Boolean getQueryable() { return this.queryable; } + public String getSubmitButtonValue(){ + return this.submitButtonValue; + } + + public void changeCollisionType(ValueChangeEvent e){ + final SearchMode value = (SearchMode)e.getNewValue(); + switch(value){ + case withoutReaction : + this.submitButtonValue = this.defaultSubmitButtonValue; + break; + + case withReaction: + this.submitButtonValue = "Select reactants and products"; + break; + } + + } + } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RadiativeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RadiativeForm.java index e782825..3e75533 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RadiativeForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RadiativeForm.java @@ -4,6 +4,7 @@ import java.util.Collection; import java.util.List; +import javax.faces.event.ValueChangeEvent; import javax.faces.model.SelectItem; import org.vamdc.dictionary.Restrictable; @@ -29,6 +30,8 @@ public class RadiativeForm extends AbstractForm implements FormForFields, TreeFo private Boolean queryable = true; private NextForm selectedMode = NextForm.anyEnergyRange; private QueryTreeInterface tree; + private final String defaultSubmitButtonValue = "Select species"; + private String submitButtonValue = defaultSubmitButtonValue; private enum NextForm{ upperLowerEnergyRange, @@ -40,7 +43,6 @@ private enum NextForm{ private static final long serialVersionUID = 1L; { add(new SelectItem(NextForm.upperLowerEnergyRange,"Transition from an energy range to another one")); - //add(new SelectItem(NextForm.stateEnergyRange,"Transition to and from a given energy range")); add(new SelectItem(NextForm.anyEnergyRange,"Any transition")); } }; @@ -64,9 +66,7 @@ public String getView() { public void validate() { if (this.selectedMode == null) return; - - //System.err.println("Adding next form "+selectedMode.name()); - + switch(this.selectedMode){ case upperLowerEnergyRange: tree.addForm(new AllStatesEnergyTreeForm(tree)); @@ -120,4 +120,24 @@ public Boolean getQueryable() { return this.queryable; } + public String getSubmitButtonValue(){ + return this.submitButtonValue; + } + + public void changeTransitionType(ValueChangeEvent e){ + NextForm value = (NextForm)e.getNewValue(); + String submitButton = "Select range"; + switch(value){ + case upperLowerEnergyRange: + this.submitButtonValue = submitButton; + break; + case stateEnergyRange: + this.submitButtonValue = submitButton; + break; + case anyEnergyRange: + this.submitButtonValue = this.defaultSubmitButtonValue; + break; + } + } + } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/ReactionCollisionForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/ReactionCollisionForm.java new file mode 100644 index 0000000..fe07cfb --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/ReactionCollisionForm.java @@ -0,0 +1,149 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; +import org.vamdc.portal.session.queryBuilder.fields.AbstractField; +import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; +import org.vamdc.portal.session.queryBuilder.forms.FormForFields; +import org.vamdc.portal.session.queryBuilder.forms.Order; + +public abstract class ReactionCollisionForm extends AbstractForm implements FormForFields, TreeFormInterface{ + + + /** + * + */ + private static final long serialVersionUID = -6587803873839744100L; + protected Integer typeAAtomCount; + protected Integer typeAMoleculeCount; + protected Integer typeAParticleCount; + protected Integer typeBAtomCount; + protected Integer typeBMoleculeCount; + protected Integer typeBParticleCount; + protected Integer maxElementCount = 5; + private QueryTreeInterface tree; + private Boolean queryable = true; + + + private String typeAName; + private String typeBName; + + public ReactionCollisionForm(QueryTreeInterface tree, String typeA, String typeB){ + this.tree = tree; + this.typeAName = typeA; + this.typeBName = typeB; + } + + @Override + public void validate() { + + for(int i=0;i nextOptions = new ArrayList(){ - private static final long serialVersionUID = -8406069388034760380L; - - { - add(new SelectItem(SearchMode.collision,"For collisional process")); - add(new SelectItem(SearchMode.radiative,"For radiative process")); - add(new SelectItem(SearchMode.species,"By species")); - } + private static final long serialVersionUID = -8406069388034760380L; + + { + add(new SelectItem(SearchMode.species,"By species")); + add(new SelectItem(SearchMode.radiative,"For radiative process")); + add(new SelectItem(SearchMode.collision,"For collisional process")); + } }; public RootForm(QueryTreeInterface tree) { - //super(tree); this.tree = tree; } @@ -51,8 +50,6 @@ public void validate(){ if (this.selectedMode == null) return; - tree.setSelectionMode(selectedMode); - switch(this.selectedMode){ case collision: tree.addForm(new CollisionTreeForm(tree)); @@ -75,29 +72,25 @@ public String getView() { @Override public String getTitle() { - // TODO Auto-generated method stub return null; } @Override public Integer getOrder() { - // TODO Auto-generated method stub return Order.GuidedRoot; } - + + @Override public Integer getPosition() { - // TODO Auto-generated method stub return 1; } @Override public Boolean getQueryable() { - // TODO Auto-generated method stub return this.queryable; } public void setQueryable(Boolean queryable) { - // TODO Auto-generated method stub this.queryable = queryable; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SineReactionCollisionForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SineReactionCollisionForm.java index b107ff1..bf91720 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SineReactionCollisionForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SineReactionCollisionForm.java @@ -6,143 +6,69 @@ import org.vamdc.portal.session.queryBuilder.forms.FormForFields; import org.vamdc.portal.session.queryBuilder.forms.Order; -public class SineReactionCollisionForm extends AbstractForm implements FormForFields, TreeFormInterface{ +public class SineReactionCollisionForm extends ReactionCollisionForm implements FormForFields, TreeFormInterface{ /** * */ private static final long serialVersionUID = -6587803873839744100L; - protected Integer targetAtomCount; - protected Integer targetMoleculeCount; - protected Integer targetParticleCount; - protected Integer colliderAtomCount; - protected Integer colliderMoleculeCount; - protected Integer colliderParticleCount; - protected Integer maxElementCount = 5; - private QueryTreeInterface tree; - private Boolean queryable = true; - private Integer formsCount = 0; public SineReactionCollisionForm(QueryTreeInterface tree){ - this.tree = tree; + super(tree, "target", "collider"); } @Override public String getView() { return "/xhtml/query/queryTree/sineReactionCollisionForm.xhtml"; } - - @Override - public void validate() { - for(int i=0;i getStoredQueries(){ - //log.info("Reading saved queries"); - List queries = null; User user = auth.getUser(); @@ -36,7 +34,6 @@ public List getStoredQueries(){ } if (queries!=null && queries.size()>0){ - log.info("Read #0 queries",queries.size()); return Collections.unmodifiableList(queries); } return new ArrayList(); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryFacade.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryFacade.java index a101e14..9552a8f 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryFacade.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryFacade.java @@ -15,8 +15,7 @@ public class QueryFacade { private final String idPrefix; public QueryFacade(Query query, String idPrefix){ - this.query = query; - + this.query = query; this.idPrefix = idPrefix; } @@ -40,7 +39,7 @@ public List getResponses(){ for (HttpHeadResponse node:query.getResponses()){ respondedNodes.add(new ResponseFacade(node)); } - if (respondedNodes.size()==0) + if (respondedNodes.isEmpty()) respondedNodes.add(new EmptyResponse()); return respondedNodes; } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryLog.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryLog.java index c7f66ec..0029d47 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryLog.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryLog.java @@ -42,14 +42,12 @@ public List getQueries(){ public void save(Query query, String queryID) { if (query.getUser()!=null && (queryID==null || queryID.substring(0,1).equals("p"))){ - //log.info("Saving query to the persistent log"); if (queryID!=null) query.setQueryID(Integer.valueOf(queryID.substring(1))); persistentQueryLog.save(query); }else{ if (queryID!=null) query.setQueryID(Integer.valueOf(queryID.substring(1))); - //log.info("Saving query to the session log"); sessionQueryLog.save(query); } } @@ -64,7 +62,6 @@ public void persistSessionQueries(){ } public void deleteQuery(String queryID){ - //log.info("Delete query"+queryID); if (queryID!=null){ if (queryID.substring(0, 1).equals("p")) persistentQueryLog.delete(Integer.valueOf(queryID.substring(1))); @@ -76,7 +73,7 @@ public void deleteQuery(String queryID){ public Query getQuery(String queryID){ if (queryID!=null){ List queries = null; - int intQueryID = Integer.valueOf(queryID.substring(1)); + int intQueryID = Integer.parseInt(queryID.substring(1)); if (queryID.substring(0, 1).equals("p")) queries = persistentQueryLog.getStoredQueries(); else diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreProcessor.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreProcessor.java new file mode 100644 index 0000000..9abc74c --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreProcessor.java @@ -0,0 +1,100 @@ +package org.vamdc.portal.session.queryLog; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.jboss.seam.Component; +import org.jboss.seam.annotations.Logger; +import org.jboss.seam.log.Log; +import org.jboss.seam.log.Logging; +import org.vamdc.portal.async.FutureTask; + +public class QueryStoreProcessor implements FutureTask{ + + private Future response; + + @Logger + private Log log = Logging.getLog(QueryStoreProcessor.class);; + + private String token; + + public QueryStoreProcessor(String token ){ + this.token = token; + } + + @Override + public void process(){ + ExecutorService executor = Executors.newSingleThreadExecutor(); + String ipaddress = ((QueryStoreRequestRegistry) Component.getInstance("querystore")).getIpAdress(); + response = executor + .submit(new QueryStoreRequest(token, ipaddress)); + executor.shutdown(); + } + + /** + * return result of querystore for a request + * + * @return + **/ + public QueryStoreResponse getResponse() { + QueryStoreResponse result; + + try { + result = this.response.get(); + } catch (InterruptedException e) { + log.debug(e); + result = new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, "", e.getMessage()); + } catch (ExecutionException e) { + log.debug(e); + result = new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, "", e.getMessage()); + }catch (NullPointerException e) { + log.debug(e); + result = new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, "", e.getMessage()); + } + + return result; + } + + @Override + public boolean isDone() { + return (response != null && response.isDone() && !response.isCancelled()); + } + + @Override + public boolean isProcessing() { + return (response != null && !response.isDone()); + } + + @Override + public boolean isOk() { + return (isDone() && !isErrorHappened()); + } + + @Override + public boolean isErrorHappened() { + if (isDone()) { + try { + response.get(); + } catch (Exception e) { + log.debug(e); + return true; + } + } + return false; + } + + @Override + public String getError() { + if (isDone()) { + try { + response.get(); + } catch (Exception e) { + log.debug(e); + return e.getMessage(); + } + } + return ""; + } +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreRequest.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreRequest.java new file mode 100644 index 0000000..0c84d0f --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreRequest.java @@ -0,0 +1,185 @@ +package org.vamdc.portal.session.queryLog; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.util.concurrent.Callable; + +import org.apache.http.HttpException; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.HttpClientBuilder; +import org.jboss.seam.Component; +import org.jboss.seam.annotations.Logger; +import org.jboss.seam.log.Log; +import org.jboss.seam.log.Logging; +import org.vamdc.portal.Settings; +import org.vamdc.portal.entity.security.User; +import org.vamdc.portal.session.security.UserInfo; + +public class QueryStoreRequest implements Callable{ + + @Logger + private Log log = Logging.getLog(QueryStoreRequest.class); + + private UserInfo auth; + private String token; + private String userIp; + + /** + * parameters of request to query store + * @author nmoreau + * + */ + enum Parameter{ + + QUERYTOKEN("queryToken"), + EMAIL("email"), + USERIP("userIp"), + USEDCLIENT("usedClient"); + + private String text; + + Parameter(String text){ + this.text = text; + } + + public String getText(){ + return this.text; + } + } + + + public QueryStoreRequest(String token, String userIp){ + auth = (UserInfo) Component.getInstance("auth"); + this.token = token; + this.userIp = userIp; + } + + @Override + public QueryStoreResponse call() throws Exception { + return this.associateRequest(token, userIp); + } + + /** + * Ask a permanent identifier for the request identified by the token string + * + * @param token token of a head request + */ + private QueryStoreResponse associateRequest(String token, String userIp) { + QueryStoreResponse result = null; + Integer count = 0; + try { + String request = this.getRequest(token, this.getUserEmail(), + this.userIp); + // send request while no result or result is empty + while ((result == null || QueryStoreResponse.STATUS_EMPTY.equals(result.getStatus())) + && count < Settings.QUERYSTORE_MAX_RETRY.getInt()) { + result = this.doRequest(request); + //if(result != null) + Thread.sleep(Settings.QUERYSTORE_RETRY_TIMER.getInt()); + count++; + } + } catch (Exception e) { + log.debug(e); + result = new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, "", "Error while querying query store"); + } + return result; + } + + + /** + * Send an HTTP request to the query store to get a UUID corresponding to a + * head token + * + * @param requestString get request string + * @return QueryStoreResponse + * @throws IOException + * @throws HttpException + * @throws KeyStoreException + * @throws NoSuchAlgorithmException + * @throws KeyManagementException + */ + private QueryStoreResponse doRequest(String requestString) + throws IOException, HttpException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { + + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(3 * 1000).build(); + + HttpClient httpClient = HttpClientBuilder.create() + .setDefaultRequestConfig(requestConfig).build(); + + HttpGet request = new HttpGet(requestString); + request.addHeader("User-Agent", Settings.PORTAL_USER_AGENT.get()); + StringBuilder result = new StringBuilder(); + + //SSLHandShakeException (IOException) occurs if missing certificate + HttpResponse response = httpClient.execute(request); + Integer statusCode = response.getStatusLine().getStatusCode(); + if ( statusCode == 200) { + BufferedReader rd = new BufferedReader(new InputStreamReader( + response.getEntity().getContent())); + String uuid; + while ((uuid = rd.readLine()) != null) { + result.append(uuid); + } + rd.close(); + } else { + // empty response + if (statusCode == 204) { + return new QueryStoreResponse(QueryStoreResponse.STATUS_EMPTY, "", ""); + } + // server error + else if (statusCode >= 500) { + return new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, "", response.getStatusLine().getReasonPhrase()); + } + // client error + else if (statusCode >= 400 && statusCode < 500) { + return new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, "", response.getStatusLine().getReasonPhrase()); + } + } + // extract uuid from json response + return QueryStoreResponseReader.parseResponse(result.toString()); + } + + /** + * Build the URL of the HTTP request sent to the query store + * + * @param token + * @param email + * @param userIp + * @return + * @throws UnsupportedEncodingException + */ + private String getRequest(String token, String email, String userIp) throws UnsupportedEncodingException { + String result = Settings.QUERYSTORE_ASSOCIATION_URL.get(); + result = result + Parameter.QUERYTOKEN.getText() +"=" + token + + "&"+ Parameter.EMAIL.getText() +"=" + email + + "&" + Parameter.USERIP.getText() + "=" + userIp + + "&" + Parameter.USEDCLIENT.getText() + "=" + + URLEncoder.encode( + Settings.PORTAL_USER_AGENT.get() + +"-"+Settings.PORTAL_VERSION.get(), "UTF-8"); + return result; + } + + /** + * Return user email if he is logged in, empty string if not + * + * @return + */ + private String getUserEmail() { + User u = auth.getUser(); + if (u != null) + return u.getEmail(); + else + return Settings.DEFAULT_USER_MAIL.get(); + } +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreRequestRegistry.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreRequestRegistry.java new file mode 100644 index 0000000..306d02d --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreRequestRegistry.java @@ -0,0 +1,66 @@ +package org.vamdc.portal.session.queryLog; + +import java.util.HashMap; +import java.util.Map; + +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.In; +import org.jboss.seam.annotations.Logger; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Scope; +import org.jboss.seam.log.Log; +import org.jboss.seam.web.ServletContexts; +import org.vamdc.portal.session.security.UserInfo; + +@Name("querystore") +@Scope(ScopeType.PAGE) +public class QueryStoreRequestRegistry { + + /** + * Map storing last uuid for a given node key = node id + */ + private Map querystoreProcessors = new HashMap( + 5); + + public void launchQueryStoreProcessor(String token, String nodeIvoaID ){ + /** + * send request to querystore, do nothing if already done once on this page + */ + if (!this.querystoreProcessors.containsKey(nodeIvoaID)){ + this.querystoreProcessors.put(nodeIvoaID, new QueryStoreProcessor(token)); + this.querystoreProcessors.get(nodeIvoaID).process(); + } + } + + /** + * return result of querystore for a request + * + * @return + **/ + public Map getQuerystoreProcessors() { + return this.querystoreProcessors; + } + + + /** + * Get IP address of the user that is asking for the association + * Requires access to ServletContexts + * + * @return + */ + public String getIpAdress() { + // client and proxies IP are concatenated in this header field : client, proxy1, proxy2 ... + String ipAddresses = ServletContexts.instance().getRequest() + .getHeader("X-FORWARDED-FOR"); + String clientAddress = ""; + + if (ipAddresses == null) { + clientAddress = ServletContexts.instance().getRequest().getRemoteAddr(); + }else{ + // keep only original client ip + clientAddress = ipAddresses.split(",")[0]; + } + return clientAddress; + } + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreResponse.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreResponse.java new file mode 100644 index 0000000..7ab81c7 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreResponse.java @@ -0,0 +1,42 @@ +package org.vamdc.portal.session.queryLog; + +public class QueryStoreResponse { + + private String status; + private String uuid; + private String errorMessage; + public static final String STATUS_ERROR = "error"; + public static final String STATUS_SUCCESS = "success"; + public static final String STATUS_UNKNOWN = "unknown"; + public static final String STATUS_EMPTY = "empty"; + + public QueryStoreResponse(String status, String uuid, String errorMessage){ + this.status = status; + this.uuid = uuid; + this.errorMessage = errorMessage; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreResponseReader.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreResponseReader.java new file mode 100644 index 0000000..68d130f --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/QueryStoreResponseReader.java @@ -0,0 +1,27 @@ +package org.vamdc.portal.session.queryLog; + +import org.json.JSONException; +import org.json.JSONObject; + +public class QueryStoreResponseReader { + + public static final String SUCCESSFULL_REQUEST = "UUIDCorrectlyAssociated"; + public static final String HEAD_ASSOCIATION_FAILED = "UUIDInErrorOnHeadQuery"; + public static final String GET_ASSOCIATION_FAILED = "UUIDInErrorOnGetQuery"; + + private QueryStoreResponseReader(){} + + public static final QueryStoreResponse parseResponse(String json) { + JSONObject jsonObject = new JSONObject(json); + + if(jsonObject.keySet().contains(SUCCESSFULL_REQUEST)) + return new QueryStoreResponse(QueryStoreResponse.STATUS_SUCCESS, jsonObject.getString(SUCCESSFULL_REQUEST), ""); + else if(jsonObject.keySet().contains(HEAD_ASSOCIATION_FAILED)) + return new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, jsonObject.getString(SUCCESSFULL_REQUEST), "Head association failed"); + else if(jsonObject.keySet().contains(GET_ASSOCIATION_FAILED)) + return new QueryStoreResponse(QueryStoreResponse.STATUS_ERROR, jsonObject.getString(SUCCESSFULL_REQUEST), "Get association failed"); + else + throw new JSONException("Unknown field in JSON object"); + } + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/security/Register.java b/portal.ejb/src/main/java/org/vamdc/portal/session/security/Register.java index 6768067..b8604a0 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/security/Register.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/security/Register.java @@ -53,7 +53,6 @@ public void execute() { } }.addRole("admin").run(); statusMessages.add(Severity.INFO,"User #0 registered successfully. You may login now.", username); - log.info("Registered new user ",username); registered=true; } catch (IdentityManagementException e) { statusMessages.add(Severity.ERROR,e.getMessage()); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/security/UserInfo.java b/portal.ejb/src/main/java/org/vamdc/portal/session/security/UserInfo.java index 3864d13..dffc5dd 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/security/UserInfo.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/security/UserInfo.java @@ -21,11 +21,7 @@ public class UserInfo { @In private Credentials credentials; @In private Identity identity; - public User getUser(){ - /*if (identity!=null){ - System.out.println("identity try login: "+identity.tryLogin()); - }*/ - + public User getUser(){ String user = null; if (identity!=null && identity.isLoggedIn() && credentials!=null) user=credentials.getUsername(); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/species/NodeSpecies.java b/portal.ejb/src/main/java/org/vamdc/portal/species/NodeSpecies.java index 5776362..bb61990 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/species/NodeSpecies.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/species/NodeSpecies.java @@ -68,14 +68,19 @@ public void querySpecies(String ivoaId, SpeciesResult resultBean){ resultBean.setReady(true); return; } - resultBean.setMirrorCount(mirrors.size()); for(URL node:mirrors){ resultBean.setMessage("Timeout : query execution was too long."); resultBean.nextMirror(); URL queryUrl=node; + System.out.println("query"); + System.out.println(query); + System.out.println(queryUrl); try { queryUrl = new URL(node.toExternalForm()+query); + + System.out.print("queryUrl"); + System.out.print(queryUrl); resultBean.setFormattedResult( formatRequestResult(queryUrl)); resultBean.setMessage(""); resultBean.setReady(true); @@ -85,6 +90,8 @@ public void querySpecies(String ivoaId, SpeciesResult resultBean){ resultBean.setMessage("Incorrect service URL "+queryUrl); } catch (IOException e) { // TODO Auto-generated catch block + + e.printStackTrace(); resultBean.setMessage("Error while proceeding request"); } catch (TransformerException e) { // TODO Auto-generated catch block @@ -110,7 +117,10 @@ public void querySpecies(String ivoaId, SpeciesResult resultBean){ * @throws TransformerException */ private static String formatRequestResult(URL url) throws IOException, TransformerException, PortalHttpException{ + System.out.print("###"); + System.out.print(url); HttpURLConnection c = (HttpURLConnection)url.openConnection(); + if(c.getResponseCode() == 200){ c.setConnectTimeout(Settings.HTTP_CONNECT_TIMEOUT.getInt()); c.setReadTimeout(Settings.HTTP_DATA_TIMEOUT.getInt()); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/species/VamdcNode.java b/portal.ejb/src/main/java/org/vamdc/portal/species/VamdcNode.java index 35ab1d7..e7708cc 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/species/VamdcNode.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/species/VamdcNode.java @@ -10,7 +10,7 @@ * @author doronin * */ -public class VamdcNode { +public class VamdcNode implements Comparable{ private final String ivoaID; private Resource node; private Registry registry; @@ -53,7 +53,12 @@ public String getMaintainer(){ } public String getStatus(){ - return "OK"; + return node.getStatus(); + } + + @Override + public int compareTo(VamdcNode node) { + return this.getName().compareTo(node.getName()); } } diff --git a/portal.ejb/src/main/resources/META-INF/persistence.xml b/portal.ejb/src/main/resources/META-INF/persistence.xml index 0d93302..cd0287c 100644 --- a/portal.ejb/src/main/resources/META-INF/persistence.xml +++ b/portal.ejb/src/main/resources/META-INF/persistence.xml @@ -11,7 +11,7 @@ - + diff --git a/portal.ejb/src/test/java/org/vamdc/portal/registry/RegistryFacadeTest.java b/portal.ejb/src/test/java/org/vamdc/portal/registry/RegistryFacadeTest.java index f4854d4..ccdb562 100644 --- a/portal.ejb/src/test/java/org/vamdc/portal/registry/RegistryFacadeTest.java +++ b/portal.ejb/src/test/java/org/vamdc/portal/registry/RegistryFacadeTest.java @@ -42,7 +42,7 @@ public void testGetResourceDescription() { assertTrue(descr.length()>0); } } - + @Test public void testGetNumberOfInputs() { Collection ivoaids=facade.getConsumerIvoaIDs(); diff --git a/portal.ejb/src/test/java/org/vamdc/portal/session/queryBuilder/forms/TestAddRemoveTreeForms.java b/portal.ejb/src/test/java/org/vamdc/portal/session/queryBuilder/forms/TestAddRemoveTreeForms.java new file mode 100644 index 0000000..8acd587 --- /dev/null +++ b/portal.ejb/src/test/java/org/vamdc/portal/session/queryBuilder/forms/TestAddRemoveTreeForms.java @@ -0,0 +1,66 @@ +package org.vamdc.portal.session.queryBuilder.forms; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.vamdc.portal.session.queryBuilder.QueryTreeController; +import org.vamdc.portal.session.queryBuilder.formsTree.AtomsTreeForm; +import org.vamdc.portal.session.queryBuilder.formsTree.RootForm; +import org.vamdc.portal.session.queryBuilder.formsTree.SpeciesSelectionForm; + +public class TestAddRemoveTreeForms { + private QueryTreeController queryTree; + + @Test + public void testInitialization() { + queryTree=new QueryTreeController(); + assertTrue(queryTree.getFormCount() == 1); + assertTrue(queryTree.getForms().get(0) instanceof RootForm); + } + + @Test + public void testAddForm(){ + queryTree=new QueryTreeController(); + RootForm rf = new RootForm(queryTree); + queryTree.addForm(rf); + assertTrue(queryTree.getFormCount() == 1); // only one RootForm + SpeciesSelectionForm spSelect = new SpeciesSelectionForm(queryTree); + queryTree.addForm(spSelect); + assertTrue(queryTree.getFormCount() == 2); + assertTrue(queryTree.getForms().get(0) instanceof RootForm); + assertTrue(queryTree.getForms().get(1) instanceof SpeciesSelectionForm); + } + + @Test + public void testAddDeleteForm(){ + queryTree=new QueryTreeController(); + SpeciesSelectionForm spSelect = new SpeciesSelectionForm(queryTree); + queryTree.addForm(spSelect); + assertTrue(queryTree.getFormCount() == 2); + + AtomsTreeForm atom1 = new AtomsTreeForm(queryTree); + AtomsTreeForm atom2 = new AtomsTreeForm(queryTree); + AtomsTreeForm atom3 = new AtomsTreeForm(queryTree); + + queryTree.addForm(atom1); + queryTree.addForm(atom2); + queryTree.addForm(atom3); + assertTrue(queryTree.getQueryData().getSpeciesForms().size() == 3); + + int pos = 1; + for(Form f : queryTree.getQueryData().getSpeciesForms()){ + assertTrue(f.getPosition() == pos); + pos++; + } + + queryTree.removeForm(atom1); + + pos = 1; + for(Form f : queryTree.getQueryData().getSpeciesForms()){ + assertTrue(f.getPosition() == pos); + pos++; + } + + } + +} diff --git a/portal.war/src/main/webapp/citation.xhtml b/portal.war/src/main/webapp/citation.xhtml new file mode 100644 index 0000000..0c2cebc --- /dev/null +++ b/portal.war/src/main/webapp/citation.xhtml @@ -0,0 +1,35 @@ + + + + +

Citation policy

+
+ +

You commit to cite the authors of the specific datasets you + may use for realizing any published work, the databases publishing + those datasets and the VAMDC Consortium.

+
    +
  • Citation of data should be done via normal reference from + journals and Digital Object Identifier of datasets when such DOI will be implemented
  • +
  • Citation of databases should be done via citing the name of + the database, the URL of the database and the reference provided by + the database to cite it
  • +
  • Citation of VAMDC Consortium should be done via citing both + its Name: « VAMDC Consortium » and the URL: « http://www.vamdc.org » +
  • +
+
+ + + +
+ +
diff --git a/portal.war/src/main/webapp/help.xhtml b/portal.war/src/main/webapp/help.xhtml index ade33a8..505ec36 100644 --- a/portal.war/src/main/webapp/help.xhtml +++ b/portal.war/src/main/webapp/help.xhtml @@ -13,10 +13,6 @@ on the VAMDC tutorial page.

-

- - VAMDC forum -

diff --git a/portal.war/src/main/webapp/home.xhtml b/portal.war/src/main/webapp/home.xhtml index da69067..9f1f494 100644 --- a/portal.war/src/main/webapp/home.xhtml +++ b/portal.war/src/main/webapp/home.xhtml @@ -1,19 +1,37 @@ + xmlns:s="http://jboss.com/products/seam/taglib" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:f="http://java.sun.com/jsf/core" + xmlns:h="http://java.sun.com/jsf/html" + xmlns:rich="http://richfaces.org/rich" + template="/layout/template.xhtml"> - + +

Welcome to the VAMDC portal!

-

Welcome to the VAMDC portal!

- - - +
- +

VAMDC aims to be an interoperable e-infrastructure that + provides the international research community with access to a broad + range of atomic and molecular (A&M) data compiled within a set + of A&M databases accessible through the provision of this portal + and of user software. Furthermore VAMDC aims to provide A&M data + providers and compilers with a large dissemination platform for + their work.

+ +

VAMDC infrastructure was established to provide a service to + a wide international research community and has been developed in + conjunction with consultations and advice from the A&M user + community.

+ +

+ +

+ +
+ diff --git a/portal.war/src/main/webapp/img/vamdc_logo_old.png b/portal.war/src/main/webapp/img/vamdc_logo_old.png new file mode 100755 index 0000000..b84b992 Binary files /dev/null and b/portal.war/src/main/webapp/img/vamdc_logo_old.png differ diff --git a/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg b/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg index 2326c68..ec6a028 100644 Binary files a/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg and b/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg differ diff --git a/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg_old b/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg_old new file mode 100644 index 0000000..26d0a27 Binary files /dev/null and b/portal.war/src/main/webapp/img/vamdc_partners_footer.jpg_old differ diff --git a/portal.war/src/main/webapp/layout/footer.xhtml b/portal.war/src/main/webapp/layout/footer.xhtml index 85f96a9..858ba7b 100644 --- a/portal.war/src/main/webapp/layout/footer.xhtml +++ b/portal.war/src/main/webapp/layout/footer.xhtml @@ -5,6 +5,5 @@ xmlns:s="http://jboss.com/products/seam/taglib" xmlns:rich="http://richfaces.org/rich" styleClass="my-toolbar-header"> - - + diff --git a/portal.war/src/main/webapp/layout/menu.xhtml b/portal.war/src/main/webapp/layout/menu.xhtml index 71d4f9a..a1f74dc 100644 --- a/portal.war/src/main/webapp/layout/menu.xhtml +++ b/portal.war/src/main/webapp/layout/menu.xhtml @@ -19,13 +19,14 @@ + + - - - + + contentType="text/html"> @@ -20,18 +21,22 @@ window.history.forward(); -
+
+
-
+
+
+
- + +
- + diff --git a/portal.war/src/main/webapp/login.xhtml b/portal.war/src/main/webapp/login.xhtml index 829ad42..732a35f 100644 --- a/portal.war/src/main/webapp/login.xhtml +++ b/portal.war/src/main/webapp/login.xhtml @@ -10,7 +10,7 @@ - +

Registration is not required. diff --git a/portal.war/src/main/webapp/nodes.xhtml b/portal.war/src/main/webapp/nodes.xhtml index 8a64fce..6800945 100644 --- a/portal.war/src/main/webapp/nodes.xhtml +++ b/portal.war/src/main/webapp/nodes.xhtml @@ -9,9 +9,17 @@ xmlns:a="http://richfaces.org/a4j" template="/layout/template.xhtml"> - - +

+ +

+ + + + + + @@ -22,9 +30,6 @@ - - - @@ -40,24 +45,58 @@ - + - - - - - - + +
diff --git a/portal.war/src/main/webapp/preview.xhtml b/portal.war/src/main/webapp/preview.xhtml index edc94de..b729818 100644 --- a/portal.war/src/main/webapp/preview.xhtml +++ b/portal.war/src/main/webapp/preview.xhtml @@ -6,83 +6,87 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" - xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml"> + xmlns:a4j="http://richfaces.org/a4j" + template="/layout/template.xhtml"> - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + diff --git a/portal.war/src/main/webapp/privacy.xhtml b/portal.war/src/main/webapp/privacy.xhtml new file mode 100644 index 0000000..08605c3 --- /dev/null +++ b/portal.war/src/main/webapp/privacy.xhtml @@ -0,0 +1,63 @@ + + + + +

VAMDC Privacy policy

+
+

When you use VAMDC services, we may collect some personal data + (your IP address and if you provide it, your e-mail). Those data are + used only to offer you the service in question, nothing else. VAMDC + does not disclose, give or sell your data to anyone unless we are + required to do so pursuant to a mandatory provision of law. We may + use some of the data in research and development work to improve our + services, but for such purposes we always use the data in a fully + anonymized form, and no personal identifiers are left in the data. + Your data is stored on VAMDC ecosystem servers, which are located in + the EU.

+

Storage and accuracy of information

+

+ We only store the information as long as is necessary to fulfill the + purpose for which it was collected or required by law. You are + responsible for the accuracy of the information you provide. For any + question, you may also contact use: http://www.vamdc.org/contact/contact-category-1/ +

+

Security

+

There are always risks associated with providing personal data + via the internet and no system or technology is completely safe or + "tamper"/"hacker" proof. VAMDC takes appropriate precautions to + prevent unauthorized access to and improper use of your personal + data: we use industry standard security measures.

+

Your rights

+

You always have the right to access your personal information. + You have the right to know what information pertaining to you has + been collected, what this information is used for. To verify your + identity in order to carry out your request, we may have to ask for + additional information.

+

VAMDC is allowed to handle your personal information when the + handling is based on a legitimate interest. We use this legal basis + in some cases for our research and development activities, as we + constantly want to develop and improve our services. You have the + right to object to the handling of your personal information for + these purposes. However, your right to object is not absolute. The + data used in our research and development work is anonymized and + cannot be associated with you. You have the right to have any of + your information corrected or deleted If you want to have your + information deleted, we will delete your user credentials and all + information and data pertaining to you. The deleted data is not + retrievable.

+

+ If you suspect misuse of the information, you may submit a complaint + to the European data + protection board or a similar authority. +

+
+
+
diff --git a/portal.war/src/main/webapp/query.xhtml b/portal.war/src/main/webapp/query.xhtml index 4bbd1d5..2b6e643 100644 --- a/portal.war/src/main/webapp/query.xhtml +++ b/portal.war/src/main/webapp/query.xhtml @@ -25,7 +25,7 @@ - + diff --git a/portal.war/src/main/webapp/queryLog.xhtml b/portal.war/src/main/webapp/queryLog.xhtml index b2ebffa..24e3019 100644 --- a/portal.war/src/main/webapp/queryLog.xhtml +++ b/portal.war/src/main/webapp/queryLog.xhtml @@ -9,116 +9,140 @@ xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
diff --git a/portal.war/src/main/webapp/queryTree.xhtml b/portal.war/src/main/webapp/queryTree.xhtml index 72daafa..1fe5254 100644 --- a/portal.war/src/main/webapp/queryTree.xhtml +++ b/portal.war/src/main/webapp/queryTree.xhtml @@ -5,33 +5,29 @@ xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" - xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jstl/core" + xmlns:rich="http://richfaces.org/rich" template="/layout/template.xhtml"> - - + + - + - - + + - - + + - - - - - - - + + + + - diff --git a/portal.war/src/main/webapp/register.xhtml b/portal.war/src/main/webapp/register.xhtml index 08f88d4..ead3d90 100644 --- a/portal.war/src/main/webapp/register.xhtml +++ b/portal.war/src/main/webapp/register.xhtml @@ -19,7 +19,7 @@ and email alerts on major updates.

- + register diff --git a/portal.war/src/main/webapp/stylesheet/style.css b/portal.war/src/main/webapp/stylesheet/style.css index f1f0312..164c289 100644 --- a/portal.war/src/main/webapp/stylesheet/style.css +++ b/portal.war/src/main/webapp/stylesheet/style.css @@ -1,3 +1,114 @@ +html { + overflow-y: scroll; +} + +body { + font: normal 12px/1.7 "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", sans-serif; + margin: 0px; + background : #F1F1F1 url() repeat top center; +} + +body .textContent{ + width : 75%; + text-align : justify; + padding-left : 1em; +} + +.container { + width : 1060px; + position : relative; + margin : auto; + background : #FFFFFF url() repeat top center; +} + +a { + color : #F05A28; +} + +a img { + border: none; +} + +h1 { + font-size: 1.6em; + margin-top: 0; +} + +input[type=submit], input[type=button] { + font-size: 11px; + margin: 5px 5px 5px 0; + cursor: pointer; +} + +input[type=text], input[type=password], textarea { + font-size: 12px; + padding-left: 1px; +} + +select { + font-size: 13px; +} + +img.errors { + padding-right: 5px; +} + +div.info { + font-size: 1.2em; +} + +ul.bullets { + list-style: square; +} + +ul.bullets li { + padding-bottom: 2px; +} + +td.action { + text-align: center; + width: 8em; + white-space: nowrap; +} + +td.action a { + padding-left: 1px; + padding-right: 1px; +} + +table.radio { + border: 0; +} + +table.radio td { + padding: 0 2px; +} + +table.radio input[type=radio] { + vertical-align: bottom; +} + +.header { + padding-top: 1em; + padding-bottom: 1em; +} + +.footer { + text-align: right; + padding-top: 1em; + padding-bottom: 1em; +} + +.footer img { + margin-right : 0.2em; +} + +.content { + padding: 0.5em; + width : 100%; +} + + .field{ margin-top:0px; margin-bottom:0px; @@ -5,7 +116,7 @@ margin-left:5px; } .narrowfield{ - width: 70px; + width: 60px; margin-top:0px; margin-bottom:0px; margin-right:5px; @@ -19,53 +130,31 @@ .leftColumn { width: 170px; font-weight: bold; - font-size: 12px; font-family: none; } .simpleColumn { width: 60px; - /*font-weight: bold;*/ - font-size: 12px; margin : 0px; font-family: none; } .rightColumn { - width: 250px; - align: right; + width: 270px; + /*align: right; text-align: right; - float: right; -} - -.rich-progress-bar-done{ - background-image: url("../img/progressBarComplete.png"); -} - -.rich-progress-bar-mockup{ - border-color: #D4CFC7; - border-width: 1px; - border-style: solid; - color: #000000; - font-family: Arial,Verdana,sans-serif; - font-size: 11px; - font-weight: bold; - text-align: center; - margin-bottom: 2px; -} - -.rich-panel-body{ - padding: 3px; + float: right;*/ } .queryMenuPanel{ position: fixed; - top: 195px; + top: 140px; + width : 120px; } .queryMenu{ - width: 120px; height: 100%; + width : 130px; } .queryMenuButton{ @@ -74,7 +163,6 @@ white-space: nowrap; font-family: Arial,Verdana,sans-serif; font-weight: bold; - font-size: 11px; margin: 3px; line-height: 20px; text-decoration: none; @@ -92,35 +180,41 @@ .queryForms{ height: 100%; vertical-align: top; - width: 460px; + width : 460px; + /*max-width : 410px;*/ } .queryRight{ height: 100%; vertical-align: top; - width: 450px; + max-width : 370px; } .showRequestPanel{ - width: 890px; - height: 70px; + width: 400px; + height: 210px; margin-left : 3px; } .showRequestText{ - width: 870px; - height: 40px; + width: 98%; + height: 170px; } .queryProgressPanel{ - width: 450px; + width: 400px; height: 210px; } .resultTable{ - margin-left : 4px; + margin-left : 0.2em; + margin-top : 0.5em; + width : 97%; } +.resultTable select{ + width : 200px; +} .consumerPanel{ width: 430px; @@ -129,13 +223,13 @@ .commentsPanel{ width: 98%; - height: 120px; + height: 110px; margin-top : 1em; } .commentsPanel textarea{ width: 98%; - height: 80px; + height: 70px; } .consumerDescription{ @@ -143,6 +237,10 @@ height: 115px; } +.consumerUpdateImg{ + margin-top : 5px; +} + .scrollPanel{ overflow-y: auto; } @@ -172,20 +270,159 @@ background-color: inherit; } -.collisionSpecies{ +.collisionSpeciesText{ text-decoration:none; border-bottom:1px dotted #D4CFC7; } -.alignCenter{ - text-align : center; + +.collisionSpeciesSelectionForm{ + width : 49%; + float : left; } + .roundButton { -moz-border-radius: 10px; border-radius: 10px; } +.largeButton{ + width : 110px; + font-weight : bold; + padding : 1px; +} + +.largerButton{ + width : 220px; + font-weight : bold; + padding : 1px; +} + +.buttonArea .largeButton{ + margin : 0px 5px 0px 0px; +} + .nodesTable{ - width : 90%; + width : 98%; + margin-bottom : 2em; +} + +.registerForm{ + width : 40%; +} + + +.bold{ + font-weight : bold; +} + +.alignJustify{ + text-align : justify; +} + +.alignCenter{ + text-align : center; +} + +.tableControl, .actionButtons, .isotopologue { + width: 100%; +} + +.tableControl a { + padding-left: 10px; +} + +.tableControl { + text-align: right; +} + + +.tableControl input[type=submit], .tableControl input[type=button], .tableControl select { + margin: 5px 0 5px 5px; +} + +/* I don't know why this is necessary, but the select is off by a pixel on the top and is padding too much on the left */ +.tableControl select { + margin-left: 2px; + position: relative; + top: 1px; +} + +.actionButtons { + padding-left: 1px; +} + +.actionButtons select { + margin: 5px 5px 5px 0; + vertical-align: bottom; +} + +.message { + padding: 5px; + list-style: none; + border: 0; + background: none; + padding: 0; + color: #000000; + margin: 5px 0 8px 0; + font-size: 12px; +} + +.message li { + background: no-repeat left center; + padding-top: 1px; + padding-left: 20px; + margin-left: 3px; +} + +.message li.infomsg { + background-image: url(../img/msginfo.png); +} + +.message li.errormsg { + background-image: url(../img/msgerror.png); +} + +.message li.warnmsg { + background-image: url(../img/msgwarn.png); +} + +.name { + vertical-align: top; + font-weight: bold; + width: 115px; + float: left; + padding: 5px; + margin-top: 3px; + clear: left; +} + +.value { + float: left; + padding: 5px; +} + +.error { + float: left; + padding: 5px; +} + +.errors { + color: #FF0000; + vertical-align: middle; +} + +.errors input, .errors textarea, .errors select { + border: 1px solid red !important; +} + +.required { + color: #FF0000; + padding-left: 2px; +} + +.important{ + text-decoration : underline; + font-weight : bold; } diff --git a/portal.war/src/main/webapp/stylesheet/theme.css b/portal.war/src/main/webapp/stylesheet/theme.css index 7038934..5214969 100644 --- a/portal.war/src/main/webapp/stylesheet/theme.css +++ b/portal.war/src/main/webapp/stylesheet/theme.css @@ -1,138 +1,35 @@ -html { - overflow-y: scroll; +.rich-progress-bar-done{ + background-image: url("../img/progressBarComplete.png"); } -body { - font-size: 12px; - margin: 0px; +.rich-progress-bar-mockup{ + border-color: #D4CFC7; + border-width: 1px; + border-style: solid; + color: #000000; + font-family: Arial,Verdana,sans-serif; + /*font-size: 11px;*/ + font-weight: bold; + text-align: center; + margin-bottom: 2px; } -a { - color : #F05A28; +.rich-panel-body{ + font: normal 12px/1.7 "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", sans-serif; + padding: 3px; + font-size : 12px; } -a img { - border: none; +.rich-table-cell{ + font-size : 12px; } -h1 { - font-size: 1.6em; - margin-top: 0; +.rich-stglpanel-body{ + font-size : 12px; } -input[type=submit], input[type=button] { - font-size: 11px; - margin: 5px 5px 5px 0; - cursor: pointer; -} - -input[type=text], input[type=password], textarea { - font-size: 12px; - padding-left: 1px; -} - -select { - font-size: 13px; -} - -.tableControl, .actionButtons { - width: 100%; -} - -.tableControl a { - padding-left: 10px; -} - -.tableControl { - text-align: right; -} - -.footer { - text-align: center; - font-size: 11px; - margin-bottom: 10px; -} - -.rich-table { - width: 100%; -} - -.body { - padding: 30px; -} -.message { - padding: 5px; - list-style: none; - border: 0; - background: none; - padding: 0; - color: #000000; - margin: 5px 0 8px 0; - font-size: 12px; -} - -.message li { - background: no-repeat left center; - padding-top: 1px; - padding-left: 20px; - margin-left: 3px; -} - -.message li.infomsg { - background-image: url(../img/msginfo.png); -} - -.message li.errormsg { - background-image: url(../img/msgerror.png); -} - -.message li.warnmsg { - background-image: url(../img/msgwarn.png); -} - -.name { - vertical-align: top; - font-weight: bold; - width: 115px; - float: left; - padding: 5px; - margin-top: 3px; - clear: left; -} - -.header { - margin-top: 15px; - margin-bottom: 20px; - margin-left: 20px; - -} - -.value { - float: left; - padding: 5px; -} - -.error { - float: left; - padding: 5px; -} - -.errors { - color: #FF0000; - vertical-align: middle; -} - -img.errors { - padding-right: 5px; -} - -.errors input, .errors textarea, .errors select { - border: 1px solid red !important; -} - -.required { - color: #FF0000; - padding-left: 2px; +.rich-ddmenu-label{ + font-size : 12px; } .rich-stglpanel-body { @@ -151,26 +48,6 @@ img.errors { margin-bottom: 0; } -.tableControl input[type=submit], .tableControl input[type=button], .tableControl select { - margin: 5px 0 5px 5px; -} - -/* I don't know why this is necessary, but the select is off by a pixel on the top and is padding too much on the left */ -.tableControl select { - margin-left: 2px; - position: relative; - top: 1px; -} - -.actionButtons { - padding-left: 1px; -} - -.actionButtons select { - margin: 5px 5px 5px 0; - vertical-align: bottom; -} - .rich-toolbar-item a { text-decoration: none; } @@ -198,46 +75,3 @@ img.errors { color : #000000; } - -div.info { - font-size: 1.2em; -} - -ul.bullets { - list-style: square; -} - -ul.bullets li { - padding-bottom: 2px; -} - -td.action { - text-align: center; - width: 8em; - white-space: nowrap; -} - -td.action a { - padding-left: 1px; - padding-right: 1px; -} - -table.radio { - border: 0; -} - -table.radio td { - padding: 0 2px; -} - -table.radio input[type=radio] { - vertical-align: bottom; -} - -body .disclaimer{ - font-size : 14px; - width : 50%; - text-align : justify; - padding-left : 2em; -} - diff --git a/portal.war/src/main/webapp/tools.xhtml b/portal.war/src/main/webapp/tools.xhtml new file mode 100644 index 0000000..cc87545 --- /dev/null +++ b/portal.war/src/main/webapp/tools.xhtml @@ -0,0 +1,33 @@ + + + + +

The VAMDC species database

+

+ Discover the content of each database in the VAMDC infrastructure +

+

+ +

+

Hitran file display and comparison

+

+ Plot data exported in HITRAN format +

+

+ +

+ + +
+
diff --git a/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml b/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml index 082558c..8b2ab48 100644 --- a/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml +++ b/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml @@ -56,15 +56,15 @@ disabled="#{consumers.selectedNodesCount == 0}" reRender="consumerLocation" tabindex="25" /> - - + direction="top-left" id="consumerErrorTex" /> diff --git a/portal.war/src/main/webapp/xhtml/disclaimer/disclaimerText.xhtml b/portal.war/src/main/webapp/xhtml/disclaimer/disclaimerText.xhtml index 02cfba4..7e3dfd3 100644 --- a/portal.war/src/main/webapp/xhtml/disclaimer/disclaimerText.xhtml +++ b/portal.war/src/main/webapp/xhtml/disclaimer/disclaimerText.xhtml @@ -8,7 +8,7 @@ xmlns:rich="http://richfaces.org/rich"> -
+

General Disclaimer

The VAMDC Consortium and its activities are based upon a high trust model within an academic environment. diff --git a/portal.war/src/main/webapp/xhtml/preview/table.xhtml b/portal.war/src/main/webapp/xhtml/preview/table.xhtml index b68b8da..62778ff 100644 --- a/portal.war/src/main/webapp/xhtml/preview/table.xhtml +++ b/portal.war/src/main/webapp/xhtml/preview/table.xhtml @@ -6,120 +6,172 @@ xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" - xmlns:a4j="http://richfaces.org/a4j"> - - - - - - - - - - - - - - - - - - - - - + xmlns:p="http://primefaces.org/ui" + xmlns:a4j="http://richfaces.org/a4j"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Last database update - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + +
+
+ + diff --git a/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml b/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml index 2b8b0d6..2d01c0f 100644 --- a/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml @@ -7,11 +7,13 @@ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> - + - + styleClass="largeButton" disabled="#{!queryData.valid}" tabindex="20"/> + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/fields/proxyRangeField.xhtml b/portal.war/src/main/webapp/xhtml/query/fields/proxyRangeField.xhtml index e2b0d71..683a6b1 100644 --- a/portal.war/src/main/webapp/xhtml/query/fields/proxyRangeField.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/fields/proxyRangeField.xhtml @@ -15,13 +15,12 @@ - - + - + diff --git a/portal.war/src/main/webapp/xhtml/query/fields/rangeField.xhtml b/portal.war/src/main/webapp/xhtml/query/fields/rangeField.xhtml index 378f378..a271ce7 100644 --- a/portal.war/src/main/webapp/xhtml/query/fields/rangeField.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/fields/rangeField.xhtml @@ -14,13 +14,12 @@ - - + - + diff --git a/portal.war/src/main/webapp/xhtml/query/fields/simpleField.xhtml b/portal.war/src/main/webapp/xhtml/query/fields/simpleField.xhtml index f5f7bd4..ec78c6b 100644 --- a/portal.war/src/main/webapp/xhtml/query/fields/simpleField.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/fields/simpleField.xhtml @@ -14,7 +14,7 @@ - + diff --git a/portal.war/src/main/webapp/xhtml/query/fields/suggestionField.xhtml b/portal.war/src/main/webapp/xhtml/query/fields/suggestionField.xhtml index dc88a54..efc126e 100644 --- a/portal.war/src/main/webapp/xhtml/query/fields/suggestionField.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/fields/suggestionField.xhtml @@ -22,9 +22,9 @@ + reRender="form#{form.id},nodeTree,buttonArea"/> - + diff --git a/portal.war/src/main/webapp/xhtml/query/fields/textField.xhtml b/portal.war/src/main/webapp/xhtml/query/fields/textField.xhtml index a449bff..4d4c3e8 100644 --- a/portal.war/src/main/webapp/xhtml/query/fields/textField.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/fields/textField.xhtml @@ -14,7 +14,7 @@ - + diff --git a/portal.war/src/main/webapp/xhtml/query/fields/unitConvRangeField.xhtml b/portal.war/src/main/webapp/xhtml/query/fields/unitConvRangeField.xhtml index 73f1f42..c546631 100644 --- a/portal.war/src/main/webapp/xhtml/query/fields/unitConvRangeField.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/fields/unitConvRangeField.xhtml @@ -18,12 +18,12 @@ + reRender="nodeTree,buttonArea,conv#{field.id}"/> + reRender="nodeTree,buttonArea,conv#{field.id}"/> Launch your request asynchronously : you will receive an email telling you when computation is done and how to get your data. + styleClass="largeButton" disabled="#{!queryData.valid}" tabindex="21" reRender="asyncForm"/> diff --git a/portal.war/src/main/webapp/xhtml/query/forms/atomsForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/atomsForm.xhtml new file mode 100644 index 0000000..47ef798 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/forms/atomsForm.xhtml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/forms/collisionsForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/collisionsForm.xhtml index 08b4966..e7c6466 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/collisionsForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/collisionsForm.xhtml @@ -1,4 +1,5 @@ - + - + diff --git a/portal.war/src/main/webapp/xhtml/query/forms/environmentForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/environmentForm.xhtml new file mode 100644 index 0000000..47ef798 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/forms/environmentForm.xhtml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/forms/formTitle.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/formTitle.xhtml index 97923d7..53dedd2 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/formTitle.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/formTitle.xhtml @@ -15,17 +15,17 @@ - + value="Clear"> + + diff --git a/portal.war/src/main/webapp/xhtml/query/forms/moleculesForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/moleculesForm.xhtml index 32647fa..65d5dcb 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/moleculesForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/moleculesForm.xhtml @@ -13,11 +13,11 @@ - - - - - + + + + + @@ -30,7 +30,7 @@ + value="#{form.molecules}" var="molecule" styleClass="isotopologue"> diff --git a/portal.war/src/main/webapp/xhtml/query/forms/particlesForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/particlesForm.xhtml new file mode 100644 index 0000000..47ef798 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/forms/particlesForm.xhtml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/forms/radiativeForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/radiativeForm.xhtml new file mode 100644 index 0000000..47ef798 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/forms/radiativeForm.xhtml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/forms/standardForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/standardForm.xhtml index 312b046..7e9cc51 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/standardForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/standardForm.xhtml @@ -9,14 +9,16 @@ xmlns:c="http://java.sun.com/jstl/core"> - - - - - + + + + + + - - + + + diff --git a/portal.war/src/main/webapp/xhtml/query/forms/utilForm.xhtml b/portal.war/src/main/webapp/xhtml/query/forms/utilForm.xhtml new file mode 100644 index 0000000..47ef798 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/forms/utilForm.xhtml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/actionButtons.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/actionButtons.xhtml index 40c1e72..aeb665b 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/actionButtons.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/actionButtons.xhtml @@ -9,9 +9,9 @@ - + styleClass="largeButton" tabindex="21"/> diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/allStatesEnergyForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/allStatesEnergyForm.xhtml index 95308d1..9f1cbfd 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/allStatesEnergyForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/allStatesEnergyForm.xhtml @@ -17,8 +17,8 @@ - + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/atomsForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/atomsForm.xhtml index 7ace7ec..ed421fd 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/atomsForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/atomsForm.xhtml @@ -12,7 +12,9 @@ - + + + diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/collisionTreeForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/collisionTreeForm.xhtml index 606cb5d..d9a14ab 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/collisionTreeForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/collisionTreeForm.xhtml @@ -10,15 +10,18 @@ xmlns:c="http://java.sun.com/jstl/core"> - + - - - - + + + + + @@ -26,11 +29,13 @@ - - + + - + diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml index 32db0b5..4b58deb 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml @@ -9,8 +9,11 @@ xmlns:c="http://java.sun.com/jstl/core"> - - + + + + + diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml index 95308d1..6365501 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml @@ -7,7 +7,7 @@ xmlns:a4j="http://richfaces.org/a4j" xmlns:c="http://java.sun.com/jstl/core"> - + @@ -17,8 +17,8 @@ - + - + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/radiativeForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/radiativeForm.xhtml index a87a933..03ab75f 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/radiativeForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/radiativeForm.xhtml @@ -10,7 +10,7 @@ xmlns:c="http://java.sun.com/jstl/core"> - + @@ -26,13 +26,14 @@

- + + - + - + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/rootForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/rootForm.xhtml index 45d39cd..097818a 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/rootForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/rootForm.xhtml @@ -9,7 +9,7 @@ xmlns:a4j="http://richfaces.org/a4j"> - + @@ -25,8 +25,8 @@ layout="pageDirection" tabindex="10"> - + - + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/sineReactionCollisionForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/sineReactionCollisionForm.xhtml index 3d50bff..539b7e1 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/sineReactionCollisionForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/sineReactionCollisionForm.xhtml @@ -10,50 +10,55 @@ xmlns:c="http://java.sun.com/jstl/core"> - + - - - - - - - + + + + + + - + - + - - - - - + + + + + + - + @@ -62,23 +67,26 @@ - + - - - - - + + + + - - + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/speciesForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/speciesForm.xhtml index e725d3c..28132f1 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/speciesForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/speciesForm.xhtml @@ -11,7 +11,7 @@ - + @@ -24,5 +24,5 @@ - + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/speciesSelectionForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/speciesSelectionForm.xhtml index 52717e8..d6f94b8 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/speciesSelectionForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/speciesSelectionForm.xhtml @@ -10,12 +10,12 @@ xmlns:c="http://java.sun.com/jstl/core"> - + + value="Please, enter the number of species you wish to query" /> - + @@ -38,16 +38,14 @@ - - - - - - - + - + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/withReactionCollisionForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/withReactionCollisionForm.xhtml index cce64cc..15a8dee 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/withReactionCollisionForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/withReactionCollisionForm.xhtml @@ -10,74 +10,79 @@ xmlns:c="http://java.sun.com/jstl/core"> - + - - - - - - - + + + + + - - + + - + - - - - - - + + + + + + + - - + + - + - - - - - + + - - + + \ No newline at end of file