use of org.obeonetwork.dsl.database.sqlgen.services.TypesServices in project InformationSystem by ObeoNetwork.
the class DatabaseGen method computeTargetFolder.
private File computeTargetFolder(File folder, Comparison comparison) {
String folderName = "";
String dbtypeFolderName = "";
if (comparison != null) {
DataBase database = (DataBase) comparison.getMatches().get(0).getLeft();
TypesLibrary physicalTypesLibrary = new TypesServices().getPhysicalTypesLibrary(database);
if (physicalTypesLibrary instanceof NativeTypesLibrary) {
dbtypeFolderName += ((NativeTypesLibrary) physicalTypesLibrary).getName() + "/";
} else if (physicalTypesLibrary instanceof UserDefinedTypesLibrary) {
dbtypeFolderName += ((UserDefinedTypesLibrary) physicalTypesLibrary).getName() + "/";
}
folderName = database.getName();
if (database.getSchemas().size() > 0) {
Schema schema = database.getSchemas().get(0);
folderName = schema.getName();
}
folderName += "-";
}
java.sql.Timestamp timeStampDate = new Timestamp(System.currentTimeMillis());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd/HH-mm-ss");
String timestamp = formatter.format(timeStampDate);
folderName += timestamp;
File targetFolder = new File(folder.getAbsolutePath() + "/" + dbtypeFolderName + folderName);
return targetFolder;
}
Aggregations