Commit 3d62b55a authored by Wylem Bars's avatar Wylem Bars
Browse files

delete unwanted files from branche validation-type-mapping

git-svn-id: https://scm.gforge.inria.fr/authscm/ycadoret/svn/gazelle/Maven/EVSClient/branches/content-analyzer-refactor@63932 356b4b1a-1d2b-0410-8bf1-ffa24008f01e
parent 1c4eeca9
......@@ -98,7 +98,7 @@
<dependency>
<groupId>net.ihe.gazelle</groupId>
<artifactId>gazelle-evsclient-common</artifactId>
<version>1.0.1-SNAPSHOT</version>
<version>1.0.0</version>
</dependency>
<dependency>
......
package net.ihe.gazelle.evs.client.common.action;
import net.ihe.gazelle.evs.client.common.model.ReferencedStandard;
import net.ihe.gazelle.evs.client.common.model.ReferencedStandardQuery;
import net.ihe.gazelle.evs.client.common.model.ValidationProfile;
import net.ihe.gazelle.evs.client.common.model.ValidationService;
import net.ihe.gazelle.evs.client.util.ValidatorType;
import net.ihe.gazelle.hql.providers.EntityManagerService;
import net.ihe.gazelle.hql.restrictions.HQLRestrictions;
import net.ihe.gazelle.mb.validator.client.MBValidator;
import net.ihe.gazelle.sch.validator.ws.client.GazelleObjectValidatorServiceStub;
import net.ihe.gazelle.sch.validator.ws.client.SOAPExceptionException;
import org.apache.axis2.Constants;
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.persistence.EntityManager;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@Name("validationProfileManager")
@Scope(ScopeType.PAGE)
public class ValidationProfileManager {
private transient GazelleObjectValidatorServiceStub stub;
private List<ValidationProfile> validationProfiles;
private ValidationProfile selectedValidationProfile;
private List<ValidatorType> validatorTypes = Arrays.asList(ValidatorType.values());
private List<String> availableExtensions;
private List<String> availableSchematrons;
private List<String> availableMBValidators;
///////////////////////////////////////////////////////////////////////////////
//////////////////// Constructor //////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
public ValidationProfileManager(){
}
///////////////////////////////////////////////////////////////////////////////
//////////////////// Getter and setter /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
public List<ValidatorType> getValidatorTypes() {
return validatorTypes;
}
public ValidationProfile getSelectedValidationProfile() {
return selectedValidationProfile;
}
public void setSelectedValidationProfile(ValidationProfile selectedValidationProfile) {
this.selectedValidationProfile = selectedValidationProfile;
if(this.selectedValidationProfile.getValidatorType() != null){
computeAvailableExtensions();
}
if(this.selectedValidationProfile.getExtension() != null){
computeAvailableSchematronAndMBValidators();
}
}
///////////////////////////////////////////////////////////////////////////////
//////////////////// Public Methods //////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
public void listValidationProfile(){
EntityManager em = EntityManagerService.provideEntityManager();
ValidationProfileQuery validationProfileQuery = new ValidationProfileQuery(em);
this.validationProfiles = new ArrayList<ValidationProfile>(validationProfileQuery.getList());
}
public void updateSelectedValidatorTypeChanges(){
computeAvailableExtensions();
this.availableMBValidators = null;
this.availableSchematrons = null;
this.selectedValidationProfile.setExtension(null);
this.selectedValidationProfile.setSchematron(null);
this.selectedValidationProfile.setMbValidator(null);
}
public void updateSelectedExtensionChanges(){
computeAvailableSchematronAndMBValidators();
this.selectedValidationProfile.setSchematron(null);
this.selectedValidationProfile.setMbValidator(null);
}
public void computeAvailableExtensions(){
if (this.selectedValidationProfile.getValidatorType() != null) {
final ReferencedStandardQuery query = new ReferencedStandardQuery();
query.addRestriction(HQLRestrictions.or(
query.name().eqRestriction(this.selectedValidationProfile.getValidatorType().getProxyType()),
query.name().eqRestriction(this.selectedValidationProfile.getValidatorType().getFriendlyName())));
query.extension().order(true);
this.availableExtensions = query.extension().getListDistinct();
} else {
this.availableExtensions = null;
this.availableSchematrons = null;
this.availableMBValidators = null;
}
}
public void computeAvailableSchematronAndMBValidators(){
List<ReferencedStandard> standards = ReferencedStandard
.getReferencedStandardFiltered(this.selectedValidationProfile.getValidatorType().getFriendlyName(),
null, this.selectedValidationProfile.getExtension(), null);
if (standards != null && !standards.isEmpty()) {
ReferencedStandard referencedStandard = standards.get(0);
List<ValidationService> services = referencedStandard.getServices();
if (services != null && !services.isEmpty()) {
for (final ValidationService service : services) {
if (service != null && service.isAvailable() && service.getEngine() != null) {
if (service.getEngine().equals(ValidationService.EngineType.SCHEMATRON.getKeyword())) {
ValidationService schematronBasedValidationService = service;
if (this.stub == null) {
try {
this.stub = new GazelleObjectValidatorServiceStub(schematronBasedValidationService.getWsdl());
this.stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,
Boolean.TRUE);
final GazelleObjectValidatorServiceStub.GetSchematronsForAGivenType params = new
GazelleObjectValidatorServiceStub.GetSchematronsForAGivenType();
params.setFileType(referencedStandard.getLabel());
final GazelleObjectValidatorServiceStub.GetSchematronsForAGivenTypeE paramsE = new
GazelleObjectValidatorServiceStub.GetSchematronsForAGivenTypeE();
paramsE.setGetSchematronsForAGivenType(params);
final GazelleObjectValidatorServiceStub.Schematron[] schematrons = this.stub.getSchematronsForAGivenType(paramsE)
.getGetSchematronsForAGivenTypeResponse().getSchematrons();
if (schematrons != null && schematrons.length > 0) {
this.availableSchematrons = new ArrayList<>();
for (final GazelleObjectValidatorServiceStub.Schematron schematron : schematrons) {
this.availableSchematrons.add(schematron.getLabel());
}
Collections.sort(this.availableSchematrons);
}
} catch (final RemoteException | SOAPExceptionException e) {
this.availableSchematrons = null;
EmailNotificationManager
.send(e, "Unable to retrieve the list of schematrons for Validation using label "
+ referencedStandard.getLabel(),
null);
FacesMessages.instance()
.addFromResourceBundle("gazelle.evs.client.service.seems.unavailable");
}
}
} else if (service.getEngine().equals(ValidationService.EngineType.MODEL_BASED.getKeyword())) {
ValidationService modelBasedValidationService = service;
List<String> validators;
try {
MBValidator mbValidator = new MBValidator(modelBasedValidationService.getWsdl());
validators = mbValidator.listAvailableValidators(referencedStandard.getExtension());
if (validators != null) {
Collections.sort(validators);
}
this.availableMBValidators = validators;
} catch (final Exception e) {
EmailNotificationManager.send(e, "Unable to retrieve the list of model based validators", null);
FacesMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "net.ihe.gazelle.evs.xml.failToValidateWithMBValidator");
}
}
}
}
}
} else {
FacesMessages.instance().addFromResourceBundle(StatusMessage.Severity.ERROR, "net.ihe.gazelle.evs.xml.noStandardFound");
}
}
}
package net.ihe.gazelle.evs.client.common.model;
import net.ihe.gazelle.evsclient.common.model.MCADocType;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "evsc_mca_doctype_mapping", schema = "public")
@SequenceGenerator(name = "evsc_mca_doctype_mapping_sequence", sequenceName = "evsc_mca_doctype_mapping_seq", allocationSize = 1)
public class MCADocTypeMapping {
@Id
@NotNull
@GeneratedValue(generator = "evsc_validation_profile_sequence", strategy = GenerationType.SEQUENCE)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
@Column(name="validation_profile")
private ValidationProfile validationProfile;
@Column(name="mca_doctype",unique = true)
private MCADocType mcaDocType;
}
package net.ihe.gazelle.evs.client.common.model;
import net.ihe.gazelle.evs.client.dicom.model.DicomOperation;
import net.ihe.gazelle.evs.client.util.ValidatorType;
import net.ihe.gazelle.tf.model.Hl7MessageProfile;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "evsc_validation_profile", schema = "public")
@SequenceGenerator(name = "evsc_validation_profile_sequence", sequenceName = "evsc_validation_profile_seq", allocationSize = 1)
public class ValidationProfile {
@Id
@NotNull
@GeneratedValue(generator = "evsc_validation_profile_sequence", strategy = GenerationType.SEQUENCE)
@Column(name = "id", nullable = false, unique = true)
private Integer id;
// Name, OID ?
@ElementCollection
@CollectionTable(name="evsc_validation_profile_validator_type", joinColumns=@JoinColumn(name="validation_profile_id"))
@Column(name="validator_type")
@Enumerated(EnumType.STRING)
private ValidatorType validatorType;
@Column(name = "extension")
private String extension;
@Column(name="schematron")
private String schematron;
@Column(name="mbvalidator")
private String mbValidator;
@Column(name ="hl7_message_profile")
private Hl7MessageProfile hl7MessageProfile;
@Column(name = "dicom_validation_service")
private ValidationService dicomValidationService;
@Column(name = "dicom_operation")
private DicomOperation dicomOperation;
public Integer getId() {
return id;
}
public ValidatorType getValidatorType() {
return validatorType;
}
public void setValidatorType(ValidatorType validatorType) {
this.validatorType = validatorType;
}
public String getExtension() {
return extension;
}
public void setExtension(String extension) {
this.extension = extension;
}
public String getSchematron() {
return schematron;
}
public void setSchematron(String schematron) {
this.schematron = schematron;
}
public String getMbValidator() {
return mbValidator;
}
public void setMbValidator(String mbValidator) {
this.mbValidator = mbValidator;
}
public Hl7MessageProfile getHl7MessageProfile() {
return hl7MessageProfile;
}
public void setHl7MessageProfile(Hl7MessageProfile hl7MessageProfile) {
this.hl7MessageProfile = hl7MessageProfile;
}
public ValidationService getDicomValidationService() {
return dicomValidationService;
}
public void setDicomValidationService(ValidationService dicomValidationService) {
this.dicomValidationService = dicomValidationService;
}
public DicomOperation getDicomOperation() {
return dicomOperation;
}
public void setDicomOperation(DicomOperation dicomOperation) {
this.dicomOperation = dicomOperation;
}
}
Markdown is supported
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