Search in sources :

Example 1 with TypesServices

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;
}
Also used : NativeTypesLibrary(org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary) Schema(org.obeonetwork.dsl.database.Schema) Timestamp(java.sql.Timestamp) NativeTypesLibrary(org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary) TypesLibrary(org.obeonetwork.dsl.typeslibrary.TypesLibrary) UserDefinedTypesLibrary(org.obeonetwork.dsl.typeslibrary.UserDefinedTypesLibrary) UserDefinedTypesLibrary(org.obeonetwork.dsl.typeslibrary.UserDefinedTypesLibrary) TypesServices(org.obeonetwork.dsl.database.sqlgen.services.TypesServices) Timestamp(java.sql.Timestamp) SimpleDateFormat(java.text.SimpleDateFormat) File(java.io.File) DataBase(org.obeonetwork.dsl.database.DataBase)

Aggregations

File (java.io.File)1 Timestamp (java.sql.Timestamp)1 SimpleDateFormat (java.text.SimpleDateFormat)1 DataBase (org.obeonetwork.dsl.database.DataBase)1 Schema (org.obeonetwork.dsl.database.Schema)1 TypesServices (org.obeonetwork.dsl.database.sqlgen.services.TypesServices)1 NativeTypesLibrary (org.obeonetwork.dsl.typeslibrary.NativeTypesLibrary)1 TypesLibrary (org.obeonetwork.dsl.typeslibrary.TypesLibrary)1 UserDefinedTypesLibrary (org.obeonetwork.dsl.typeslibrary.UserDefinedTypesLibrary)1