Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3e4fe582a5fd4fdb3087fdc7991dad903bd3ab1e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Created on Jun 23, 2010
 *
 * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
 */
package org.eclipse.osee.framework.core.message.internal.translation;

import org.eclipse.osee.framework.core.exception.OseeCoreException;
import org.eclipse.osee.framework.core.message.DatastoreInitRequest;
import org.eclipse.osee.framework.core.translation.ITranslator;
import org.eclipse.osee.framework.jdk.core.type.PropertyStore;

public class DatastoreInitRequestTranslator implements ITranslator<DatastoreInitRequest> {

   private static enum Entry {
      INDEX_DATA_SPACE,
      TABLE_DATA_SPACE,
      USE_FILE_SPECIFIED_SCHEMAS;
   }

   @Override
   public DatastoreInitRequest convert(PropertyStore store) throws OseeCoreException {
      String tableDataSpace = store.get(Entry.TABLE_DATA_SPACE.name());
      String indexDataSpace = store.get(Entry.INDEX_DATA_SPACE.name());
      boolean useSchemasSpecified = store.getBoolean(Entry.USE_FILE_SPECIFIED_SCHEMAS.name());
      return new DatastoreInitRequest(tableDataSpace, indexDataSpace, useSchemasSpecified);
   }

   @Override
   public PropertyStore convert(DatastoreInitRequest object) throws OseeCoreException {
      PropertyStore store = new PropertyStore();
      store.put(Entry.INDEX_DATA_SPACE.name(), object.getIndexDataSpace());
      store.put(Entry.TABLE_DATA_SPACE.name(), object.getTableDataSpace());
      store.put(Entry.USE_FILE_SPECIFIED_SCHEMAS.name(), object.isUseFileSpecifiedSchemas());
      return store;
   }
}

Back to the top