use of com.khartec.waltz.data.software_catalog.SoftwarePackageDao in project waltz by khartec.
the class SoftwarePackageGenerator method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
SoftwarePackageDao softwarePackageDao = ctx.getBean(SoftwarePackageDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
List<SoftwarePackage> softwarePackages = ListUtilities.builder(SoftwarePackage.class).addAll(DatabaseSoftwarePackages.dbs).addAll(AppServerSoftwarePackages.appServers).addAll(MiddlewareSoftwarePackages.middleware).build();
System.out.println("-- deleting all software packages");
dsl.deleteFrom(SOFTWARE_PACKAGE).where(SOFTWARE_PACKAGE.PROVENANCE.eq(SampleDataUtilities.SAMPLE_DATA_PROVENANCE)).execute();
System.out.println(" -- storing packages ( " + softwarePackages.size() + " )");
softwarePackageDao.bulkStore(softwarePackages);
System.out.println(" -- done");
}
use of com.khartec.waltz.data.software_catalog.SoftwarePackageDao in project waltz by khartec.
the class SoftwareUsageGenerator method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
SoftwarePackageDao softwarePackageDao = ctx.getBean(SoftwarePackageDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
ApplicationDao applicationDao = ctx.getBean(ApplicationDao.class);
List<SoftwarePackage> allSoftware = softwarePackageDao.findAll();
List<SoftwareUsageRecord> records = applicationDao.getAll().stream().flatMap(app -> IntStream.range(0, new Random().nextInt(4) + 1).mapToObj(x -> new SoftwareUsageRecord(app.id().get(), ListUtilities.randomPick(allSoftware).id().get(), "waltz-random"))).collect(Collectors.toList());
System.out.println("-- deleting all software usages");
dsl.deleteFrom(SOFTWARE_USAGE).where(SOFTWARE_USAGE.PROVENANCE.eq("waltz-sample")).execute();
System.out.println(" -- storing usages ( " + records.size() + " )");
dsl.batchInsert(records).execute();
System.out.println(" -- done");
}
Aggregations