├── dist ├── ParsePDM.jar ├── lib │ ├── dom4j-1.6.1.jar │ ├── jaxen-1.1.1.jar │ ├── log4j-1.2.16.jar │ ├── commons-lang-2.6.jar │ └── commons-logging-api-1.1.jar └── README.TXT ├── manifest.mf ├── README.md ├── nbproject ├── private │ ├── private.xml │ ├── private.properties │ └── profiler │ │ └── configurations.xml ├── genfiles.properties ├── project.xml ├── project.properties └── build-impl.xml └── src └── com └── smshen ├── utils ├── PDMReferenceJoin.java ├── PDMUser.java ├── PDMIndex.java ├── PDMPhysicalDiagram.java ├── PDMKey.java ├── PDMColumn.java ├── PDMReference.java ├── PDMTable.java ├── PDM.java └── Parser.java ├── ContactEditorUI.form └── ContactEditorUI.java /dist/ParsePDM.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lite/ParsePDM/master/dist/ParsePDM.jar -------------------------------------------------------------------------------- /dist/lib/dom4j-1.6.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lite/ParsePDM/master/dist/lib/dom4j-1.6.1.jar -------------------------------------------------------------------------------- /dist/lib/jaxen-1.1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lite/ParsePDM/master/dist/lib/jaxen-1.1.1.jar -------------------------------------------------------------------------------- /dist/lib/log4j-1.2.16.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lite/ParsePDM/master/dist/lib/log4j-1.2.16.jar -------------------------------------------------------------------------------- /manifest.mf: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | X-COMMENT: Main-Class will be added automatically by build 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ParsePDM 2 | 在 Mac OS 上查看 PDM 文件 3 | ## 使用方式 4 | 1. 把项目clone到本地 5 | 2. 打开 dist --> ParsePDM.jar 6 | -------------------------------------------------------------------------------- /dist/lib/commons-lang-2.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lite/ParsePDM/master/dist/lib/commons-lang-2.6.jar -------------------------------------------------------------------------------- /dist/lib/commons-logging-api-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lite/ParsePDM/master/dist/lib/commons-logging-api-1.1.jar -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=c70515cc 2 | build.xml.script.CRC32=5f7cae55 3 | build.xml.stylesheet.CRC32=8064a381@1.68.1.46 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=c70515cc 7 | nbproject/build-impl.xml.script.CRC32=297b200e 8 | nbproject/build-impl.xml.stylesheet.CRC32=5a01deb7@1.68.1.46 9 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | ParsePDM 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | file.reference.commons-lang-2.6.jar=/Users/ice/shao/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar 3 | file.reference.commons-logging-api-1.1.jar=/Users/ice/shao/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar 4 | file.reference.dom4j-1.6.1.jar=/Users/ice/shao/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar 5 | file.reference.jaxen-1.1.1.jar=/Users/ice/shao/repository/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar 6 | file.reference.log4j-1.2.16.jar=/Users/ice/shao/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar 7 | user.properties.file=/Users/ice/Library/Application Support/NetBeans/7.4/build.properties 8 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMReferenceJoin.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | public class PDMReferenceJoin { 4 | private String Id; 5 | private PDMColumn parentTable_Col; 6 | private PDMColumn childTable_Col; 7 | 8 | public String getId() { 9 | return Id; 10 | } 11 | 12 | public void setId(String id) { 13 | Id = id; 14 | } 15 | 16 | public PDMColumn getParentTable_Col() { 17 | return parentTable_Col; 18 | } 19 | 20 | public void setParentTable_Col(PDMColumn parentTable_Col) { 21 | this.parentTable_Col = parentTable_Col; 22 | } 23 | 24 | public PDMColumn getChildTable_Col() { 25 | return childTable_Col; 26 | } 27 | 28 | public void setChildTable_Col(PDMColumn childTable_Col) { 29 | this.childTable_Col = childTable_Col; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMUser.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDMUser { 6 | private String id; 7 | private String name; 8 | private String code; 9 | private ArrayList tables = new ArrayList(); 10 | 11 | public String getId() { 12 | return id; 13 | } 14 | 15 | public void setId(String id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | public String getCode() { 28 | return code; 29 | } 30 | 31 | public void setCode(String code) { 32 | this.code = code; 33 | } 34 | 35 | public ArrayList getTables() { 36 | return tables; 37 | } 38 | 39 | public void setTables(ArrayList tables) { 40 | this.tables = tables; 41 | } 42 | 43 | public void addTable(PDMTable table) { 44 | tables.add(table); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMIndex.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDMIndex { 6 | private String id; 7 | private String name; 8 | private String code; 9 | private ArrayList columns = new ArrayList(); 10 | 11 | public String getId() { 12 | return id; 13 | } 14 | 15 | public void setId(String id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | public String getCode() { 28 | return code; 29 | } 30 | 31 | public void setCode(String code) { 32 | this.code = code; 33 | } 34 | 35 | public ArrayList getColumns() { 36 | return columns; 37 | } 38 | 39 | public void setColumns(ArrayList columns) { 40 | this.columns = columns; 41 | } 42 | 43 | public void addColumn(PDMColumn column) { 44 | columns.add(column); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMPhysicalDiagram.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDMPhysicalDiagram { 6 | private String id; 7 | private String name; 8 | private String code; 9 | private ArrayList tables = new ArrayList(); 10 | 11 | public String getId() { 12 | return id; 13 | } 14 | 15 | public void setId(String id) { 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | public String getCode() { 28 | return code; 29 | } 30 | 31 | public void setCode(String code) { 32 | this.code = code; 33 | } 34 | 35 | public ArrayList getTables() { 36 | return tables; 37 | } 38 | 39 | public void setTables(ArrayList tables) { 40 | this.tables = tables; 41 | } 42 | 43 | public void addTable(PDMTable table) { 44 | tables.add(table); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMKey.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDMKey { 6 | private String id; 7 | private String name; 8 | private String code; 9 | private String constraintName; 10 | private ArrayList columns = new ArrayList(); 11 | 12 | public String getId() { 13 | return id; 14 | } 15 | 16 | public void setId(String id) { 17 | this.id = id; 18 | } 19 | 20 | public String getName() { 21 | return name; 22 | } 23 | 24 | public void setName(String name) { 25 | this.name = name; 26 | } 27 | 28 | public String getCode() { 29 | return code; 30 | } 31 | 32 | public void setCode(String code) { 33 | this.code = code; 34 | } 35 | 36 | public String getConstraintName() { 37 | return constraintName; 38 | } 39 | 40 | public void setConstraintName(String constraintName) { 41 | this.constraintName = constraintName; 42 | } 43 | 44 | public ArrayList getColumns() { 45 | return columns; 46 | } 47 | 48 | public void setColumns(ArrayList columns) { 49 | this.columns = columns; 50 | } 51 | 52 | public void addColumn(PDMColumn column) { 53 | columns.add(column); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "ParsePDM.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMColumn.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | public class PDMColumn { 4 | private String id; 5 | private String name; 6 | private String code; 7 | private String dataType; // 数据类型 8 | private int length; // 数据长度 9 | private int precision; // 精度 10 | private int mandatory = 0; // 约束 11 | private String defaultValue; // 默认值 12 | private String lowValue; 13 | private String highValue; 14 | private String comment; 15 | private PDMTable table; 16 | 17 | public String getId() { 18 | return id; 19 | } 20 | 21 | public void setId(String id) { 22 | this.id = id; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public void setName(String name) { 30 | this.name = name; 31 | } 32 | 33 | public String getCode() { 34 | return code; 35 | } 36 | 37 | public void setCode(String code) { 38 | this.code = code; 39 | } 40 | 41 | public String getDataType() { 42 | return dataType; 43 | } 44 | 45 | public void setDataType(String dataType) { 46 | this.dataType = dataType; 47 | } 48 | 49 | public int getLength() { 50 | return length; 51 | } 52 | 53 | public void setLength(int length) { 54 | this.length = length; 55 | } 56 | 57 | public int getPrecision() { 58 | return precision; 59 | } 60 | 61 | public void setPrecision(int precision) { 62 | this.precision = precision; 63 | } 64 | 65 | public int getMandatory() { 66 | return mandatory; 67 | } 68 | 69 | public void setMandatory(int mandatory) { 70 | this.mandatory = mandatory; 71 | } 72 | 73 | public String getDefaultValue() { 74 | return defaultValue; 75 | } 76 | 77 | public void setDefaultValue(String defaultValue) { 78 | this.defaultValue = defaultValue; 79 | } 80 | 81 | public String getLowValue() { 82 | return lowValue; 83 | } 84 | 85 | public void setLowValue(String lowValue) { 86 | this.lowValue = lowValue; 87 | } 88 | 89 | public String getHighValue() { 90 | return highValue; 91 | } 92 | 93 | public void setHighValue(String highValue) { 94 | this.highValue = highValue; 95 | } 96 | 97 | public String getComment() { 98 | return comment; 99 | } 100 | 101 | public void setComment(String comment) { 102 | this.comment = comment; 103 | } 104 | 105 | public PDMTable getTable() { 106 | return table; 107 | } 108 | 109 | public void setTable(PDMTable table) { 110 | this.table = table; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMReference.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDMReference { 6 | private String id; 7 | private String name; 8 | private String code; 9 | private String constraintName; 10 | private PDMTable parentTable; 11 | // private String parentKey; 12 | private PDMTable childTable; 13 | private int updateConstraint = 1; 14 | private int deleteConstraint = 1; 15 | private String implementationType; 16 | private ArrayList joins = new ArrayList(); 17 | 18 | public String getId() { 19 | return id; 20 | } 21 | 22 | public void setId(String id) { 23 | this.id = id; 24 | } 25 | 26 | public String getName() { 27 | return name; 28 | } 29 | 30 | public void setName(String name) { 31 | this.name = name; 32 | } 33 | 34 | public String getCode() { 35 | return code; 36 | } 37 | 38 | public void setCode(String code) { 39 | this.code = code; 40 | } 41 | 42 | public String getConstraintName() { 43 | return constraintName; 44 | } 45 | 46 | public void setConstraintName(String constraintName) { 47 | this.constraintName = constraintName; 48 | } 49 | 50 | public PDMTable getParentTable() { 51 | return parentTable; 52 | } 53 | 54 | public void setParentTable(PDMTable parentTable) { 55 | this.parentTable = parentTable; 56 | } 57 | 58 | public PDMTable getChildTable() { 59 | return childTable; 60 | } 61 | 62 | public void setChildTable(PDMTable childTable) { 63 | this.childTable = childTable; 64 | } 65 | 66 | public int getUpdateConstraint() { 67 | return updateConstraint; 68 | } 69 | 70 | public void setUpdateConstraint(int updateConstraint) { 71 | this.updateConstraint = updateConstraint; 72 | } 73 | 74 | public int getDeleteConstraint() { 75 | return deleteConstraint; 76 | } 77 | 78 | public void setDeleteConstraint(int deleteConstraint) { 79 | this.deleteConstraint = deleteConstraint; 80 | } 81 | 82 | public String getImplementationType() { 83 | return implementationType; 84 | } 85 | 86 | public void setImplementationType(String implementationType) { 87 | this.implementationType = implementationType; 88 | } 89 | 90 | public ArrayList getJoins() { 91 | return joins; 92 | } 93 | 94 | public void setJoins(ArrayList joins) { 95 | this.joins = joins; 96 | } 97 | 98 | public void addReferenceJoin(PDMReferenceJoin pdmReferenceJoin) { 99 | joins.add(pdmReferenceJoin); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDMTable.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDMTable { 6 | public String id; 7 | private String name; 8 | private String code; 9 | private PDMUser user; 10 | private ArrayList columns = new ArrayList(); 11 | private ArrayList keys = new ArrayList(); 12 | private PDMKey primaryKey; 13 | private ArrayList indexs = new ArrayList(); 14 | 15 | public String getId() { 16 | return id; 17 | } 18 | 19 | public void setId(String id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name; 29 | } 30 | 31 | public String getCode() { 32 | return code; 33 | } 34 | 35 | public void setCode(String code) { 36 | this.code = code; 37 | } 38 | 39 | public PDMUser getUser() { 40 | return user; 41 | } 42 | 43 | public void setUser(PDMUser user) { 44 | user.addTable(this); 45 | this.user = user; 46 | } 47 | 48 | public ArrayList getColumns() { 49 | return columns; 50 | } 51 | 52 | public void setColumns(ArrayList columns) { 53 | this.columns = columns; 54 | for (PDMColumn column : columns) { 55 | column.setTable(this); 56 | } 57 | } 58 | 59 | public ArrayList getKeys() { 60 | return keys; 61 | } 62 | 63 | public void setKeys(ArrayList keys) { 64 | this.keys = keys; 65 | } 66 | 67 | public PDMKey getPrimaryKey() { 68 | return primaryKey; 69 | } 70 | 71 | public void setPrimaryKey(PDMKey primaryKey) { 72 | this.primaryKey = primaryKey; 73 | } 74 | 75 | public ArrayList getIndexs() { 76 | return indexs; 77 | } 78 | 79 | public void setIndexs(ArrayList indexs) { 80 | this.indexs = indexs; 81 | } 82 | 83 | public void addColumn(PDMColumn column) { 84 | columns.add(column); 85 | column.setTable(this); 86 | } 87 | 88 | public void addKey(PDMKey key) { 89 | keys.add(key); 90 | } 91 | 92 | public void addIndex(PDMIndex index) { 93 | indexs.add(index); 94 | } 95 | 96 | public PDMColumn getPDMColumn(String id) throws Exception { 97 | for (PDMColumn column : columns) { 98 | if (id.equals(column.getId())) { 99 | return column; 100 | } 101 | } 102 | throw new Exception("Id编号" + id + "没有找到"); 103 | } 104 | 105 | public PDMKey getPDMKey(String id) throws Exception { 106 | for (PDMKey key : keys) { 107 | if (id.equals(key.getId())) { 108 | return key; 109 | } 110 | } 111 | throw new Exception("Id编号" + id + "没有找到"); 112 | } 113 | 114 | @Override 115 | public String toString() { 116 | return this.name + "(" + this.code + ")"; 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/com/smshen/utils/PDM.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | 5 | public class PDM { 6 | private String id; 7 | private String name; 8 | private String code; 9 | private String dBMSCode; 10 | private String dBMSName; 11 | private ArrayList physicalDiagrams = new ArrayList(); 12 | private ArrayList users = new ArrayList(); 13 | private ArrayList tables = new ArrayList(); 14 | private ArrayList references = new ArrayList(); 15 | 16 | public String getId() { 17 | return id; 18 | } 19 | 20 | public void setId(String id) { 21 | this.id = id; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public void setName(String name) { 29 | this.name = name; 30 | } 31 | 32 | public String getCode() { 33 | return code; 34 | } 35 | 36 | public void setCode(String code) { 37 | this.code = code; 38 | } 39 | 40 | public String getDBMSCode() { 41 | return dBMSCode; 42 | } 43 | 44 | public void setDBMSCode(String code) { 45 | dBMSCode = code; 46 | } 47 | 48 | public String getDBMSName() { 49 | return dBMSName; 50 | } 51 | 52 | public void setDBMSName(String name) { 53 | dBMSName = name; 54 | } 55 | 56 | public ArrayList getPhysicalDiagrams() { 57 | return physicalDiagrams; 58 | } 59 | 60 | public void setPhysicalDiagrams( 61 | ArrayList physicalDiagrams) { 62 | this.physicalDiagrams = physicalDiagrams; 63 | } 64 | 65 | public ArrayList getUsers() { 66 | return users; 67 | } 68 | 69 | public void setUsers(ArrayList users) { 70 | this.users = users; 71 | } 72 | 73 | public ArrayList getTables() { 74 | return tables; 75 | } 76 | 77 | public void setTables(ArrayList tables) { 78 | this.tables = tables; 79 | } 80 | 81 | public ArrayList getReferences() { 82 | return references; 83 | } 84 | 85 | public void setReferences(ArrayList references) { 86 | this.references = references; 87 | } 88 | 89 | public PDMUser getPDMUser(String id) throws Exception { 90 | for (PDMUser user : users) { 91 | if (id.equals(user.getId())) { 92 | return user; 93 | } 94 | } 95 | throw new Exception("Id编号" + id + ",USER没有找到"); 96 | } 97 | 98 | public PDMTable getPDMTable(String id) throws Exception { 99 | for (PDMTable table : tables) { 100 | if (id.equals(table.getId())) { 101 | return table; 102 | } 103 | } 104 | throw new Exception("Id编号" + id + ",TABLE没有找到"); 105 | } 106 | 107 | public PDMReference getPDMReference(String id) throws Exception { 108 | for (PDMReference reference : references) { 109 | if (id.equals(reference.getId())) { 110 | return reference; 111 | } 112 | } 113 | throw new Exception("Id编号" + id + ",REFERENCE没有找到"); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # build.classes.dir \u4e2d\u5e94\u4ece\u5206\u53d1 jar \u4e2d\u6392\u9664\u7684\u6587\u4ef6 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/ParsePDM.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | file.reference.commons-lang-2.6.jar=/Users/ice/shao/workspace/ParsePDM/lib/commons-lang-2.6.jar 31 | file.reference.commons-logging-api-1.1.jar=/Users/ice/shao/workspace/ParsePDM/lib/commons-logging-api-1.1.jar 32 | file.reference.dom4j-1.6.1.jar=/Users/ice/shao/workspace/ParsePDM/lib/dom4j-1.6.1.jar 33 | file.reference.jaxen-1.1.1.jar=/Users/ice/shao/workspace/ParsePDM/lib/jaxen-1.1.1.jar 34 | file.reference.log4j-1.2.16.jar=/Users/ice/shao/workspace/ParsePDM/lib/log4j-1.2.16.jar 35 | includes=** 36 | jar.compress=false 37 | javac.classpath=\ 38 | ${file.reference.commons-lang-2.6.jar}:\ 39 | ${file.reference.commons-logging-api-1.1.jar}:\ 40 | ${file.reference.dom4j-1.6.1.jar}:\ 41 | ${file.reference.jaxen-1.1.1.jar}:\ 42 | ${file.reference.log4j-1.2.16.jar} 43 | # Space-separated list of extra javac options 44 | javac.compilerargs= 45 | javac.deprecation=false 46 | javac.processorpath=\ 47 | ${javac.classpath} 48 | javac.source=1.7 49 | javac.target=1.7 50 | javac.test.classpath=\ 51 | ${javac.classpath}:\ 52 | ${build.classes.dir} 53 | javac.test.processorpath=\ 54 | ${javac.test.classpath} 55 | javadoc.additionalparam= 56 | javadoc.author=false 57 | javadoc.encoding=${source.encoding} 58 | javadoc.noindex=false 59 | javadoc.nonavbar=false 60 | javadoc.notree=false 61 | javadoc.private=false 62 | javadoc.splitindex=true 63 | javadoc.use=true 64 | javadoc.version=false 65 | javadoc.windowtitle= 66 | main.class=com.smshen.ContactEditorUI 67 | manifest.file=manifest.mf 68 | meta.inf.dir=${src.dir}/META-INF 69 | mkdist.disabled=false 70 | platform.active=default_platform 71 | run.classpath=\ 72 | ${javac.classpath}:\ 73 | ${build.classes.dir} 74 | # Space-separated list of JVM arguments used when running the project. 75 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 76 | # To set system properties for unit tests define test-sys-prop.name=value: 77 | run.jvmargs= 78 | run.test.classpath=\ 79 | ${javac.test.classpath}:\ 80 | ${build.test.classes.dir} 81 | source.encoding=UTF-8 82 | src.dir=src 83 | test.src.dir=test 84 | -------------------------------------------------------------------------------- /src/com/smshen/ContactEditorUI.form: -------------------------------------------------------------------------------- 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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /nbproject/private/profiler/configurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1000 5 | false 6 | profiler.simple.filter 7 | false 8 | 9 | 64 10 | true 11 | 12 | 10 13 | false 14 | true 15 | 0 16 | false 17 | true 18 | 1 19 | false 20 | false 21 | false 22 | profiler.simple.filter 23 | 32 24 | false 25 | 1 26 | true 27 | 1 28 | 10 29 | 1 30 | true 31 | 分析内存 32 | false 33 | 10 34 | 1 35 | true 36 | 10 37 | 0 38 | profiler.simple.filter 39 | 0 40 | false 41 | true 42 | 43 | 1 44 | 45 | true 46 | 47 | 48 | false 49 | 10 50 | false 51 | true 52 | false 53 | false 54 | 32 55 | 快速过滤器... 56 | false 57 | 0 58 | false 59 | 0 60 | 61 | 10 62 | 0 63 | true 64 | true 65 | 66 | true 67 | 10 68 | 69 | 1000 70 | 0 71 | profiler.simple.filter 72 | false 73 | 分析性能 74 | 1 75 | 76 | 2 77 | 78 | false 79 | 0 80 | profiler.simple.filter 81 | 快速过滤器... 82 | false 83 | true 84 | 0 85 | true 86 | 87 | 2 88 | 89 | 32 90 | false 91 | 0 92 | false 93 | 只分析项目类 94 | 0 95 | 0 96 | true 97 | profiler.simple.filter 98 | 1 99 | false 100 | 10 101 | 10 102 | false 103 | false 104 | true 105 | false 106 | false 107 | 0 108 | 快速过滤器... 109 | false 110 | 111 | 监视应用程序 112 | 128 113 | 1000 114 | true 115 | true 116 | 117 | -------------------------------------------------------------------------------- /src/com/smshen/ContactEditorUI.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | 7 | package com.smshen; 8 | 9 | import com.smshen.utils.PDM; 10 | import com.smshen.utils.PDMColumn; 11 | import com.smshen.utils.PDMTable; 12 | import com.smshen.utils.Parser; 13 | import java.awt.Frame; 14 | import java.io.File; 15 | import java.util.ArrayList; 16 | import javax.swing.JFileChooser; 17 | import javax.swing.event.TreeSelectionEvent; 18 | import javax.swing.event.TreeSelectionListener; 19 | import javax.swing.table.DefaultTableModel; 20 | import javax.swing.table.TableModel; 21 | import javax.swing.tree.DefaultMutableTreeNode; 22 | import javax.swing.tree.DefaultTreeModel; 23 | 24 | /** 25 | * 26 | * @author ice 27 | */ 28 | public class ContactEditorUI extends javax.swing.JFrame { 29 | 30 | /** 31 | * Creates new form ContactEditorUI 32 | */ 33 | public ContactEditorUI() { 34 | initComponents(); 35 | } 36 | 37 | /** 38 | * This method is called from within the constructor to initialize the form. 39 | * WARNING: Do NOT modify this code. The content of this method is always 40 | * regenerated by the Form Editor. 41 | */ 42 | @SuppressWarnings("unchecked") 43 | // //GEN-BEGIN:initComponents 44 | private void initComponents() { 45 | 46 | jScrollPane2 = new javax.swing.JScrollPane(); 47 | jTree1 = new javax.swing.JTree(); 48 | jScrollPane3 = new javax.swing.JScrollPane(); 49 | jTable1 = new javax.swing.JTable(); 50 | jMenuBar1 = new javax.swing.JMenuBar(); 51 | jMenu3 = new javax.swing.JMenu(); 52 | jMenuItem1 = new javax.swing.JMenuItem(); 53 | jMenuItem2 = new javax.swing.JMenuItem(); 54 | jMenu2 = new javax.swing.JMenu(); 55 | 56 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 57 | setExtendedState(6); 58 | 59 | jScrollPane2.setViewportView(jTree1); 60 | 61 | jTable1.setModel(new javax.swing.table.DefaultTableModel( 62 | new Object [][] { 63 | 64 | }, 65 | new String [] { 66 | 67 | } 68 | )); 69 | jScrollPane3.setViewportView(jTable1); 70 | 71 | jMenu3.setText("文件"); 72 | 73 | jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK)); 74 | jMenuItem1.setText("打开"); 75 | jMenuItem1.addActionListener(new java.awt.event.ActionListener() { 76 | public void actionPerformed(java.awt.event.ActionEvent evt) { 77 | jMenuItem1ActionPerformed(evt); 78 | } 79 | }); 80 | jMenu3.add(jMenuItem1); 81 | 82 | jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.CTRL_MASK)); 83 | jMenuItem2.setText("退出"); 84 | jMenuItem2.addActionListener(new java.awt.event.ActionListener() { 85 | public void actionPerformed(java.awt.event.ActionEvent evt) { 86 | jMenuItem2ActionPerformed(evt); 87 | } 88 | }); 89 | jMenu3.add(jMenuItem2); 90 | 91 | jMenuBar1.add(jMenu3); 92 | 93 | jMenu2.setText("关于"); 94 | jMenuBar1.add(jMenu2); 95 | 96 | setJMenuBar(jMenuBar1); 97 | 98 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 99 | getContentPane().setLayout(layout); 100 | layout.setHorizontalGroup( 101 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 102 | .addGroup(layout.createSequentialGroup() 103 | .addContainerGap() 104 | .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) 105 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 106 | .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE) 107 | .addContainerGap()) 108 | ); 109 | layout.setVerticalGroup( 110 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 111 | .addComponent(jScrollPane2) 112 | .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE) 113 | ); 114 | 115 | pack(); 116 | }// //GEN-END:initComponents 117 | 118 | private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed 119 | // TODO add your handling code here: 120 | JFileChooser jfc = new JFileChooser(); 121 | jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); 122 | 123 | File file = null; 124 | if (JFileChooser.APPROVE_OPTION== jfc.showOpenDialog(this)) { 125 | file = jfc.getSelectedFile(); 126 | try { 127 | PDM p = new Parser().pdmParser(file.getPath()); 128 | DefaultMutableTreeNode top = new DefaultMutableTreeNode("表"); 129 | 130 | 131 | for (PDMTable t : p.getTables()) { 132 | System.out.println("table-->" + t.getName() + ", code-->" + t.getCode()); 133 | DefaultMutableTreeNode child = new DefaultMutableTreeNode(t); 134 | top.add(child); 135 | } 136 | jTree1.setModel(new DefaultTreeModel(top)); 137 | jTree1.addTreeSelectionListener(new TreeSelectionListener() { 138 | @Override 139 | public void valueChanged(TreeSelectionEvent e) { 140 | DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1 141 | .getLastSelectedPathComponent(); 142 | 143 | if (node == null) 144 | return; 145 | 146 | Object object = node.getUserObject(); 147 | if (node.isLeaf()) { 148 | PDMTable pdmt = (PDMTable) object; 149 | ArrayList cols = pdmt.getColumns(); 150 | String[] columnNames = {"名称", "CODE", "数据类型", "备注"}; 151 | cols.trimToSize(); 152 | Object[][] data = new Object[cols.size()][columnNames.length]; 153 | 154 | int i = 0; 155 | for (PDMColumn col : cols) { 156 | data[i][0] = col.getName(); 157 | data[i][1] = col.getCode(); 158 | data[i][2] = col.getDataType(); 159 | data[i][3] = col.getComment(); 160 | i++; 161 | } 162 | int s = Frame.MAXIMIZED_BOTH; 163 | TableModel dataMode = new DefaultTableModel(data, columnNames); 164 | jTable1.setModel(dataMode); 165 | }} 166 | }); 167 | } catch (Exception e) { 168 | e.printStackTrace(); 169 | } 170 | } 171 | }//GEN-LAST:event_jMenuItem1ActionPerformed 172 | 173 | private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed 174 | // TODO add your handling code here: 175 | System.exit(0); 176 | }//GEN-LAST:event_jMenuItem2ActionPerformed 177 | 178 | /** 179 | * @param args the command line arguments 180 | */ 181 | public static void main(String args[]) { 182 | /* Set the Nimbus look and feel */ 183 | // 184 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 185 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 186 | */ 187 | try { 188 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 189 | if ("Nimbus".equals(info.getName())) { 190 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 191 | break; 192 | } 193 | } 194 | } catch (ClassNotFoundException ex) { 195 | java.util.logging.Logger.getLogger(ContactEditorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 196 | } catch (InstantiationException ex) { 197 | java.util.logging.Logger.getLogger(ContactEditorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 198 | } catch (IllegalAccessException ex) { 199 | java.util.logging.Logger.getLogger(ContactEditorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 200 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { 201 | java.util.logging.Logger.getLogger(ContactEditorUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 202 | } 203 | // 204 | 205 | /* Create and display the form */ 206 | java.awt.EventQueue.invokeLater(new Runnable() { 207 | public void run() { 208 | new ContactEditorUI().setVisible(true); 209 | } 210 | }); 211 | } 212 | 213 | // Variables declaration - do not modify//GEN-BEGIN:variables 214 | private javax.swing.JMenu jMenu2; 215 | private javax.swing.JMenu jMenu3; 216 | private javax.swing.JMenuBar jMenuBar1; 217 | private javax.swing.JMenuItem jMenuItem1; 218 | private javax.swing.JMenuItem jMenuItem2; 219 | private javax.swing.JScrollPane jScrollPane2; 220 | private javax.swing.JScrollPane jScrollPane3; 221 | private javax.swing.JTable jTable1; 222 | private javax.swing.JTree jTree1; 223 | // End of variables declaration//GEN-END:variables 224 | } 225 | -------------------------------------------------------------------------------- /src/com/smshen/utils/Parser.java: -------------------------------------------------------------------------------- 1 | package com.smshen.utils; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.apache.log4j.Logger; 7 | import org.dom4j.Document; 8 | import org.dom4j.Element; 9 | import org.dom4j.Node; 10 | import org.dom4j.io.SAXReader; 11 | 12 | public class Parser { 13 | 14 | private PDM pdm = new PDM(); 15 | private final static Logger LOGGER = Logger.getLogger(Parser.class.getName()); 16 | 17 | public PDM pdmParser(String pdmFileName) throws Exception { 18 | SAXReader reader = new SAXReader(); 19 | Document doc = reader.read(pdmFileName); 20 | 21 | Node model = doc.selectSingleNode("//c:Children/o:Model"); 22 | 23 | pdm.setId(((Element) model).attributeValue("Id")); 24 | pdm.setName(model.selectSingleNode("a:Name").getText()); 25 | pdm.setCode(model.selectSingleNode("a:Code").getText()); 26 | 27 | Node dbms = model.selectSingleNode("//o:Shortcut"); 28 | pdm.setDBMSCode(dbms.selectSingleNode("a:Code").getText()); 29 | pdm.setDBMSName(dbms.selectSingleNode("a:Name").getText()); 30 | 31 | LOGGER.info("解析PDM为:" + pdm.getCode() + "(" + pdm.getName() + ") DBMS为:" + pdm.getDBMSCode() + "(" + pdm.getDBMSName() + ")"); 32 | 33 | pdm.setUsers(pdmUserParser(model)); 34 | pdm.setTables(pdmTableParser(model)); 35 | pdm.setPhysicalDiagrams(pdmPhysicalDiagramParser(model)); 36 | pdm.setReferences(pdmReferenceParser(model)); 37 | 38 | return pdm; 39 | } 40 | 41 | public ArrayList pdmPhysicalDiagramParser(Node node) throws Exception { 42 | ArrayList physicalList = new ArrayList(); 43 | for (Object o : node.selectNodes("c:PhysicalDiagrams/o:PhysicalDiagram")) { 44 | Node physicalNode = (Node) o; 45 | PDMPhysicalDiagram pdmPhysical = new PDMPhysicalDiagram(); 46 | pdmPhysical.setId(((Element) physicalNode).attributeValue("Id")); 47 | pdmPhysical.setName(physicalNode.selectSingleNode("a:Name").getText()); 48 | pdmPhysical.setCode(physicalNode.selectSingleNode("a:Code").getText()); 49 | // 添加Table 50 | for (Object table : physicalNode.selectNodes("c:Symbols/o:TableSymbol/c:Object/o:Table")) { 51 | String id = ((Element) table).attributeValue("Ref"); 52 | pdmPhysical.addTable(pdm.getPDMTable(id)); 53 | } 54 | physicalList.add(pdmPhysical); 55 | } 56 | return physicalList; 57 | } 58 | 59 | public ArrayList pdmTableParser(Node node) throws Exception { 60 | ArrayList tableList = new ArrayList(); 61 | ArrayList l = new ArrayList(); 62 | List ll = node.selectNodes("c:Packages/o:Package/c:Tables/o:Table"); 63 | if (!ll.isEmpty()) { 64 | l.addAll((ArrayList) node.selectNodes("c:Packages/o:Package/c:Tables/o:Table")); 65 | } 66 | List lll = node.selectNodes("c:Tables/o:Table"); 67 | if (!lll.isEmpty()) { 68 | l.addAll(node.selectNodes("c:Tables/o:Table")); 69 | } 70 | 71 | // List l = node.selectNodes("c:Packages/o:Package/c:Tables/o:Table"); 72 | for (Object o : l) { 73 | Node tableNode = (Node) o; 74 | PDMTable pdmTable = new PDMTable(); 75 | pdmTable.setId(((Element) tableNode).attributeValue("Id")); 76 | pdmTable.setName(tableNode.selectSingleNode("a:Name").getText()); 77 | pdmTable.setCode(tableNode.selectSingleNode("a:Code").getText()); 78 | // 添加Columns 79 | pdmTable.setColumns(pdmColumnParser(tableNode)); 80 | // 添加key 81 | for (Object key : tableNode.selectNodes("c:Keys/o:Key")) { 82 | Node keyNode = (Node) key; 83 | PDMKey pdmKey = new PDMKey(); 84 | pdmKey.setId(((Element) keyNode).attributeValue("Id")); 85 | pdmKey.setName(keyNode.selectSingleNode("a:Name").getText()); 86 | pdmKey.setCode(keyNode.selectSingleNode("a:Code").getText()); 87 | for (Object column : keyNode.selectNodes("c:Key.Columns/o:Column")) { 88 | String id = ((Element) column).attributeValue("Ref"); 89 | pdmKey.addColumn(pdmTable.getPDMColumn(id)); 90 | } 91 | pdmTable.addKey(pdmKey); 92 | } 93 | // 添加PrimaryKey 94 | if (null != tableNode.selectSingleNode("c:PrimaryKey/o:Key")) { 95 | String keyId = ((Element) tableNode.selectSingleNode("c:PrimaryKey/o:Key")).attributeValue("Ref"); 96 | pdmTable.setPrimaryKey(pdmTable.getPDMKey(keyId)); 97 | } 98 | 99 | // 添加Indexes 100 | for (Object index : tableNode.selectNodes("c:Indexes/o:Index")) { 101 | Node indexNode = (Node) index; 102 | PDMIndex pdmIndex = new PDMIndex(); 103 | pdmIndex.setId(((Element) indexNode).attributeValue("Id")); 104 | pdmIndex.setName(indexNode.selectSingleNode("a:Name").getText()); 105 | pdmIndex.setCode(indexNode.selectSingleNode("a:Code").getText()); 106 | /* 107 | for (Object column : indexNode.selectNodes("//c:Column/o:Column")) { 108 | String id = ((Element) column).attributeValue("Ref"); 109 | pdmIndex.addColumn(pdmTable.getPDMColumn(id)); 110 | } 111 | */ 112 | pdmTable.addIndex(pdmIndex); 113 | } 114 | // 添加User 115 | Element userElement = (Element) tableNode.selectSingleNode("c:Owner/o:User"); 116 | if (userElement != null) { 117 | String userId = userElement.attributeValue("Ref"); 118 | pdmTable.setUser(pdm.getPDMUser(userId)); 119 | } 120 | 121 | tableList.add(pdmTable); 122 | } 123 | return tableList; 124 | } 125 | 126 | public ArrayList pdmColumnParser(Node node) { 127 | ArrayList columnList = new ArrayList(); 128 | 129 | try { 130 | for (Object o : node.selectNodes("c:Columns/o:Column")) { 131 | Node columnNode = (Node) o; 132 | if (columnNode == null) { 133 | break; 134 | } 135 | PDMColumn pdmColumn = new PDMColumn(); 136 | pdmColumn.setId(((Element) columnNode).attributeValue("Id")); 137 | pdmColumn.setName(columnNode.selectSingleNode("a:Name") == null ? "" : columnNode.selectSingleNode("a:Name").getText()); 138 | pdmColumn.setCode(columnNode.selectSingleNode("a:Code") == null ? "" : columnNode.selectSingleNode("a:Code").getText()); 139 | pdmColumn.setDataType(columnNode.selectSingleNode("a:DataType") == null ? "" : columnNode.selectSingleNode("a:DataType").getText()); 140 | pdmColumn.setLength(selectSingleNodeIntText(columnNode, "a:Length")); 141 | pdmColumn.setPrecision(selectSingleNodeIntText(columnNode, "a:Precision")); 142 | pdmColumn.setMandatory(selectSingleNodeIntText(columnNode, "a:Mandatory")); 143 | pdmColumn.setDefaultValue(selectSingleNodeStringText(columnNode, "a:DefaultValue")); 144 | pdmColumn.setLowValue(selectSingleNodeStringText(columnNode, "a:LowValue")); 145 | pdmColumn.setHighValue(selectSingleNodeStringText(columnNode, "a:HighValue")); 146 | pdmColumn.setComment(selectSingleNodeStringText(columnNode, "a:Comment")); 147 | columnList.add(pdmColumn); 148 | } 149 | } catch (Exception e) { 150 | e.printStackTrace(); 151 | System.out.println("error:" + e.getMessage()); 152 | } 153 | 154 | return columnList; 155 | } 156 | 157 | public ArrayList pdmUserParser(Node node) { 158 | ArrayList userList = new ArrayList(); 159 | for (Object o : node.selectNodes("c:Users/o:User")) { 160 | Node userNode = (Node) o; 161 | PDMUser pdmUser = new PDMUser(); 162 | pdmUser.setId(((Element) userNode).attributeValue("Id")); 163 | pdmUser.setName(userNode.selectSingleNode("a:Name").getText()); 164 | pdmUser.setCode(userNode.selectSingleNode("a:Code").getText()); 165 | 166 | userList.add(pdmUser); 167 | } 168 | return userList; 169 | } 170 | 171 | public ArrayList pdmReferenceParser(Node node) throws Exception { 172 | ArrayList referenceList = new ArrayList(); 173 | for (Object reference : node.selectNodes("c:References/o:Reference")) { 174 | Node referenceNode = (Node) reference; 175 | PDMReference pdmReference = new PDMReference(); 176 | pdmReference.setId(((Element) referenceNode).attributeValue("Id")); 177 | pdmReference.setName(referenceNode.selectSingleNode("a:Name").getText()); 178 | pdmReference.setCode(referenceNode.selectSingleNode("a:Code").getText()); 179 | pdmReference.setConstraintName(selectSingleNodeStringText(referenceNode, "ForeignKeyConstraintName")); 180 | pdmReference.setUpdateConstraint(selectSingleNodeIntText(referenceNode, "UpdateConstraint")); 181 | pdmReference.setDeleteConstraint(selectSingleNodeIntText(referenceNode, "DeleteConstraint")); 182 | pdmReference.setImplementationType(selectSingleNodeStringText(referenceNode, "ImplementationType")); 183 | // 添加ParentTable 184 | String parentTableId = ((Element) referenceNode.selectSingleNode("c:ParentTable/o:Table")).attributeValue("Ref"); 185 | pdmReference.setParentTable(pdm.getPDMTable(parentTableId)); 186 | // 添加ChildTable 187 | String childTableId = ((Element) referenceNode.selectSingleNode("c:ChildTable/o:Table")).attributeValue("Ref"); 188 | pdmReference.setChildTable(pdm.getPDMTable(childTableId)); 189 | // 添加Joins 190 | for (Object jion : referenceNode.selectNodes("c:Joins/o:ReferenceJoin")) { 191 | Node referenceJoinNode = (Node) jion; 192 | PDMReferenceJoin pdmReferenceJoin = new PDMReferenceJoin(); 193 | pdmReferenceJoin.setId(((Element) referenceJoinNode).attributeValue("Id")); 194 | 195 | String id = ((Element) referenceJoinNode.selectSingleNode("c:Object1/o:Column")).attributeValue("Ref"); 196 | pdmReferenceJoin.setParentTable_Col(pdmReference.getParentTable().getPDMColumn(id)); 197 | 198 | id = ((Element) referenceJoinNode.selectSingleNode("c:Object2/o:Column")).attributeValue("Ref"); 199 | pdmReferenceJoin.setChildTable_Col(pdmReference.getChildTable().getPDMColumn(id)); 200 | 201 | pdmReference.addReferenceJoin(pdmReferenceJoin); 202 | } 203 | 204 | referenceList.add(pdmReference); 205 | } 206 | return referenceList; 207 | } 208 | 209 | private String selectSingleNodeStringText(Node parentNode, String childNodeName) { 210 | Node childNode = parentNode.selectSingleNode(childNodeName); 211 | if (childNode != null) { 212 | return childNode.getText(); 213 | } else { 214 | return null; 215 | } 216 | } 217 | 218 | private int selectSingleNodeIntText(Node parentNode, String childNodeName) { 219 | Node childNode = parentNode.selectSingleNode(childNodeName); 220 | if (childNode != null) { 221 | return Integer.parseInt(childNode.getText()); 222 | } else { 223 | return 0; 224 | } 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /nbproject/build-impl.xml: -------------------------------------------------------------------------------- 1 | 2 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | Must set src.dir 224 | Must set test.src.dir 225 | Must set build.dir 226 | Must set dist.dir 227 | Must set build.classes.dir 228 | Must set dist.javadoc.dir 229 | Must set build.test.classes.dir 230 | Must set build.test.results.dir 231 | Must set build.classes.excludes 232 | Must set dist.jar 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | Must set javac.includes 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | No tests executed. 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | Must set JVM to use for profiling in profiler.info.jvm 713 | Must set profiler agent JVM arguments in profiler.info.jvmargs.agent 714 | 715 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | Must select some files in the IDE or set javac.includes 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | To run this application from the command line without Ant, try: 992 | 993 | java -jar "${dist.jar.resolved}" 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | Must select one file in the IDE or set run.class 1041 | 1042 | 1043 | 1044 | Must select one file in the IDE or set run.class 1045 | 1046 | 1047 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | Must select one file in the IDE or set debug.class 1072 | 1073 | 1074 | 1075 | 1076 | Must select one file in the IDE or set debug.class 1077 | 1078 | 1079 | 1080 | 1081 | Must set fix.includes 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1093 | 1096 | 1097 | This target only works when run from inside the NetBeans IDE. 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | Must select one file in the IDE or set profile.class 1107 | This target only works when run from inside the NetBeans IDE. 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | This target only works when run from inside the NetBeans IDE. 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | This target only works when run from inside the NetBeans IDE. 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | Must select one file in the IDE or set run.class 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | Must select some files in the IDE or set test.includes 1174 | 1175 | 1176 | 1177 | 1178 | Must select one file in the IDE or set run.class 1179 | 1180 | 1181 | 1182 | 1183 | Must select one file in the IDE or set applet.url 1184 | 1185 | 1186 | 1187 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | Must select some files in the IDE or set javac.includes 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | Some tests failed; see details above. 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | Must select some files in the IDE or set test.includes 1293 | 1294 | 1295 | 1296 | Some tests failed; see details above. 1297 | 1298 | 1299 | 1300 | Must select some files in the IDE or set test.class 1301 | Must select some method in the IDE or set test.method 1302 | 1303 | 1304 | 1305 | Some tests failed; see details above. 1306 | 1307 | 1308 | 1313 | 1314 | Must select one file in the IDE or set test.class 1315 | 1316 | 1317 | 1318 | Must select one file in the IDE or set test.class 1319 | Must select some method in the IDE or set test.method 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1336 | 1337 | Must select one file in the IDE or set applet.url 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1349 | 1350 | Must select one file in the IDE or set applet.url 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | 1386 | 1387 | 1388 | 1389 | 1390 | 1391 | 1392 | 1393 | 1394 | 1395 | 1396 | 1397 | 1398 | 1399 | 1400 | 1401 | 1402 | 1403 | 1404 | 1405 | 1406 | 1407 | 1408 | --------------------------------------------------------------------------------