List<Asset> result = new ArrayList<Asset>();
//for validFacts we need to create a temporal Working Set RuleAsset
if (validFacts != null && validFacts.length > 0){
final Asset workingSet = new Asset();
workingSet.setUuid( "workingSetMock"+UUID.randomUUID().toString() );
WorkingSetConfigData wsConfig = new WorkingSetConfigData();
wsConfig.validFacts = validFacts;
workingSet.setContent( wsConfig );
result.add(workingSet);
}
//for each xml working set definition we need to unmarshall it
//to WorkingSetConfigData and create a Working Set Rule Asset
if (xmlDefinitions != null && xmlDefinitions.length > 0){
//Unmarshal each definition and put it in the list
XStream xt = new XStream(new DomDriver());
for (String xml : xmlDefinitions) {
WorkingSetConfigData workingSetConfigData = (WorkingSetConfigData)xt.fromXML(xml);
final Asset workingSet = new Asset();
workingSet.setUuid( "workingSetMock"+UUID.randomUUID().toString() );
workingSet.setContent( workingSetConfigData );
result.add(workingSet);
}
}