Skip to content
Snippets Groups Projects
Commit f3bcabe8 authored by cramakri's avatar cramakri
Browse files

LMS-1887 Added another utility method to DataSetLister -- useful for testing.

SVN: 18872
parent e06e5213
No related branches found
No related tags found
No related merge requests found
......@@ -44,11 +44,11 @@ public class DataSetLister
{
String serverUrl = args[0];
String userId = args[1];
String password;
if (args.length == 3)
{
password =args[2];
password = args[2];
} else
{
password = getConsoleReader().readLine("Password: ", Character.valueOf('*'));
......@@ -78,11 +78,10 @@ public class DataSetLister
return new ConsoleReader();
} catch (final IOException ex)
{
throw new EnvironmentFailureException("ConsoleReader could not be instantiated.",
ex);
throw new EnvironmentFailureException("ConsoleReader could not be instantiated.", ex);
}
}
private final IGeneralInformationService generalInformationService;
private final String sessionToken;
......@@ -132,4 +131,28 @@ public class DataSetLister
System.out.println(sb.toString());
System.out.println("\n");
}
/**
* Find data sets with a specific value for a property.
*/
@SuppressWarnings("unused")
private void findDataSetsForSamplesWithCode(String code)
{
SearchCriteria sc = new SearchCriteria();
sc.addMatchClause(MatchClause.createAttributeMatch(MatchClauseAttribute.CODE, code));
List<Sample> samples = generalInformationService.searchForSamples(sessionToken, sc);
List<DataSet> result = generalInformationService.listDataSets(sessionToken, samples);
StringBuilder sb = new StringBuilder();
sb.append("Found ");
sb.append(samples.size());
sb.append(" sample(s) with code");
sb.append("=");
sb.append(code);
sb.append(". Data sets attached to these samples:\n");
sb.append(result);
System.out.println(sb.toString());
System.out.println("\n");
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment