String strategyName = (String) context.getJobDetail().getJobDataMap().get(JOB_DATA_STRATEGYNAME);
PersistenceManager persistenceManager = PersistenceManager.getInstance();
if(persistenceManager!=null) {
ModelRepository modelRepository = persistenceManager.modelRepository;
PersistenceService persistenceService = persistenceManager.persistenceServices.get(modelName);
if(modelRepository!=null && persistenceService!=null) {
EObject model = modelRepository.getModel(modelName + ".persist");
if (model instanceof PersistenceModel) {
PersistenceModel persistModel = (PersistenceModel) model;
for(PersistenceConfiguration config : persistModel.getConfigs()) {
if(hasStrategy(persistModel, config, strategyName)) {
for(Item item : persistenceManager.getAllItems(config)) {
long startTime = System.currentTimeMillis();
persistenceService.store(item, config.getAlias());
logger.trace("Storing item '{}' with persistence service '{}' took {}ms",
new Object[] { item.getName(), modelName, System.currentTimeMillis() - startTime});
}
}
}