Skip to content

Commit

Permalink
* choosing criteria for querying QA services checks now for unmapped …
Browse files Browse the repository at this point in the history
…criteria - fixes #249

* querying for services now checks for missing format info  - fixes #248
* cleanup
  • Loading branch information
kraxner committed May 22, 2015
1 parent b4f501b commit b53a5e7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
Expand Up @@ -271,7 +271,7 @@ private List<VPlanLeaf> getPlanLeavesMatchingCriterion(Measure measure) {

// Test which leaves match
for (VPlanLeaf leaf : planSelection.getSelectionPlanLeaves()) {
if (leaf.getMeasure() != null) {
if (leaf.isMapped()) {
if (leaf.getMeasure().getUri().equals(measure.getUri())) {
matchingLeaves.add(leaf);
}
Expand Down
Expand Up @@ -48,7 +48,6 @@
import com.hp.hpl.jena.sparql.syntax.ElementGroup;
import com.hp.hpl.jena.sparql.syntax.ElementUnion;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.GenericType;
import com.sun.jersey.api.client.UniformInterfaceException;
import com.sun.jersey.api.client.WebResource;
Expand Down
Expand Up @@ -42,6 +42,7 @@
import eu.scape_project.planning.model.Plan;
import eu.scape_project.planning.model.PlanState;
import eu.scape_project.planning.model.PreservationActionDefinition;
import eu.scape_project.planning.model.SampleObject;
import eu.scape_project.planning.model.User;
import eu.scape_project.planning.model.tree.Leaf;
import eu.scape_project.planning.model.tree.TreeNode;
Expand Down Expand Up @@ -173,7 +174,10 @@ public void init(Plan plan) {
}
}

sourceMimetype = plan.getSampleRecordsDefinition().getFirstSampleWithFormat().getFormatInfo().getMimeType();
SampleObject sampleWithFormat = plan.getSampleRecordsDefinition().getFirstSampleWithFormat();
if (sampleWithFormat != null) {
sourceMimetype = sampleWithFormat.getFormatInfo().getMimeType();
}
myExperimentSearch.setSourceMimetype(sourceMimetype);

serviceLoaders.put("myExperiment", myExperimentServices);
Expand Down Expand Up @@ -253,7 +257,9 @@ public void selectAlternative(Alternative alternative) {
*/
public void selectLeaf(Leaf leaf) {
this.selectedLeaf = leaf;
myExperimentSearch.setMeasure(leaf.getMeasure().getUri());
if (leaf.isMapped()) {
myExperimentSearch.setMeasure(leaf.getMeasure().getUri());
}
myExperimentSearch.setSourceMimetype(sourceMimetype);
myExperimentSearch.setTargetMimetype(targetMimetypes.get(selectedAlternative));
Set<IServiceInfo> searchResults = new HashSet<IServiceInfo>();
Expand All @@ -274,16 +280,18 @@ public void selectLeaf(Leaf leaf) {
* the component info to add
*/
public void addComponent(IServiceInfo serviceInfo) {
String currentMeasure = selectedLeaf.getMeasure().getUri();
if (!openMeasures.contains(currentMeasure)) {
openMeasures.add(currentMeasure);
if (selectedLeaf.isMapped()) {
String currentMeasure = selectedLeaf.getMeasure().getUri();
if (!openMeasures.contains(currentMeasure)) {
openMeasures.add(currentMeasure);
}
RecommendedComponent recommendedComponent = MyExperimentExecutablePlanGenerator.recommendComponent(serviceInfo,
openMeasures, targetMimetypes.get(selectedAlternative));

removeMeasureRecommendation(currentMeasure);
recommendedComponents.add(recommendedComponent);
openMeasures.removeAll(recommendedComponent.measures);
}
RecommendedComponent recommendedComponent = MyExperimentExecutablePlanGenerator.recommendComponent(serviceInfo,
openMeasures, targetMimetypes.get(selectedAlternative));

removeMeasureRecommendation(currentMeasure);
recommendedComponents.add(recommendedComponent);
openMeasures.removeAll(recommendedComponent.measures);
}

/**
Expand Down

0 comments on commit b53a5e7

Please sign in to comment.