@SuppressWarnings("unchecked") public static synchronized void execute( IDataBase dataBase, Composite composite, Executer executer) { List list = dataBase.find(composite.getClass()); for (Object object : list) { executer.execute(object); } }
private static synchronized void log( ICriteria criteria, Composite<?, ?> composite, int tabs, String data) { if (criteria == null || (criteria != null && criteria.satisfied(composite))) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < tabs; i++) { builder.append(" "); } builder.append(composite.getClass().getSimpleName()); builder.append(" : "); builder.append(data); logger.warn(builder.toString()); } }
/** * Clears the data in the database. * * @param dataBase the database to truncate */ @SuppressWarnings("unchecked") public static synchronized void clear(IDataBase dataBase) { Project<?, ?> project = (Project<?, ?>) dataBase.find(Project.class, Toolkit.hash(Project.class.getName())); if (project != null) { dataBase.remove(Project.class, project.getId()); } List<Package> packages = dataBase.find(Package.class); for (Composite<?, ?> composite : packages) { dataBase.remove(composite.getClass(), composite.getId()); } List<Class> classes = dataBase.find(Class.class); for (Composite composite : classes) { dataBase.remove(composite.getClass(), composite.getId()); } List<Method> methods = dataBase.find(Method.class); for (Composite composite : methods) { dataBase.remove(composite.getClass(), composite.getId()); } List<Line> lines = dataBase.find(Line.class); for (Composite composite : lines) { dataBase.remove(composite.getClass(), composite.getId()); } List<Snapshot> snapshots = dataBase.find(Snapshot.class); for (Snapshot snapshot : snapshots) { dataBase.remove(Snapshot.class, snapshot.getId()); } }