Guest User

Untitled

a guest
Dec 9th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.sql.SQLException;
  3. import java.util.List;
  4. import java.util.Map;
  5.  
  6. import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
  7. import org.apache.openjpa.jdbc.meta.ReverseMappingTool;
  8. import org.apache.openjpa.lib.conf.ObjectValue;
  9. import org.apache.openjpa.lib.util.Options;
  10.  
  11. public class MemReverseMappingTool extends ReverseMappingTool {
  12.     private static final String MEM_REVERSE_MAPPER_CODE_MAP = "myReverseMapper.codeMap";
  13.     private Map                 codeMap;
  14.  
  15.     public MemReverseMappingTool(JDBCConfiguration conf, Map outputMap) {
  16.         super(conf);
  17.         codeMap = outputMap;
  18.     }
  19.  
  20.     protected static ReverseMappingTool newInstance(JDBCConfiguration conf) {
  21.         Map map = (Map) conf.getValue(MEM_REVERSE_MAPPER_CODE_MAP).get();
  22.         return new MemReverseMappingTool(conf, map);
  23.     }
  24.  
  25.     @Override
  26.     public List recordCode() throws IOException {
  27.         return recordCode(codeMap);
  28.     }
  29.  
  30.     public static boolean run(JDBCConfiguration conf, String[] args, Options opts, Map outputMap) throws IOException, SQLException {
  31.         ObjectValue codeMapValue = new ObjectValue(MEM_REVERSE_MAPPER_CODE_MAP);
  32.         codeMapValue.set(outputMap);
  33.         conf.addValue(codeMapValue);
  34.         return ReverseMappingTool.run(conf, args, opts);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment