+ public void saveLab(LabInfo lab) {
+ synchronized (LOCK) {
+ labDAO.saveOrUpdate(lab);
+ }
+ }
+
+ public void deleteLab(LabInfo lab) {
+ synchronized (LOCK) {
+ labDAO.deleteLab(lab);
+ }
+ }
+
+ public LabInfo getLab(String lab) {
+ synchronized (LOCK) {
+ return labDAO.getLab(lab);
+ }
+ }
+
+ public LabInfo getLabBasedOnSilo(String silo) {
+ synchronized (LOCK) {
+ return labDAO.getLabBasedOnSilo(silo);
+ }
+ }
+
+ public List<LabInfo> getLabs() {
+ synchronized (LOCK) {
+ return labDAO.getLabs();
+ }
+ }
+
+ public void deleteLabAll() {
+ synchronized (LOCK) {
+ labDAO.deleteAll();
+ }
+ }
+
+ public void saveBlueprintInstance(BlueprintInstance blueprintIns) {
+ synchronized (LOCK) {
+ Set<Timeslot> timeslots = blueprintIns.getTimeslots();
+ if (timeslots != null && timeslots.size() > 1) {
+ for (Timeslot timeslot : timeslots) {
+ if (!compareTimeslots(timeslot, timeslotDAO.getTimeslot(timeslot.getTimeslotId()))) {
+ throw new RuntimeException("Timeslot instance data changed.");
+ }
+ }
+ bluInstDao.merge(blueprintIns);
+ return;
+ }
+ bluInstDao.saveOrUpdate(blueprintIns);
+ }
+ }
+
+ public List<BlueprintInstance> getBlueprintInstances() {
+ synchronized (LOCK) {
+ return bluInstDao.getBlueprintInstances();
+ }
+ }
+
+ public BlueprintInstance getBlueprintInstance(int instId) {
+ synchronized (LOCK) {
+ return bluInstDao.getBlueprintInstance(instId);
+ }
+ }
+
+ public BlueprintInstance getBlueprintInstance(Blueprint blueprint, String version) {
+ synchronized (LOCK) {
+ return bluInstDao.getBlueprintInstance(blueprint, version);
+ }
+ }
+
+ public void deleteBlueprintInstance(BlueprintInstance blueprintIns) {
+ synchronized (LOCK) {
+ bluInstDao.deleteBlueprintInstance(blueprintIns);
+ }
+ }
+
+ public void deleteBluInstAll() {
+ synchronized (LOCK) {
+ bluInstDao.deleteAll();
+ }
+ }
+
+ public void saveBlueprintLayer(BlueprintLayer layer) {
+ synchronized (LOCK) {
+ layerDAO.saveOrUpdate(layer);
+ }
+ }
+
+ public BlueprintLayer getBlueprintLayer(Integer layerId) {
+ synchronized (LOCK) {
+ return layerDAO.getBlueprintLayer(layerId);
+ }
+ }
+
+ public BlueprintLayer getBlueprintLayer(String layerData) {
+ synchronized (LOCK) {
+ return layerDAO.getBlueprintLayer(layerData);
+ }
+ }
+
+ public List<BlueprintLayer> getBlueprintLayers() {
+ synchronized (LOCK) {
+ return layerDAO.getBlueprintLayers();
+ }
+ }
+
+ public void deleteBlueprintLayer(BlueprintLayer layer) {
+ synchronized (LOCK) {
+ layerDAO.deleteBlueprintLayer(layer);
+ }
+ }
+
+ public void deleteBluLayersAll() {
+ synchronized (LOCK) {
+ layerDAO.deleteAll();
+ }
+ }
+
+ public void saveBlueprint(Blueprint blueprint) {
+ synchronized (LOCK) {
+ blueprintDAO.saveOrUpdate(blueprint);
+ }
+ }
+
+ public Blueprint getBlueprint(String name) {
+ synchronized (LOCK) {
+ return blueprintDAO.getBlueprint(name);
+ }
+ }
+
+ public List<Blueprint> getBlueprints() {
+ synchronized (LOCK) {
+ return blueprintDAO.getBlueprints();
+ }
+ }
+
+ public void deleteBlueprint(Blueprint blueprint) {
+ synchronized (LOCK) {
+ blueprintDAO.deleteBlueprint(blueprint);
+ }
+ }
+
+ public void deleteBluAll() {
+ synchronized (LOCK) {
+ blueprintDAO.deleteAll();
+ }
+ }
+
+ public void saveTimeslot(Timeslot timeslot) {
+ synchronized (LOCK) {
+ LabInfo labInfo = timeslot.getLabInfo();
+ if (labInfo != null) {
+ if (!compareLabInfos(labInfo, labDAO.getLab(labInfo.getLabId()))) {
+ throw new RuntimeException("Lab data changed.");
+ }
+ }
+ timeslotDAO.saveOrUpdate(timeslot);
+ }
+ }
+
+ public List<Timeslot> getTimeslots() {
+ synchronized (LOCK) {
+ return timeslotDAO.getTimeslots();
+ }
+ }
+
+ public void deleteTimeslot(Timeslot timeslot) {
+ synchronized (LOCK) {
+ timeslotDAO.deleteTimeslot(timeslot);
+ }
+ }
+
+ public void deleteTimeslotAll() {
+ synchronized (LOCK) {
+ timeslotDAO.deleteAll();
+ }
+ }
+