use of com.solinia.solinia.Models.SoliniaAlignment in project solinia3-core by mixxit.
the class JsonAlignmentRepository method commit.
@Override
public void commit() {
// TODO Auto-generated method stub
GsonBuilder gsonbuilder = new GsonBuilder();
// gsonbuilder.setPrettyPrinting();
Gson gson = gsonbuilder.create();
String jsonOutput = gson.toJson(alignments.values(), new TypeToken<List<SoliniaAlignment>>() {
}.getType());
try {
File file = new File(filePath);
if (!file.exists())
file.createNewFile();
FileOutputStream fileOut = new FileOutputStream(file);
OutputStreamWriter outWriter = new OutputStreamWriter(fileOut);
outWriter.append(jsonOutput);
outWriter.close();
fileOut.close();
System.out.println("Commited " + alignments.size() + " Alignments");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
use of com.solinia.solinia.Models.SoliniaAlignment in project solinia3-core by mixxit.
the class ConfigurationManager method addAlignment.
@Override
public void addAlignment(String alignmentname) throws Exception {
for (ISoliniaAlignment alignment : getAlignments()) {
if (alignment.getName().equals(alignmentname.toUpperCase()))
throw new Exception("Alignment already exists");
}
SoliniaAlignment alignment = new SoliniaAlignment();
alignment.setId(getNextAlignmentId());
alignment.setName(alignmentname);
alignmentsRepository.add(alignment);
}
Aggregations