1 56 package org.objectstyle.cayenne.project; 57 58 import java.io.PrintWriter ; 59 60 import org.objectstyle.cayenne.map.DataMap; 61 62 68 public class DataMapFile extends ProjectFile { 69 public static final String LOCATION_SUFFIX = ".map.xml"; 70 71 protected DataMap map; 72 73 public DataMapFile() {} 74 75 78 public DataMapFile(Project project, DataMap map) { 79 super(project, map.getLocation()); 80 this.map = map; 81 } 82 83 86 public Object getObject() { 87 return map; 88 } 89 90 93 public String getObjectName() { 94 return map.getName(); 95 } 96 97 public void save(PrintWriter out) throws Exception { 98 map.encodeAsXML(out); 99 } 100 101 104 public boolean canHandle(Object obj) { 105 return obj instanceof DataMap; 106 } 107 108 111 public void willSave() { 112 super.willSave(); 113 114 if (map != null) { 115 map.setLocation(getLocation()); 116 } 117 } 118 119 122 public String getLocationSuffix() { 123 return LOCATION_SUFFIX; 124 } 125 } 126 | Popular Tags |