public static void processParams(String s[]) { /**/ if (s[0].equals("DevData")) { if (s.length == 1) { Err.error("Need to explicitly specify a database"); } /* * Dangerous! */ if (s[1].equals(WombatConnectionEnum.PROD)) { Err.error("Cannot work with the " + WombatConnectionEnum.getFromName(s[1]) + " database"); } /**/ if (s.length == 2) { DataStoreFactory dataStoreFactory = new WombatDataStoreFactory(); dataStoreFactory.addConnection(WombatConnectionEnum.getFromName(s[1])); dataStore = dataStoreFactory.getEntityManagedDataStore(); } else { Err.error(); } dataStore.startTx(); List list = (List) dataStore.get(POJOWombatData.WORKER); update(list); dataStore.commitTx(); } else { Err.error("Unrecognised param " + s[0]); } }
private void populate() { DataStoreFactory dataStoreFactory = new WombatDataStoreFactory(); dataStoreFactory.addConnection(WombatConnectionEnum.SERVER_CAYENNE); dataStore = dataStoreFactory.getEntityManagedDataStore(); demoDataCayenne = CayenneWombatDemoData.getInstance(ORMTypeEnum.CAYENNE_SERVER, dataStore); dataStore.startTx(); demoDataCayenne.doPopulation(); populateFromDemoData(); if (!COMMIT_POPULATION) { dataStore.rollbackTx(); } else { dataStore.commitTx(); } }