View Javadoc
1   package xuml.tools.diagram;
2   
3   import xuml.tools.datastore.DatastoreText;
4   
5   public class ModelPersistence {
6   
7       private static final String KEY_KIND = "diagram";
8       private static ModelPersistencedelPersistence">ModelPersistence instance = new ModelPersistence();
9   
10      public static ModelPersistence instance() {
11          return instance;
12      }
13  
14      public String getXml(String id) {
15          String entity = id + "-model";
16          String property = "model";
17          // TODO change to DatastoreText.instance()
18          DatastoreText ds = Context.instance().getDatastore();
19          String result = ds.get(KEY_KIND, entity, property);
20          return result;
21      }
22  
23      public void save(String id, String xml) {
24          String entity = id + "-model";
25          String property = "model";
26          // TODO change to DatastoreText.instance()
27          DatastoreText ds = Context.instance().getDatastore();
28          ds.put(KEY_KIND, entity, property, xml);
29      }
30  }