Commit cca05138 authored by Malo Toudic's avatar Malo Toudic
Browse files
parent 5a092d6a
/* CAS SSO */
DELETE FROM app_configuration WHERE variable = 'cas_url';
/* Change in the SoapuiProject tables */
ALTER TABLE gwt_test_component ADD COLUMN new_project_id INTEGER;
ALTER TABLE gwt_test_component ADD COLUMN soapui_project INTEGER;
ALTER TABLE gwt_soapui_project ADD COLUMN gwt_project INTEGER;
......
package net.ihe.gazelle.wstester.action;
import net.ihe.gazelle.common.filter.Filter;
import net.ihe.gazelle.common.filter.FilterDataModel;
import net.ihe.gazelle.hql.criterion.HQLCriterionsForFilter;
import net.ihe.gazelle.wstester.xdstools.model.CallingTool;
import net.ihe.gazelle.wstester.xdstools.model.CallingToolQuery;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.international.StatusMessage;
import javax.faces.context.FacesContext;
import java.util.List;
import java.util.Map;
@Name("callingToolManager")
@Scope(ScopeType.PAGE)
public class CallingToolManager {
private FilterDataModel<CallingTool> callingTools;
private Filter<CallingTool> filter;
boolean addCallingTool = false;
CallingTool newCallingTool = null;
public FilterDataModel<CallingTool> getCallingTools() {
return new FilterDataModel<CallingTool>(getFilter()) {
@Override
protected Object getId(CallingTool callingTool) {
return callingTool.getId();
}
};
}
public Filter<CallingTool> getFilter() {
if (filter == null) {
Map<String, String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
this.filter = new Filter(this.getHqlCriterions(), params);
}
return this.filter;
}
private HQLCriterionsForFilter getHqlCriterions() {
CallingToolQuery query = new CallingToolQuery();
HQLCriterionsForFilter criterion = query.getHQLCriterionsForFilter();
criterion.addPath("label", query.label());
criterion.addPath("oid", query.oid());
criterion.addPath("url", query.url());
return criterion;
}
public boolean isAddCallingTool() {
return addCallingTool;
}
public void setAddCallingTool(boolean addCallingTool) {
this.addCallingTool = addCallingTool;
}
public CallingTool getNewCallingTool() {
return newCallingTool;
}
public void setNewCallingTool(CallingTool newCallingTool) {
this.newCallingTool = newCallingTool;
}
public void merge() {
List<CallingTool> callingToolList = CallingTool.getAllTool();
for (CallingTool callingTool : callingToolList) {
if (newCallingTool.getLabel().equals(callingTool.getLabel())) {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "There is already a calling tool with this name");
return;
} else if (newCallingTool.getOid().equals(callingTool.getOid())) {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "There is already a calling tool with this OID");
return;
} else if (newCallingTool.getUrl().equals(callingTool.getUrl())) {
FacesMessages.instance().add(StatusMessage.Severity.ERROR, "There is already a calling tool with this URL");
return;
}
}
newCallingTool.save();
cancel();
}
public void addCallingTool(){
newCallingTool = new CallingTool();
addCallingTool = true;
}
public void cancel() {
newCallingTool = null;
addCallingTool = false;
}
public void reset() {
if (this.filter != null) {
this.filter.clear();
}
}
}
......@@ -14,6 +14,7 @@ public enum Pages implements Page {
UPLOAD_PROJECT("/uploadProject.seam", null, "Upload a SoapUI project", Authorizations.LOGGED),
LOGIN_REDIRECT("/login_redirect.seam", null, "User Not Logged In", Authorizations.ALL),
ADMINISTRATION("/administration/configure.seam", null, "Admin Configuration", Authorizations.ADMIN),
CALLING_TOOL("/administration/callingTools.seam", null, "Manager calling tools", Authorizations.ADMIN),
ERROR("/error.seam", null, "Error", Authorizations.ALL);
......
......@@ -64,6 +64,11 @@ public class CallingTool implements Serializable {
return query.getUniqueResult();
}
public static List<CallingTool> getAllTool() {
final CallingToolQuery query = new CallingToolQuery();
return query.getListNullIfEmpty();
}
public void save() {
final EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
entityManager.merge(this);
......@@ -111,31 +116,22 @@ public class CallingTool implements Serializable {
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
return prime * result + (this.label == null ? 0 : this.label.hashCode());
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CallingTool that = (CallingTool) o;
if (!label.equals(that.label)) return false;
if (!oid.equals(that.oid)) return false;
return url.equals(that.url);
}
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (this.getClass() != obj.getClass()) {
return false;
}
final CallingTool other = (CallingTool) obj;
if (this.label == null) {
if (other.label != null) {
return false;
}
} else if (!this.label.equals(other.label)) {
return false;
}
return true;
public int hashCode() {
int result = label.hashCode();
result = 31 * result + oid.hashCode();
result = 31 * result + url.hashCode();
return result;
}
}
<ui:composition xmlns:h="http://java.sun.com/jsf/html" xmlns:s="http://jboss.org/schema/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich"
xmlns:g="http://www.ihe.net/gazelle" xmlns="http://www.w3.org/1999/xhtml"
xmlns:a4j="http://richfaces.org/a4j" xmlns:f="http://java.sun.com/jsf/core"
xmlns:gri="http://java.sun.com/jsf/composite/gri"
template="/layout/template.xhtml">
<ui:param name="pageNameTitle" value="Manage calling tools"/>
<ui:define name="body">
<h:form id="globalForm">
<gri:panel>
<f:facet name="header">
<h:outputText value="Calling tools"/>
</f:facet>
<rich:dataTable id="callingToolTable"
value="#{callingToolManager.callingTools}" var="callingTool"
rows="#{dataScrollerMemory.numberOfResultsPerPage}"
render="ds">
<g:column sortBy="#{'id'}">
<ui:define name="header">Id</ui:define>
<h:outputText value="#{callingTool.id}"/>
</g:column>
<g:column sortBy="#{'label'}" filterBy="#{'label'}">
<ui:define name="header">Name</ui:define>
<h:outputText value="#{callingTool.label}"/>
</g:column>
<g:column sortBy="#{'oid'}" filterBy="#{'oid'}">
<ui:define name="header">OID</ui:define>
<h:outputText value="#{callingTool.oid}"/>
</g:column>
<g:column sortBy="#{'url'}" filterBy="#{'url'}">
<ui:define name="header">Url</ui:define>
<h:outputText value="#{callingTool.url}"/>
</g:column>
<f:facet name="footer">
<ui:include src="/util/datatableFooter.xhtml">
<ui:param name="dataScrollerId" value="ds"/>
<ui:param name="dataTableId" value="projectsTable"/>
</ui:include>
</f:facet>
</rich:dataTable>
<f:facet name="footer">
<a4j:commandButton id="addCallingTool" styleClass="gzl-btn-blue" value="Add a calling tool"
actionListener="#{callingToolManager.addCallingTool()}"
render="globalForm"
rendered="#{callingToolManager.addCallingTool == false}"/>
</f:facet>
</gri:panel>
<gri:panel rendered="#{callingToolManager.addCallingTool}">
<s:decorate template="/layout/form/_edit.xhtml">
<ui:param name="id" value="nameInput"/>
<ui:define name="label">Name</ui:define>
<h:inputText id="nameInput" value="#{callingToolManager.newCallingTool.label}"
required="true" styleClass="form-control"/>
</s:decorate>
<s:decorate template="/layout/form/_edit.xhtml">
<ui:param name="id" value="oidInput"/>
<ui:define name="label">OID</ui:define>
<h:inputText id="oidInput" value="#{callingToolManager.newCallingTool.oid}"
required="true" styleClass="form-control"/>
</s:decorate>
<s:decorate template="/layout/form/_edit.xhtml">
<ui:param name="id" value="urlInput"/>
<ui:define name="label">URL</ui:define>
<h:inputText id="urlInput" value="#{callingToolManager.newCallingTool.url}"
required="true" styleClass="form-control"/>
</s:decorate>
<f:facet name="footer">
<a4j:commandButton id="mergeCallingTool" styleClass="gzl-btn-green" value="Validate"
actionListener="#{callingToolManager.merge()}"
render="globalForm"/>
<a4j:commandButton id="cancel" styleClass="gzl-btn" value="Cancel"
actionListener="#{callingToolManager.cancel()}"
render="globalForm" immediate="true"/>
</f:facet>
</gri:panel>
</h:form>
</ui:define>
</ui:composition>
\ No newline at end of file
<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
xmlns="http://www.w3.org/1999/xhtml">
<!-- ADT -->
<li>
<h:outputLink value="/gazelle-webservice-tester/administration/callingTools.seam">
<h:outputText value="Manage calling tools"/>
</h:outputLink>
</li>
</ui:composition>
\ No newline at end of file
......@@ -51,6 +51,7 @@
<ui:decorate template="/layout/menu-right.xhtml">
<ui:param name="applicationRoot" value="gazelle-webservice-tester"/>
<ui:define name="administration_links">
<ui:include src="/layout/admin.xhtml"/>
</ui:define>
</ui:decorate>
</ui:define>
......
......@@ -4,7 +4,7 @@
<parent>
<groupId>net.ihe.gazelle.simulators</groupId>
<artifactId>simulator-common</artifactId>
<version>4.3.16</version>
<version>4.4.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment