001// license-header java merge-point 002// 003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify! 004// 005package org.andromda.metafacades.uml14; 006 007import java.util.Collection; 008import java.util.List; 009import org.andromda.core.metafacade.MetafacadeBase; 010import org.andromda.core.metafacade.ModelValidationMessage; 011import org.andromda.metafacades.uml.FrontEndAction; 012import org.andromda.metafacades.uml.FrontEndActivityGraph; 013import org.andromda.metafacades.uml.FrontEndController; 014import org.andromda.metafacades.uml.FrontEndFinalState; 015import org.andromda.metafacades.uml.FrontEndParameter; 016import org.andromda.metafacades.uml.FrontEndUseCase; 017import org.andromda.metafacades.uml.FrontEndView; 018import org.andromda.metafacades.uml.Role; 019import org.andromda.translation.ocl.validation.OCLCollections; 020import org.andromda.translation.ocl.validation.OCLExpressions; 021import org.andromda.translation.ocl.validation.OCLIntrospector; 022import org.andromda.translation.ocl.validation.OCLResultEnsurer; 023import org.apache.commons.collections.Predicate; 024import org.apache.commons.collections.Transformer; 025import org.apache.log4j.Logger; 026import org.omg.uml.behavioralelements.usecases.UseCase; 027 028/** 029 * Represents a use case used in the "front end" of an application. 030 * MetafacadeLogic for FrontEndUseCase 031 * 032 * @see FrontEndUseCase 033 */ 034public abstract class FrontEndUseCaseLogic 035 extends UseCaseFacadeLogicImpl 036 implements FrontEndUseCase 037{ 038 /** 039 * The underlying UML object 040 * @see Object 041 */ 042 protected Object metaObject; 043 044 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 045 * @param metaObjectIn 046 * @param context 047 */ 048 protected FrontEndUseCaseLogic(Object metaObjectIn, String context) 049 { 050 super((UseCase)metaObjectIn, getContext(context)); 051 this.metaObject = metaObjectIn; 052 } 053 054 /** 055 * The logger instance. 056 */ 057 private static final Logger logger = Logger.getLogger(FrontEndUseCaseLogic.class); 058 059 /** 060 * Gets the context for this metafacade logic instance. 061 * @param context String. Set to FrontEndUseCase if null 062 * @return context String 063 */ 064 private static String getContext(String context) 065 { 066 if (context == null) 067 { 068 context = "org.andromda.metafacades.uml.FrontEndUseCase"; 069 } 070 return context; 071 } 072 073 /** Reset context only for non-root metafacades 074 * @param context 075 */ 076 @Override 077 public void resetMetafacadeContext(String context) 078 { 079 if (!this.contextRoot) // reset context only for non-root metafacades 080 { 081 context = getContext(context); // to have same value as in original constructor call 082 setMetafacadeContext (context); 083 } 084 } 085 086 /** 087 * @return boolean true always 088 * @see FrontEndUseCase 089 */ 090 public boolean isFrontEndUseCaseMetaType() 091 { 092 return true; 093 } 094 095 // --------------- attributes --------------------- 096 097 /** 098 * @see FrontEndUseCase#isEntryUseCase() 099 * @return boolean 100 */ 101 protected abstract boolean handleIsEntryUseCase(); 102 103 private boolean __entryUseCase1a; 104 private boolean __entryUseCase1aSet = false; 105 106 /** 107 * True if this use-case is the entry point to the front end. 108 * @return (boolean)handleIsEntryUseCase() 109 */ 110 public final boolean isEntryUseCase() 111 { 112 boolean entryUseCase1a = this.__entryUseCase1a; 113 if (!this.__entryUseCase1aSet) 114 { 115 // entryUseCase has no pre constraints 116 entryUseCase1a = handleIsEntryUseCase(); 117 // entryUseCase has no post constraints 118 this.__entryUseCase1a = entryUseCase1a; 119 if (isMetafacadePropertyCachingEnabled()) 120 { 121 this.__entryUseCase1aSet = true; 122 } 123 } 124 return entryUseCase1a; 125 } 126 127 /** 128 * @see FrontEndUseCase#isSecured() 129 * @return boolean 130 */ 131 protected abstract boolean handleIsSecured(); 132 133 private boolean __secured2a; 134 private boolean __secured2aSet = false; 135 136 /** 137 * Indicates if this use case is "secured". This is true when there is at least one role 138 * associated to it. 139 * @return (boolean)handleIsSecured() 140 */ 141 public final boolean isSecured() 142 { 143 boolean secured2a = this.__secured2a; 144 if (!this.__secured2aSet) 145 { 146 // secured has no pre constraints 147 secured2a = handleIsSecured(); 148 // secured has no post constraints 149 this.__secured2a = secured2a; 150 if (isMetafacadePropertyCachingEnabled()) 151 { 152 this.__secured2aSet = true; 153 } 154 } 155 return secured2a; 156 } 157 158 // ------------- associations ------------------ 159 160 private List<FrontEndFinalState> __getReferencingFinalStates1r; 161 private boolean __getReferencingFinalStates1rSet = false; 162 163 /** 164 * The use case the final state is "targetting". 165 * @return (List<FrontEndFinalState>)handleGetReferencingFinalStates() 166 */ 167 public final List<FrontEndFinalState> getReferencingFinalStates() 168 { 169 List<FrontEndFinalState> getReferencingFinalStates1r = this.__getReferencingFinalStates1r; 170 if (!this.__getReferencingFinalStates1rSet) 171 { 172 // targetUseCase has no pre constraints 173 List result = handleGetReferencingFinalStates(); 174 List shieldedResult = this.shieldedElements(result); 175 try 176 { 177 getReferencingFinalStates1r = (List<FrontEndFinalState>)shieldedResult; 178 } 179 catch (ClassCastException ex) 180 { 181 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 182 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getReferencingFinalStates List<FrontEndFinalState> " + result + ": " + shieldedResult); 183 } 184 // targetUseCase has no post constraints 185 this.__getReferencingFinalStates1r = getReferencingFinalStates1r; 186 if (isMetafacadePropertyCachingEnabled()) 187 { 188 this.__getReferencingFinalStates1rSet = true; 189 } 190 } 191 return getReferencingFinalStates1r; 192 } 193 194 /** 195 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 196 * @return List 197 */ 198 protected abstract List handleGetReferencingFinalStates(); 199 200 private List<Role> __getAllRoles2r; 201 private boolean __getAllRoles2rSet = false; 202 203 /** 204 * Represents a use case used in the "front end" of an application. 205 * @return (List<Role>)handleGetAllRoles() 206 */ 207 public final List<Role> getAllRoles() 208 { 209 List<Role> getAllRoles2r = this.__getAllRoles2r; 210 if (!this.__getAllRoles2rSet) 211 { 212 // frontEndUseCase has no pre constraints 213 List result = handleGetAllRoles(); 214 List shieldedResult = this.shieldedElements(result); 215 try 216 { 217 getAllRoles2r = (List<Role>)shieldedResult; 218 } 219 catch (ClassCastException ex) 220 { 221 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 222 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getAllRoles List<Role> " + result + ": " + shieldedResult); 223 } 224 // frontEndUseCase has no post constraints 225 this.__getAllRoles2r = getAllRoles2r; 226 if (isMetafacadePropertyCachingEnabled()) 227 { 228 this.__getAllRoles2rSet = true; 229 } 230 } 231 return getAllRoles2r; 232 } 233 234 /** 235 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 236 * @return List 237 */ 238 protected abstract List handleGetAllRoles(); 239 240 private List<Role> __getRoles3r; 241 private boolean __getRoles3rSet = false; 242 243 /** 244 * Represents a use case used in the "front end" of an application. 245 * @return (List<Role>)handleGetRoles() 246 */ 247 public final List<Role> getRoles() 248 { 249 List<Role> getRoles3r = this.__getRoles3r; 250 if (!this.__getRoles3rSet) 251 { 252 // frontEndUseCase has no pre constraints 253 List result = handleGetRoles(); 254 List shieldedResult = this.shieldedElements(result); 255 try 256 { 257 getRoles3r = (List<Role>)shieldedResult; 258 } 259 catch (ClassCastException ex) 260 { 261 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 262 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getRoles List<Role> " + result + ": " + shieldedResult); 263 } 264 // frontEndUseCase has no post constraints 265 this.__getRoles3r = getRoles3r; 266 if (isMetafacadePropertyCachingEnabled()) 267 { 268 this.__getRoles3rSet = true; 269 } 270 } 271 return getRoles3r; 272 } 273 274 /** 275 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 276 * @return List 277 */ 278 protected abstract List handleGetRoles(); 279 280 private FrontEndController __getController4r; 281 private boolean __getController4rSet = false; 282 283 /** 284 * Returns the use-case "controlled" by this controller. 285 * @return (FrontEndController)handleGetController() 286 */ 287 public final FrontEndController getController() 288 { 289 FrontEndController getController4r = this.__getController4r; 290 if (!this.__getController4rSet) 291 { 292 // useCase has no pre constraints 293 Object result = handleGetController(); 294 MetafacadeBase shieldedResult = this.shieldedElement(result); 295 try 296 { 297 getController4r = (FrontEndController)shieldedResult; 298 } 299 catch (ClassCastException ex) 300 { 301 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 302 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getController FrontEndController " + result + ": " + shieldedResult); 303 } 304 // useCase has no post constraints 305 this.__getController4r = getController4r; 306 if (isMetafacadePropertyCachingEnabled()) 307 { 308 this.__getController4rSet = true; 309 } 310 } 311 return getController4r; 312 } 313 314 /** 315 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 316 * @return Object 317 */ 318 protected abstract Object handleGetController(); 319 320 private List<FrontEndView> __getViews5r; 321 private boolean __getViews5rSet = false; 322 323 /** 324 * The use-case of which this view is a member. 325 * @return (List<FrontEndView>)handleGetViews() 326 */ 327 public final List<FrontEndView> getViews() 328 { 329 List<FrontEndView> getViews5r = this.__getViews5r; 330 if (!this.__getViews5rSet) 331 { 332 // useCase has no pre constraints 333 List result = handleGetViews(); 334 List shieldedResult = this.shieldedElements(result); 335 try 336 { 337 getViews5r = (List<FrontEndView>)shieldedResult; 338 } 339 catch (ClassCastException ex) 340 { 341 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 342 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getViews List<FrontEndView> " + result + ": " + shieldedResult); 343 } 344 // useCase has no post constraints 345 this.__getViews5r = getViews5r; 346 if (isMetafacadePropertyCachingEnabled()) 347 { 348 this.__getViews5rSet = true; 349 } 350 } 351 return getViews5r; 352 } 353 354 /** 355 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 356 * @return List 357 */ 358 protected abstract List handleGetViews(); 359 360 private List<FrontEndAction> __getActions6r; 361 private boolean __getActions6rSet = false; 362 363 /** 364 * Represents a use case used in the "front end" of an application. 365 * @return (List<FrontEndAction>)handleGetActions() 366 */ 367 public final List<FrontEndAction> getActions() 368 { 369 List<FrontEndAction> getActions6r = this.__getActions6r; 370 if (!this.__getActions6rSet) 371 { 372 // frontEndUseCase has no pre constraints 373 List result = handleGetActions(); 374 List shieldedResult = this.shieldedElements(result); 375 try 376 { 377 getActions6r = (List<FrontEndAction>)shieldedResult; 378 } 379 catch (ClassCastException ex) 380 { 381 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 382 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getActions List<FrontEndAction> " + result + ": " + shieldedResult); 383 } 384 // frontEndUseCase has no post constraints 385 this.__getActions6r = getActions6r; 386 if (isMetafacadePropertyCachingEnabled()) 387 { 388 this.__getActions6rSet = true; 389 } 390 } 391 return getActions6r; 392 } 393 394 /** 395 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 396 * @return List 397 */ 398 protected abstract List handleGetActions(); 399 400 private List<FrontEndUseCase> __getAllUseCases7r; 401 private boolean __getAllUseCases7rSet = false; 402 403 /** 404 * Represents a use case used in the "front end" of an application. 405 * @return (List<FrontEndUseCase>)handleGetAllUseCases() 406 */ 407 public final List<FrontEndUseCase> getAllUseCases() 408 { 409 List<FrontEndUseCase> getAllUseCases7r = this.__getAllUseCases7r; 410 if (!this.__getAllUseCases7rSet) 411 { 412 // frontEndUseCase has no pre constraints 413 List result = handleGetAllUseCases(); 414 List shieldedResult = this.shieldedElements(result); 415 try 416 { 417 getAllUseCases7r = (List<FrontEndUseCase>)shieldedResult; 418 } 419 catch (ClassCastException ex) 420 { 421 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 422 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getAllUseCases List<FrontEndUseCase> " + result + ": " + shieldedResult); 423 } 424 // frontEndUseCase has no post constraints 425 this.__getAllUseCases7r = getAllUseCases7r; 426 if (isMetafacadePropertyCachingEnabled()) 427 { 428 this.__getAllUseCases7rSet = true; 429 } 430 } 431 return getAllUseCases7r; 432 } 433 434 /** 435 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 436 * @return List 437 */ 438 protected abstract List handleGetAllUseCases(); 439 440 private FrontEndView __getInitialView8r; 441 private boolean __getInitialView8rSet = false; 442 443 /** 444 * Represents a use case used in the "front end" of an application. 445 * @return (FrontEndView)handleGetInitialView() 446 */ 447 public final FrontEndView getInitialView() 448 { 449 FrontEndView getInitialView8r = this.__getInitialView8r; 450 if (!this.__getInitialView8rSet) 451 { 452 // frontEndUseCase has no pre constraints 453 Object result = handleGetInitialView(); 454 MetafacadeBase shieldedResult = this.shieldedElement(result); 455 try 456 { 457 getInitialView8r = (FrontEndView)shieldedResult; 458 } 459 catch (ClassCastException ex) 460 { 461 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 462 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getInitialView FrontEndView " + result + ": " + shieldedResult); 463 } 464 // frontEndUseCase has no post constraints 465 this.__getInitialView8r = getInitialView8r; 466 if (isMetafacadePropertyCachingEnabled()) 467 { 468 this.__getInitialView8rSet = true; 469 } 470 } 471 return getInitialView8r; 472 } 473 474 /** 475 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 476 * @return Object 477 */ 478 protected abstract Object handleGetInitialView(); 479 480 private FrontEndActivityGraph __getActivityGraph9r; 481 private boolean __getActivityGraph9rSet = false; 482 483 /** 484 * The use case to which this activity graph belongs. 485 * @return (FrontEndActivityGraph)handleGetActivityGraph() 486 */ 487 public final FrontEndActivityGraph getActivityGraph() 488 { 489 FrontEndActivityGraph getActivityGraph9r = this.__getActivityGraph9r; 490 if (!this.__getActivityGraph9rSet) 491 { 492 // frontEndUseCase has no pre constraints 493 Object result = handleGetActivityGraph(); 494 MetafacadeBase shieldedResult = this.shieldedElement(result); 495 try 496 { 497 getActivityGraph9r = (FrontEndActivityGraph)shieldedResult; 498 } 499 catch (ClassCastException ex) 500 { 501 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 502 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getActivityGraph FrontEndActivityGraph " + result + ": " + shieldedResult); 503 } 504 // frontEndUseCase has no post constraints 505 this.__getActivityGraph9r = getActivityGraph9r; 506 if (isMetafacadePropertyCachingEnabled()) 507 { 508 this.__getActivityGraph9rSet = true; 509 } 510 } 511 return getActivityGraph9r; 512 } 513 514 /** 515 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 516 * @return Object 517 */ 518 protected abstract Object handleGetActivityGraph(); 519 520 private List<FrontEndParameter> __getViewVariables10r; 521 private boolean __getViewVariables10rSet = false; 522 523 /** 524 * Represents a use case used in the "front end" of an application. 525 * @return (List<FrontEndParameter>)handleGetViewVariables() 526 */ 527 public final List<FrontEndParameter> getViewVariables() 528 { 529 List<FrontEndParameter> getViewVariables10r = this.__getViewVariables10r; 530 if (!this.__getViewVariables10rSet) 531 { 532 // frontEndUseCase has no pre constraints 533 List result = handleGetViewVariables(); 534 List shieldedResult = this.shieldedElements(result); 535 try 536 { 537 getViewVariables10r = (List<FrontEndParameter>)shieldedResult; 538 } 539 catch (ClassCastException ex) 540 { 541 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 542 FrontEndUseCaseLogic.logger.warn("incorrect metafacade cast for FrontEndUseCaseLogic.getViewVariables List<FrontEndParameter> " + result + ": " + shieldedResult); 543 } 544 // frontEndUseCase has no post constraints 545 this.__getViewVariables10r = getViewVariables10r; 546 if (isMetafacadePropertyCachingEnabled()) 547 { 548 this.__getViewVariables10rSet = true; 549 } 550 } 551 return getViewVariables10r; 552 } 553 554 /** 555 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 556 * @return List 557 */ 558 protected abstract List handleGetViewVariables(); 559 560 /** 561 * <p><b>Constraint:</b> org::andromda::metafacades::uml::FrontEndUseCase::each usecase needs one and only one graph</p> 562 * <p><b>Error:</b> Each use-case needs one and only one activity graph.</p> 563 * <p><b>OCL:</b> context FrontEndUseCase inv: activityGraph->notEmpty()</p> 564 * <p><b>Constraint:</b> org::andromda::metafacades::uml::FrontEndUseCase::one and only one usecase must be a FrontEndApplication</p> 565 * <p><b>Error:</b> One and only one use-case must be marked as the application entry use-case. Currently this is done by adding the FrontEndApplication stereotype to it.</p> 566 * <p><b>OCL:</b> context FrontEndUseCase inv: allUseCases->one(entryUseCase = true)</p> 567 * <p><b>Constraint:</b> org::andromda::metafacades::uml::FrontEndUseCase::non-empty unique usecase name</p> 568 * <p><b>Error:</b> Each use-case must have a non-empty name that is unique among all use-cases.</p> 569 * <p><b>OCL:</b> context FrontEndUseCase inv: name->notEmpty() and model.allUseCases->isUnique(name)</p> 570 * <p><b>Constraint:</b> org::andromda::metafacades::uml::FrontEndUseCase::each front-end use-case needs to be in a package</p> 571 * <p><b>Error:</b> Each front-end use-case is required to be modeled in a package, doing otherwise will result in uncompileable code due to filename collisions.</p> 572 * <p><b>OCL:</b> context FrontEndUseCase inv: packageName->notEmpty()</p> 573 * @param validationMessages Collection<ModelValidationMessage> 574 * @see UseCaseFacadeLogicImpl#validateInvariants(Collection validationMessages) 575 */ 576 @Override 577 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 578 { 579 super.validateInvariants(validationMessages); 580 try 581 { 582 final Object contextElement = this.THIS(); 583 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"activityGraph"))); 584 if (!constraintValid) 585 { 586 validationMessages.add( 587 new ModelValidationMessage( 588 (MetafacadeBase)contextElement , 589 "org::andromda::metafacades::uml::FrontEndUseCase::each usecase needs one and only one graph", 590 "Each use-case needs one and only one activity graph.")); 591 } 592 } 593 catch (Throwable th) 594 { 595 Throwable cause = th.getCause(); 596 int depth = 0; // Some throwables have infinite recursion 597 while (cause != null && depth < 7) 598 { 599 th = cause; 600 depth++; 601 } 602 logger.error("Error validating constraint 'org::andromda::metafacades::uml::FrontEndUseCase::each usecase needs one and only one graph' ON " 603 + this.THIS().toString() + ": " + th.getMessage(), th); 604 } 605 try 606 { 607 final Object contextElement = this.THIS(); 608 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.one(OCLIntrospector.invoke(contextElement,"allUseCases"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(OCLExpressions.equal(OCLIntrospector.invoke(object,"entryUseCase"),true))).booleanValue();}})); 609 if (!constraintValid) 610 { 611 validationMessages.add( 612 new ModelValidationMessage( 613 (MetafacadeBase)contextElement , 614 "org::andromda::metafacades::uml::FrontEndUseCase::one and only one usecase must be a FrontEndApplication", 615 "One and only one use-case must be marked as the application entry use-case. Currently this is done by adding the FrontEndApplication stereotype to it.")); 616 } 617 } 618 catch (Throwable th) 619 { 620 Throwable cause = th.getCause(); 621 int depth = 0; // Some throwables have infinite recursion 622 while (cause != null && depth < 7) 623 { 624 th = cause; 625 depth++; 626 } 627 logger.error("Error validating constraint 'org::andromda::metafacades::uml::FrontEndUseCase::one and only one usecase must be a FrontEndApplication' ON " 628 + this.THIS().toString() + ": " + th.getMessage(), th); 629 } 630 try 631 { 632 final Object contextElement = this.THIS(); 633 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name"))&&OCLCollections.isUnique(OCLIntrospector.invoke(contextElement,"model.allUseCases"),new Transformer(){public Object transform(Object object){return OCLIntrospector.invoke(object,"name");}})); 634 if (!constraintValid) 635 { 636 validationMessages.add( 637 new ModelValidationMessage( 638 (MetafacadeBase)contextElement , 639 "org::andromda::metafacades::uml::FrontEndUseCase::non-empty unique usecase name", 640 "Each use-case must have a non-empty name that is unique among all use-cases.")); 641 } 642 } 643 catch (Throwable th) 644 { 645 Throwable cause = th.getCause(); 646 int depth = 0; // Some throwables have infinite recursion 647 while (cause != null && depth < 7) 648 { 649 th = cause; 650 depth++; 651 } 652 logger.error("Error validating constraint 'org::andromda::metafacades::uml::FrontEndUseCase::non-empty unique usecase name' ON " 653 + this.THIS().toString() + ": " + th.getMessage(), th); 654 } 655 try 656 { 657 final Object contextElement = this.THIS(); 658 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"packageName"))); 659 if (!constraintValid) 660 { 661 validationMessages.add( 662 new ModelValidationMessage( 663 (MetafacadeBase)contextElement , 664 "org::andromda::metafacades::uml::FrontEndUseCase::each front-end use-case needs to be in a package", 665 "Each front-end use-case is required to be modeled in a package, doing otherwise will result in uncompileable code due to filename collisions.")); 666 } 667 } 668 catch (Throwable th) 669 { 670 Throwable cause = th.getCause(); 671 int depth = 0; // Some throwables have infinite recursion 672 while (cause != null && depth < 7) 673 { 674 th = cause; 675 depth++; 676 } 677 logger.error("Error validating constraint 'org::andromda::metafacades::uml::FrontEndUseCase::each front-end use-case needs to be in a package' ON " 678 + this.THIS().toString() + ": " + th.getMessage(), th); 679 } 680 } 681}