1 package org.andromda.cartridges.webservice.metafacades;
2
3 import java.util.Collection;
4 import org.andromda.core.metafacade.MetafacadeBase;
5 import org.andromda.core.metafacade.ModelValidationMessage;
6 import org.andromda.translation.ocl.validation.OCLIntrospector;
7 import org.andromda.utils.StringUtilsHelper;
8
9
10
11
12
13
14
15 public class WSDLTypeAssociationEndLogicImpl
16 extends WSDLTypeAssociationEndLogic
17 {
18 private static final long serialVersionUID = 34L;
19
20
21
22
23
24
25 public WSDLTypeAssociationEndLogicImpl(Object metaObject, String context)
26 {
27 super(metaObject, context);
28 }
29
30
31
32
33
34 protected boolean handleIsNillable()
35 {
36 return !this.isRequired();
37 }
38
39
40
41
42
43
44
45 @Override
46 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
47 {
48 super.validateInvariants(validationMessages);
49 try
50 {
51 final Object contextElement = this.THIS();
52 final String name = (String)OCLIntrospector.invoke(contextElement,"name");
53 if (name != null && name.length()>0 && !StringUtilsHelper.startsWithLowercaseLetter(name))
54 {
55 validationMessages.add(
56 new ModelValidationMessage(
57 (MetafacadeBase)contextElement ,
58 "org::andromda::cartridges::webservice::metafacades::WSDLTypeAssociationEnd::association end must start with a lowercase letter",
59 "AssociationEnd name must start with a lowercase letter."));
60 }
61 }
62 catch (Throwable th)
63 {
64 Throwable cause = th.getCause();
65 int depth = 0;
66 while (cause != null && depth < 7)
67 {
68 th = cause;
69 depth++;
70 }
71 logger.error("Error validating constraint 'org::andromda::cartridges::webservice::WSDLTypeAssociationEnd::association end must start with a lowercase letter' ON "
72 + this.THIS().toString() + ": " + th.getMessage(), th);
73 }
74 }
75 }