1 17 18 package com.finalist.jag.uml; 19 20 21 import com.finalist.jaggenerator.modules.*; 22 import com.finalist.jaggenerator.*; 23 import com.finalist.uml14.simpleuml.*; 24 import org.apache.commons.logging.Log; 25 import org.apache.commons.logging.LogFactory; 26 27 import javax.xml.parsers.DocumentBuilderFactory ; 28 import javax.xml.parsers.DocumentBuilder ; 29 import javax.swing.*; 30 import java.io.*; 31 import java.util.*; 32 import java.net.URL ; 33 import java.net.MalformedURLException ; 34 import org.w3c.dom.Document ; 35 36 43 public class UML2JagGenerator { 44 private ConsoleLogger logger; 45 private static SimpleModel model; 46 static Log log = LogFactory.getLog(UML2JagGenerator.class); 47 48 private static final String DEFAULT_SQL_TYPE = "VARCHAR(255)"; private static final String CHARACTER_PRIMITIVE = "char"; 50 private static final String CHARACTER_CLASS = "java.lang.Character"; 51 private static final String JAVA_LANG_PACKAGE_PREFIX = "java.lang."; 52 private static final char DOT = '.'; 53 private static final String EMPTY_STRING = ""; 54 private static final String INTEGER_PRIMITIVE = "int"; 55 private static final String INTEGER_CLASS = "java.lang.Integer"; 56 private static final String DEFAULT_JDBC_TYPE = "VARCHAR"; 57 private static final String NUMBER_SQL_TYPE = "NUMBER"; 58 private static final String TIMESTAMP_SQL_TYPE = "DATE"; 59 private static final String BIGINT_JDBC_TYPE = "BIGINT"; 60 61 66 public UML2JagGenerator(ConsoleLogger logger) { 67 this.logger = logger; 68 model = new SimpleModel(); 69 } 70 71 74 public UML2JagGenerator() { 75 model = new SimpleModel(); 76 } 77 78 79 86 public synchronized File generateXML(String xmiFileName, String outputDir) { 87 URL url = null; 88 try { 89 url = new URL ("FILE", EMPTY_STRING, xmiFileName); 90 } catch (MalformedURLException e) { 91 e.printStackTrace(); 92 } 93 94 model.readModel(url); 95 96 try { 97 checkInterruptStatus(); 98 return generateXML(model, outputDir); 99 100 } catch (InterruptedException e) { 101 e.printStackTrace(); 102 } 103 104 return null; 105 } 106 107 private File generateXML(SimpleModel model, String outputDir) throws InterruptedException { 108 File file = null; 109 Root root = generateConfig(model); 110 checkInterruptStatus(); 111 112 try { 113 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 114 DocumentBuilder builder = dbf.newDocumentBuilder(); 115 Document doc = builder.newDocument(); 116 org.w3c.dom.Element skelet = doc.createElement("skelet"); 117 doc.appendChild(skelet); 118 root.getXML(skelet); 119 String XMLDoc = com.finalist.jaggenerator.JagGenerator.outXML(doc); 120 log.debug("The generated xml project file is: "); 121 log.debug(XMLDoc); 122 file = new File(outputDir, model.getName() + ".xml"); 123 checkInterruptStatus(); 124 125 OutputStream outputStream = new FileOutputStream(file); 126 outputStream.write(XMLDoc.getBytes()); 127 outputStream.flush(); 128 outputStream.close(); 129 130 } catch (Exception e) { 131 e.printStackTrace(); 132 log("Error writing the file."); 133 } 134 135 return file; 136 } 137 138 144 private Root generateConfig(SimpleModel model) throws InterruptedException { 145 Root root = new Root(); 146 createDataSource(model, root.datasource); 147 createConfig(model, root.config, root.app, root.paths); 148 checkInterruptStatus(); 149 150 HashMap sessionEJBMap = createSessionEJBs(model); 152 if (sessionEJBMap != null && sessionEJBMap.size() > 0) { 153 root.setSessionEjbs(new ArrayList(sessionEJBMap.values())); 154 } 155 checkInterruptStatus(); 156 157 HashMap entityEJBMap = createEntityEJBs(model); 159 if (entityEJBMap != null && entityEJBMap.size() > 0) { 160 root.setEntityEjbs(new ArrayList(entityEJBMap.values())); 161 } 162 checkInterruptStatus(); 163 164 createContainerManagedRelations(entityEJBMap, model); 166 167 return root; 168 } 169 170 private void checkInterruptStatus() throws InterruptedException { 171 if (Thread.interrupted()) { 172 throw new InterruptedException (); 173 } 174 } 175 176 182 private HashMap createEntityEJBs(SimpleModel model) { 183 HashMap map = new HashMap(); 184 Collection pkList = model.getAllSimpleUmlPackages(model); 186 for (Iterator pkIterator = pkList.iterator(); pkIterator.hasNext();) { 187 SimpleUmlPackage simpleUmlPackage = (SimpleUmlPackage) pkIterator.next(); 188 Collection list; 189 list = simpleUmlPackage.getSimpleClassifiers(); 190 for (Iterator pkit = list.iterator(); pkit.hasNext();) { 191 SimpleModelElement el = (SimpleModelElement) pkit.next(); 192 if ((el instanceof SimpleUmlClass) && 193 model.getStereoType(el) != null && 194 model.getStereoType(el).equalsIgnoreCase(JagUMLProfile.STEREOTYPE_CLASS_ENTITY)) { 195 197 SimpleUmlClass suc = (SimpleUmlClass) el; 198 199 String rootPackage = simpleUmlPackage.getFullPackageName(); 200 String tableName = getTaggedValue(model, 201 JagUMLProfile.TAGGED_VALUE_CLASS_TABLE_NAME, suc, 202 Utils.unformat(Utils.firstToLowerCase(suc.getName()))); 203 204 Entity entity = new Entity(EMPTY_STRING, tableName, EMPTY_STRING); 205 entity.setRootPackage(rootPackage); 206 entity.setName(suc.getName()); 207 entity.setDescription(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_DOCUMENTATION, suc)); 208 if (model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DISPLAY_NAME, suc) != null) { 209 entity.setDisplayName(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DISPLAY_NAME, suc)); 210 } 211 if (model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_IS_ASSOCIATION, suc) != null) { 212 entity.isAssociationEntity.setSelectedItem(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_IS_ASSOCIATION, suc)); 213 } 214 215 entity.setRefName(entity.getName().toString()); 216 217 int pkCount = 0; 219 Collection attributes = suc.getSimpleAttributes(); 220 Field primaryKeyField = null; 221 for (Iterator iterator = attributes.iterator(); iterator.hasNext();) { 222 SimpleAttribute att = (SimpleAttribute) iterator.next(); 223 boolean isPK = equal(model.getStereoType(att), JagUMLProfile.STEREOTYPE_ATTRIBUTE_PRIMARY_KEY); 224 boolean required = false; 225 if (isPK) { 226 required = true; 227 } else { 228 required = equal(model.getStereoType(att), JagUMLProfile.STEREOTYPE_ATTRIBUTE_REQUIRED); 230 } 231 232 Column col = new Column(); 233 String colName = model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_ATTRIBUTE_COLUMN_NAME, att); 234 235 if (colName == null) { 236 colName = Utils.unformat(att.getName()); 238 } 239 col.setName(colName); 240 String sqlType = getTaggedValue(model, 241 JagUMLProfile.TAGGED_VALUE_ATTRIBUTE_SQL_TYPE, att, null); 242 String jdbcType = getTaggedValue(model, 243 JagUMLProfile.TAGGED_VALUE_ATTRIBUTE_JDBC_TYPE, att, null); 244 col.setPrimaryKey(isPK); 245 col.setNullable(!required); 246 247 SimpleClassifier theClassifier = att.getType(); 248 String fieldType = theClassifier.getOwner().getFullPackageName(); 249 if (fieldType != null && !Character.isLowerCase(theClassifier.getName().charAt(0))) { 250 fieldType = fieldType + DOT + theClassifier.getName(); 251 } else { 252 String primitiveType = theClassifier.getName(); 254 if (CHARACTER_PRIMITIVE.equals(primitiveType)) { 255 fieldType = CHARACTER_CLASS; 256 } 257 else if (INTEGER_PRIMITIVE.equals(primitiveType)) { 258 fieldType = INTEGER_CLASS; 259 } 260 else { 261 fieldType = JAVA_LANG_PACKAGE_PREFIX + 262 Character.toUpperCase(primitiveType.charAt(0)) + 263 primitiveType.substring(1); 264 } 265 } 266 if (sqlType == null) { 267 String [] mappedTypes = getDatabaseColumnTypesForClass(fieldType); 268 sqlType = mappedTypes[0]; 269 jdbcType = mappedTypes[1]; 270 } 271 col.setSqlType(sqlType); 272 String autoGeneratedPrimaryKey = model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_ATTRIBUTE_AUTO_PRIMARY_KEY, att); 273 boolean generate = false; 274 if ("true".equalsIgnoreCase(autoGeneratedPrimaryKey)) { 275 generate = true; 276 } 277 Field field = new Field(entity, col); 278 field.setName(att.getName()); 279 field.setType(fieldType); if (isPK) { 281 field.setPrimaryKey(isPK); 282 } 283 field.setSqlType(sqlType); 284 field.setJdbcType(jdbcType); 285 field.setHasAutoGenPrimaryKey(generate); 286 287 288 if (isPK) { 289 pkCount++; 290 primaryKeyField = field; 291 } 292 entity.add(field); 293 } 294 295 if (pkCount > 1) { 296 entity.setIsComposite("true"); 298 String compositePK = model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_COMPOSITE_PRIMARY_KEY, suc); 300 entity.setPKeyType(compositePK); 301 } else { 303 if (primaryKeyField != null) { 304 entity.setPrimaryKey(primaryKeyField); 305 } 306 } 307 308 if (pkCount == 0) { 309 log("UML Error! Entity '" + entity.getName() + "' has no primary key! At least one attribute " + 310 "in an entity bean must have the stereotype \"PrimaryKey\"."); 311 JOptionPane.showMessageDialog(null, 312 "Entity '" + entity.getName() + "' has no primary key! At least one attribute " + 313 "in an entity bean must have the stereotype \"PrimaryKey\".", 314 "UML Error!", 315 JOptionPane.ERROR_MESSAGE); 316 } else { 317 map.put(entity.getRefName(), entity); 319 } 320 } 321 } 322 } 323 return map; 324 } 325 326 335 private String [] getDatabaseColumnTypesForClass(String javaClass) { 336 if (Byte .class.getName().equals(javaClass) || 337 Short .class.getName().equals(javaClass) || 338 Integer .class.getName().equals(javaClass) || 339 Long .class.getName().equals(javaClass) || 340 Double .class.getName().equals(javaClass)) { 341 return new String [] {NUMBER_SQL_TYPE, BIGINT_JDBC_TYPE}; 342 } 343 if (java.sql.Timestamp .class.getName().equals(javaClass) || 344 java.sql.Date .class.getName().equals(javaClass) || 345 java.util.Date .class.getName().equals(javaClass)) { 346 return new String [] {TIMESTAMP_SQL_TYPE, TIMESTAMP_SQL_TYPE}; 347 } 348 349 return new String [] {DEFAULT_SQL_TYPE, DEFAULT_JDBC_TYPE}; 350 } 351 352 private String getTaggedValue(SimpleModel model, String taggedValueAttributeSqlType, 353 SimpleModelElement att, String defaultValue) { 354 String value = model.getTaggedValue(taggedValueAttributeSqlType, att); 355 return value == null ? defaultValue : value; 356 } 357 358 359 private HashMap createSessionEJBs(SimpleModel model) { 360 HashMap map = new HashMap(); 361 362 Collection pkList = model.getAllSimpleUmlPackages(model); 364 for (Iterator pkIterator = pkList.iterator(); pkIterator.hasNext();) { 365 SimpleUmlPackage simpleUmlPackage = (SimpleUmlPackage) pkIterator.next(); 366 367 Collection list = simpleUmlPackage.getSimpleClassifiers(); 368 for (Iterator it = list.iterator(); it.hasNext();) { 369 SimpleModelElement el = (SimpleModelElement) it.next(); 370 if ((el instanceof SimpleUmlClass) && 371 model.getStereoType(el) != null && 372 model.getStereoType(el).equals(JagUMLProfile.STEREOTYPE_CLASS_SERVICE)) { 373 ArrayList businessMethods = new ArrayList(); 375 376 SimpleUmlClass suc = (SimpleUmlClass) el; 377 Collection operations = suc.getSimpleOperations(); 378 for (Iterator oit = operations.iterator(); oit.hasNext();) { 379 BusinessMethod bm = new BusinessMethod(); 380 SimpleOperation operation = (SimpleOperation) oit.next(); 381 log.info("The operation name is: " + operation.getName()); 382 383 bm.setMethodName(operation.getName()); 384 String desc = model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_DOCUMENTATION, operation); 385 if (desc == null) { 386 bm.setDescription(""); 387 } else { 388 bm.setDescription(desc); 389 } 390 391 ArrayList argList = new ArrayList(); 392 log.info("The number of parameters: " + operation.getSimpleParameters().size()); 393 for (Iterator pit = operation.getSimpleParameters().iterator(); pit.hasNext();) { 394 SimpleParameter param = (SimpleParameter) pit.next(); 395 BusinessArgument arg = new BusinessArgument(); 396 String type; 397 log.debug("Param kind: " + param.getKind()); 399 if (param.getType() != null) { 400 if (param.getType().getName() != null && param.getType().getName().equalsIgnoreCase("void")) { 401 type = "void"; 402 } else { 403 String packageName = param.getType().getOwner().getFullPackageName(); 404 if (packageName == null) { 405 packageName = ""; 406 } else { 407 packageName = param.getType().getOwner().getFullPackageName() + "."; 408 } 409 String typeName = param.getType().getName(); 410 if (typeName != null) { 411 if (typeName.startsWith("java::lang::")) { 412 typeName = typeName.substring(12); 414 } 415 } 416 type = "" + packageName + typeName; 417 } 418 } else { 419 type = "void"; 420 } 421 if (param.getKind().equalsIgnoreCase(SimpleParameter.RETURN)) { 422 log.info("Found a return type"); 423 bm.setReturnType(type); 424 } else { 425 log.info("The param name is: " + param.getName()); 426 arg.setName(param.getName()); 427 log.info("The param type is: " + type); 428 arg.setType(type); 429 argList.add(arg); 430 } 431 } 432 bm.setArgumentList(argList); 433 businessMethods.add(bm); 434 } 435 436 String rootPackage = simpleUmlPackage.getFullPackageName(); 437 Session session = new Session(rootPackage); 438 session.setName(suc.getName()); 439 session.setRootPackage(rootPackage); 440 session.setRefName(suc.getName()); 441 session.setDescription(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_DOCUMENTATION, suc)); 442 session.setBusinessMethods(businessMethods); 443 Collection deps = model.getSimpleDependencies(); 445 for (Iterator iterator = deps.iterator(); iterator.hasNext();) { 446 SimpleDependency sd = (SimpleDependency) iterator.next(); 447 if (sd.getClient().getName().equals(session.getName().toString())) { 449 String entityRef = sd.getSupplier().getName(); 451 session.addRef(entityRef); 452 } 453 } 454 map.put(session.getRefName(), session); 456 } 457 } 458 } 459 return map; 460 } 461 462 468 private void createContainerManagedRelations(HashMap entityEJBMap, SimpleModel simpleModel) { 469 Iterator assocs = simpleModel.getSimpleAssociations().iterator(); 470 while (assocs.hasNext()) { 471 SimpleAssociation assoc = (SimpleAssociation) assocs.next(); 472 473 String sourceEntityName = assoc.getSource().getSimpleClassifier().getName(); 474 String destinationEntityName = assoc.getDestination().getSimpleClassifier().getName(); 475 Entity sourceEntity = (Entity) entityEJBMap.get(sourceEntityName); 476 Entity destinationEntity = (Entity) entityEJBMap.get(destinationEntityName); 477 boolean multiplicity; 478 boolean bidirectional; 479 if (JagUMLProfile.TAGGED_VALUE_ASSOCIATION_MULTIPLICITY_ONE_TO_ONE.equals(simpleModel.getTaggedValue(JagUMLProfile.TAGGED_VALUE_ASSOCIATION_MULTIPLICITY, assoc))) { 480 multiplicity = false; 481 } else { 482 multiplicity = true; 484 } 485 if ("true".equals(simpleModel.getTaggedValue(JagUMLProfile.TAGGED_VALUE_ASSOCIATION_BIDIRECTIONAL, assoc))) { 486 bidirectional = true; 487 } else { 488 bidirectional = false; 490 } 491 492 if (sourceEntity == null || destinationEntity == null) { 493 log("The relation named '" + assoc.getName() + 494 "' has 1 or more 'association ends' " + 495 "whose names do not correspond to entity bean class names"); 496 continue; 497 } 498 499 ForeignKey info = new ForeignKey(); 500 String fkFieldName = assoc.getName(); 501 String fkColumnName = null; 502 Iterator i = sourceEntity.getFields().iterator(); 503 while (i.hasNext()) { 504 Field field = (Field) i.next(); 505 if (field.getName().equals(fkFieldName)) { 506 fkColumnName = field.getColumnName(); 507 } 508 } 509 info.setPkTableName(destinationEntity.getLocalTableName().toString()); 510 info.setPkColumnName(destinationEntity.getPrimaryKey().getColumnName()); 511 info.setFkColumnName(fkColumnName); 512 info.setFkName(fkFieldName); 513 514 Relation relation = new Relation(sourceEntity, info, false); 515 relation.setBidirectional(bidirectional); 516 relation.setTargetMultiple(multiplicity); 517 sourceEntity.addRelation(relation); 518 log("Added relation: " + relation); 519 } 520 } 521 522 private void log(String message) { 523 log.info(message); 524 if (logger != null) { 525 logger.log(message); 526 } 527 } 528 529 530 private void createDataSource(SimpleModel model, Datasource ds) { 531 boolean datasourceFound = false; 532 Collection pkList = model.getAllSimpleUmlPackages(model); 534 for (Iterator pkIterator = pkList.iterator(); pkIterator.hasNext();) { 535 SimpleUmlPackage simpleUmlPackage = (SimpleUmlPackage) pkIterator.next(); 536 Collection list = simpleUmlPackage.getSimpleClassifiers(); 537 for (Iterator it = list.iterator(); it.hasNext();) { 538 SimpleModelElement el = (SimpleModelElement) it.next(); 539 if ((el instanceof SimpleUmlClass) && 540 model.getStereoType(el) != null && 541 model.getStereoType(el).equals(JagUMLProfile.STEREOTYPE_CLASS_DATA_SOURCE)) { 542 datasourceFound = true; 544 ds.setJndi(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DATA_SOURCE_JNDI_NAME, el)); 545 ds.setMapping(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DATA_SOURCE_MAPPING, el)); 546 ds.setJdbcUrl(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DATA_SOURCE_JDBC_URL, el)); 547 ds.setUserName(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DATA_SOURCE_USER_NAME, el)); 548 ds.setPassword(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CLASS_DATA_SOURCE_PASSWORD, el)); 549 } 550 } 551 } 552 553 if (!datasourceFound) { 554 ds.setJndi("jdbc/" + model.getName()); 555 556 } 557 } 558 559 560 private void createConfig(SimpleModel model, Config config, App app, Paths paths) { 561 Collection pkList = model.getAllSimpleUmlPackages(model); 563 for (Iterator pkIterator = pkList.iterator(); pkIterator.hasNext();) { 564 SimpleUmlPackage simpleUmlPackage = (SimpleUmlPackage) pkIterator.next(); 565 Collection list = simpleUmlPackage.getSimpleClassifiers(); 566 for (Iterator it = list.iterator(); it.hasNext();) { 567 SimpleModelElement el = (SimpleModelElement) it.next(); 568 if ((el instanceof SimpleUmlClass) && 569 model.getStereoType(el) != null && 570 model.getStereoType(el).equals(JagUMLProfile.STEREOTYPE_CLASS_JAG_CONFIG)) { 571 573 config.setAuthor(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_AUTHOR, el)); 574 config.setVersion(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_VERSION, el)); 575 config.setCompany(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_COMPANY, el)); 576 String templateDir = model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_TEMPLATE, el); 577 if (templateDir != null) { 578 File dir = new File(templateDir); 579 config.getTemplate().setTemplateDir(dir); 580 } 581 HashMap map = new HashMap(); 582 map.put(JagGenerator.TEMPLATE_APPLICATION_SERVER, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_APPSERVER, el)); 583 map.put(JagGenerator.TEMPLATE_USE_RELATIONS, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_USE_RELATIONS, el)); 584 map.put(JagGenerator.TEMPLATE_USE_JAVA5, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_USE_JAVA5, el)); 585 map.put(JagGenerator.TEMPLATE_USE_MOCK, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_USE_MOCK, el)); 586 map.put(JagGenerator.TEMPLATE_WEB_TIER, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_WEB_TIER, el)); 587 map.put(JagGenerator.TEMPLATE_BUSINESS_TIER, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_BUSINESS_TIER, el)); 588 map.put(JagGenerator.TEMPLATE_SERVICE_TIER, model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_CONFIG_SERVICE_TIER, el)); 589 config.setTemplateSettings(map); 590 591 app.setName(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_APPLICATION_NAME, el)); 592 app.setDescription(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_DESCRIPTION, el)); 593 app.setVersion(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_APPLICATION_VERSION, el)); 594 app.setRootPackage(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_ROOT_PACKAGE, el)); 595 app.setLogFramework(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_LOGGING, el)); 596 app.setDateFormat(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_DATE_FORMAT, el)); 597 app.setTimestampFormat(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_TIMESTAMP_FORMAT, el)); 598 599 paths.setServiceOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_SERVICE_PATH, el)); 600 paths.setEjbOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_EJB_PATH, el)); 601 paths.setWebOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_WEB_PATH, el)); 602 paths.setJspOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_JSP_PATH, el)); 603 paths.setTestOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_TEST_PATH, el)); 604 paths.setConfigOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_CONFIG_PATH, el)); 605 paths.setSwingOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_SWING_PATH, el)); 606 paths.setMockOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_MOCK_PATH, el)); 607 paths.setHibernateOutput(model.getTaggedValue(JagUMLProfile.TAGGED_VALUE_MODEL_HIBERNATE_PATH, el)); 608 } 609 } 610 } 611 } 612 613 614 private boolean equal(String a, String b) { 615 if (a != null && b != null && a.equals(b)) { 616 return true; 617 } else 618 return false; 619 } 620 621 625 public static void main(String [] args) { 626 if (args.length == 1) { 627 new UML2JagGenerator().generateXML(args[0], "."); 628 } else { 629 System.out.println("Pass an xmi file as argument!"); 630 } 631 } 632 } 633 634 | Popular Tags |