diff --git a/portal.ejb/src/main/java/org/vamdc/portal/RedirectPage.java b/portal.ejb/src/main/java/org/vamdc/portal/RedirectPage.java index 896a396..eaf8f7f 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/RedirectPage.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/RedirectPage.java @@ -2,6 +2,7 @@ public class RedirectPage { public static final String QUERY="query"; + public static final String QUERYTREE="queryTree"; public static final String PREVIEW="preview"; public static final String QUERY_LOG="queryLog"; public static final String SPECIES="species"; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PersistableQueryInterface.java b/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PersistableQueryInterface.java new file mode 100644 index 0000000..690a5ee --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/preview/PersistableQueryInterface.java @@ -0,0 +1,16 @@ +package org.vamdc.portal.session.preview; + +import java.util.List; + +import org.vamdc.portal.entity.query.HttpHeadResponse; +import org.vamdc.portal.entity.security.User; +import org.vamdc.portal.session.queryBuilder.FormHolder; +import org.vamdc.portal.session.queryBuilder.QueryData; +import org.vamdc.portal.session.queryLog.QueryLog; + +public interface PersistableQueryInterface { + public List getNodesResponse(); + public User getUser(); + public QueryLog getQueryLog(); + public QueryData getQueryData(); +} 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 6a0b696..ee98f98 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 @@ -48,6 +48,7 @@ public class PreviewManager implements Serializable{ private long startTime; public void initiate(){ + if (nodeFutureResponses.size()>0) return; @@ -153,7 +154,10 @@ public void clear(){ public String refine(){ clear(); - return RedirectPage.QUERY; + if(!queryData.isGuidedQuery()) + return RedirectPage.QUERY; + else + return RedirectPage.QUERYTREE; } /** 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 2f1e050..07d448f 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 @@ -17,8 +17,9 @@ import org.jboss.seam.log.Log; import org.vamdc.portal.RedirectPage; import org.vamdc.portal.entity.query.HttpHeadResponse; -import org.vamdc.portal.entity.query.HttpHeadResponse.Response; import org.vamdc.portal.entity.query.Query; +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.forms.AtomsForm; import org.vamdc.portal.session.queryBuilder.forms.BranchesForm; @@ -40,7 +41,7 @@ */ @Name("query") @Scope(ScopeType.EVENT) -public class QueryController { +public class QueryController implements PersistableQueryInterface{ @Logger Log log; @@ -60,11 +61,8 @@ public class QueryController { @End public String saveQuery(){ - if (queryData.isValid()){ - persistQuery(); - - + persistQuery(); conversation.endAndRedirect(); log.info("Save action"); return RedirectPage.QUERY_LOG; @@ -75,11 +73,12 @@ public String saveQuery(){ } private void persistQuery() { - Query query = constructQuery(); + QueryPersister p = new QueryPersister(this); + Query query = p.constructQuery();//constructQuery(); queryLog.save(query,queryData.getEditQueryId()); } - private Query constructQuery(){ + /*private Query constructQuery(){ Query result=null; if (queryData.getEditQueryId()!=null) result = queryLog.getQuery(queryData.getEditQueryId()); @@ -103,7 +102,7 @@ private List selectRespondedNodes() { responses.add(response); } return responses; - } + }*/ @@ -111,8 +110,9 @@ public String preview(){ if (queryData.isValid()){ return RedirectPage.PREVIEW; - }else + }else{ return RedirectPage.QUERY; + } } public String edit(String queryID){ @@ -168,5 +168,24 @@ public void addFormUtil(){ queryData.addForm(new UtilForm()); } + @Override + public List getNodesResponse() { + return preview.getNodes(); + } + + @Override + public User getUser() { + return auth.getUser(); + } + + @Override + public QueryLog getQueryLog(){ + return this.queryLog; + } + + @Override + public QueryData getQueryData(){ + return this.queryData; + } } 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 2c0ec3a..643dced 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 @@ -30,6 +30,7 @@ import org.vamdc.tapservice.vss2.RestrictExpression; import org.vamdc.tapservice.vss2.VSSParser; + @Name("queryData") @Scope(ScopeType.CONVERSATION) public class QueryData implements FormHolder,Serializable{ @@ -39,6 +40,7 @@ public class QueryData implements FormHolder,Serializable{ //All forms and lists are serialized explicitly private transient Collection
forms; private transient List formsList; + private transient List unsortedFormsList; //Species-related forms private transient Collection speciesForms; @@ -54,6 +56,9 @@ public class QueryData implements FormHolder,Serializable{ private transient Collection activeKeywords; private transient Collection activeNodes; + private Integer speciesFormPosition; + private Boolean guidedQuery = false; + @In(create=true) private transient RegistryFacade registryFacade; public QueryData(){ @@ -63,6 +68,7 @@ public QueryData(){ private void initCollections(){ formCounts=Collections.synchronizedMap(new TreeMap()); forms=Collections.synchronizedSet(new TreeSet(new Order())); + unsortedFormsList = Collections.synchronizedList(new ArrayList()); formsList = Collections.synchronizedList(new ArrayList()); speciesForms=Collections.synchronizedSet(new TreeSet(new Order())); request = EnumSet.noneOf(Requestable.class); @@ -124,8 +130,7 @@ private Collection getKeywordsFromForms(){ for (Form form:getForms()){ result.addAll(form.getKeywords()); } - return result; - + return result; } private Collection getKeywordsFromQuery(String query){ @@ -148,12 +153,11 @@ private Collection getKeywordsFromQuery(String query){ } - public String getQueryString(){ if (isUserModified()) return customQueryString; return QueryGenerator.buildQueryString(request,formsList); - } + } private boolean isUserModified(){ @@ -172,6 +176,10 @@ public List getForms(){ return formsList; } + public List getUnsortedForms(){ + return this.unsortedFormsList; + } + public Collection getSpeciesForms(){ return new ArrayList(speciesForms); } @@ -205,13 +213,36 @@ private boolean quickAddForm(Form form){ form.setQueryData(this); forms.add(form); formCounts.put(form.getOrder(), getFormTypeCount(form)+1); + + if(form.getOrder() == Order.GuidedSpeciesType) + this.speciesFormPosition = forms.size()-1; + if (form instanceof SpeciesForm) speciesForms.add((SpeciesForm) form); + else + unsortedFormsList.add(form); + return true; } return false; } + public List getOrderedGuidedForm(){ + if(this.getSpeciesForms().size() > 0 && this.speciesFormPosition != null){ + List result = new ArrayList(); + for(Form f : this.unsortedFormsList){ + result.add(f); + } + int i = this.speciesFormPosition; + for(Form f : this.speciesForms){ + result.add(i+1, f); + i++; + } + return result; + }else + return this.unsortedFormsList; + } + public Integer getFormTypeCount(Form form){ Integer count; if ((count=formCounts.get(form.getOrder()))!=null){ @@ -231,13 +262,15 @@ public void deleteForm(Form form){ } formCounts.put(form.getOrder(), getFormTypeCount(form)-1); forms.remove(form); + unsortedFormsList.remove(form); if (form.getOrder() forms){ - + SortedSet sorted = new TreeSet(new NewOrder()); sorted.addAll(forms); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryPersister.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryPersister.java new file mode 100644 index 0000000..d215335 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryPersister.java @@ -0,0 +1,46 @@ +package org.vamdc.portal.session.queryBuilder; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + + +import org.vamdc.portal.entity.query.HttpHeadResponse; +import org.vamdc.portal.entity.query.Query; +import org.vamdc.portal.entity.query.HttpHeadResponse.Response; +import org.vamdc.portal.session.preview.PersistableQueryInterface; + + +public class QueryPersister { + private PersistableQueryInterface queryManager; + + public QueryPersister(PersistableQueryInterface queryManager){ + this.queryManager = queryManager; + } + + public Query constructQuery(){ + Query result=null; + if (queryManager.getQueryData().getEditQueryId() !=null) + result = queryManager.getQueryLog().getQuery(queryManager.getQueryData().getEditQueryId()); + else + result = new Query(); + result.setComments(queryManager.getQueryData().getComments()); + result.setQueryString(queryManager.getQueryData().getQueryString()); + result.setResponses(selectRespondedNodes()); + result.setUser(queryManager.getUser()); + result.setDate(new Date()); + return result; + } + + private List selectRespondedNodes() { + ArrayList responses = new ArrayList(); + + for (HttpHeadResponse response:queryManager.getNodesResponse()){ + if (response.getStatus()==Response.OK || response.getStatus()==Response.TRUNCATED) + responses.add(response); + } + return responses; + } + + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTree.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTree.java deleted file mode 100644 index 398ba9d..0000000 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTree.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.vamdc.portal.session.queryBuilder; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; - -import org.jboss.seam.annotations.In; -import org.jboss.seam.annotations.Logger; -import org.jboss.seam.annotations.Name; -import org.jboss.seam.annotations.Out; -import org.jboss.seam.annotations.Scope; -import org.jboss.seam.log.Log; -import org.jboss.seam.ScopeType; -import org.vamdc.portal.RedirectPage; -import org.vamdc.portal.session.queryBuilder.formsTree.RootForm; -import org.vamdc.portal.session.queryBuilder.formsTree.TreeFormInterface; - - -@Name("queryTree") -@Scope(ScopeType.CONVERSATION) -public class QueryTree implements QueryTreeInterface { - - @In(create=true) @Out QueryData queryData; - @Logger private Log log; - - private Collection forms; - public QueryTree(){ - forms=new ArrayList(); - forms.add(new RootForm(this)); - - } - - public Collection getForms(){ - return Collections.unmodifiableCollection(forms); - } - - public boolean isDone(){ - return true; - } - - public String saveQuery(){ - log.info("Mock save query"); - return RedirectPage.QUERY_LOG; - } - - public String preview(){ - log.info("Mock preview query"); - if (isDone()){ - return RedirectPage.PREVIEW; - }else - return RedirectPage.QUERY; - } - - @Override - public void addForm(TreeFormInterface form) { - System.out.println("Adding a form "+form.getView()); - forms.add(form); - System.out.println("New forms size is "+forms.size()); - } -} 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 new file mode 100644 index 0000000..73e51c0 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/QueryTreeController.java @@ -0,0 +1,211 @@ +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; +import org.jboss.seam.ScopeType; +import org.jboss.seam.annotations.End; +import org.jboss.seam.annotations.In; +import org.jboss.seam.annotations.Logger; +import org.jboss.seam.annotations.Name; +import org.jboss.seam.annotations.Out; +import org.jboss.seam.annotations.Scope; +import org.jboss.seam.log.Log; +import org.vamdc.portal.RedirectPage; +import org.vamdc.portal.entity.query.HttpHeadResponse; +import org.vamdc.portal.entity.query.Query; +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; + +@Name("queryTree") +@Scope(ScopeType.CONVERSATION) +public class QueryTreeController implements QueryTreeInterface, PersistableQueryInterface{ + + @In(create=true) @Out QueryData queryData; + @In(create=true) UserInfo auth; + @Logger + transient private Log log; + @In(create=true) private PreviewManager preview; + @In(create=true) private QueryLog queryLog; + + private SearchMode searchMode = SearchMode.species; + + public QueryTreeController(){ + this.addForm(new RootForm(this)); + } + + @End + public String saveQuery(){ + if (queryData.isValid()){ + persistQuery(); + //conversation.endAndRedirect(); + log.info("Save action"); + return RedirectPage.QUERY_LOG; + }else{ + return RedirectPage.QUERYTREE; + } + + } + + private void persistQuery() { + QueryPersister p = new QueryPersister(this); + Query query = p.constructQuery();//constructQuery(); + queryLog.save(query,queryData.getEditQueryId()); + } + + private Boolean isRequestable(Form f){ + if(f.getOrder() != Order.GuidedRequestType + && f.getOrder() != Order.GuidedRoot + && f.getOrder() != Order.GuidedSpeciesType) + return true; + return false; + } + + private Integer requestableFormsCount(){ + Integer result = 0; + for(Form f : this.getQueryData().getForms()){ + if(isRequestable(f)){ + result++; + } + } + return result; + } + + /** + * sort forms list to display menus at the top + * @return + * @throws Exception + */ + 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; + } + + + public String preview() { + if (queryData.isValid() && isDone()) { + return RedirectPage.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); + } + return queryData; + } + + + @Override + public Integer getFormCount() { + return this.getQueryData().getForms().size(); + } + + public Boolean getSubmitable(){ + if(this.requestableFormsCount() > 0) + return true; + + return false; + } + + @Override + public List getNodesResponse() { + return preview.getNodes(); + } + + @Override + public User getUser() { + return auth.getUser(); + } + + + @Override + public QueryLog getQueryLog() { + return this.queryLog; + } + + @Override + public void setSelectionMode(SearchMode searchMode) { + this.searchMode = searchMode; + } + + +} 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 0252941..dbb2309 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,8 +1,15 @@ 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; -public interface QueryTreeInterface { -public void addForm(TreeFormInterface form); + +public interface QueryTreeInterface { +public void addForm( T form); +public Boolean getSubmitable(); +//public void removeForm(AbstractForm form); +public Integer getFormCount(); +public void setSelectionMode(SearchMode searchMode); } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/AbstractField.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/AbstractField.java index 7ae0220..a6d242d 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/AbstractField.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/AbstractField.java @@ -23,7 +23,7 @@ public abstract class AbstractField implements Field,Serializable{ protected String prefix; protected boolean ignoreField=false; private String inSeparators="[,.:_]"; - protected FormForFields parentForm; + protected FormForFields parentForm; public void setInSeparators(String inSeparators) { this.inSeparators = inSeparators; diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionField.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionField.java index cacd8f5..4364915 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionField.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/fields/SuggestionField.java @@ -26,6 +26,7 @@ public SuggestionField(Restrictable keyword, String title, Suggestion suggestion public Suggestion getSuggestion(){ return this.suggestion; } public void setSuggestion(Suggestion suggestion) { this.suggestion = suggestion; } + diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AbstractForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AbstractForm.java index 182b5ab..82cd4c3 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AbstractForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/AbstractForm.java @@ -27,6 +27,10 @@ public abstract class AbstractForm implements Form,FormForFields{ private final String id; protected String prefix; private Integer position; + + public String getObject(){ + return this.toString(); + } public AbstractForm(){ @@ -48,7 +52,7 @@ public void fieldUpdated(AbstractField field){ this.queryData.resetCaches(); } - void addField(AbstractField field){ + protected void addField(AbstractField field){ field.setParentForm(this); fields.add(field); if (field.getKeyword()!=null) 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 fbc8dcf..4f28f45 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 @@ -1,12 +1,14 @@ package org.vamdc.portal.session.queryBuilder.forms; import org.vamdc.dictionary.Restrictable; +import org.vamdc.portal.session.queryBuilder.fields.AbstractField; import org.vamdc.portal.session.queryBuilder.fields.RangeField; import org.vamdc.portal.session.queryBuilder.fields.SimpleField; import org.vamdc.portal.session.queryBuilder.fields.TextField; import org.vamdc.portal.session.queryBuilder.fields.UnitConvRangeField; import org.vamdc.portal.session.queryBuilder.unitConv.EnergyUnitConverter; import java.lang.Integer; +import java.util.List; public class AtomsForm extends SpeciesForm implements Form { @@ -30,5 +32,9 @@ public AtomsForm(){ Restrictable.StateEnergy, "State energy", new EnergyUnitConverter())); } + + public List getFields(){ + return fields; + } } 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 6b9bde1..c8dc0bf 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 @@ -34,10 +34,10 @@ public interface MoleculeInfo{ private List molecules = Collections.emptyList(); - private AbstractField molChemName; - private AbstractField molStoichForm; - private AbstractField molOrdForm; - private AbstractField inchikey; + protected AbstractField molChemName; + protected AbstractField molStoichForm; + protected AbstractField molOrdForm; + protected AbstractField inchikey; private Map inchikeys = new HashMap(); @@ -52,6 +52,11 @@ public interface MoleculeInfo{ public MoleculesForm(){ super(); + init(); + + } + + protected void init(){ molChemName = new SuggestionField(null,"Chemical name", new ChemNameSuggestion()); addField(molChemName); @@ -65,7 +70,8 @@ public MoleculesForm(){ addField(new SuggestionField(Restrictable.MoleculeStateNuclearSpinIsomer,"Spin isomer",new SymmetrySuggest())); inchikey = new TextField(Restrictable.InchiKey,"Standard InChIKey"); - addField(inchikey); + addField(inchikey); + } @@ -76,6 +82,10 @@ public void clear(){ resetInchiKeys(); molecules = Collections.emptyList(); } + + public String info(){ + return "test"; + } public List getMolecules() { return molecules; } @@ -159,6 +169,7 @@ public void selected() { fillFromMolecules(); resetInchiKeys(); } + } @@ -203,6 +214,7 @@ public String getIllegalLabel() { @Override public void selected() { + EntityManager em = (EntityManager) Component.getInstance("entityManager"); molecules = EntityFacade.loadMoleculesFromOrdForm(em, molOrdForm.getValue()); fillFromMolecules(); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Order.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Order.java index 6510751..638974b 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Order.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/forms/Order.java @@ -3,19 +3,26 @@ import java.util.Comparator; public class Order implements Comparator{ - final static Integer Atoms=1; - final static Integer Molecules=2; - final static Integer Particles=3; + public final static Integer Atoms=1; + public final static Integer Molecules=2; + public final static Integer Particles=3; public final static Integer SPECIES_LIMIT=4;//Species go below this number final static Integer Environment=7; - public final static Integer SINGLE_LIMIT=10;//Forms above this number can occur once - final static Integer Process = 12; - final static Integer Util = 15; - final static Integer Branches = 18; - final static Integer Query = 19; - static final Integer Comments = 20; + public final static Integer SINGLE_LIMIT=10;//Forms above this number can occur more than once + public final static Integer Process = 12; + public final static Integer Util = 15; + public final static Integer Branches = 18; + public final static Integer Query = 19; + public static final Integer Comments = 20; + + public static final Integer GuidedRequestType =21; + public static final Integer GuidedSpeciesType =22; + public static final Integer GuidedRoot = 23; + public final static Integer GuidedRadiative = 24; + public static final Integer GuidedStates = 25; + @Override public int compare(Form o1, Form o2) { diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AbstractTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AbstractTreeForm.java new file mode 100644 index 0000000..eaa2325 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AbstractTreeForm.java @@ -0,0 +1,14 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +import java.io.Serializable; + +import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; + +public abstract class AbstractTreeForm extends AbstractForm implements TreeFormInterface, Serializable{ + + /** + * + */ + private static final long serialVersionUID = 3650369816935085779L; + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AllStatesEnergyTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AllStatesEnergyTreeForm.java new file mode 100644 index 0000000..1c11536 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AllStatesEnergyTreeForm.java @@ -0,0 +1,67 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +import java.util.List; + +import org.vamdc.dictionary.Restrictable; +import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; +import org.vamdc.portal.session.queryBuilder.fields.AbstractField; +import org.vamdc.portal.session.queryBuilder.fields.RangeField; +import org.vamdc.portal.session.queryBuilder.fields.UnitConvRangeField; +import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; +import org.vamdc.portal.session.queryBuilder.forms.FormForFields; +import org.vamdc.portal.session.queryBuilder.forms.Order; +import org.vamdc.portal.session.queryBuilder.unitConv.EnergyUnitConverter; + + +public class AllStatesEnergyTreeForm extends AbstractForm implements FormForFields, TreeFormInterface{ + + /** + * + */ + private static final long serialVersionUID = 1777979203251373978L; + private Boolean queryable = true; + private QueryTreeInterface tree; + + public AllStatesEnergyTreeForm(QueryTreeInterface tree){ + this.tree = tree; + init(); + } + + + private void init(){ + AbstractField field = new UnitConvRangeField(Restrictable.StateEnergy, "Upper state energy", new EnergyUnitConverter()); + field.setPrefix("upper"); + addField(field); + field = new UnitConvRangeField(Restrictable.StateEnergy, "Lower state energy", new EnergyUnitConverter()); + field.setPrefix("lower"); + addField(field); + addField(new RangeField(Restrictable.RadTransProbabilityA,"Probability, A")); + } + + @Override + public String getTitle() { + return "Search by state energy"; + } + + @Override + public Integer getOrder() { + return Order.GuidedStates; + } + + @Override + public String getView() { + return "/xhtml/query/queryTree/allStatesEnergyForm.xhtml"; + } + + @Override + public Boolean getQueryable() { + return this.queryable; + } + + @Override + public void validate() { + tree.addForm(new SpeciesSelectionForm(tree)); + this.queryable = false; + } + +} 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 new file mode 100644 index 0000000..d1f48e9 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/AtomsTreeForm.java @@ -0,0 +1,59 @@ +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; + +public class AtomsTreeForm extends AtomsForm implements FormForFields, TreeFormInterface { + /** + * + */ + 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 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; + } + + @Override + public String getTitle() { return "Atom "; } + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/MoleculesTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/MoleculesTreeForm.java new file mode 100644 index 0000000..cc1c9ed --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/MoleculesTreeForm.java @@ -0,0 +1,44 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; +import org.vamdc.portal.session.queryBuilder.forms.FormForFields; +import org.vamdc.portal.session.queryBuilder.forms.MoleculesForm; + +public class MoleculesTreeForm extends MoleculesForm implements FormForFields, TreeFormInterface { + + /** + * + */ + private static final long serialVersionUID = 1L; + protected Integer position; + private QueryTreeInterface tree; + + public MoleculesTreeForm(){ + super(); + } + + + public MoleculesTreeForm(QueryTreeInterface tree){ + this.tree = tree; + position = tree.getFormCount(); + } + + @Override + public Boolean getQueryable() { + return true; + } + + @Override + public void validate() { + tree.addForm(this); + } + + /*@Override + public String getView() { + return "/xhtml/query/queryTree/moleculesForm.xhtml"; + }*/ + + @Override + public String getTitle() { return "Molecule "; } + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/OneStateEnergyTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/OneStateEnergyTreeForm.java new file mode 100644 index 0000000..a23baa1 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/OneStateEnergyTreeForm.java @@ -0,0 +1,66 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +import java.util.List; + +import org.vamdc.dictionary.Restrictable; +import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; +import org.vamdc.portal.session.queryBuilder.fields.AbstractField; +import org.vamdc.portal.session.queryBuilder.fields.RangeField; +import org.vamdc.portal.session.queryBuilder.fields.UnitConvRangeField; +import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; +import org.vamdc.portal.session.queryBuilder.forms.FormForFields; +import org.vamdc.portal.session.queryBuilder.forms.Order; +import org.vamdc.portal.session.queryBuilder.unitConv.EnergyUnitConverter; + + +public class OneStateEnergyTreeForm extends AbstractForm implements FormForFields, TreeFormInterface{ + + /** + * + */ + private static final long serialVersionUID = 1777979203251373978L; + private Boolean queryable = true; + private QueryTreeInterface tree; + + + public OneStateEnergyTreeForm(QueryTreeInterface tree){ + this.tree = tree; + init(); + } + + + + private void init(){ + addField(new UnitConvRangeField(Restrictable.StateEnergy, "State energy", new EnergyUnitConverter())); + addField(new RangeField(Restrictable.RadTransProbabilityA,"Probability, A")); + } + + @Override + public String getTitle() { + return "Search by state energy"; + } + + @Override + public Integer getOrder() { + // TODO Auto-generated method stub + return Order.GuidedStates; + } + + @Override + public String getView() { + return "/xhtml/query/queryTree/oneStateEnergyForm.xhtml"; + } + + @Override + public Boolean getQueryable() { + // TODO Auto-generated method stub + return this.queryable; + } + + @Override + public void validate() { + tree.addForm(new SpeciesSelectionForm(tree)); + this.queryable = false; + } + +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/ParticlesTreeForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/ParticlesTreeForm.java new file mode 100644 index 0000000..b2ad6ac --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/ParticlesTreeForm.java @@ -0,0 +1,42 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; +import org.vamdc.portal.session.queryBuilder.forms.FormForFields; +import org.vamdc.portal.session.queryBuilder.forms.ParticlesForm; + +public class ParticlesTreeForm extends ParticlesForm implements FormForFields, TreeFormInterface { + + /** + * + */ + private static final long serialVersionUID = -7247779540094437626L; + protected Integer position; + private QueryTreeInterface tree; + + public ParticlesTreeForm(QueryTreeInterface tree){ + this.tree = tree; + position = tree.getFormCount(); + } + + + @Override + public Boolean getQueryable() { + // TODO Auto-generated method stub + return true; + } + + @Override + public void validate() { + // TODO Auto-generated method stub + tree.addForm(this); + } + + /*@Override + public String getView() { + return "/xhtml/query/queryTree/particlesForm.xhtml"; + }*/ + + + @Override + public String getTitle() { return "Particle "; } +} 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 3cc5da9..5ab3b52 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,37 +4,53 @@ import java.util.Collection; import java.util.List; +import javax.faces.model.SelectItem; + import org.vamdc.dictionary.Restrictable; import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; import org.vamdc.portal.session.queryBuilder.fields.AbstractField; import org.vamdc.portal.session.queryBuilder.fields.ProxyRangeField; -import org.vamdc.portal.session.queryBuilder.fields.RangeField; -import org.vamdc.portal.session.queryBuilder.fields.SimpleField; import org.vamdc.portal.session.queryBuilder.fields.UnitConvRangeField; +import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; import org.vamdc.portal.session.queryBuilder.forms.FormForFields; +import org.vamdc.portal.session.queryBuilder.forms.Order; import org.vamdc.portal.session.queryBuilder.unitConv.CustomConverters; import org.vamdc.portal.session.queryBuilder.unitConv.EnergyUnitConverter; import org.vamdc.portal.session.queryBuilder.unitConv.FrequencyUnitConverter; import org.vamdc.portal.session.queryBuilder.unitConv.WavelengthUnitConverter; import org.vamdc.portal.session.queryBuilder.unitConv.WavenumberUnitConverter; -public class RadiativeForm extends TreeForm implements FormForFields{ +public class RadiativeForm extends AbstractForm implements FormForFields, TreeFormInterface{ - protected List fields; + /** + * + */ + private static final long serialVersionUID = -621884685195400242L; + private Boolean queryable = true; + private NextForm selectedMode = null; + private QueryTreeInterface tree; + + private enum NextForm{ + upperLowerEnergyRange, + stateEnergyRange, + anyEnergyRange + } + + private List nextOptions = new ArrayList(){ + 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")); + } + }; + public RadiativeForm(QueryTreeInterface tree) { - super(tree); + //super(tree); + this.tree = tree; this.fields = new ArrayList(); - //ProxyRangeField wlField = setupWLField(); - //fields.add(wlField); - - //AbstractField field = new UnitConvRangeField(Restrictable.StateEnergy, "Lower state energy", new EnergyUnitConverter()); - //field.setPrefix("lower"); - AbstractField field=new SimpleField(Restrictable.AtomSymbol,"Test field"); - fields.add(field); - field.setParentForm(this); - field=new SimpleField(Restrictable.AtomMass,"massatom"); - fields.add(field); - field.setParentForm(this); + ProxyRangeField wlField = setupWLField(); + fields.add(wlField); } public Collection getFields() { return fields; } @@ -46,7 +62,23 @@ public String getView() { @Override 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)); + break; + case stateEnergyRange: + tree.addForm(new OneStateEnergyTreeForm(tree)); + break; + case anyEnergyRange: + tree.addForm(new SpeciesSelectionForm(tree)); + break; + } + this.queryable = false; } static ProxyRangeField setupWLField() { @@ -56,10 +88,36 @@ static ProxyRangeField setupWLField() { wlField.addProxyField(new UnitConvRangeField(Restrictable.RadTransEnergy,"Energy",new EnergyUnitConverter()), CustomConverters.WnToWl()); return wlField; } + + public List getNextOptions(){ + return nextOptions; + } + + public NextForm getSelectedMode() { + return selectedMode; + } + + public void setSelectedMode(NextForm selectedMode) { + this.selectedMode = selectedMode; //null if nothing selected + } @Override public void fieldUpdated(AbstractField field) { - System.out.println("Field "+field.getTitle()+" was updated!"); + } + + @Override + public String getTitle() { + return "Define radiative configuration"; + } + + @Override + public Integer getOrder() { + return Order.GuidedRadiative; + } + + @Override + public Boolean getQueryable() { + return this.queryable; } } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RootForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RootForm.java index d9b96ec..661d22b 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RootForm.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/RootForm.java @@ -5,48 +5,54 @@ import javax.faces.model.SelectItem; import org.vamdc.portal.session.queryBuilder.QueryTreeInterface; +import org.vamdc.portal.session.queryBuilder.forms.AbstractForm; +import org.vamdc.portal.session.queryBuilder.forms.Order; -public class RootForm extends TreeForm{ +public class RootForm extends AbstractForm implements TreeFormInterface{ + + /** + * + */ + private static final long serialVersionUID = 48058013878512872L; + private SearchMode selectedMode; + private QueryTreeInterface tree; + private Boolean queryable=true; - private NextForm selectedMode; - private enum NextForm{ - collision, - radiative, - species - } private List nextOptions = new ArrayList(){ private static final long serialVersionUID = -8406069388034760380L; { - add(new SelectItem(NextForm.collision,"For collisional process")); - add(new SelectItem(NextForm.radiative,"For radiative process")); - add(new SelectItem(NextForm.species,"By species")); + //add(new SelectItem(SearchMode.collision,"For collisional process")); + add(new SelectItem(SearchMode.radiative,"For radiative process")); + add(new SelectItem(SearchMode.species,"By species")); } }; public RootForm(QueryTreeInterface tree) { - super(tree); + //super(tree); + this.tree = tree; } public List getNextOptions(){ return nextOptions; } - public NextForm getSelectedMode() { + public SearchMode getSelectedMode() { return selectedMode; } - public void setSelectedMode(NextForm selectedMode) { - System.err.println("Set form "+selectedMode.name()); + public void setSelectedMode(SearchMode selectedMode) { this.selectedMode = selectedMode; } @Override - public void validate(){ + public void validate(){ if (this.selectedMode == null) return; - System.err.println("Adding next form "+selectedMode.name()); + + tree.setSelectionMode(selectedMode); + switch(this.selectedMode){ case collision: break; @@ -54,8 +60,11 @@ public void validate(){ tree.addForm(new RadiativeForm(tree)); break; case species: + tree.addForm(new SpeciesSelectionForm(tree)); break; } + this.queryable = false; + } @Override @@ -63,4 +72,32 @@ public String getView() { return "/xhtml/query/queryTree/rootForm.xhtml"; } + @Override + public String getTitle() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Integer getOrder() { + // TODO Auto-generated method stub + return Order.GuidedRoot; + } + + 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/SearchMode.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SearchMode.java new file mode 100644 index 0000000..40a82b8 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SearchMode.java @@ -0,0 +1,7 @@ +package org.vamdc.portal.session.queryBuilder.formsTree; + +public enum SearchMode { + collision, + radiative, + species +} diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SpeciesSelectionForm.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SpeciesSelectionForm.java new file mode 100644 index 0000000..8109ff4 --- /dev/null +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryBuilder/formsTree/SpeciesSelectionForm.java @@ -0,0 +1,118 @@ +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 class SpeciesSelectionForm extends AbstractForm implements FormForFields, TreeFormInterface{ + + + /** + * + */ + private static final long serialVersionUID = -6587803873839744100L; + protected Integer atomCount; + protected Integer moleculeCount; + protected Integer particleCount; + protected Integer maxElementCount = 5; + private QueryTreeInterface tree; + private Boolean queryable = true; + private Integer formsCount = 0; + + public SpeciesSelectionForm(QueryTreeInterface tree){ + this.tree = tree; + } + + @Override + public String getView() { + return "/xhtml/query/queryTree/speciesSelectionForm.xhtml"; + } + + @Override + public void validate() { + + + for(int i=0;i getStoredQueries(){ - log.info("Reading saved queries"); + //log.info("Reading saved queries"); List queries = null; 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 97886fe..c7f66ec 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 @@ -36,20 +36,20 @@ public List getQueries(){ for (Query session:sessionQueryLog.getStoredQueries()){ queries.add(new QueryFacade(session,"s")); } - log.info("Loaded #0 queries to log", queries.size()); + return Collections.unmodifiableList(queries); } 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"); + //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"); + //log.info("Saving query to the session log"); sessionQueryLog.save(query); } } @@ -64,7 +64,7 @@ public void persistSessionQueries(){ } public void deleteQuery(String queryID){ - log.info("Delete query"+queryID); + //log.info("Delete query"+queryID); if (queryID!=null){ if (queryID.substring(0, 1).equals("p")) persistentQueryLog.delete(Integer.valueOf(queryID.substring(1))); diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseFacade.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseFacade.java index ebee4e3..ba0d268 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseFacade.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseFacade.java @@ -41,5 +41,10 @@ public String getId(){ result = UUID.randomUUID().toString(); return result; } + + @Override + public String getStatus() { + return response.getStatus().toString(); + } } diff --git a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseInterface.java b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseInterface.java index af058db..2fc92b7 100644 --- a/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseInterface.java +++ b/portal.ejb/src/main/java/org/vamdc/portal/session/queryLog/ResponseInterface.java @@ -5,5 +5,6 @@ public interface ResponseInterface { public String getStatsString(); public String getFullQueryURL(); public String getId(); + public String getStatus(); } \ No newline at end of file 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 1fba124..3864d13 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 @@ -22,10 +22,9 @@ public class UserInfo { @In private Identity identity; public User getUser(){ - if (identity!=null){ - System.out.println("identity try login: "+identity.tryLogin()); - - } + /*if (identity!=null){ + System.out.println("identity try login: "+identity.tryLogin()); + }*/ String user = null; if (identity!=null && identity.isLoggedIn() && credentials!=null) diff --git a/portal.war/src/main/webapp/WEB-INF/pages.xml b/portal.war/src/main/webapp/WEB-INF/pages.xml index 8ae6200..2009e80 100644 --- a/portal.war/src/main/webapp/WEB-INF/pages.xml +++ b/portal.war/src/main/webapp/WEB-INF/pages.xml @@ -5,8 +5,11 @@ no-conversation-view-id="/home.xhtml" login-view-id="/login.xhtml"> -
+
+ + + diff --git a/portal.war/src/main/webapp/layout/menu.xhtml b/portal.war/src/main/webapp/layout/menu.xhtml index 2915830..92d1e52 100644 --- a/portal.war/src/main/webapp/layout/menu.xhtml +++ b/portal.war/src/main/webapp/layout/menu.xhtml @@ -9,7 +9,9 @@ propagation="none" /> - + diff --git a/portal.war/src/main/webapp/preview.xhtml b/portal.war/src/main/webapp/preview.xhtml index bff82d6..cead1e5 100644 --- a/portal.war/src/main/webapp/preview.xhtml +++ b/portal.war/src/main/webapp/preview.xhtml @@ -9,7 +9,7 @@ xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml"> - + diff --git a/portal.war/src/main/webapp/queryLog.xhtml b/portal.war/src/main/webapp/queryLog.xhtml index d697789..b2ebffa 100644 --- a/portal.war/src/main/webapp/queryLog.xhtml +++ b/portal.war/src/main/webapp/queryLog.xhtml @@ -9,8 +9,9 @@ xmlns:a4j="http://richfaces.org/a4j" template="/layout/template.xhtml"> - - + + + @@ -35,6 +36,9 @@ + + + @@ -60,7 +64,7 @@ styleClass="logActionButton" /> + styleClass="logActionButton" reRender="queryList" /> @@ -75,7 +79,7 @@ - + @@ -85,19 +89,24 @@ - + - + value="#{registryFacade.getResourceTitle(response.nodeIVOAId)} " /> + + + + @@ -110,6 +119,7 @@ + diff --git a/portal.war/src/main/webapp/queryTree.xhtml b/portal.war/src/main/webapp/queryTree.xhtml index 35174ef..adaf332 100644 --- a/portal.war/src/main/webapp/queryTree.xhtml +++ b/portal.war/src/main/webapp/queryTree.xhtml @@ -10,22 +10,22 @@ xmlns:c="http://java.sun.com/jstl/core" template="/layout/template.xhtml"> + - - - - - - + + + + + + - - + diff --git a/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml b/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml index a65db9f..3a77173 100644 --- a/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml +++ b/portal.war/src/main/webapp/xhtml/consumer/consumerPanel.xhtml @@ -8,59 +8,80 @@ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> - - - - - - - - - -
- -
- - - - - - - - - - - - + + + - - - - - - - - - - - - - - + + value="#{titlePrefix} Results Conversion (entries starting with ** are recommended)" + rendered="#{consumers.selectedNodesCount > 0}" /> + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -
-
+ + diff --git a/portal.war/src/main/webapp/xhtml/preview/table.xhtml b/portal.war/src/main/webapp/xhtml/preview/table.xhtml index d4a8759..11c330f 100644 --- a/portal.war/src/main/webapp/xhtml/preview/table.xhtml +++ b/portal.war/src/main/webapp/xhtml/preview/table.xhtml @@ -69,7 +69,7 @@ value="#{consumers.queries[node.fullQueryURL]}" disabled="#{!preview.done }" rendered="#{node.isOk()}" id="process" tabindex="10" > - + diff --git a/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml b/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml index 60e3873..2b8b0d6 100644 --- a/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/actionButtons.xhtml @@ -11,8 +11,6 @@ - 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 a5e8903..97923d7 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/formTitle.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/formTitle.xhtml @@ -6,7 +6,8 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> - + + @@ -22,7 +23,7 @@ + value="Remove form" immediate="true"> 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 9547c2b..32647fa 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/moleculesForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/moleculesForm.xhtml @@ -11,7 +11,7 @@ - + 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 0c0a211..312b046 100644 --- a/portal.war/src/main/webapp/xhtml/query/forms/standardForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/forms/standardForm.xhtml @@ -9,17 +9,15 @@ xmlns:c="http://java.sun.com/jstl/core"> - - - - + + + - \ 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 545c506..40c1e72 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/actionButtons.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/actionButtons.xhtml @@ -7,13 +7,11 @@ xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j"> - + - + styleClass="roundButton" 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 new file mode 100644 index 0000000..95308d1 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/allStatesEnergyForm.xhtml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..7ace7ec --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/atomsForm.xhtml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml new file mode 100644 index 0000000..162794c --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/moleculesForm.xhtml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml b/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml new file mode 100644 index 0000000..95308d1 --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/oneStateEnergyForm.xhtml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + \ 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 f11ac77..a87a933 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/radiativeForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/radiativeForm.xhtml @@ -11,15 +11,28 @@ + - + - + + +

+ + + + + + + + \ 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 7254c12..45d39cd 100644 --- a/portal.war/src/main/webapp/xhtml/query/queryTree/rootForm.xhtml +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/rootForm.xhtml @@ -9,17 +9,24 @@ xmlns:a4j="http://richfaces.org/a4j"> - + + - + + + + + + - - - + + - - + + + \ 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 new file mode 100644 index 0000000..e725d3c --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/speciesForm.xhtml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + \ 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 new file mode 100644 index 0000000..35a181f --- /dev/null +++ b/portal.war/src/main/webapp/xhtml/query/queryTree/speciesSelectionForm.xhtml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file