Module: Mrdf_Repository

Defined in:
lib/ontomde-java/java/tenant.rb,
lib/ontomde-java/jpa/jpa.rb,
lib/ontomde-java/jpa/jpa.rb,
lib/ontomde-java/java/xsd.rb,
lib/ontomde-java/flex/main.rb,
lib/ontomde-java/flex/main.rb,
lib/ontomde-java/java/java.rb,
lib/ontomde-java/jpdl/jpdl.rb,
lib/ontomde-java/jpdl/main.rb,
lib/ontomde-java/crank/main.rb,
lib/ontomde-java/java/build.rb,
lib/ontomde-java/java/build.rb,
lib/ontomde-java/vmware/vso.rb,
lib/ontomde-java/crank/menu2.rb,
lib/ontomde-java/java/groovy.rb,
lib/ontomde-java/struts/main.rb,
lib/ontomde-java/java/javadoc.rb,
lib/ontomde-java/jpdl/graphic.rb,
lib/ontomde-java/java/refactor.rb,
lib/ontomde-java/java/security.rb,
lib/ontomde-java/struts/footer.rb,
lib/ontomde-java/struts/header.rb,
lib/ontomde-java/struts/spring.rb,
lib/ontomde-java/struts/webXml.rb,
lib/ontomde-java/java/component.rb,
lib/ontomde-java/java/component.rb,
lib/ontomde-java/struts/jsp_edit.rb,
lib/ontomde-java/struts/jsp_edit.rb,
lib/ontomde-java/struts/jsp_edit.rb,
lib/ontomde-java/flex/Editor.mxml.rb,
lib/ontomde-java/jpdl/jpdl_deploy.rb,
lib/ontomde-java/kbjava/rdfToJava.rb,
lib/ontomde-java/struts/jsp_index.rb,
lib/ontomde-java/struts/validator.rb,
lib/ontomde-java/crank/facesconfig.rb,
lib/ontomde-java/jpa/configuration.rb,
lib/ontomde-java/struts/validation.rb,
lib/ontomde-java/flex/ImportationAS.rb,
lib/ontomde-java/flex/ValueObjectAS.rb,
lib/ontomde-java/java/contextualize.rb,
lib/ontomde-java/struts/header_link.rb,
lib/ontomde-java/java/enumAssignable.rb,
lib/ontomde-java/struts/localeAction.rb,
lib/ontomde-java/struts/reloadAction.rb,
lib/ontomde-java/struts/struts-config.rb,
lib/ontomde-java/java/operationAsClass.rb,
lib/ontomde-java/java/annotationOntoMDE.rb,
lib/ontomde-java/struts/MessageResources.rb,
lib/ontomde-java/java/enumCompatibilityLayer.rb,
lib/ontomde-java/jpa/simulationAutoImplement.rb,
lib/ontomde-java/jpdl/processOperationToClass.rb,
lib/ontomde-java/struts/mappingToJavaHierarchy.rb

Overview

automatically populate methods with simulated code. Methods will return an element or a liste of element of the specified type.

Constant Summary collapse

ACTIONSCRIPT_JAVA_ADAPTER_ID =

Name of action script adapter

"java-dao"
JAVA_SCRIPT_ANNOTATION =

Java annotation used to mark a Secured method or field.

"@xmda.scripting.aop.Script"
TENANT_DEFAULT_CLASS_QUALIFIED_NAME =

default qualified name of the class used for tenant

'xmda.tenant.Tenant'
TENANT_STEREOTYPE_NAME =

stereotype name used to identify a tenant in model

'tenant'
JAVA_GLOBAL_ACCESS_CONTROL_ENUM =

JAVA_GLOBAL_ACCESS_CONTROL_ENUM=“xmda .security.StaticSecurityRole” Enumerated containing the list of all access control criteria

"xmda.security.GlobalComputedAccessControlCriteria"
JAVA_GLOBAL_ACCESS_CONTROL_ENUM_COMMENT =
<<ENDHELP
This enum contains a list of all computed access control criteria.

Generic examples of access control:
* userIsManagerForThisObject
* userOwnsThisObject
* userIsOnDuty

AccessControl criteria are computed in the context of one class instance of the model and one user. (ex: User Martin accessing contract number 3003).

Some criteria migth not need to know what object is beeing accessed (example: userIsOnDuty). Some other will need to know what object is access (Is martin a manager for contract 42000 ?, Does Martin owns product number 13239 ?)

This list is defined at design time because these rules criteria are implemented usign an algorithm (model query, date computation, ...) that require some coding and optimisation at developpement time. It is however possible to add RESERVED elements for future extension (RESERVED1, RESERVED2, ...).
ENDHELP
JAVA_SECURE_ANNOTATION =

Java annotation used to mark a Secured method or field.

"@xmda.security.Secure"
STRUTS_WEBXML_HEAD =

HEADER of generated web.xml

<<ENDHEAD
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  id="services" version="2.5">

<!-- Generated by XMDA -->
	<display-name>Struts Examples Application</display-name>
ENDHEAD
STRUTS_SERVLET =
<<SERVLET
  <!-- Standard Action Servlet Configuration (with debugging) -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <!-- Default -->
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>2</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>
SERVLET
STRUTS_SERVLET_MAPPING =
<<MAPPING
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <!-- Standard Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

MAPPING
STRUTS_WEBXML_FOOT =

Footer of generated web.xml

<<ENDFOOT

  

	<!-- The Usual Welcome File List -->
	<welcome-file-list>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>index.html</welcome-file>
		<welcome-file>upload.jsp</welcome-file>
	</welcome-file-list>

	<error-page>
		<error-code>500</error-code>
		<location>/errorPage.jsp</location>
	</error-page>

	<error-page>
		<exception-type>java.lang.Exception</exception-type>
		<location>/errorPage.jsp</location>
	</error-page>
</web-app>
ENDFOOT
STRUTS_WEBXML_ACEGI_FILTER =

ACEGI STRUTS FILTER definition

<<ENDSEC
  <filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>xmda.security.FilterChainProxyTrigger</filter-class>
  </filter>
ENDSEC
STRUTS_WEBXML_ACEGI_MAPPING =
<<ENDMAP
  <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
ENDMAP
STRUTS_WEBXML_XMDA_FILTER =

WEBXML filter for xmda actions

<<ENDMAP
  	<filter-mapping>
          <filter-name>XmdaFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
ENDMAP
STRUTS_SPRING_LISTENER =
<<END11
    <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <!-- Charge par le Struts Plugin -->
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
    </listener>
    <!-- end of spring section -->
END11
STRUTS_SESSION_TIMEOUT_IN_MINUTES_RES =
"server.session.timeout.minutes"
BPM_JPDL_DEPLOY_CLASS =
"xmda.jpdl.Deploy"
STRUTS_VALIDATOR_NAMES =

list of validator names defined

Array.new
STRUTS_RES_DIRECTORY =
"res"
STRUTS_ACTION_LOCALE_FORM =
"xmda.struts.ActionLocaleForm"
STRUTS_ACTION_LOCALE_PATH =
"/setLocale"
STRUTS_ACTION_LOCALE_URL =
"#{STRUTS_ACTION_LOCALE_PATH}.do"
STRUTS_DEFAULT_LOCALE =
"fr"
MESSAGE_RES_EN =
<<ENDEN
java.lang.Boolean.true=true
java.lang.Boolean.false=false
button.return=Back
button.delete=Erase
button.cancel=Cancel
button.confirm=Submit
button.reset=Reset
button.save=Save
button.validate=Validate
userMessage.deleteItem=_en :Are you sure that you want to delete this item ?
# Errors
errors.footer=
errors.header=<h3><font color="red">Validation error</font></h3>You should change the following error(s) before to continue :
errors.ioException=I/O exception during the error message : {0}
error.database.missing=<li>The users database is missing. Impossible to validate the connexion privileges.
errors.required={0} is required.
errors.minlength={0} can't have less than {1} character.
errors.maxlength={0} can't have more than {1} character.
errors.invalid={0} is invalid.

errors.byte={0} should be a byte number.
errors.short={0} should be a short number.
errors.integer={0} should be an integer number.
errors.long={0} should be a long number.
errors.float={0} should be a float number.
errors.double={0} should be a double number.

errors.date={0} isn't a date.

errors.range={0} isn't in the interval {1} to {2}.

errors.creditcard={0} isn't a valid credit card number.

errors.email={0} is an incorrect email address.

# Index Page
index.title=Struts Validator
index.power=Powered by Struts

# default Form
defaultForm.title=Type form
defaultForm.title.create=Create the form
defaultForm.byte.displayname=Byte field
defaultForm.short.displayname=Short field
defaultForm.integer.displayname=Integer field
defaultForm.long.displayname=Long field
defaultForm.float.displayname=Float field
defaultForm.floatRange.displayname=Float interval
defaultForm.double.displayname=Double field
defaultForm.date.displayname=Date field
defaultForm.creditCard.displayname=Credit card field
defaultForm.nested=Nested text
defaultForm.nested.name.displayname=Name
defaultForm.selectMessage = EN_Message_Generique
label.helper.cancel= cancel
label.helper.none=<i>there is no element to display.</i>
help.label=Field documentation:
ENDEN
MESSAGE_RES_DE =
<<ENDDE
java.lang.Boolean.true=richtige
java.lang.Boolean.false=unwahrheit
button.return=Back
button.delete=L�schen Sie
button.cancel=L�schen
button.confirm=Reichen Sie ein
button.reset=Zur�ckstellen
button.save=Au�er
button.validate=de_validate
userMessage.deleteItem=Sind Sie sicher, dass Sie l�schen wollen dieses Produkt ?

# Errors
errors.footer=
errors.header=<h3><font color="red">G�ltigkeitserkl�rungst�rung </font></h3>Sie sollten das folgende error(s) vorher �ndern, um fortzufahren :
errors.ioException=I/H Ausnahme w�hrend der Fehlermeldung : {0}
error.database.missing=<li>Die Benutzerdatenbank fehlt. Unm�glich, die Berechtigungen zu validieren..
errors.required={0} wird angefordert.
errors.minlength={0} {0} kann nicht kleiner als {1} Buchstabe haben.
errors.maxlength={0} kann nicht mehr als {1} Buchstabe haben.
errors.invalid={0} ist unzul�ssig.

errors.byte={0} sein sollte eine Bytezahl.
errors.short={0} sein sollte eine kurze Zahl.
errors.integer={0} sein sollte eine Ganzzahl Zahl.
errors.long={0} sein sollte eine lange Zahl.
errors.float={0} sein sollte eine Hin- und Herbewegung Zahl.
errors.double={0} sein sollte eine doppelte Zahl.

errors.date={0} nicht ist ein Datum.

errors.range={0} ist nicht im Abstand {1} {2}.

errors.creditcard={0} nicht ist eine g�ltige Kreditkarte Zahl.

errors.email={0} ist ein falsches email address.

# Index Page
index.title=Struts Validator
index.power=Vorbei Struts angetrieben

# default Form
defaultForm.title=Art Form
defaultForm.title.create=Verursachen Sie die Form
defaultForm.byte.displayname=Eine Byte Feld
defaultForm.short.displayname=Eine kurze Feld
defaultForm.integer.displayname=Eine Ganzzahl Feld
defaultForm.long.displayname=Eine lange Feld
defaultForm.float.displayname=Eine Hin- und Herbewegung Feld
defaultForm.floatRange.displayname=Eine Hin- und Herbewegung Abstand
defaultForm.double.displayname=Eine doppelte Feld
defaultForm.date.displayname=Datum Feld
defaultForm.creditCard.displayname=Kreditkarte Feld
defaultForm.nested=Genisteter Text
defaultForm.nested.name.displayname=Name
defaultForm.selectMessage = dl_Message_Generique
label.helper.cancel= dl_cancel
label.helper.none= dl:<i>il n'y a pas d'&eacute;l&eacute;�ment &agrave; afficher.</i>
help.label=Information sur le champs:
ENDEN
ENDDE
MESSAGE_RES_JA =
<<ENDJA
button.delete=Supprimer
button.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
button.confirm=\u78ba\u8a8d
button.reset=\u30ea\u30bb\u30c3\u30c8
button.save=\u4fdd\u5b58
button.validate=??
userMessage.deleteItem=-ja :Etes-vous s&ucirc;r(e) de vouloir supprimer cet Item ?
# Errors
errors.footer=
errors.header=<h3><font color="red">\u5165\u529b\u30c1\u30a7\u30c3\u30af\u30a8\u30e9\u30fc</font></h3>\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044:
errors.ioException=\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8 {0} \u306e\u51fa\u529b\u3067I/O\u4f8b\u5916\u304c\u767a\u751f\u3057\u307e\u3057\u305f
error.database.missing=<li>\u30e6\u30fc\u30b6\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002\u30ed\u30b0\u30aa\u30f3\u306e\u8a8d\u8a3c\u304c\u51fa\u6765\u307e\u305b\u3093\u3002</li>
errors.required={0} \u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002
errors.minlength={0} \u306f {1} \u6587\u5b57\u4ee5\u4e0a\u3067\u306a\u3051\u308c\u3070\u3044\u3051\u307e\u305b\u3093
errors.maxlength={0} \u306F {1} \u6587\u5B57\u4EE5\u4E0B\u3067\u306A\u3051\u308C\u3070\u306A\u308A\u307E\u305B\u3093\u3002
errors.invalid={0} \u306f\u6b63\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002

errors.byte={0} \u306fbyte\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.short={0} \u306fshort\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.integer={0} \u306finteger\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.long={0} \u306flong\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.float={0} \u306ffloat\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002
errors.double={0} \u306fdouble\u578b\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002

errors.date={0} \u306f\u65e5\u4ed8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002

errors.range={0} \u306f {1} \u304b\u3089 {2} \u306e\u9593\u3067\u306a\u3051\u308c\u3070\u306a\u308a\u307e\u305b\u3093\u3002

errors.creditcard={0} \u306F\u6B63\u3057\u3044\u30AF\u30EC\u30B8\u30C3\u30C8\u30FC\u30AB\u30FC\u30C9\u756A\u53F7\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002

errors.email={0} \u306F\u6B63\u3057\u3044\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002

# Index Page
index.title=Struts Validator
index.power=Powered by Struts

# Type form
defaultForm.name.displayname=String\u578B\u30D5\u30A3\u30FC\u30EB\u30C9
defaultForm.byte.displayname=Byte\u578b\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.checkbox.wouldrecommend=\u304A\u3059\u3059\u3081
defaultForm.checkbox.used.languages=\u5229\u7528\u30D7\u30ED\u30B0\u30E9\u30E0\u8A00\u8A9E
defaultForm.creditCard.displayname=\u30af\u30ec\u30b8\u30c3\u30c8\u30fc\u30ab\u30fc\u30c9\u756a\u53f7\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.date.displayname=\u65e5\u4ed8\u578b\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.description=\u30d7\u30ea\u30df\u30c6\u30a3\u30d6\u578b\u306e\u6570\u5b57\u3001integer\u306e\u7bc4\u56f2\u3001\u65e5\u4ed8\u3001\u304a\u3088\u3073\u30af\u30ec\u30b8\u30c3\u30c8\u30ab\u30fc\u30c9\u756a\u53f7\u306e\u5165\u529b\u30c1\u30a7\u30c3\u30af\u306e\u30b5\u30f3\u30d7\u30eb
defaultForm.double.displayname=Double\u578b\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.float.displayname=Float\u578b\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.floatRange.displayname=Float\u578b\u306e\u7bc4\u56f2\u30c1\u30a7\u30c3\u30af\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.integer.displayname=Integer\u578b\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.long.displayname=Long\u578b\u30d5\u30a3\u30fc\u30eb\u30c9
defaultForm.nested.name.displayname=\u540d\u524d
defaultForm.selectMessage = JA_Message_Generique
label.helper.cancel= cancel
label.helper.none= JA_NONE
help.label=jp:Information sur le champs:
ENDEN
# default Labels (from model):
ENDJA
MESSAGE_RES_FR =
<<END
# **************************************************
# DO NOT MODIFY THIS FILE (automatically generated)
# **************************************************
#
# To add custom labels, create a MessageResources_fr.properties file
#
# **************************************************
#
# Correct translations compliments of Regis Brochu
# Some fields have been added after Regis Brochu
# translated the file and may have incorrect translation.
java.lang.Boolean.true=vrai
java.lang.Boolean.false=faux
button.return=Retour
button.delete=Supprimer
button.cancel=Annuler
button.confirm=Soumettre
button.reset=Effacer
button.save=Sauvegarder
button.validate=Valider
userMessage.deleteItem=Etes-vous s&ucirc;r(e) de vouloir supprimer cet Item ?

# Errors
errors.footer=
errors.header=<h3><font color="red">Erreur de Validation</font></h3>Vous devez corriger l'erreur(s) suivante avant de continuer :
errors.ioException=Exception d'E/S durant le rendu des messages d'erreur: {0}
error.message=Nous sommes d&eacute;sol&eacute;s, une erreur technique est survenue.<br>L'&eacute;quipe technique met tout en oeuvre pour la corriger.
error.database.missing=<li>La base de donn&eacute;es des utilisateurs est manquante. Impossible de valider les privil&egrave;ges de connexion
errors.required={0} est obligatoire.
errors.minlength={0} ne peut pas &ecirc;tre moins de {1} caract&egrave;res.
errors.maxlength={0} ne peut pas &ecirc;tre plus de {1} caract&egrave;res.
errors.invalid={0} est invalide.

errors.byte={0} doit &ecirc;tre un nombre de type byte.
errors.string={0} doit &ecirc;tre un champ de type texte.
errors.short={0} doit &ecirc;tre un nombre de type short.
errors.integer={0} doit &ecirc;tre un nombre de type integer.
errors.long={0} doit &ecirc;tre un nombre de type long.
errors.float={0} doit &ecirc;tre un nombre de type float.
errors.double={0} doit &ecirc;tre un nombre de type double.

errors.date={0} n'est pas une date.

errors.range={0} n'est pas dans l'intervalle {1} &agrave; {2}.

errors.creditcard={0} n'est pas un num�ro de carte de cr&eacute;dit valide.

errors.email={0} est une adresse incorrecte de e-mail.

# Index Page
index.title=Struts Validator
index.power=Actionn� par Struts

# default Form
defaultForm.title=Formulaire de type
defaultForm.description=Exemple validant quelques nombres primitifs, un intervalle sur la zone de nombre entier, une date, et un nombre de carte de cr&eacute;dit.
defaultForm.title.create=Cr&eacute;er le formulaire
defaultForm.byte.displayname=Champ Octet
defaultForm.short.displayname=Champ Short
defaultForm.string.displayname=Champ Texte
defaultForm.integer.displayname=Champ Entier
defaultForm.long.displayname=Champ Long
defaultForm.float.displayname=Champ Float
defaultForm.floatRange.displayname=Champ Float l'intervalle
defaultForm.double.displayname=Champ Double
defaultForm.date.displayname=Champ Date
defaultForm.creditCard.displayname=Champ Carte de cr&eacute;dit
defaultForm.nested=Embo�t� Texte
defaultForm.nested.name.displayname=Nom
defaultForm.selectMessage = FR_Message_Generique
label.helper.cancel= cancel
label.helper.none= <i>il n'y a pas d'&eacute;l&eacute;ment &agrave; afficher.</i>
help.label=Information sur le champs:
END
MESSAGE_RES_ZU =
""

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#soa_IgnoreDataFilterObject

, [::Mrdf_Resource ]



278
279
280
# File 'lib/ontomde-java/java/component.rb', line 278

def soa_IgnoreDataFilter
  @soa_IgnoreDataFilter
end

Instance Method Details

#as_addFDSannotations!Object

adds Flex Data Services annotations



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/ontomde-java/flex/main.rb', line 202

def as_addFDSannotations!
	#must copy before transformation (hash modified runtime error)
	uml_Class_all.each {|c|
		next unless c.kind_of?(Muml_Class) || c.kind_of?(Muml_Interface)||c.kind_of?(Muml_Enumeration)

		next if c.kind_of?(Muml_Enumeration)

		if !c.kind_of?(Muml_Interface)
			c.as_annotation_add(%{[Managed]})
			c.as_annotation_add(%{[RemoteClass(alias="#{c.java_qualifiedName}")]})
		end

		#id persistence
		p=c.umlx_createAndAddProperty(c.rdf_uri+"_auto_id","id")
		#p.java_annotation_add("@Id")
		#p.java_annotation_add("@GeneratedValue")
		p.uml_type=p.umlx_owner_one.umlx_dataType_long
		p.uml_visibility=::Cuml_VisibilityKind::Private
	}
end

#as_addFormReference!Object



315
316
317
318
319
320
321
# File 'lib/ontomde-java/flex/main.rb', line 315

def as_addFormReference!
	uml_Class_all.each {|a|
		next if a.kind_of?(Muml_Interface)
		next if a.kind_of?(Muml_Enumeration)
		a.as_addFormReference!
	}
end

#as_FDS_generateConfigurationFileObject



223
224
225
226
227
# File 'lib/ontomde-java/flex/main.rb', line 223

def as_FDS_generateConfigurationFile
	mtk_writeSession("#{context[:build]}/data-management-config.xml") {
		as_FDS_writeConfigurationFile
	}
end

#as_FDS_write_GeneralConfItems(&block) ⇒ Object



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/ontomde-java/flex/main.rb', line 243

def as_FDS_write_GeneralConfItems(&block)
		write %{
<service id="data-service"
    class="flex.data.DataService"
    messageTypes="flex.data.messages.DataMessage">

    <adapters>
        <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/>
        <adapter-definition id="#{ACTIONSCRIPT_JAVA_ADAPTER_ID}" class="flex.data.adapters.JavaAdapter"/>
    </adapters>

     <default-channels>
        <channel ref="my-rtmp"/>
    </default-channels>
   }

   yield

   write( "</service>\n" )
end

#as_FDS_writeConfigurationFileObject

writes Flex Data Services configuration file



230
231
232
233
234
235
236
237
238
# File 'lib/ontomde-java/flex/main.rb', line 230

def as_FDS_writeConfigurationFile
	write %{<?xml version="1.0" encoding="UTF-8"?>\n}
	as_FDS_write_GeneralConfItems {
		uml_Class_all.each {|c|
			next if c.kind_of?(Muml_Interface)
			next if c.kind_of?(Muml_Enumeration)
			c.as_FDS_writeConfiguration
	}}
end

#bpm_addPingNode!Object

adds ping node to all process in model (feature used for process deployement test)



39
40
41
42
43
# File 'lib/ontomde-java/jpdl/main.rb', line 39

def bpm_addPingNode!
  bpm_allProcess.each { |c|
    c.bpm_addPingNode!
  }
end

#bpm_allProcess(ret = Array.new) ⇒ Object



45
46
47
48
49
50
# File 'lib/ontomde-java/jpdl/main.rb', line 45

def bpm_allProcess(ret=Array.new)
  self.each { |k,c|
    ret<< c if c.kind_of?(Mbpm_process)
  }
  return ret
end

#bpm_dumpJPDLObject



4
5
6
7
8
9
# File 'lib/ontomde-java/jpdl/jpdl.rb', line 4

def bpm_dumpJPDL
  bpm_allProcess.each { |c|
    puts ""
    puts "#{mtk_stss{c.bpm_writeJPDL}}"
  }
end

#bpm_genJPDLDeployObject

Generates a JPDL deployer as a JUNIT class Junit provides easy diagnostic an a convenient GUI



8
9
10
11
# File 'lib/ontomde-java/jpdl/jpdl_deploy.rb', line 8

def bpm_genJPDLDeploy
  bpm_allProcess.each { |c|
  }
end

#bpm_graphGen_dotObject



2
3
4
5
6
# File 'lib/ontomde-java/jpdl/graphic.rb', line 2

def bpm_graphGen_dot
  bpm_allProcess { |res|
    res.bpm_graphGen_dot
  }
end

#bpm_handleProcessMethods!Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/ontomde-java/jpdl/processOperationToClass.rb', line 19

def bpm_handleProcessMethods!
  #return unless context[:withGenerateMethodForm]
  uml_Class_all.each { |c|
    next unless c.kind_of?(Muml_Class)
    c.uml_ownedOperation.each {|biz|
      next unless biz.kind_of?(Muml_Operation)
      #next unless biz.umlx_businessMethod?

      next if biz.umlx_isConstructor?
      bpm_processMethods(c, biz) if biz.umlx_hasStereotype?("Process")
      c.bpm_asyncMethods(biz) if biz.umlx_hasStereotype?("Async")
      c.bpm_callbackMethods(biz) if biz.umlx_hasStereotype?("Callback")
    }}
end

#bpm_loadBPMObject

loads bpm meta-model from protege/2000 DSL model.

You can browse bpm meta-model with protege/2000 using bpm.pprj protege/2000 project in this file directory.



19
20
21
# File 'lib/ontomde-java/jpdl/main.rb', line 19

def bpm_loadBPM
  loadMetaModelFromFile("#{File.dirname(__FILE__)}/bpm.rdfs",true)
end

#bpm_loadJPDL(fileNameJPDL) ⇒ Object

Load a BPM from a JPDL XML file



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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/ontomde-java/jpdl/jpdl.rb', line 16

def bpm_loadJPDL(fileNameJPDL)
  nameHash=Hash.new
  file = File.new( fileNameJPDL)
  doc = REXML::Document.new file
  i=0
  pname=doc.elements["/process-definition"].attribute("name").to_s
  #puts "pname=#{pname}"

  if (pname.nil? || pname=="")
    log.error { %{Error detected
********* PROCESS WITHOUT NAME ****************
This software has detected that process stored
in file #{fileNameJPDL} has a blank name.
********* PROCESS WITHOUT NAME ****************
      }}

    exit 1
  end


  pr=Cbpm_process.new(self,"#{pname}_#{i}")
  #Le nom du process peut contenir le type de retour du process
  pnames = pname.split('|')
  pr.bpm_processName=pnames[0]
  puts "Process Name #{pr.bpm_processName}"
  if pnames.length > 1
    pr.bpm_processReturnType = pnames[1]
  end

  doc.elements.each("/process-definition/*") { |elt|
    # t is the XML node name() which is the type of the node
    nodeType=elt.elements["name()"].to_s
    i=i+1 ; obj=nil
    name=elt.attribute("name").to_s
    node_uri="node_#{pname}_#{name}"

    if (name.nil? || name=="")
      log.error { %{Error detected
********* PROCESS WITHOUT NAME ****************
This software has detected that process stored
in file #{fileNameJPDL} has a blank name.
********* PROCESS WITHOUT NAME ****************
        }}

      exit 1
    end
    if nodeType==Cbpm_forkNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_forkNode.new(self,node_uri)
    elsif nodeType==Cbpm_joinNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_joinNode.new(self,node_uri)
    elsif nodeType==Cbpm_endNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_endNode.new(self,node_uri)
    elsif nodeType==Cbpm_startNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_startNode.new(self,node_uri)
    elsif nodeType==Cbpm_synchronousDecisionNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_synchronousDecisionNode.new(self,node_uri)
    elsif nodeType==Cbpm_synchronousNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_synchronousNode.new(self,node_uri)
    elsif nodeType==Cbpm_asynchronousNode::BPM_JPDL_TYPE_NAME
      obj=Cbpm_asynchronousNode.new(self,node_uri)
      #elsif #TODO: asynchronous decision node
    else
      throw Exception.new("unknown jpdl node type '#{nodeType}' for process #{pr.bpm_processName} in file #{fileNameJPDL}")
    end

    # this node is part of pr process
    pr.bpm_processNode_add(obj)

    if obj.kind_of?(Mbpm_named_Node)
      obj.bpm_nodeName=name
    end
    nameHash[name]=obj
  }

  timerHash=Hash.new

  doc.elements.each("//timer") { |elt|
    from=nameHash[elt.elements[".."].attribute("name").to_s]
    #Le nom du timer est en fait le nom de la transition de sortie du timer
    puts "Timer found:#{elt} "
    name=elt.attribute("transition")

    tr=Cbpm_timeOutTransition.new(self,"tr_#{pname}_#{name}")
    tr.bpm_transitionName=name.to_s
    from.bpm_leavingTransition_add(tr)

    #Gestion du temps
    jpdlDuration = "#{elt.attribute("duration")}"
    jpdlSplit = jpdlDuration.split(" ")
    tr.bpm_timeOutDuration=jpdlSplit[0]
    tr.bpm_timeOutUnit=jpdlSplit[jpdlSplit.length - 1]
    tr.bpm_timeOutIsBusinessDuration=RDF_FALSE
    jpdlSplit.each { |element|
      if "business"==element
        tr.bpm_timeOutIsBusinessDuration=RDF_TRUE
        break
      end
    }

    timerHash["#{name}"]=tr
  }

  doc.elements.each("//transition") { |elt|
    from=nameHash[elt.elements[".."].attribute("name").to_s]
    to=nameHash[elt.attribute("to").to_s]
    name=elt.attribute("name")

    #On regarde si la transition porte le m�me nom que la transition du timer
    tr = timerHash["#{name}"]
    if tr.nil?
      # Ce n'est pas une transition de timer
      tr=Cbpm_transition.new(self,"tr_#{pname}_#{name}")
      tr.bpm_transitionName=name.to_s
      from.bpm_leavingTransition_add(tr)
    end
    #On rajoute dans tous les cas le noeud de sortie
    tr.bpm_destinationNode=to
  }
end

#bpm_processMethods(c, biz) ⇒ Object



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
# File 'lib/ontomde-java/jpdl/processOperationToClass.rb', line 35

def bpm_processMethods(c, biz)

  p=c.umlx_package
  if p.nil?
    log.error{"Model modification required !!! class #{c} is in root model element. Classes should be in a package."}
    next
  end
  #Type de retour dans le mod�le
  initialReturnParam = biz.uml_getReturnParameter
  mpc=java_getClassWithQualifiedName("#{c.umlx_owner_one.java_qualifiedName}.#{biz.java_Name}")
  mpc=p.umlx_createAndAddClass(biz.rdf_uri+"_proc") if mpc.nil?
  mpc.umlx_businessMethod=RDF_TRUE
  mpc.bpm_addAllOperationAggregateParameterClass!(biz)
  code=%{ #{mpc.java_qualifiedName} proc=new #{mpc.java_qualifiedName}();}
  biz.uml_ownedParameter.each { |param|
    code=code+"proc.set#{param.java_NameBean}(#{param.java_Name});\n"
  }

  #Set the right Return Type on the Process
  #If already specified in the Process definition, not overhide
  #find the corresponding process
  self.each { |k,p|
    next if !p.kind_of?(Mbpm_process)
    if "#{p.bpm_processName}" == "#{mpc.java_qualifiedName}"
      # bpm_processReturnType is a string
      p.bpm_processReturnType = initialReturnParam.uml_type.to_s if !initialReturnParam.nil? && p.bpm_processReturnType_one0.nil?
      break
    end
  }

  #If return set handler
  code_getCallBackMethod = ""
  if !initialReturnParam.nil?
    c.bpm_manageAsynchronousMethods(biz)
    code_getCallBackMethod = "handler"
  end


  #Modifiy the code of the method to manage the asynchronous
  code=code+"proc.persist();proc.startAsynchronously(#{code_getCallBackMethod});\n"
  biz.java_code=code

  #Ajoute un champ calcule pour la visualization de la console
  console=mpc.umlx_createAndAddProperty(mpc.rdf_uri+"_console","console")
  console.uml_isDerived=RDF_TRUE
  console.uml_type=mpc.umlx_getOrCreateDataType("URL")
  mpc.java_addAccessorsFor!(console)
  getter = console.java_AttributeGlobalGetter
  getter[0].java_code = <<END_OF_STRING
  if (this.getProcessId() != null) {
      return "/ontomde-bpm-console/processimage?id=" + this.getProcessId();
  } else {
      return "#";
  }
END_OF_STRING


  #    biz.uml_appliedStereotype.each {|s|
  #      #TODO: utiliser processImpl
  #      puts "add stereotype #{s} to #{mpc}::#{mpc.class}"
  #      mpc.uml_appliedStereotype_add(s)
  #    }

end

#bpm_transform!Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ontomde-java/jpdl/main.rb', line 23

def bpm_transform!
  #mtk_writeSession("bpm.log") {
  s=Array.new
  each { |k,res|
    next unless res.kind_of?(Mbpm_process)
    s << res
  }
  s.each { |res|
    res.bpm_transform!
  }
  #bpm_dumpJPDL
  bpm_genJPDLDeploy
end

#crank_faces_crankbeanObject



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
# File 'lib/ontomde-java/crank/facesconfig.rb', line 76

def crank_faces_crankbean   
  eachCrankBean.each { |c|
  write <<BEAN
<navigation-rule>
  <navigation-case>
    <from-outcome>#{c.java_Name.upcase}</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Listing.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>

<navigation-rule>
  <navigation-case>
    <from-outcome>#{c.java_Name.upcase}_FORM</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Form.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>

BEAN
if !context[:crankXmdaNav]
    write <<BEAN
<navigation-rule>
  <from-view-id>/pages/crud/#{c.java_Name}/*</from-view-id>
  <navigation-case>
    <from-outcome>LISTING</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Listing.xhtml</to-view-id>
  </navigation-case>
  <navigation-case>
    <from-outcome>FORM</from-outcome>
    <to-view-id>/pages/crud/#{c.java_Name}/Form.xhtml</to-view-id>
  </navigation-case>    
</navigation-rule>

BEAN
  end
  }
end


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ontomde-java/crank/facesconfig.rb', line 54

def crank_faces_footer
    if context[:crankXmdaNav]    
      write <<END
      <navigation-rule>
    <from-view-id>/pages/crud/*</from-view-id>
    <navigation-case>
      <from-outcome>LISTING</from-outcome>
      <to-view-id>\#{%sCrudProxy.crudViewHandler.calculateListingViewId}</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>FORM</from-outcome>
      <to-view-id>\#{%sCrudProxy.crudViewHandler.calculateFormViewId}</to-view-id>
    </navigation-case>    
  </navigation-rule>    
END
    end
    write <<END

</faces-config>
END
end

#crank_faces_headerObject



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
# File 'lib/ontomde-java/crank/facesconfig.rb', line 7

def crank_faces_header
  write <<END
<?xml version="1.0"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
  version="1.2">

<!-- 
<lifecycle>
  <phase-listener>org.crank.jsf.support.DebugPhaseListener</phase-listener>
</lifecycle>
 -->
  
<application>
  <action-listener>org.crank.crud.jsf.support.JsfMessageActionListener</action-listener>
  <variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
  <message-bundle>messages</message-bundle>
</application>

<!-- 
<component>
  <component-type>org.crank.javax.faces.SelectOne</component-type>
  <component-class>org.crank.javax.faces.component.UISelectOne</component-class>
</component>
<render-kit>
    <renderer>
    <component-family>javax.faces.SelectOne</component-family>
    <renderer-type>org.crank.javax.faces.Listbox</renderer-type>
    <renderer-class>
    org.crank.javax.faces.component.ListboxRenderer
    </renderer-class>
  </renderer>

</render-kit>
 -->

<navigation-rule>
  <navigation-case>
    <from-outcome>HOME</from-outcome>
    <to-view-id>/pages/Home.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>
END
end

#crank_generate_contextObject



34
35
36
# File 'lib/ontomde-java/crank/main.rb', line 34

def crank_generate_context
  crank_generate_dao
end

#crank_generate_daoObject



60
61
62
63
64
65
66
67
# File 'lib/ontomde-java/crank/main.rb', line 60

def crank_generate_dao
  mtk_writeSession("#{context[:jpaConfigDir]}/dao-beans.xml") {
    crank_jpadao_header
    crank_jpadao_crankbean  
    crank_jpadao_footer
  }

end

#crank_generate_faceletsObject



40
41
42
# File 'lib/ontomde-java/crank/main.rb', line 40

def crank_generate_facelets
  
end

#crank_generate_facesconfigObject



52
53
54
55
56
57
58
# File 'lib/ontomde-java/crank/main.rb', line 52

def crank_generate_facesconfig
#    mtk_writeSession("#{context[:webContentDir]}/WEB-INF/faces-config.xml") {
#      crank_faces_header
#      crank_faces_crankbean  
#      crank_faces_footer
#    }
end

#crank_generate_ForEachBeanObject



16
17
18
19
20
21
22
23
# File 'lib/ontomde-java/crank/main.rb', line 16

def crank_generate_ForEachBean
#    crank_generate_facesconfig
#    crank_generate_home
#    eachCrankBean.each { |c|
#      c.crank_generate_listing
#      c.crank_generate_form
#    }
end

#crank_generate_ForEachBeanAfterTransformObject

Called after java transformation



26
27
28
29
30
31
32
# File 'lib/ontomde-java/crank/main.rb', line 26

def crank_generate_ForEachBeanAfterTransform
#    umlx_reserved_model.crank_generate_context
#    eachCrankBean.each { |c|
#      c.crank_generate_validation
#      c.java_generate_equalsAndHash
#    }
end

#crank_generate_homeObject



44
45
46
47
48
49
50
# File 'lib/ontomde-java/crank/main.rb', line 44

def crank_generate_home
#    mtk_writeSession("#{context[:webContentDir]}/pages/Menu.xhtml") {
#      crank_home_header
#      crank_home_crankbean  
#      crank_home_footer
#    }
end

#crank_generate_validationObject



37
38
39
# File 'lib/ontomde-java/crank/main.rb', line 37

def crank_generate_validation
  
end

#crank_home_crankbeanObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ontomde-java/crank/menu2.rb', line 29

def crank_home_crankbean
  pkg=Hash.new
  eachCrankBean.each {|c|
    p=c.uml_ownedMember_inv_one
    pkg[p]=Array.new if pkg[p].nil?
    pkg[p] << c
  }
  pkg.keys.sort {|a,b| a.uml_name.to_s <=> b.uml_name.to_s }.each { |p|
    write <<BEAN
     <rich:panelMenuGroup label="#{p.java_qualifiedName}" iconExpanded="triangleDown" iconCollapsed="triangleUp">
BEAN
    clazz = pkg[p].sort { |a,b| a.uml_name.to_s <=> b.uml_name.to_s }
    clazz.each {|c|
      c.crank_class_submenu if c.crank_isTopCrankBean        
    }
    write <<BEAN
     </rich:panelMenuGroup>
BEAN
  }    
end


21
22
23
24
25
26
27
# File 'lib/ontomde-java/crank/menu2.rb', line 21

def crank_home_footer
   write <<FOOTER
 </rich:panelMenu>     
</h:form>
</ui:composition>
FOOTER
end

#crank_home_headerObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ontomde-java/crank/menu2.rb', line 5

def crank_home_header
  write <<END
<ui:composition   xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:crank="http://www.googlecode.com/crank"
>
<h:form>
 <rich:panelMenu>
END
end

#css_color_classObject



28
29
30
# File 'lib/ontomde-java/struts/header_link.rb', line 28

def css_color_class
  return  "orange"
end

#css_path_modelObject



24
25
26
# File 'lib/ontomde-java/struts/header_link.rb', line 24

def css_path_model
  return  "#{STRUTS_RES_DIRECTORY}/"
end

#db_addDAO!Object



84
85
86
87
88
# File 'lib/ontomde-java/jpa/jpa.rb', line 84

def db_addDAO!
  db_Class_persistent.each { |c|
    c.jpa_addDAO!
  }
end

#db_addPersistence!Object



32
33
34
# File 'lib/ontomde-java/jpa/jpa.rb', line 32

def db_addPersistence!
  jpa_addPersistence!
end

#db_addTestImplementations!Object



7
8
9
# File 'lib/ontomde-java/jpa/simulationAutoImplement.rb', line 7

def db_addTestImplementations!
  jpa_addTestImplementations!
end

#db_Class_persistentObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ontomde-java/jpa/jpa.rb', line 35

def db_Class_persistent
  ret=Set.new
  uml_Class_all.each { |c|
    next if c.kind_of?(Muml_Interface) || c.kind_of?(Muml_Enumeration)
    next unless c.kind_of?(Muml_Class)
    if c.umlx_hasStereotype?('DTO')
      c.db_isTransient=RDF_TRUE
    elsif context[:db_useStereotypeMarker,false]
      c.db_isTransient=((c.umlx_hasStereotype?(context[:db_persistentStereotype,'Persistent'])) ? RDF_FALSE : RDF_TRUE)
    end
    next if c.db_isTransient?
    if c.umlx_package.nil?
      log.error("no package for #{c}::#{c.class.name} #{c.rdf_uri}. Skipping addPersistence!")
      next
    end
    ret<< c
  }
  return ret
end

#db_findNameUsingDB_URI_ALIAS(k) ⇒ Object



179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/ontomde-java/jpa/jpa.rb', line 179

def db_findNameUsingDB_URI_ALIAS(k)
  n="-- key not found for #{k}--"
  if self[k].nil?
    # an uri present in old file no longer exists
    ::Muml_Class::DB_URI_ALIAS.each {|key,v|
      n=key if v==k
    }
  else
    n=self[k].java_qualifiedName
  end
  return n
end

#db_generateConfigurationObject

Generates persistence configuration file



23
24
25
# File 'lib/ontomde-java/jpa/configuration.rb', line 23

def db_generateConfiguration
  jpa_generateConfiguration
end

#db_saveDB_DISCRIMINATORObject



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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/ontomde-java/jpa/jpa.rb', line 192

def db_saveDB_DISCRIMINATOR
  return unless context[:dbTypeDiscriminator]==:int
  mtk_writeSession("#{context[:dbDiscriminatorCacheRelFile]}") {
    write <<END
# saved discriminator numbers
# This file is read and rewritten by generator
def declarePredefinedDiscrimators()
# first parameter is java qualified class name
# second parameter is the identifier used in database
#    when different java type are stored in a
#    single table and need to be differenciated.
END
    ::Muml_Class::DB_DISCRIMINATOR.sort{|a,b| a[1]<=>b[1]}.each { |k|
      n=db_findNameUsingDB_URI_ALIAS(k[0])
      write(%{  db_disc("#{n}",#{k[1]})\n})
    }
    write("end\n")
    write <<END
# ###########################
# END OF USER MODIFIABLE ZONE
# ###########################



# Conversion to model URI
def db_disc(k,v)
	::Muml_Class::DB_DISCRIMINATOR[::Muml_Class::DB_URI_ALIAS[k]]=v
end
END

[false,true].each { |exists|
write(!exists ? "# Saved Element From History\n" : "# Current elements\n")

write <<END
::Muml_Class::DB_URI_ALIAS.merge!({
END
    ::Muml_Class::DB_DISCRIMINATOR.sort{|a,b| a[0]<=>b[0]}.each { |k|
      n=db_findNameUsingDB_URI_ALIAS(k[0])
      write("  %{#{n}} => %{#{k[0]}} ,\n") if self[k[0]].nil?!=exists
    }
    write("})\n")
}

    write <<END
declarePredefinedDiscrimators();
#free ressources
def declarePredefinedDiscrimators()
end
END
  }

end

#dto_addFilter!(typedElement, filterName) ⇒ Object



309
310
311
312
313
314
315
316
# File 'lib/ontomde-java/java/component.rb', line 309

def dto_addFilter!(typedElement, filterName)
  data_model=self[:dataModel]
  filter=dto_findFilterByName(filterName)
  
  dpfr=Csoa_dataParameterFilterRule(data_model,"#{typeElement}_filter")
  dpfr.soa_filteredProperty=typedElement
  dpfr.soa_useDataFilter=filter
end

#dto_autoPopulate!Object

automatically add missing predefined mappings to repository.



283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/ontomde-java/java/component.rb', line 283

def dto_autoPopulate!
  data_model=self[:dataModel]
  found=Set.new
  data_model.each_value { |rule|
    next unless rule.kind_of?(Msoa_predefinedDataFilter)
    found.add(rule.soa_dataFilterName.to_s)
  }
  ["FULL","ID","debug","INCLUDE"].each {|s|
    next if found.include?(s)
    #puts "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ creating #{s}"
    pdf=Csoa_predefinedDataFilter.new(data_model,"predefinedDataFilter:#{s}")
    pdf.soa_dataFilterName=s
  }
end

#dto_findFilterByName(filterName) ⇒ Object

Raises:

  • (Exception)


298
299
300
301
302
303
304
305
306
307
# File 'lib/ontomde-java/java/component.rb', line 298

def dto_findFilterByName(filterName)
  data_model=self[:dataModel]
  data_model.each_value { |rule|
    next unless rule.kind_of?(Msoa_dataFilter)
    next unless rule.soa_dataFilterName.to_s==filterName
    return rule
  }
  return soa_getPredefinedDataFilter(filterName) if ["IGNORE","FULL","ID"].include?(filterName) 
  raise Exception.new("soa filter not found with name='#{filterName}'")
end

#dto_forceDTO_generation!(data_model) ⇒ Object



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/ontomde-java/java/component.rb', line 165

def dto_forceDTO_generation!(data_model)
  cdfs=Set.new
  data_model.each { |k,v|
    next unless v.kind_of?(Msoa_customDataFilter)
    cdfs.add(v)
  }
  
  uml_Class_all.each { |c|
    next unless c.kind_of?(Muml_Class)
    next if c.umlx_hasStereotype?('DTO')
    next if c.db_isDAO?
    next unless c.umlx_businessMethod?
    
    cdfs.each { |v|
      #next unless v.kind_of?(Msoa_customDataFilter)
      #puts "v --> #{v.class}"
      #force filtered class generation
      v.dto_getFilteredClass(c)
    }
  }
end

#dto_generateCustomDTO_step1Object

process filter rules from protege/2000



188
189
190
191
192
193
194
195
196
# File 'lib/ontomde-java/java/component.rb', line 188

def dto_generateCustomDTO_step1()
  data_model=self[:dataModel]
  return if data_model.nil?

  dto_autoPopulate!
  dto_forceDTO_generation!(data_model)
  dto_processParameterFilterRule!(data_model)
  dto_processServiceParametersNoRule!(data_model)
end

#dto_generateCustomDTO_step2Object



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/ontomde-java/java/component.rb', line 260

def dto_generateCustomDTO_step2()
  data_model=self[:dataModel]
  return if data_model.nil?
  
  each_value { |prop_uml|
    next unless prop_uml.kind_of?(Muml_TypedElement)
    next if prop_uml.soa_requestedMode.empty?
    
    filter=dto_findFilterByName(prop_uml.soa_requestedMode.to_s)
    fc_uml=filter.dto_getFilteredClass(prop_uml.uml_type_one)
#      puts "!!!@@@!!! soa_requestedMode : #{prop_uml.soa_requestedMode} --> #{filter}"
    puts "#{__LINE__} changing #{prop_uml.uml_type} to #{fc_uml}"
    prop_uml.uml_type=fc_uml
  }
  
  
  
end

#dto_processParameterFilterRule!(data_model) ⇒ Object



232
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
# File 'lib/ontomde-java/java/component.rb', line 232

def dto_processParameterFilterRule!(data_model)
  s=Set.new
  data_model.each_value { |rule|
    next unless rule.kind_of?(Msoa_dataParameterFilterRule)
    if rule.soa_filteredProperty.empty? || rule.soa_useDataFilter.empty?
puts "WARNING: ignored incomplete filteredProperty" 
next
    end
    #next unless rule.kind_of?(Msoa_dataFilterRule)
    s.add(rule)
  }
  s.each{|rule|
#      puts "°°°°°Processing filter #{rule}"
#      puts "??? #{rule.soa_filteredProperty_one}"
#      puts "??? #{rule.soa_useDataFilter_one}"
#      
    prop=rule.soa_filteredProperty_one
    prop_uml=self[prop.rdf_uri]
    puts "prop_uml: #{prop_uml}:#{prop_uml.class}"
    filter=rule.soa_useDataFilter_one
    fc_uml=filter.dto_getFilteredClass(prop_uml.uml_type_one)
#      puts "fc_uml: #{fc_uml}:#{fc_uml.class}"
    
    # Replacing core type by filtered type
    puts "#{__LINE__} changing #{prop_uml.uml_type} to #{fc_uml} in #{prop_uml} #{prop_uml.rdf_uri}"
    prop_uml.uml_type=fc_uml
  }
end

#dto_processServiceParametersNoRule!(data_model) ⇒ Object

For every class stereotyped DTO, replace non DTO class by their DTO correspondant.



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/ontomde-java/java/component.rb', line 200

def dto_processServiceParametersNoRule!(data_model)
    filter_id=dto_findFilterByName("ID")

    uml_Class_all.each { |clazz|
	    #next unless  clazz.
	    next unless clazz.umlx_hasStereotype?('DTO')
	    puts "AAAAA #{clazz.class}  #{clazz}"
            dto_ReplaceAllParametersByDTO!(clazz,filter_id)
    }
    uml_Component_all.each { |clazz|
	    #next unless clazz.umlx_hasStereotype?('DTO')
	    puts "AAAAA #{clazz.class}  #{clazz}"
            dto_ReplaceAllParametersByDTO!(clazz,filter_id)
    }
end

#dto_ReplaceAllParametersByDTO!(clazz, filter_id) ⇒ Object



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/ontomde-java/java/component.rb', line 216

def dto_ReplaceAllParametersByDTO!(clazz,filter_id)
    clazz.uml_ownedOperation.each { |op|
	        (op.uml_returnResult+op.uml_ownedParameter).each { |param| 
			
			# element has already have been processed by a filter rule
			# or it is already a DTO in source UML model
			next if param.uml_type_one.db_isDAO?

			nt=filter_id.dto_getFilteredClass(param.uml_type_one)
			next if nt==param.uml_type_one
			puts "changing type #{param.uml_type} -> #{nt} in #{clazz}/#{param}"
			param.uml_type=nt
		}
    }
end

#eachCrankBean(ret = Set.new) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/ontomde-java/crank/main.rb', line 3

def eachCrankBean(ret=Set.new)
  uml_Class_all.each { |c|
    next if c.kind_of?(Muml_Enumeration)
    next if c.kind_of?(Muml_Interface)
    next if c.java_ignoreMe?
    next if c.db_isTransient?
#      next if c.uml_isAbstract?
    ret.add(c)
  }
  return ret.sort{ |a,b| a <=> b}
end

#eachStrutsBeanObject



44
45
46
47
48
49
50
51
# File 'lib/ontomde-java/struts/jsp_edit.rb', line 44

def eachStrutsBean
  uml_Class_all.each { |c|
    next if c.kind_of?(Muml_Enumeration)
    next if c.kind_of?(Muml_Interface)
    next if c.java_ignoreMe?
    yield(c)
  }
end

#eachStrutsFormsetObject



53
54
55
56
57
58
59
60
# File 'lib/ontomde-java/struts/jsp_edit.rb', line 53

def eachStrutsFormset
  uml_Class_all.each { |c|
    next if c.kind_of?(Muml_Enumeration)
    next if c.kind_of?(Muml_Interface)
    next if c.java_ignoreMe?
    yield(c)
  }
end

#flex_generateImportationASObject

EXAMPLE // ActionScript file import src.package1.Adresse; import src.package1.AdresseType2; import src.package1.AdresseType1; import src.package1.Session; import src.package1.Client; import src.package1.Contrat; import src.package1.methods.ClientajoutRapideContratMPC;

cpForm:AdresseType1; cpForm:AdresseType2; cpForm:Adresse; cpForm:ClientajoutRapideContratMPC; cpForm:Contrat; cpForm:Client; cpForm:Session;



24
25
26
27
28
# File 'lib/ontomde-java/flex/ImportationAS.rb', line 24

def  flex_generateImportationAS
	mtk_writeSession("#{context[:javaDir]}/importation.as"){
		flex_writeImportationAS
	}
end

#flex_generateMXMLObject



4
5
6
7
8
9
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 4

def flex_generateMXML
	eachStrutsBean { |b|
		next if b.struts_actionForm.empty?
		b.flex_generateMXML
	}
end

#flex_generateVOObject



3
4
5
6
7
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 3

def flex_generateVO
	struts_viewableClassifier(false).each { |b|
		b.flex_generateVO
	}
end

#flex_writeImportationASObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ontomde-java/flex/ImportationAS.rb', line 29

def  flex_writeImportationAS
	write("// Action Script file used to force inclusion of view into .swf\n")
	struts_viewableClassifier(true).each { |b|
		write("import #{Muml_Class::FLEX_NS_PREFIX}#{b.java_qualifiedName};\n")
	}
	write("\n//force inclusion of class in .swf by creating dummy instances\n")
	struts_viewableClassifier(true).each { |b|
		write("cpForm:#{b.java_Name};\n")
	}
	write("// eof \n")
end

#java_addContextJavaFilePathMapping(qualifiedNameRegexp, relativePath) ⇒ Object

Example java_addJavaFilePathMapping(/.example/,“src/main/example/” ]) TODO: add helping error if jfp.nil?



107
108
109
110
# File 'lib/ontomde-java/java/java.rb', line 107

def java_addContextJavaFilePathMapping(qualifiedNameRegexp,relativePath)
  jfp=context[:javaFilePathRegexp]
  jfp[qualifiedNameRegexp,relativePath]
end

#java_addEnumAssignable!Object

adds enum for all assignable class types.

Reference: #uml_Class_all



25
26
27
28
29
30
31
# File 'lib/ontomde-java/java/enumAssignable.rb', line 25

def java_addEnumAssignable!
	uml_Class_all.each {|c|
		next if c.kind_of?(Muml_Enumeration)
		next if c.umlx_external?
		c.java_addEnumAssignable!
	}
end

#java_addEnumCompatibilityLayerMethods!Object

adds enum compatibility properties which exposes property of enum type to be accessed trough string accessors.

Reference: #uml_Class_all, #java_addEnumCompatibilityLayerProperties!, #java_addEnumPostDeserialiseUpdate!



23
24
25
26
27
28
# File 'lib/ontomde-java/java/enumCompatibilityLayer.rb', line 23

def java_addEnumCompatibilityLayerMethods!
  uml_Class_all.each {|c|
    next unless c.kind_of?(Muml_Class)
    c.java_addEnumPostDeserialiseUpdate!
  }
end

#java_addEnumCompatibilityLayerProperties!Object

adds enum compatibility properties which exposes property of enum type to be accessed trough string accessors.

Reference: #uml_Class_all, #java_addEnumStringAttribute!, #java_addEnumCompatibilityLayerMethods!



11
12
13
14
15
16
17
18
# File 'lib/ontomde-java/java/enumCompatibilityLayer.rb', line 11

def java_addEnumCompatibilityLayerProperties!
  uml_Class_all.each {|c|
    next unless c.kind_of?(Muml_Class)
    c.uml_ownedAttribute.each {|e|
      e.java_addEnumStringAttribute!
    }
  }
end

#java_addJavaAnnotationOntoMDE!Object



9
10
11
12
13
# File 'lib/ontomde-java/java/annotationOntoMDE.rb', line 9

def java_addJavaAnnotationOntoMDE!
  uml_Class_all.each {|c|
    c.java_getJavaAnnotationOntoMDE
  }
end

#java_addJavaEnumInterface!Object

Reference: #uml_Class_all,



13
14
15
16
17
18
19
20
# File 'lib/ontomde-java/java/enumAssignable.rb', line 13

def java_addJavaEnumInterface!
	return unless context[:java_addJavaEnumInterface]
	uml_Class_all.each {|c|
		next unless c.kind_of?(Muml_Enumeration)
		i=c.java_getJavaEnumInterface
		c.umlx_createAndAddImplementation(i)
	}
end

#java_addTenantClass!Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ontomde-java/java/tenant.rb', line 24

def java_addTenantClass!   
  # look in model for an existing class stereotyped "tenant"
  tenant=java_getTenantClass
  
  # fields should be provided by model
  return tenant unless tenant.nil?
  
  # no tenant class found in model. we will create one.
  tenant=umlx_reserved_model.umlx_getOrCreateClass(TENANT_DEFAULT_CLASS_QUALIFIED_NAME)
  f=tenant.umlx_createAndAddProperty(tenant.rdf_uri+"_tname","tenant Name")
  f.uml_type=tenant.umlx_owner_one.umlx_dataType_string
  tenant.umlx_external=RDF_FALSE
  tenant.db_isTransient=RDF_FALSE
  
  tenant.uml_appliedStereotype_add(tenant.umlx_getOrCreateStereotype(TENANT_STEREOTYPE_NAME))
  return tenant
end

#java_addTenantFields!Object



42
43
44
45
46
47
48
49
# File 'lib/ontomde-java/java/tenant.rb', line 42

def java_addTenantFields!
  tenant=java_addTenantClass!
  uml_Class_all.each { |c|
    next if c.kind_of?(Muml_Interface)
    next unless c.uml_generalization.empty?
    c.java_addTenantField!(tenant)
  }
end

#java_autoGenerateCrudComponents!Object

process every component



5
6
7
8
9
10
# File 'lib/ontomde-java/java/component.rb', line 5

def java_autoGenerateCrudComponents!
  uml_Class_all.each { |c|
    next unless c.kind_of?(Cuml_Class)
    c.java_createCrudComponent!
  }
end

#java_ClassRelativeDirObject

returns directory containing compiled java classes and other ressources in classpath.



16
17
18
19
20
21
22
# File 'lib/ontomde-java/java/build.rb', line 16

def java_ClassRelativeDir
	p="#{context[:javaDir]}"
	p="#{context[:webContentRelativeDir,p]}"
	p="#{p}/WEB-INF/classes"
	p="#{context[:javaClassDir,p]}"
	return p
end

#java_contextualizeStaticProperties!Object



6
7
8
9
10
11
# File 'lib/ontomde-java/java/contextualize.rb', line 6

def java_contextualizeStaticProperties!
  uml_Class_all.each {|c|
    next unless c.kind_of?(Muml_Class)
    c.java_contextualizeMyStaticProperties!
  }
end

#java_genEnumMsgRes(c, fillFromModel, locale) ⇒ Object



105
106
107
108
109
110
111
112
# File 'lib/ontomde-java/struts/MessageResources.rb', line 105

def java_genEnumMsgRes(c,fillFromModel,locale)
	msg=c.java_enumAssignableDataType_inv.empty? ? "-- --" : "create and add"
	struts_writeMsgRes("#{c.java_qualifiedName}.#{::Muml_Property::NIL_LVB_RES_KEY}",msg,!fillFromModel,locale)

	c.uml_ownedLiteral.each {|ol|
		struts_writeMsgRes("#{c.java_qualifiedName}.#{ol.java_Name}",ol.to_s,!fillFromModel,locale)
		}
end

#java_generateAntBuildFileObject



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
# File 'lib/ontomde-java/java/build.rb', line 26

def java_generateAntBuildFile
	return unless context[:generateAntBuildFile,false]

mtk_writeSession("#{context[:targetDir]}/build.xml") {
	write  %{
<project name="demo" default="all">

<target name="all" depends="compile,log4j" />

<target name="compile">
	<mkdir dir="#{java_ClassRelativeDir}" />
	<sync todir="#{java_ClassRelativeDir}">
		<fileset dir="#{context[:javaRelativeDir]}">
			<include name="**/*"/>
			<exclude name="**/*.java"/>
		</fileset>
		<!-- only supported if ant >=1.7
		<preserveintarget>
			<include name="**/*.class"/>
		</preserveintarget>
		-->
	</sync>
	<javac srcdir="#{context[:javaRelativeDir]}" destdir="#{java_ClassRelativeDir}" debug="yes">
		<classpath>
			<!-- catch-all -->
			<fileset dir="." includes="**/*.jar" />
		</classpath>
		<compilerarg value="-Xlint:deprecation"/>
		<compilerarg value="-Xlint:unchecked"/>
	</javac>
</target>
<target name="log4j">
	<concat destfile="#{java_ClassRelativeDir}/log4j.properties">
      		<header filtering="no" trimleading="yes">
			# ---------------------------------------
			# Changes to this file will be deleted
			# on next ant build because
			# this file is the concatenation of
			# file matching log4j*.properties
			# in #{context[:javaRelativeDir]}"
			# ---------------------------------------
      		</header>

		<fileset dir="#{context[:javaRelativeDir]}" includes="log4j*.properties"/>
	</concat>
</target>
<target name="clean" />

</project>
}
	}
end

#java_generatePackageDocObject

generates java documentation files (package-info.java) for packages directly containing elements (class, enum, interface) cf: java.sun.com/docs/books/jls/third_edition/html/packages.html



241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/ontomde-java/java/javadoc.rb', line 241

def java_generatePackageDoc
  return unless context[:javadoc]
  return unless context[:javadocForDir,false]
  java_getUsedPackages.each { |packageName,packageSet|
    fn=nil
    packageSet.each { |package|
      fn="#{package.java_FilePath}/#{package.java_Name}/package-info.java"
      break
    }
    mtk_writeSession(fn) {
      write("\t/**\n")
      packageSet.each { |package|
        package.uml_ownedComment.each { |comment|
          comment.uml_body_one.java_writeJavadoc(self)
        }
      }
      write("\t */\n\n")
      write("package #{packageName};\n")
    }
  }
end

#java_generateRefactorFileObject



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
# File 'lib/ontomde-java/java/refactor.rb', line 14

def java_generateRefactorFile
s=Set.new	
p=Set.new
uml_Class_all.each {|c|
	next unless c.kind_of?(Muml_Class) || c.kind_of?(Muml_Interface)||c.kind_of?(Muml_Enumeration)
	# only generate if requested to do so
	# usefull for generating separtely tests dans model
	next if c.java_isATestFile? && !context[:includeTestFiles]
	next if (!c.java_isATestFile?) && context[:excludeNonTestFiles]
	s.add(c)	
	p.add(c.umlx_owner_one) if c.umlx_owner_one.kind_of?(Muml_Package)
}

mtk_writeSession(context[:javaRefactorFile]) {
	write <<END
<?xml version="1.0" encoding="UTF-8"?>
<refactor>
 <!-- 

 Although ontomde tries to behave nicely
 when generating over existing code with
 a modified UML model, it is not always
 possible to handle all cases transparently.

 Therefore, it is sometime best to perform
 Eclipse code refactoring (or such), prior
 to running generation with the new model.

 The question is now, what should I refactor ?

 This file is here to help you in this task.

 When processed with diff (such as TortoiseSVN),
 this file will tell you what to refactor. You
 will now deleted or modified elements (as well
 as neewly created elements).

 Please note that you should versionned this file 
 after running generator on a new model.

 This file has been designed to behave nicely 
 with diff and avoid false change information.

 -->
END
	#sort is on rdf_uri because uri does not change
	#sorting on label is KO
	s.sort { |a,b| a.rdf_uri <=> b.rdf_uri }.each { |cc|
	cc.java_writeRefactorData
	} 
	p.sort { |a,b| a.rdf_uri <=> b.rdf_uri }.each { |cc|
	cc.java_writeRefactorData
	} 
	write(%{</refactor>\n})
}
end

#java_generateRepositoryObject

Main java generator entry point. Triggers the generation of every Java file for the model.



153
154
155
156
157
# File 'lib/ontomde-java/java/java.rb', line 153

def java_generateRepository
  uml_Model_all.each {|m|
    m.java_generateModel
  }
end

#java_getClassWithQualifiedName(qname) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/ontomde-java/jpdl/main.rb', line 6

def java_getClassWithQualifiedName(qname)
  uml_Class_all.each { |f|
    return f if f.java_qualifiedName.to_s.casecmp(qname)==0
  }
  puts "not found #{qname}"
  #exit 1
  return nil
end

#java_getTenantClassObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ontomde-java/java/tenant.rb', line 11

def java_getTenantClass
  tenant=nil
  uml_Class_all.each { |c|
    next unless c.umlx_hasStereotype?(TENANT_STEREOTYPE_NAME)
    unless tenant.nil?
      puts 'ERROR: ****************************************************'
      puts 'ERROR: multiple class found in model with stereotype tenant'
      puts 'ERROR: ****************************************************'
    end
    tenant=c
  }
  return tenant
end

#java_getUsedPackagesObject

returns a hash of package sets for which a javadoc should be generated. hash key is the qualifiedName of the packages (several uml packages may have the same name in different UML models)

A package is included if :

  • it contains a generated class/interface/enum

  • it contains a uml comment



206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/ontomde-java/java/javadoc.rb', line 206

def java_getUsedPackages

  ps=Hash.new
  uml_Class_all.each  { |e|
    p=e.umlx_owner_one
    next unless p.kind_of?(Muml_Package)
    next if p.umlx_isARootNamespace?
    next if e.umlx_external?
    pn=p.java_qualifiedName.to_s
    s=ps[pn]
    if s.nil?
      s=Set.new
      ps[pn]=s
    end
    s.add(p)
  }

  each { |k,p|
    next unless p.kind_of?(Muml_Package)
    next if p.kind_of?(Muml_Model)
    next if p.uml_ownedComment.empty?
    pn=p.java_qualifiedName.to_s
    s=ps[pn]
    if s.nil?
      s=Set.new
      ps[pn]=s
    end
    s.add(p)
  }
  return ps
end

#java_processComponents!Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/ontomde-java/java/component.rb', line 11

def java_processComponents!
  
  
  
  uml_Component_all.each { |c|
    c.java_processComponent!
  }
  
  mtk_writeSession("#{context[:webContentDir]}/WEB-INF/jwsContext.xml") {
    jws_config_write
  }
  
end

#java_transform!Object

trigger Muml_Classifier java_transform! for every class element



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/ontomde-java/java/java.rb', line 135

def java_transform!
  #must copy before transformation (hash modified runtime error)
  a=Array.new
  each { |k,c|
    next if c.kind_of?(Muml_Stereotype)
    next unless c.kind_of?(Muml_Class) || c.kind_of?(Muml_Interface)||c.kind_of?(Muml_Enumeration)
    a << c unless c.java_ignoreMe?
  }
  a.each {|c|
    c.java_transform! 
  }

  #java_addPersistence!
  umlx_processStereotypes!
end

#jpa_addPersistence!Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ontomde-java/jpa/jpa.rb', line 54

def jpa_addPersistence!
  #jpa_copyInterfaceAttributesToClass!
  uml_Class_all.each { |c|
    next unless c.kind_of?(Muml_Interface) || c.kind_of?(Muml_Enumeration)
    c.db_isTransient=RDF_TRUE
  }
  db_Class_persistent.each { |c|
    c.jpa_addPersistence!()
    c.jpa_addPersistenceId!
    c.jpa_addOptimisticLockingVar!
  }
  uml_Class_all.each { |i|
    i.jpa_processDTO
    #TODO ???
    next unless i.kind_of?(Muml_Interface)
    i.jpa_addPersistenceId!
    #c.jpa_addOptimisticLockingVar!
  }


end

#jpa_addTestImplementations!Object



10
11
12
13
14
15
# File 'lib/ontomde-java/jpa/simulationAutoImplement.rb', line 10

def jpa_addTestImplementations!
  each { |k,m|
    next unless m.kind_of?(Muml_Operation)
    m.jpa_addTestImplementation!
  }
end

#jpa_copyInterfaceAttributesToClass!Object



75
76
77
78
79
80
81
82
83
# File 'lib/ontomde-java/jpa/jpa.rb', line 75

def jpa_copyInterfaceAttributesToClass!
  uml_Class_all.each { |c|
    next unless c.kind_of?(Muml_Interface)
    puts "found interface #{c}"
    c.uml_ownedAttribute.each { |a|
      puts "found attribute #{a.uml_name}"
    }
  }
end

#jpa_default_db_urlObject

writes configuration parameter for hibernate sgbd connection. Some parameter are extracted from context.



116
117
118
119
# File 'lib/ontomde-java/jpa/configuration.rb', line 116

def jpa_default_db_url
  #name=umlx_model.uml_name_one.tr('^a-zA-Z0-9','_')
  return %{jdbc:mysql:///#{context[:db_schema_name,"testschema"]}}
end

#jpa_generateConfigurationObject

Generates hibernate configuration file



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ontomde-java/jpa/configuration.rb', line 28

def jpa_generateConfiguration
  if context[:struts_useSpring]
    mtk_writeSession("#{context[:jpaConfigDir]}/META-INF/persistence.xml") {
      jpa_writeConfigurationForSpring
      jpa_generateSpringConfigDerby
    }
  else
    # empty
  end

end

#jpa_generateSpringConfigDerbyObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ontomde-java/jpa/configuration.rb', line 4

def jpa_generateSpringConfigDerby

    mtk_writeSession("#{context[:webResourcesDir]}/contextConfigDerby.properties") {
 write <<END

#This file will hold environnement properties that are needed in the application.

jpa.dialect=org.springframework.orm.jpa.vendor.HibernateJpaDialect
persistence.unit.name=persistence-unit-test
database.platform=org.hibernate.dialect.DerbyDialect
driverClassName=org.apache.derby.jdbc.EmbeddedDriver
url=jdbc:derby:#{context[:dbSchemaName,'testschema-derby']};create=true
username=root
password=root
END
	}
end

#jpa_writeConfigurationForSpringObject



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/ontomde-java/jpa/configuration.rb', line 40

def jpa_writeConfigurationForSpring
  write %{<?xml version="1.0" encoding="UTF-8"?>
<!-- This configuration file is for a spring enabled application. -->
<!-- For database settings, please see ApplicationContext-jpa.xml -->

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
	version="1.0">
	#{mtk_stss{jpa_writeWebAppConfiguration}}

	#{mtk_stss{jpa_writeDeploymentConfiguration}}
</persistence>
  }
end

#jpa_writeConfigurationPersistentClassesObject

writes jpa configuration list of persistent class



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/ontomde-java/jpa/configuration.rb', line 169

def jpa_writeConfigurationPersistentClasses
  write %{<!-- begin Persistent classes declaration -->\n}
  s=Set.new
  uml_Class_all.each {|c|
    next unless c.kind_of?(Muml_Class) && c.umlx_isReallyAClass?
    s.add(c)
  }
  s.sort { |a,b| a.java_qualifiedName.to_s <=>b.java_qualifiedName.to_s }.each { |c|
    c.jpa_writeConfiguration
  }
  #TODO: remove hack
  #	context[:db_additionalPersistentClass,["com.jbpm.wrapper.process.Process"]].each { |cl|
  #		write %{<class>#{cl}</class>\n}
  #	}
  write %{<exclude-unlisted-classes>true</exclude-unlisted-classes>\n}
  write %{<!--  end Persistent classes declaration -->\n}
end

#jpa_writeConfigurationStandardObject

writes jpa configuration file to current



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
# File 'lib/ontomde-java/jpa/configuration.rb', line 87

def jpa_writeConfigurationStandard
  write %{<?xml version="1.0" encoding="UTF-8"?>
<persistence
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit
name="persistence-unit-test"
transaction-type="RESOURCE_LOCAL"
>
  }
  jpa_writeConfigurationPersistentClasses

  write %{<properties>\n}
  jpa_writeDBConnectionParameters
  jpa_writeConnectionPool
  write %{
<!-- Echo all executed SQL to stdout -->
<property name="hibernate.show_sql" value="false"/>
<!-- recreate schema ? validate | update | create | create-drop -->
	<property name="hibernate.hbm2ddl.auto" value="#{context[:jpa_ddl_mode,"update"]}"/>
  }

  write %{</properties>\n</persistence-unit>\n</persistence>\n}
end

#jpa_writeConnectionPoolObject

writes configuration parameter for hibernate connection pool.



156
157
158
159
160
161
162
163
164
165
166
# File 'lib/ontomde-java/jpa/configuration.rb', line 156

def jpa_writeConnectionPool
  write %{
<!-- connection pool -->
<!-- cf: http://www.hibernate.org/214.html -->
<property name="hibernate.c3p0.min_size" value="5"/>
<property name="hibernate.c3p0.max_size" value="20"/>
<property name="hibernate.c3p0.timeout" value="1800"/> <!-- seconds -->
<property name="hibernate.c3p0.idle_test_period" value="100"/> <!-- seconds -->
<property name="hibernate.c3p0.max_statement" value="50"/>
  }
end

#jpa_writeDBConnectionParametersObject



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/ontomde-java/jpa/configuration.rb', line 120

def jpa_writeDBConnectionParameters
  write %{
<property name="hibernate.dialect" value="#{context[:hib_dialect,"org.hibernate.dialect.MySQL5InnoDBDialect"]}"/>
<property name="hibernate.connection.driver_class" value="#{context[:hib_connection_driver_class,"com.mysql.jdbc.Driver"]}"/>
<property name="hibernate.connection.url" value="#{context[:hib_connection_url,jpa_default_db_url]}"/>
<property name="hibernate.connection.username" value="#{context[:hib_connection_username,"testuser"]}"/>
<property name="hibernate.connection.password" value="#{context[:hib_connection_password,"testpwd"]}"/>
<!--
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
<property name="hibernate.connection.username" value="sa"/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value="jdbc:hsqldb:hsql://localhost:1701"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
-->
  }
end

#jpa_writeDeploymentConfigurationObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/ontomde-java/jpa/configuration.rb', line 69

def jpa_writeDeploymentConfiguration
  write %{
	<!-- This persistence unit is used only by hibernateTools in "deployBD.xml"
 to generate tables. -->
	<persistence-unit name="deployment-persistence-unit"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
#{mtk_stss{jpa_writeConfigurationPersistentClasses}}
<properties>
	#{mtk_stss{jpa_writeDBConnectionParameters}}
</properties>
	</persistence-unit>
  }
end

#jpa_writeOptimizedHibernatePropertiesObject



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/ontomde-java/jpa/configuration.rb', line 139

def jpa_writeOptimizedHibernateProperties
  write %{
	<property name="hibernate.show_sql" value="false" />
	<property name="hibernate.hbm2ddl.auto" value="update" />

	<!-- Set a maximum "depth" for the outer join fetch tree for single-ended associations (one-to-one, many-to-one) -->
	<property name="hibernate.max_fetch_depth" value="0" />

	<!-- determines the JDBC fetch size (calls Statement.setFetchSize()) -->
	<property name="hibernate.jdbc.fetch_size" value="4" />

	<!-- makes Hibernate start faster (it does not try to build cglib-enhanced objects to access getter/setters) -->
	<property name="hibernate.bytecode.use_reflection_optimizer" value="false" />
  }
end

#jpa_writeWebAppConfigurationObject



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/ontomde-java/jpa/configuration.rb', line 56

def jpa_writeWebAppConfiguration
  write %{
	<persistence-unit name="persistence-unit-test"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
#{mtk_stss{jpa_writeConfigurationPersistentClasses}}
<properties>
	#{mtk_stss{jpa_writeOptimizedHibernateProperties}}
</properties>
	</persistence-unit>
  }
end

#jws_config_writeObject



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
# File 'lib/ontomde-java/java/component.rb', line 25

def jws_config_write
  write <<JWS
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:cxf="http://cxf.apache.org/core"
  xmlns:jaxws="http://cxf.apache.org/jaxws"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-2.5.xsd
      http://cxf.apache.org/core
      http://cxf.apache.org/schemas/core.xsd
      http://cxf.apache.org/jaxws
      http://cxf.apache.org/schemas/jaxws.xsd"
  default-autowire="byName">

  <!-- Load CXF modules from cxf.jar -->
  <import resource="classpath:META-INF/cxf/cxf.xml" />
  <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
  <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
  
  <!-- Enable message logging using the CXF logging feature -->
  <cxf:bus>
      <cxf:features>
          <cxf:logging/>
      </cxf:features>
  </cxf:bus>
  
  <!-- Aegis data binding -->
  <bean id="aegisBean"
      class="org.apache.cxf.aegis.databinding.AegisDatabinding"
      scope="prototype"/> 
  <bean id="jaxws-and-aegis-service-factory"
      class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
      scope="prototype">
      <property name="dataBinding" ref="aegisBean"/>
      <property name="serviceConfigurations">
          <list>
            <bean class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
            <bean class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
            <bean class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/> 
          </list>
      </property>
  </bean>
JWS

  uml_Component_all.each { |c|
    c.writeJWSConfig
  }

  
  write <<JWS 
</beans>
JWS
  
end

#kbjava_computeCoverageObject



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/ontomde-java/kbjava/rdfToJava.rb', line 312

def kbjava_computeCoverage
  puts "COVERAGE REPORT"
  puts %{class|property|hit|min hit\n}
  ret=Array.new
  uml_Class_all.each { |c|

    next if c.uml_isAbstract?
    next if c.kind_of?(Cuml_Enumeration)
    next if c.uml_ownedAttribute.empty?
    puts %{#{c.uml_name}|id|#{c.kb_coverage.size}|1\n}
    c.uml_ownedAttribute.each {|a|
      max=a.uml_type_one.kind_of?(Muml_Enumeration) ? a.uml_type_one.uml_ownedLiteral.size : "1"
      puts %{#{c.uml_name}|#{a.uml_name}|#{a.kb_coverage.size}|#{max}\n}
      ret<< { "class" => c.uml_name,"property"=> a.uml_name, "hit" =>a.kb_coverage.size, "minhit" => max}
    }

  }
  puts "COVERAGE REPORT END"
  return ret
end

#struts_ActionLocaleWriteActionBeanObject



27
28
29
# File 'lib/ontomde-java/struts/localeAction.rb', line 27

def struts_ActionLocaleWriteActionBean
  write  %{<form-bean name="#{STRUTS_ACTION_LOCALE_FORM}" type="#{STRUTS_ACTION_LOCALE_FORM}"/>\n}
end

#struts_ActionLocaleWriteActionPathObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ontomde-java/struts/localeAction.rb', line 16

def struts_ActionLocaleWriteActionPath
  write(%{
 <action path="#{STRUTS_ACTION_LOCALE_PATH}"
  type="org.apache.struts.actions.LocaleAction"
  name="#{STRUTS_ACTION_LOCALE_FORM}"
  scope="session"
  validate="false"
  cancellable="true"
  />
    })
end

#struts_addActionLocaleForm!Object



9
10
11
12
13
14
15
# File 'lib/ontomde-java/struts/localeAction.rb', line 9

def struts_addActionLocaleForm!
  each { |k,c|
    next unless c.kind_of?(::Muml_Model)
    c.struts_addActionLocaleForm!
    break
  }
end

#struts_addAllOperationAggregateParameterClass!Object

generates for every business operation in repository.



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
# File 'lib/ontomde-java/java/operationAsClass.rb', line 29

def struts_addAllOperationAggregateParameterClass!
  return unless context[:withGenerateMethodForm]

  uml_Class_all.each {|c|
    #exclude classes explicitely set to false
    next if (!c.umlx_businessMethod.empty?) && (!c.umlx_businessMethod?)
    c.uml_ownedOperation.each {|biz|
      #next if c.java_isATestFile?
      next unless biz.kind_of?(Muml_Operation)
      next unless biz.umlx_businessMethod?
      next if biz.umlx_isConstructor?
      next if biz.uml_visibility_one.isPrivate?
      next if biz.uml_visibility_one.isProtected?
      next if biz.uml_visibility_one.isPackage?
      next if biz.uml_isStatic?
      #c=biz.umlx_owner_one

      p=c.umlx_package
      if p.nil?
        log.error{"Model modification required !!! class #{c} is in root model element. Classes should be in a package."}
        next
      end
      next unless c.kind_of?(Muml_Class)

      p=p.umlx_getOrCreatePackage(context[:classMethodSubDir,"methods"],p)
      #BUG:biz_uri ne suffisait pas car si 2 classes immplémnetaient 2 fois une méthode d'une classe abstraite
      #la classe crée avait les 2 mêmes uri et donc était zappé par la suite(notamment le java_transform
      mpc=p.umlx_createAndAddClass(c.rdf_uri+biz.rdf_uri+"_mpc2");
      mpc.umlx_businessMethod=RDF_TRUE
      mpc.struts_addAllOperationAggregateParameterClass!(biz)
      mpc.db_isTransient=RDF_TRUE
      mpc.java_addTenantField!

	# propagate template parameters 
	mpc.uml_ownedTemplateSignature=c.uml_ownedTemplateSignature unless c.uml_ownedTemplateSignature.empty?

      m=mpc.umlx_createAndAddOperation(mpc.rdf_uri+"merge","merge");
      #TODO merge referenced items
      m.java_code="return this; "
      p=m.umlx_createAndAddReturnParameter(m.rdf_uri+'_ret',"return")
      p.uml_type=mpc

      
    
    }}
end

#struts_addPerClassElement!Object

adds struts forms and struts action classes for each #struts_viewableClassifier.



31
32
33
34
35
36
37
38
39
# File 'lib/ontomde-java/struts/main.rb', line 31

def struts_addPerClassElement!
  struts_viewableClassifier.each { |c|
    c.struts_addActionForm!
  }
  struts_viewableClassifier.each { |c|
    next if c.struts_actionForm_one0.nil?
    c.struts_addAction!
  }
end

#struts_addReloadDefinitionsAction(uri = "/admin/reload") ⇒ Object

Calling this method will setup a struts reload action. This action will be accessible with a browser using the provided uri. Calling the action will trigger a struts configuration reload, usefull for developpment.

Note: *This method should be called before code generation and before setup generation. *Action is extracted from ruby *Thanks to Stephane Coutant for pointing out this feature.



15
16
17
# File 'lib/ontomde-java/struts/reloadAction.rb', line 15

def struts_addReloadDefinitionsAction(uri="/admin/reload")
	self.struts_reloadDefinitionsActionUri=uri
end

#struts_addValidator(name) ⇒ Object

declare a new validator return name for easy insertion in templates



14
15
16
17
# File 'lib/ontomde-java/struts/validator.rb', line 14

def struts_addValidator(name)
	STRUTS_VALIDATOR_NAMES << name.to_s
	return name
end

#struts_copyReloadDefinitionsActionClassObject

internal use copys required java source files to project



21
22
23
24
# File 'lib/ontomde-java/struts/reloadAction.rb', line 21

def struts_copyReloadDefinitionsActionClass()
	#return if self.struts_reloadDefinitionsActionUri.empty?
	#FileUtils.cp("#{File.dirname(__FILE__)}/ReloadDefinitionsAction.java","#{context[:build]}/WEB-INF/src/java/xmda/struts/ReloadDefinitionsAction.java")
end

#struts_createDataTypeHelpers!Object



4
5
6
7
8
# File 'lib/ontomde-java/struts/mappingToJavaHierarchy.rb', line 4

def struts_createDataTypeHelpers!
	DatatypeMapping.instance.getMappings.each { |m|
		m.struts_generateHelper(self)
	}
end

#struts_edit_generateObject



62
63
64
65
66
67
68
69
70
71
# File 'lib/ontomde-java/struts/jsp_edit.rb', line 62

def struts_edit_generate
  uml_Class_all.eachInThread(self) { |c|
    next if c.kind_of?(Muml_Enumeration)
    next if c.kind_of?(Muml_Interface)
    next if c.java_ignoreMe?
    #next if c.db_isTransient?
    c.struts_edit_generate
    c.struts_row_generate
  }
end

#struts_encloseWrite(before, after, &block) ⇒ Object



28
29
30
31
32
# File 'lib/ontomde-java/struts/jsp_edit.rb', line 28

def struts_encloseWrite(before,after,&block)
  write(before)
  yield
  write(after)
end


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
121
# File 'lib/ontomde-java/struts/footer.rb', line 5

def struts_footer_generate
  write <<END
<!-- **********************************
************  BAS DE PAGE   ***********
************************************ -->
<SCRIPT>
function #{::Muml_Class::STRUTS_SETLOCALE_ACTION}(lang) {
 document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SETLOCALE_ACTION}";
 document.forms[0].#{Muml_Class::STRUTS_SETLOCALE_LANGUAGE_FIELD}.value=lang;
 document.forms[0].submit();
 }
function #{::Muml_Class::STRUTS_SETTIMEZONE_ACTION}(tz) {
 document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SETTIMEZONE_ACTION}";
 document.forms[0].#{Muml_Class::STRUTS_SETTIMEZONE_FIELD}.value=tz;
 document.forms[0].submit();
 }
function #{::Muml_Class::STRUTS_SETSKIN_ACTION}(skin) {
 alert("!!");
 document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SETSKIN_ACTION}";
 document.forms[0].#{Muml_Class::STRUTS_SETSKIN_FIELD}.value=skin;
 document.forms[0].submit();
 }
 function #{::Muml_Class::STRUTS_SWITH_TO_FLEX_ACTION}() {
 document.forms[0].#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}.value="#{::Muml_Class::STRUTS_SWITH_TO_FLEX_ACTION}";
 document.forms[0].submit();
 }

</SCRIPT>
<br/>
<table>
	<tr>
<td>
	<img  onClick="switchToFlex();" src="#{css_path_model}/#{css_color_class}/image/logoFrancetelecom.gif"  border="0" alt=""/>
</td>
<td width="100%">
</td>
<td>
	<a href="#">
		<img  onClick="#{::Muml_Class::STRUTS_SWITH_TO_FLEX_ACTION}();" src="#{css_path_model}/#{css_color_class}/image/btnFX.gif" width="28" height="25" border="0" alt=""/>
	</a>
</td>
<td>
		<a href="#">
			<img src="#{css_path_model}/#{css_color_class}/image/btnSend.gif" width="25" height="25" border="0" alt="" />
		</a>
	</td>
                      <td>
		<a href="#">
			<img src="#{css_path_model}/#{css_color_class}/image/btnUp.gif" width="25" height="25" border="0" alt=""/>
		</a>
	</td>
                      <td>
		<img src="#{css_path_model}/#{css_color_class}/image/imgSprtr.gif" width="1" height="30" border="0" alt="" />
	</td>
                      <td>
		<a href="#">
			<img  onclick="setLocale('fr');" src="#{css_path_model}/#{css_color_class}/image/btnLanguage_Fr.gif" width="24" height="19" border="0"     alt="" />
		</a>
	</td>
                      <td>
		<a href="#">
			<img onclick="setLocale('en');" src="#{css_path_model}/#{css_color_class}/image/btnLanguage_Eng.gif" width="24" height="19" border="0" alt="" />
		</a>
	</td>
                      <td>
		<a href="#">
			<img onclick="setLocale('de');" src="#{css_path_model}/#{css_color_class}/image/btnLanguage_Dch.gif" width="24" height="19" border="0" alt="" />
		</a>
	</td>
                        <td>
		<img src="#{css_path_model}/#{css_color_class}/image/imgSprtr.gif" width="1" height="30" border="0" alt="" />
	</td>
                      <td>
<html:hidden property="#{::Muml_Class::STRUTS_SETLOCALE_LANGUAGE_FIELD}"/>
<input type="hidden" name="#{::Muml_Class::STRUTS_SETSKIN_FIELD}"/>
END



  write(struts_getTimeZoneSelect())

  write %{
	</td>
	<td>
  }
  struts_writeTimeoutIndicator()

  if context[:security]
    # DISPLAY A WARNING IN WEB PAGE IF SERVER SECURITY IS DISABLED
    write <<SECWARN
<%= 
xmda.security.ProviderImpl.getSecurityIsDisabled()
? "<span style=\\"background-color:red; text-color:black\\" bgcolor=\\"black\\">ACCESS<br>CONTROL<br>DISABLED</span>" 
: "" 
%>
SECWARN
  
 
  
    #cf: j_acegi_logout is handled in Application-security.xml
    write <<END2
   <td><html:link page="/j_spring_security_logout" title="Logout"><img src="res/orange/image/exit.gif" width="25" height="25" border="0" alt="exit"/></html:link></td>
END2
  end
 
 
  write <<END

	</td>
    </tr>
              </table>




END
end

#struts_generate_webxmlObject



4
5
6
7
8
# File 'lib/ontomde-java/struts/webXml.rb', line 4

def struts_generate_webxml
  mtk_writeSession("#{context[:webContentDir]}/WEB-INF/web.xml") {
    struts_webxml_write
  }
end

#struts_generateSpringApplicationContextObject



5
6
7
8
9
10
# File 'lib/ontomde-java/struts/spring.rb', line 5

def struts_generateSpringApplicationContext
	return unless context[:struts_useSpring]
	mtk_writeSession("#{context[:webContentDir]}/WEB-INF/applicationContext.xml") {
		struts_writeSpringApplicationContext
	}
end

#struts_getReloadDefinitionsActionConfigObject

internal use inserts required configuration item in struts configuration file.



28
29
30
31
# File 'lib/ontomde-java/struts/reloadAction.rb', line 28

def struts_getReloadDefinitionsActionConfig
	return "<!-- no reload definition action -->" if struts_reloadDefinitionsActionUri.empty?
	return %{<action path="#{struts_reloadDefinitionsActionUri}" type="org.apache.struts.tiles.actions.ReloadDefinitionsAction"/>}
end

#struts_header_generate(element = nil) ⇒ Object



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
# File 'lib/ontomde-java/struts/header.rb', line 3

def struts_header_generate(element=nil)
  write <<END
	<%-- ********  ENTETE ****************** --%>
<div class="cadre">
	<div class="AgLeft">
<a href="http://ontomde.rubyforge.org/">
	<img src="#{css_path_model}/#{css_color_class}/image/logoMDE.gif" border="0"  alt="Home"/>
</a>
	</div>
      <div class="AgCenter">
<img src="#{css_path_model}/#{css_color_class}/image/bienvenue.gif" border="0"  alt="will be delete"/>
      </div>
	<div class="AgRight">
	<a href="javascript:window.print();">
	<img src="#{css_path_model}/#{css_color_class}/image/btnPrint.gif" width="25" height="25" border="0" alt="Print"/>
</a>
<html:link page="/Welcome.do"title="Retour a l'accueil">
	<img src="#{css_path_model}/#{css_color_class}/image/btnPosition.gif" width="25" height="25" border="0" alt="Position"/>
</html:link>
<a href="#">
	<img src="#{css_path_model}/#{css_color_class}/image/btnHelp.gif" width="25" height="25" border="0" alt="Help"/>
</a>

#{(element.nil?  || context[:rsm6WebDocURI].empty?)  ? "" : 
%{<a target="rsm6doc" href="#{context[:rsm6WebDocURI]}/content/#{UriNamespace.instance.unalias(element.umlx_owner_one.rdf_uri).gsub(/http:\/\/kb#/,"")}-content.html"><img src="#{css_path_model}/#{css_color_class}/image/rsm6.gif" width="25" height="25" border="0" alt="Help"/></a>}
}
	</div>
</div>
	<%-- ********  USER CONTEXT ************* --%>
END
end


32
33
34
35
36
37
# File 'lib/ontomde-java/struts/header_link.rb', line 32

def struts_header_link_generate(sourcePage)
  rel=Pathname.new(".").relative_path_from(Pathname.new(File.dirname(sourcePage)))
  write <<END
<jsp:include page="#{rel}/res/orange/include/include_head.jsp" flush="false"/>
END
end

#struts_index_generateObject



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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/ontomde-java/struts/jsp_index.rb', line 3

def struts_index_generate

	mtk_writeSession( %{#{context[:webContentDir]}/index.jsp} ) {
		mtk_context( :struts_curClass => self) {
			write <<END
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<%@ page contentType="text/html;charset=ISO8859-1" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<html:html>
<head>
<script src="res//orange/script/initialization.js" type="text/javascript"></script>
<script src="res//orange/script/main.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="res//orange/css/layout.css"/>
<link rel="stylesheet" type="text/css" href="res//orange/css/content.css"/>
<link rel="stylesheet" type="text/css" media="print" href="res//orange/css/print.css"/>
<script type="text/javascript" language="Javascript" src="res//orange/script/fonctionsJS-archimede.js"></script>

<title>Index -- Generated with XMDA</title>
</head>
#{%{
<%!
 public #{java_getTenantClass.java_qualifiedName}  get#{Muml_Classifier::TENANT_FIELD_BEAN_NAME}() {
     return null;
 }
%>} if context[:multiTenant] }

<body >

<html:form action="#{STRUTS_ACTION_LOCALE_URL}">
<%-- not necessary in jsp_index debug form --%>
<input type="hidden" name="#{Muml_Class::STRUTS_DISPATCH_FIELD_NAME}" />

<logic:messagesPresent>
  <bean:message key="errors.header"/>
  <ul>
  <html:messages id="error">
     <li><bean:write name="error"/></li>
  </html:messages>
  </ul><hr />
</logic:messagesPresent>
<center>

END

			struts_header_generate
			write <<END
	<!-- **************************************
	************  CORPS DE PAGE  **************
	**************************************** -->
			<center>
   	<div class="milieu">
		<div class="contenusansMenu">
			<!-- Indicateur Hi�rarchique -->
			<div class="indicateur"><h1>Accueil</h1></div>
			<a name="contenu"></a>
			<!-- Corps de Page -->
			<h2 style="font-size:120%">Generated with XMDA</h2>
			<ul>
END
pkg=Hash.new
uml_Class_all.each {|c|
	next if c.kind_of?(Muml_Enumeration)
	next if c.kind_of?(Muml_Class)&& !c.umlx_isReallyAClass?
	next if c.java_ignoreMe?
	#puts "JSP_INDEX #{c}::#{c.class.name} #{c.db_isTransient?}"
	#next if c.db_isTransient?
	#next if c.java_DAOClass.empty?
	next if c.struts_action.empty?
	p=c.uml_ownedMember_inv_one
	pkg[p]=Array.new if pkg[p].nil?
	pkg[p] << c
	}
write %{<table border="1" style="border-style: ; border: gray; border-spacing:0px">}
write %{<tr bgcolor="#EEEEEE"><td valign="center" width="10%"><a name="index"/><h3>Package index</h3></td><td><ul>}
pkg.keys.sort {|a,b| a.java_qualifiedName.to_s <=> b.java_qualifiedName.to_s }.each { |p|
	write %{<li><a href="##{p.java_qualifiedName}">#{p.java_qualifiedName}</a></li>  }
	}
write "</ul></td></tr>"
pkg.keys.sort {|a,b| a.java_qualifiedName.to_s <=> b.java_qualifiedName.to_s }.each { |p|
	write %{<tr><td valign="center"><h3><a name="#{p.java_qualifiedName}"/><a href="#index">#{p.java_qualifiedName.gsub(/\./," .")}</a></h3></td><td><ul>}
	pkg[p].sort { |a,b| a.uml_name.to_s <=> b.uml_name.to_s }.each {|c|
		write <<END
			#{if (!c.uml_isAbstract?)
				%{<li>#{c.uml_name}: <html:link page="/#{c.java_Name}-new.do?doWhat=newa">new</html:link> #{%{ (transient)} if c.db_isTransient? }
#{ %{
<%
for (java.util.Iterator<?> iter = #{c.db_getFindAllCall}.iterator(); iter.hasNext();) {
	#{c.java_qualifiedName} c=(#{c.java_qualifiedName})iter.next();

	out.println(", <a href=\\"#{c.java_Name}-new.do?doWhat=sgbd_read&id="+c.getId()+"\\">"+c.getId()+"</a>");
}
%>
} unless (c.db_isTransient? || c.java_DAOClass.empty?) }

			</li>}
			else
				%{}
			end
			}
END
				}


	write("</ul></td></tr>")
	}
write <<END
	</table>
</span>

		</div>
	</div>
<%-- TODO: html:xxx --%>
<div class="bodyBottom"></div>
<input type="hidden" name="page" value="/Welcome.do"/>
END

			struts_footer_generate
			write <<END
	</div>



</center>
</html:form>

</body>
</html:html>
END
		}
	}
end

#struts_messageResources_generateObject



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
# File 'lib/ontomde-java/struts/MessageResources.rb', line 25

def struts_messageResources_generate
	["_fr","_en","_de","_ja","_zu",""].each {|lang|
		f=%{#{context[:webResourcesDir]}/MessageResources#{lang}.properties}
		mtk_writeSession(f) {
			#mtk_protected("GENERIC"){
			if(lang=="_en")
				write MESSAGE_RES_EN
				writeMessagesFromModel(lang)
			elsif(lang=="_de")
				write MESSAGE_RES_DE
				writeMessagesFromModel(lang)
			elsif(lang=="_ja")
				write MESSAGE_RES_JA
				writeMessagesFromModel(lang)
			elsif(lang=="_fr")
				#write MESSAGE_RES_FR
				#writeMessagesFromModel(lang)
			elsif(lang=="_zu")
				write MESSAGE_RES_ZU
				writeMessagesFromModel(lang,true,true)
			elsif(lang=="")
				struts_writeMsgRes(::Mrdf_Repository::STRUTS_SESSION_TIMEOUT_IN_MINUTES_RES,"30",false,"")
				write MESSAGE_RES_FR
				writeMessagesFromModel(lang,true)
			else
				log.error "unknown locale #{lang}"
			end
		#}
		}}
end

#struts_springIgnore(b) ⇒ Object



41
42
43
44
45
# File 'lib/ontomde-java/struts/spring.rb', line 41

def struts_springIgnore(b)
	return true if b.struts_action_one0.nil?
	#return true if b.java_DAOClass_one0.nil?
	return false
end

#struts_struts_config_generateObject



17
18
19
20
21
# File 'lib/ontomde-java/struts/struts-config.rb', line 17

def struts_struts_config_generate
	mtk_writeSession("#{context[:webContentDir]}/WEB-INF/struts-config.xml") {
		struts_struts_config_writeFile
	}
end

#struts_struts_config_writeFileObject



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
# File 'lib/ontomde-java/struts/struts-config.rb', line 26

def struts_struts_config_writeFile
# CAUTION no CR befor <?xml> instruction
	before=<<END
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE struts-config PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
        "http://struts.apache.org/dtds/struts-config_1_3.dtd">

<struts-config>
END
	after=<<END
 <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
  <set-property property="pathnames" value="/WEB-INF/validation.xml, /WEB-INF/validator-rules.xml"/>
  <set-property property="stopOnFirstError" value="true"/>
 </plug-in>
</struts-config>
END

#<!ELEMENT struts-config (data-sources?, form-beans?, global-exceptions?, global-forwards?, action-mappings?, controller?, message-resources*, plug-in*)>

	encloseWrite(before,after) {
 		struts_write_struts_config_form_beans
		struts_struts_config_writeFile_GlobalException
		struts_struts_config_writeFile_GlobalForwards
		struts_write_struts_config_action_mappings
		struts_writeSpringRequestProcess_controller
 		write(%{<!-- Message are in /WEB-INF/classes/ApplicationResources*.properties -->\n})
		write(%{<message-resources parameter="MessageResources"/>\n})
		struts_writeSpringRequestProcess_plugin
	}
end

#struts_struts_config_writeFile_GlobalExceptionObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/ontomde-java/struts/struts-config.rb', line 60

def struts_struts_config_writeFile_GlobalException
	before="<global-exceptions>"
	after="</global-exceptions>"
	encloseWrite(before,after) {
			write <<ENDEXCEPTION
	<exception
		key="errors.ioException"
		type="#{struts_getFunctionalException.java_qualifiedName}"
		path="errorPage.jsp"
		handler="#{struts_getExceptionHandlerClass.java_qualifiedName}"
	 />
ENDEXCEPTION
		}
end

#struts_struts_config_writeFile_GlobalForwardsObject



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/ontomde-java/struts/struts-config.rb', line 75

def struts_struts_config_writeFile_GlobalForwards
	before=<<END
<global-forwards>
	<forward name="#{Muml_Class::STRUTS_SWITCH_TO_FLEX_FORWARD}" path="#{Muml_Class::FLEX_SWITCH_TO_JSP_PATH}" />
	<forward name="#{Muml_Class::NOGIF_FORWARD}" path="/res/orange/image/noImage.gif" />
END
	after=<<END
</global-forwards>
END
	encloseWrite(before,after) {
#<!--
# <global-forwards type="org.apache.struts.webapp.examples.CustomActionForward">
#  <forward name="welcome" path="/welcome.do">
#   <set-property property="example" value="EXAMPLE"/>
#  </forward>
# </global-forwards>
#-->
		struts_struts_config_writeFile_GlobalForwards_editAction
	}
end

#struts_struts_config_writeFile_GlobalForwards_editActionObject



95
96
97
98
99
100
101
102
103
# File 'lib/ontomde-java/struts/struts-config.rb', line 95

def struts_struts_config_writeFile_GlobalForwards_editAction
	eachStrutsBean { |c|
		b=c.struts_actionFormSrc_one0
		next if b.nil?
		write(%{<forward path="/#{b.java_Name}-new.do?#{Muml_Classifier::STRUTS_DISPATCH_FIELD_NAME}=#{Muml_Classifier::STRUTS_ACTION_STARTEDIT}"
			name="#{b.struts_editForwardName}" redirect="false" />\n})
	}

end

#struts_struts_config_writeFile_struts_configObject



57
58
# File 'lib/ontomde-java/struts/struts-config.rb', line 57

def struts_struts_config_writeFile_struts_config
end

#struts_validation_generateObject



4
5
6
7
8
# File 'lib/ontomde-java/struts/validation.rb', line 4

def struts_validation_generate
	mtk_writeSession("#{context[:webContentDir]}/WEB-INF/validation.xml") {
		struts_validation_writeFile
	}
end

#struts_validation_writeFileObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ontomde-java/struts/validation.rb', line 10

def struts_validation_writeFile

# CAUTION no CR befor <?xml> instruction
write <<END
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
     "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.3.0//EN"
     "http://jakarta.apache.org/commons/dtds/validator_1_3_0.dtd">

<!-- Generated by XMDA -->

<form-validation>

<!--
     This is a minimal Validator form file with a couple of examples.
-->
END

	struts_write_validation_formset
	write %{</form-validation>\n}
end

#struts_validator_generateObject



4
5
6
7
8
# File 'lib/ontomde-java/struts/validator.rb', line 4

def struts_validator_generate
	mtk_writeSession("#{context[:webContentDir]}/WEB-INF/validator-rules.xml") {
		struts_validator_write
	}
end

#struts_validator_writeObject



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
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
224
225
226
227
228
229
230
231
232
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
334
335
336
337
338
339
# File 'lib/ontomde-java/struts/validator.rb', line 22

def struts_validator_write
write <<END
<!DOCTYPE form-validation PUBLIC
          "-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
          "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
<!--
  $Id: validator-rules.xml,v 1.1 2006/07/21 12:40:26 nacid Exp $

   This file contains the default Struts Validator pluggable validator
   definitions.  It should be placed somewhere under /WEB-INF and
   referenced in the struts-config.xml under the plug-in element
   for the ValidatorPlugIn.

      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
                                                  /WEB-INF/validation.xml"/>
      </plug-in>

   These are the default error messages associated with
   each validator defined in this file.  They should be
   added to your projects ApplicationResources.properties
   file or you can associate new ones by modifying the
   pluggable validators msg attributes in this file.

   # Struts Validator Error Messages
   errors.required={0} is required.
   errors.minlength={0} can not be less than {1} characters.
   errors.maxlength={0} can not be greater than {1} characters.
   errors.invalid={0} is invalid.

   errors.byte={0} must be a byte.
   errors.short={0} must be a short.
   errors.integer={0} must be an integer.
   errors.long={0} must be a long.
   errors.float={0} must be a float.
   errors.double={0} must be a double.

   errors.date={0} is not a date.
   errors.range={0} is not in the range {1} through {2}.
   errors.creditcard={0} is an invalid credit card number.
   errors.email={0} is an invalid e-mail address.

   Note: Starting in Struts 1.2.0 the default javascript definitions have
         been consolidated to commons-validator. The default can be overridden
         by supplying a <javascript> element with a CDATA section, just as
         in struts 1.1.

-->

<form-validation>

   <global>

      <validator name="#{struts_addValidator("required")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateRequired"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
                  msg="errors.required"/>

      <validator name="#{struts_addValidator("requiredif")}"
                 classname="org.apache.struts.validator.FieldChecks"
                 method="validateRequiredIf"
                 methodParams="java.lang.Object,
                               org.apache.commons.validator.ValidatorAction,
                               org.apache.commons.validator.Field,
                               org.apache.struts.action.ActionMessages,
                               org.apache.commons.validator.Validator,
                               javax.servlet.http.HttpServletRequest"
                 msg="errors.required"/>

      <validator name="#{struts_addValidator("validwhen")}"
          msg="errors.required"
                 classname="org.apache.struts.validator.validwhen.ValidWhen"
                 method="validateValidWhen"
                 methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"/>


      <validator name="#{struts_addValidator("minlength")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMinLength"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.minlength"
           jsFunction="org.apache.commons.validator.javascript.validateMinLength"/>


      <validator name="#{struts_addValidator("maxlength")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMaxLength"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.maxlength"
           jsFunction="org.apache.commons.validator.javascript.validateMaxLength"/>



      <validator name="#{struts_addValidator("mask")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateMask"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.invalid"/>


      <validator name="#{struts_addValidator("byte")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateByte"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.byte"
       jsFunctionName="ByteValidations"/>


      <validator name="#{struts_addValidator("short")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateShort"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.short"
       jsFunctionName="ShortValidations"/>


      <validator name="#{struts_addValidator("integer")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateInteger"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.integer"
       jsFunctionName="IntegerValidations"/>



      <validator name="#{struts_addValidator("long")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateLong"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.long"/>


      <validator name="#{struts_addValidator("float")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateFloat"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.float"
       jsFunctionName="FloatValidations"/>

      <validator name="#{struts_addValidator("double")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateDouble"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.double"/>


      <validator name="#{struts_addValidator("date")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateDate"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.date"
       jsFunctionName="DateValidations"/>


      <validator name="#{struts_addValidator("intRange")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateIntRange"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends="integer"
                  msg="errors.range"/>


      <validator name="#{struts_addValidator("floatRange")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateFloatRange"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends="float"
                  msg="errors.range"/>

      <validator name="#{struts_addValidator("doubleRange")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateDoubleRange"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends="double"
                  msg="errors.range"/>


      <validator name="#{struts_addValidator("creditCard")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateCreditCard"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.creditcard"/>


      <validator name="#{struts_addValidator("email")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateEmail"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.email"/>

      <validator name="#{struts_addValidator("url")}"
            classname="org.apache.struts.validator.FieldChecks"
               method="validateUrl"
         methodParams="java.lang.Object,
                       org.apache.commons.validator.ValidatorAction,
                       org.apache.commons.validator.Field,
                       org.apache.struts.action.ActionMessages,
                       org.apache.commons.validator.Validator,
                       javax.servlet.http.HttpServletRequest"
              depends=""
                  msg="errors.url"/>

     <!--
       This simply allows struts to include the validateUtilities into a page, it should
       not be used as a validation rule.
     -->
     <validator name="includeJavaScriptUtilities"
            classname=""
               method=""
         methodParams=""
              depends=""
                  msg=""
           jsFunction="org.apache.commons.validator.javascript.validateUtilities"/>

   </global>

</form-validation>

END
end

#struts_validatorExists?(name) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ontomde-java/struts/validator.rb', line 18

def struts_validatorExists?(name)
	return STRUTS_VALIDATOR_NAMES.include?(name.to_s)
end

#struts_viewableClassifier(ignoreAbstract = true) ⇒ Object

returns a list of classifier which are “viewable” (for which a GUI should be created)



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ontomde-java/struts/main.rb', line 6

def struts_viewableClassifier(ignoreAbstract=true)
  ret=Array.new
  uml_Class_all.each { |c|
    next unless (c.kind_of?(Muml_Class) && c.umlx_isReallyAClass?) #TODO: for jdo || c.kind_of?(Muml_Interface)
    next if c.java_ignoreMe?
    next if c.struts_isForm?
    #next if c.java_isATestFile?

    #TODO: Hack for  human task (bug if MPC in name)!
    if context[:db_useStereotypeMarker] && !"#{c.uml_name}".include?("MPC")
      next if c.db_isTransient?
    end
    
    next if c.umlx_hasStereotype?('DTO')

    next if c.db_isDAO?
    next unless c.umlx_businessMethod?
    #no struts for abstract classes
    next if c.uml_isAbstract? && ignoreAbstract
    ret<< c
  }
  return ret
end

#struts_webxml_writeObject



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
# File 'lib/ontomde-java/struts/webXml.rb', line 131

def struts_webxml_write
  encloseWrite(STRUTS_WEBXML_HEAD,STRUTS_WEBXML_FOOT) {
    struts_writeSpringWebApplicationContext
    write <<ENDXFILTER
	<filter>
<filter-name>XmdaFilter</filter-name>
<filter-class>#{viewFilter}</filter-class>
	</filter>    
ENDXFILTER
    write STRUTS_WEBXML_ACEGI_FILTER if context[:security]  
    write STRUTS_WEBXML_XMDA_FILTER
    write STRUTS_WEBXML_ACEGI_MAPPING if context[:security]
    struts_writeSpringWebApplicationListener
    
    write STRUTS_SERVLET
    if context[:webservice]
    write <<JWS
<servlet>
  <servlet-name>CXFServlet</servlet-name>
  <servlet-class>
    org.apache.cxf.transport.servlet.CXFServlet
  </servlet-class>
</servlet>

<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
  <servlet-name>CXFServlet</servlet-name>
  <url-pattern>/services/*</url-pattern>
</servlet-mapping>
JWS
    end
    write STRUTS_SERVLET_MAPPING
  }
end

#struts_write_struts_config_action_mappingsObject



143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/ontomde-java/struts/struts-config.rb', line 143

def struts_write_struts_config_action_mappings
#write(%{<action-mappings type="org.apache.struts.webapp.examples.CustomActionMapping"> \n})
	before=%{ <action-mappings> \n}
	after=<<END
   <action path="/Welcome" forward="/index.jsp" />
 </action-mappings>
END

      	encloseWrite(before,after) {
		write(%{#{struts_getReloadDefinitionsActionConfig}\n})
		struts_ActionLocaleWriteActionPath
		eachStrutsBean { |b|
			b.struts_write_struts_config_action_mapping
		}
	}
end

#struts_write_struts_config_form_beansObject



105
106
107
108
109
110
111
112
113
114
# File 'lib/ontomde-java/struts/struts-config.rb', line 105

def struts_write_struts_config_form_beans
	write %{ <form-beans>\n}

	struts_ActionLocaleWriteActionBean

	eachStrutsBean { |b|
		b.struts_write_struts_config_form_bean
	}
    write %{ </form-beans>\n}
end

#struts_write_validation_formsetObject



32
33
34
35
36
37
38
# File 'lib/ontomde-java/struts/validation.rb', line 32

def struts_write_validation_formset
	write %{	<formset>\n}
	eachStrutsFormset { |b|
		b.struts_write_validation_config_formset
	}
    write %{	</formset>\n}
end

#struts_writeSpringApplicationContextObject



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
# File 'lib/ontomde-java/struts/spring.rb', line 12

def struts_writeSpringApplicationContext

write <<END
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

	<!-- ===========================actions struts ================================ -->

	#{mtk_stss { struts_writeSpringStrutsBean }}

	<!-- ============================================ DAO beans =================================== -->

	#{mtk_stss { struts_writeSpringBean }}

	<!-- scope="prototype" because PersistenceContextType is extended and thus not thread safe. We need to have a single private PersistenceContext for the duration of the transaction. We need EXTENTED because SGBD need to be accessed read-only from JSPs, after transaction has been committed -->
	<bean id="#{Muml_Class::DB_Context.gsub(/^.*\./,'')}" class="#{Muml_Class::DB_Context}" scope="prototype" />
	<bean class="#{Muml_Class::DB_Context}$#{Muml_Class::DB_Context.gsub(/^.*\./,'')}SpringContext" />
</beans>
END

end

#struts_writeSpringBeanObject



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ontomde-java/struts/spring.rb', line 75

def struts_writeSpringBean
	# beans are no longer spring beans
	return
	eachStrutsBean { |b|
		next if struts_springIgnore(b)
		dao=b.java_DAOClass_one
		if b.uml_isAbstract?
			write("<!-- ignore abstract : #{b.java_Name} -->\n")
		else
			write %{<bean id="#{dao.java_Name}" class="#{dao.java_qualifiedName}" />\n}
		end
	}
end

#struts_writeSpringRequestProcess_controllerObject

struts-config configuration for spring



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/ontomde-java/struts/struts-config.rb', line 117

def struts_writeSpringRequestProcess_controller
	return unless context[:struts_useSpring]
	write <<END
<controller>
  <set-property
     property="processorClass"
     value="org.springframework.web.struts.DelegatingRequestProcessor"
  />
</controller>
END
end

#struts_writeSpringRequestProcess_pluginObject



129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/ontomde-java/struts/struts-config.rb', line 129

def struts_writeSpringRequestProcess_plugin
  return
	return unless context[:struts_useSpring]
	write <<END
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
  <set-property
     property="contextConfigLocation"
     value="/WEB-INF/applicationContext.xml, /WEB-INF/applicationContext-jpa.xml"
  />
</plug-in>
END
end

#struts_writeSpringStrutsBeanObject



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
# File 'lib/ontomde-java/struts/spring.rb', line 46

def struts_writeSpringStrutsBean
	eachStrutsBean { |b|
		next if struts_springIgnore(b)
		#puts "b=#{b.java_qualifiedName}"

		if b.struts_action_one.nil?
			#puts "!!!! #{b} n'a pas de struts_action"
			next
		end
	suffixes=["-new"]
	b.struts_ownedTab.each {|tab|
		idOnglet=tab.java_Name_one
		suffixes<< "#{idOnglet}-submit"
		}
	suffixes.each { |suffix|
	if b.uml_isAbstract?
		write("<!-- ignore abstract : #{b.java_Name} -->\n")
	else
		write <<END
	<bean	name="/#{b.java_Name}#{suffix}"
		parent="txProxyTemplate"
		scope="session">
		<property name="target"><bean class="#{b.struts_action_one.java_qualifiedName}"/></property>
	</bean>
END
		end
	}}
end

#struts_writeSpringWebApplicationContextObject



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/ontomde-java/struts/webXml.rb', line 166

def struts_writeSpringWebApplicationContext
  return unless context[:struts_useSpring]
  jwsContext = ""
  jwsContext = "/WEB-INF/jwsContext.xml," if context[:webservice]
  
  write <<END12
	<!-- begin of spring section -->
	<context-param>
<param-name>webAppRootKey</param-name>
<param-value>xmda-struts.root</param-value>
	</context-param>
	<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
	</context-param>
	<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml,#{jwsContext}/WEB-INF/applicationContext-jpa.xml
#{ %{, /WEB-INF/applicationContext-security.xml} if context[:security] }
  </param-value>
  </context-param>
END12
end

#struts_writeSpringWebApplicationListenerObject



190
191
192
193
# File 'lib/ontomde-java/struts/webXml.rb', line 190

def struts_writeSpringWebApplicationListener
  return unless context[:struts_useSpring]
  write STRUTS_SPRING_LISTENER 
end

#umlx_generateStaticSecurityRoleEnumObject

Model may contain several enumeration of roles stereotypes staticSecurityRole For implementation use, an enumeration containing every roles is generated. Role container name could be appended to role name but it is not because it would make code refactoring more complex. As a consequence, role name should be unique application wide.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/ontomde-java/java/security.rb', line 110

def  umlx_generateStaticSecurityRoleEnum
  e=umlx_reserved_model.umlx_getOrCreateEnumeration(JAVA_GLOBAL_ACCESS_CONTROL_ENUM,Muml_Classifier::UMLX_SEARCH_EVERY_MODEL)
  e.umlx_createAndAddComment("#{e.rdf_uri}_comment",JAVA_GLOBAL_ACCESS_CONTROL_ENUM_COMMENT) if e.uml_ownedComment.empty?

  self.each_value { |v|
    next unless v.kind_of?(Muml_Enumeration)
    #next unless v.umlx_hasStereotype?("staticSecurityRole")
    next unless v.umlx_hasStereotype?("ComputedAccessControlCriteria")
    v.uml_ownedLiteral.each {|c|
      #role name should be unique
      e.umlx_createAndAddLiteral(c.to_s)
    }
  }
end

#umlx_getScriptMethodEnumerationObject

Retrieve an enumeration that will contain a list of script methods



15
16
17
# File 'lib/ontomde-java/java/groovy.rb', line 15

def umlx_getScriptMethodEnumeration
  return umlx_reserved_model.umlx_getOrCreateEnumeration("xmda.scripting.ScriptMethodInventory",Muml_Classifier::UMLX_SEARCH_EVERY_MODEL)
end

#umlx_getSecuredMethodEnumerationObject

Retrieve an enumeration that will contain a list of secured methods



21
22
23
# File 'lib/ontomde-java/java/security.rb', line 21

def umlx_getSecuredMethodEnumeration
  return umlx_reserved_model.umlx_getOrCreateEnumeration("xmda.security.SecuredMethodInventory",Muml_Classifier::UMLX_SEARCH_EVERY_MODEL)
end

#umlx_getSecuredPropertyEnumerationObject

Retrieve an enumeration that will contain a list of secured property



126
127
128
# File 'lib/ontomde-java/java/security.rb', line 126

def umlx_getSecuredPropertyEnumeration
  return umlx_reserved_model.umlx_getOrCreateEnumeration("xmda.security.SecuredPropertyInventory",Muml_Classifier::UMLX_SEARCH_EVERY_MODEL)
end

#umlx_populateScriptedMethodEnumerationObject

populate script method inventory (which is stored as a java enum.)



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
# File 'lib/ontomde-java/java/groovy.rb', line 20

def umlx_populateScriptedMethodEnumeration
#    umlx_generateStaticSecurityRoleEnum
  e=umlx_getScriptMethodEnumeration

  #populate inventory
  uml_Class_all.each {|c|
    next unless c.umlx_businessMethod?
    next if c.kind_of?(Muml_Interface)
    cn="#{c.java_qualifiedName}.class"
    c.uml_ownedOperation.each  {|op|
      next unless op.umlx_businessMethod?
	next unless op.umlx_isScripted?
      #operation was generated from an interface
      next if (!op.umlx_redefinesMethod.empty?) && (!op.umlx_redefinesMethod_one.umlx_owner_one.kind_of?(Muml_Interface))
      lit=e.umlx_createAndAddLiteral("#{op.umlx_owner_one.java_qualifiedName}_#{op.java_Name}")
      lit.java_initParameterValue_add(cn)
      lit.java_initParameterValue_add(%{"#{op.java_Name}"})
    }
  }

  cc=umlx_reserved_model.umlx_getOrCreateClass("java.lang.Classxx")
  cc.uml_name="Class<?>"
  cc.java_isGeneric=RDF_TRUE

  str=e.umlx_owner_one.umlx_dataType_string
  # add constructor
  c=e.umlx_createAndAddOperation("#{c}.constructor","constructor")
  c.uml_appliedStereotype_add(e.umlx_getOrCreateStereotype("Create"))
  c.uml_visibility=::Cuml_VisibilityKind::Private
  p1=c.umlx_createAndAddParameter("#{c.uri}_p1","_ownerClass")
  p1.uml_type=cc
  p2=c.umlx_createAndAddParameter("#{c.uri}_p2","_operationName")
  p2.uml_type=str
  c.java_code="ownerClass=_ownerClass;\noperationName=_operationName;"

  #add attributes
  a1=e.umlx_createAndAddProperty("#{e}_a1","ownerClass")
  a1.uml_type=cc
  a2=e.umlx_createAndAddProperty("#{e}_a2","operationName")
  a2.uml_type=str

  #add finder
  f=e.umlx_createAndAddOperation("#{e.uri}_find","find")
  f.uml_isStatic=RDF_TRUE
  a1=f.umlx_createAndAddParameter("#{e}_a1","ownerClass")
  a1.uml_type=cc
  a2=f.umlx_createAndAddParameter("#{e}_a2","operationName")
  a2.uml_type=str
  a3=f.umlx_createAndAddReturnParameter("#{e}_ret","enum")
  a3.uml_type=e
  f.java_code=<<END
//TODO !!!!!!!!!!!
return null ; //#{e.java_Name}
END

end

#umlx_populateSecuredMethodEnumerationObject

populate secured method inventory (which is stored as a java enum.)



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
# File 'lib/ontomde-java/java/security.rb', line 26

def umlx_populateSecuredMethodEnumeration
  umlx_generateStaticSecurityRoleEnum
  e=umlx_getSecuredMethodEnumeration

  #populate inventory
  uml_Class_all.each {|c|
    next unless c.umlx_businessMethod?
    next if c.kind_of?(Muml_Interface)
    rns=c.umlx_rootNamespace_one0
    next if (!rns.nil?)&& (rns.java_Name.to_s!='domain')

    cn="#{c.java_qualifiedName}.class"
    c.uml_ownedOperation.each  {|op|
      next unless op.umlx_businessMethod?
	next unless op.umlx_isSecured?
      #operation was generated from an interface
      next if (!op.umlx_redefinesMethod.empty?) && (!op.umlx_redefinesMethod_one.umlx_owner_one.kind_of?(Muml_Interface))
      lit=e.umlx_createAndAddLiteral("#{op.umlx_owner_one.java_qualifiedName}_#{op.java_Name}")
      lit.java_initParameterValue_add(cn)
      lit.java_initParameterValue_add(%{"#{op.java_Name}"})
    }
  }

  cc=umlx_reserved_model.umlx_getOrCreateClass("java.lang.Classxx")
  cc.uml_name="Class<?>"
  cc.java_isGeneric=RDF_TRUE

  str=e.umlx_owner_one.umlx_dataType_string
  # add constructor
  c=e.umlx_createAndAddOperation("#{c}.constructor","constructor")
  c.uml_appliedStereotype_add(e.umlx_getOrCreateStereotype("Create"))
  c.uml_visibility=::Cuml_VisibilityKind::Private
  p1=c.umlx_createAndAddParameter("#{c.uri}_p1","_ownerClass")
  p1.uml_type=cc
  p2=c.umlx_createAndAddParameter("#{c.uri}_p2","_operationName")
  p2.uml_type=str
  c.java_code="ownerClass=_ownerClass;\noperationName=_operationName;"

  #add attributes
  a1=e.umlx_createAndAddProperty("#{e}_a1","ownerClass")
  a1.uml_type=cc
  a2=e.umlx_createAndAddProperty("#{e}_a2","operationName")
  a2.uml_type=str

  #add finder
  f=e.umlx_createAndAddOperation("#{e.uri}_find","find")
  f.uml_isStatic=RDF_TRUE
  a1=f.umlx_createAndAddParameter("#{e}_a1","ownerClass")
  a1.uml_type=cc
  a2=f.umlx_createAndAddParameter("#{e}_a2","operationName")
  a2.uml_type=str
  a3=f.umlx_createAndAddReturnParameter("#{e}_ret","enum")
  a3.uml_type=e
  f.java_code=<<END
//TODO !!!!!!!!!!!
return null ; //#{e.java_Name}
END

end

#umlx_populateSecuredPropertyEnumerationObject

Populate secured property inventory (which is stored as a java enum)



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
# File 'lib/ontomde-java/java/security.rb', line 131

def umlx_populateSecuredPropertyEnumeration
  #umlx_generateStaticSecurityRoleEnum
  e=umlx_getSecuredPropertyEnumeration

  #populate inventory
  uml_Class_all.each {|c|
    next unless c.umlx_businessMethod?
    
    #Hack: transient operation 
    #next if c.db_isTransient?
    
    
    next if c.kind_of?(Muml_Interface)
    cn="#{c.java_qualifiedName}.class"

    rns=c.umlx_rootNamespace_one0
    next if (!rns.nil?)&& (rns.java_Name.to_s!='domain')

    c.uml_ownedAttribute.each  {|op|
      #next unless op.umlx_businessMethod?
      #operation was generated from an interface
      #next if (!op.umlx_redefinesProperty.empty?) && (!op.umlx_redefinesProperty_one.umlx_owner_one.kind_of?(Muml_Interface))
      lit=e.umlx_createAndAddLiteral("#{op.umlx_owner_one.java_qualifiedName}_#{op.java_Name}")
      lit.java_initParameterValue_add(cn)
      lit.java_initParameterValue_add(%{"#{op.java_Name}"})
      lit.java_initParameterValue_add(op.umlx_isSecured?)
    }
  }


  #Classxx is on purpose
  cc=umlx_reserved_model.umlx_getOrCreateClass("java.lang.Classxx")
  cc.uml_name="Class<?>"
  cc.java_isGeneric=RDF_TRUE

  str=e.umlx_owner_one.umlx_dataType_string
  bol=e.umlx_owner_one.umlx_dataType_boolean
  # add constructor
  c=e.umlx_createAndAddOperation("#{c}.constructor","constructor")
  c.uml_appliedStereotype_add(e.umlx_getOrCreateStereotype("Create"))
  c.uml_visibility=::Cuml_VisibilityKind::Private
  p1=c.umlx_createAndAddParameter("#{c.uri}_p1","_ownerClass")
  p1.uml_type=cc
  p2=c.umlx_createAndAddParameter("#{c.uri}_p2","_propertyName")
  p2.uml_type=str
  p3=c.umlx_createAndAddParameter("#{c.uri}_p3","_isSecured")
  p3.uml_type=bol
  c.java_code="ownerClass=_ownerClass;\npropertyName=_propertyName;\nisSecured=_isSecured;"

  #add attributes
  a1=e.umlx_createAndAddProperty("#{e}_a1","ownerClass")
  a1.uml_type=cc
  a2=e.umlx_createAndAddProperty("#{e}_a2","propertyName")
  a2.uml_type=str
  a3=e.umlx_createAndAddProperty("#{e}_a2","isSecured")
  a3.uml_type=bol


  #add finder
  f=e.umlx_createAndAddOperation("#{e.uri}_find","find")
  f.uml_isStatic=RDF_TRUE
  a1=f.umlx_createAndAddParameter("#{e}_a1","ownerClass")
  a1.uml_type=cc
  a2=f.umlx_createAndAddParameter("#{e}_a2","propertyName")
  a2.uml_type=str
  a3=f.umlx_createAndAddReturnParameter("#{e}_ret","enum")
  a3.uml_type=e
  f.java_code=<<END
//TODO !!!!!!!!!!!
return null ; //#{e.java_Name}
END

end

#umlx_processScriptedElementsObject

process element marked as secured



82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/ontomde-java/java/groovy.rb', line 82

def umlx_processScriptedElements
  
  uml_Class_all.each {|c|
    #sec=false
    next if c.kind_of?(Muml_Interface) || c.kind_of?(Muml_Enumeration)
    c.uml_ownedOperation.each {|o|
      next unless o.umlx_isScripted? 
      o.java_annotation_add(JAVA_SCRIPT_ANNOTATION)
      #sec=true
    } 
  }
end

#umlx_processSecuredElementsObject

process element marked as secured



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/ontomde-java/java/security.rb', line 209

def umlx_processSecuredElements
  e=umlx_reserved_model.umlx_getOrCreateInterface("org.springframework.security.userdetails.UserDetails")
  
  uml_Class_all.each {|c|
    #sec=false
    next if c.kind_of?(Muml_Interface) || c.kind_of?(Muml_Enumeration)
    next if c.umlx_hasStereotype?('DTO')
    c.uml_ownedOperation.each {|o|
      next unless o.umlx_isSecured? 
      o.java_annotation_add(JAVA_SECURE_ANNOTATION)
      #sec=true
    } 
    c.uml_ownedAttribute.each { |a|
      next unless a.umlx_isSecured?
      a.java_annotation_add(JAVA_SECURE_ANNOTATION)
      #sec=true
    }
    c.umlx_addGetStaticRoleOperation! #if sec
  }
end

#umlx_processStereotypes!Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/ontomde-java/java/xsd.rb', line 138

def umlx_processStereotypes!
  return
  each { |k,c|
    next unless c.kind_of?(Muml_Stereotype)
    #log.debug "Registering stereotype #{c.getRubyStereotypeName}"
    eval %{
	module ::Muml_Stereotype_#{c.getRubyStereotypeName}
	end
    }
  }
  each {|k,c|
    next unless c.kind_of?(Muml_Element)
    next if c.appliedStereotype.empty?
    appliedStereotype.each { |s|
      c.class_eval %{

      }
    }
  }

end

#viewFilterObject



10
11
12
13
14
15
16
# File 'lib/ontomde-java/struts/webXml.rb', line 10

def viewFilter
  if context[:struts_useSpring]
    return "xmda.jpa.OpenDbContextInViewFilter"
  else
    return "xmda.jpa.OpenJEEDbContextInViewFilter"
  end
end

#vso_enumerationsObject



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/ontomde-java/vmware/vso.rb', line 110

def vso_enumerations 
	ret=Set.new
	uml_Class_all.each { |c|
		# inner enumeration ??
		if c.kind_of?(Muml_Enumeration)
			ret.add(c)	
		elsif c.kind_of?(Muml_Class)
			c.uml_nestedClassifier.each { |c2|
				if c2.kind_of?(Muml_Enumeration)
					ret.add(c2) 
				end
			}
		end
		#next unless
	}
	return ret 
end

#vso_generateMappingObject



5
6
7
8
9
10
11
# File 'lib/ontomde-java/vmware/vso.rb', line 5

def vso_generateMapping
	return if context[:vsoTargetFile,nil].nil?
	mtk_context(:hideJavadocReverseTag => true,:reversedFiles=>[],:requireReverseExtensions=>[],:reverseGlobalMap=>{} ) {
	mtk_writeSession(context[:vsoTargetFile]) {
		vso_writeMapping
	}}
end

#vso_scriptingObjectsObject

return a set of scripting objects



98
99
100
101
102
103
104
105
106
107
# File 'lib/ontomde-java/vmware/vso.rb', line 98

def vso_scriptingObjects
	ret=Set.new
	uml_Class_all.each { |c|
		next unless c.kind_of?(Muml_Class)
		next if c.kind_of?(Muml_DataType)
		#next unless
		ret.add(c)	
	}
	return ret 
end

#vso_writeEnumerations(tab) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/ontomde-java/vmware/vso.rb', line 84

def vso_writeEnumerations(tab)
	tab2=tab.tab
	before="#{tab}<enumerations>\n"
	after="#{tab}</enumerations>\n"
	encloseWrite(before,after) {
		write("#{tab2}<!-- dynamic enumeration(s) section -->\n")
		write("#{tab2}<!-- static enumeration(s) section -->\n")
		vso_enumerations.each { |so|
			so.vso_writeEnumerationMapping(tab2)
		}
	}
end

#vso_writeFinderDataSources(tab) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ontomde-java/vmware/vso.rb', line 39

def vso_writeFinderDataSources(tab)
	before="#{tab}<finder-datasources>\n"
	after="#{tab}</finder-datasources>\n"
	tab2=tab.tab
	found=encloseWrite(before,after,true) {
		vso_scriptingObjects.each { |so|
			next unless  so.umlx_hasStereotype?('TFINDER')
			write(%{#{tab2}<finder-datasource name="#{so.vso_DataSourceName}" adaptor-class="#{so.java_qualifiedName}" debug="true"/>\n})
		}
	}
	write("<!-- WARNING: no finder-datasources found in model (ie: stereotype TFINDER) -->\n") unless found
end

#vso_writeFinders(tab) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/ontomde-java/vmware/vso.rb', line 62

def vso_writeFinders(tab)
	before="#{tab}<finders>\n"
	after="#{tab}</finders>\n"
	tab2=tab.tab
	encloseWrite(before,after) {
		vso_scriptingObjects.sort { |a,b| a.java_qualifiedName.to_s <=> b.java_qualifiedName.to_s }.each { |so|
			so.vso_writeFinder(tab2)
		}
	}
end

#vso_writeInventory(tab) ⇒ Object



52
53
54
55
56
57
58
59
60
# File 'lib/ontomde-java/vmware/vso.rb', line 52

def vso_writeInventory(tab)
	found=encloseWrite(%{#{tab}<inventory type="},%{"/>\n},true) {
		vso_scriptingObjects.each { |so|
			next unless  so.umlx_hasStereotype?('TROOT')
			write(so.java_Name)
		}
	}
	write("<!-- WARNING: no inventory root found model (ie: stereotype TROOT) -->\n") unless found
end

#vso_writeMapping(tab = "") ⇒ Object



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
# File 'lib/ontomde-java/vmware/vso.rb', line 13

def vso_writeMapping(tab="")
	tab2=tab.tab
	before=<<END 
#{tab}<module 
#{tab2}xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
#{tab2}xsi:noNamespaceSchemaLocation="http://vs-o.dunes.ch/plugin-3-2.xsd"
#{tab2}name="#{context[:vsoPluginName,%{undefinedPluginName}]}" 
#{tab2}version="#{context[:vsoPluginVersion,%{0000}]}" 
#{tab2}build-number="#{Time.new().to_i() / 60 / 60}" 
#{tab2}image="training-logo-32x32.png">
#{tab2}<description>#{context[:vsoPluginDescription,%{no description available}]}\n(generated by ontomde v.#{Ontomde::Java::VERSION})</description>
END
	after=<<END
#{tab}</module>
#{tab}<!-- end of file -->
END
	encloseWrite(before,after) {
		vso_writeFinderDataSources(tab2)
		vso_writeInventory(tab2)
		vso_writeFinders(tab2)
		vso_writeScriptingObjects(tab2)
		vso_writeEnumerations(tab2)
	}

end

#vso_writeScriptingObjects(tab) ⇒ Object



73
74
75
76
77
78
79
80
81
82
# File 'lib/ontomde-java/vmware/vso.rb', line 73

def vso_writeScriptingObjects(tab)
	before="#{tab}<scripting-objects>\n"
	after="#{tab}</scripting-objects>\n"
	tab2=tab.tab
	encloseWrite(before,after) {
		vso_scriptingObjects.sort { |a,b| a.java_qualifiedName.to_s <=> b.java_qualifiedName.to_s }.each { |so|
			so.vso_writeObjectMapping(tab2)
		}
	}
end

#writeMessagesFromModel(locale, fillFromModel = false, test = false) ⇒ Object



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
# File 'lib/ontomde-java/struts/MessageResources.rb', line 56

def writeMessagesFromModel(locale,fillFromModel=false,test=false)
	uml_Class_all.each {|c|
		next unless c.kind_of?(Muml_Class) #|| c.kind_of?(Muml_Interface)
		next if c.kind_of?(Muml_Stereotype)
		write("#############################\n")
		write("##### #{c.java_qualifiedName}\n")
		write("#############################\n")

		c.struts_ownedTab.each { |tab|
			struts_writeMsgRes("#{c.java_qualifiedName}.#{tab.java_Name}.tab","#{tab.java_Name}",!fillFromModel,locale)
		}

		struts_writeMsgRes("#{c.java_qualifiedName}.title","#{c.java_qualifiedName}",!fillFromModel,locale);
		i=-1
		(c.struts_formAttribute+c.struts_formOperation).each {|a|
			msg="#{a.uml_name_one}"
			if fillFromModel && !test
				msg="#{a.uml_name_one}"
			elsif fillFromModel
				msg="#{a.uml_name_one.nil? ? "":a.uml_name_one.upcase}"
			end
			struts_writeMsgRes("#{c.java_qualifiedName}.#{a.java_Name}",msg,!fillFromModel,locale)
			helpmsg=""
			a.uml_ownedComment.each { |comment|
				# comment are used as default help message for default locale.
				helpmsg=comment.uml_body_one0
			}
			struts_writeMsgRes("#{c.java_qualifiedName}.#{a.java_Name}.help",helpmsg,false,locale)
		}}

	write "# *********************\n"
	write "# Enumerations\n"
	write "# *********************\n"
	uml_Class_all.each {|c|
		if c.kind_of?(Muml_Enumeration)
			java_genEnumMsgRes(c,fillFromModel,locale)
		else
			c.uml_nestedClassifier.each  { |nc|
				next unless nc.kind_of?(Muml_Enumeration)
				java_genEnumMsgRes(nc,fillFromModel,locale)
			}
		end
		}

	write "# *********************\n"
	write "# End of file\n"
	write "# *********************\n"

end

#xsd_addContextJavaFilePathMapping(qualifiedNameRegexp, relativePath) ⇒ Object

Example xsd_addJavaFilePathMapping(/.example/,“src/main/example/” ]) TODO: add helping error if jfp.nil?



133
134
135
136
# File 'lib/ontomde-java/java/xsd.rb', line 133

def xsd_addContextJavaFilePathMapping(qualifiedNameRegexp,relativePath)
  jfp=context[:javaFilePathRegexp]
  jfp[qualifiedNameRegexp,relativePath]
end

#xsd_generate_allObject

Main java generator entry point. Triggers the generation of every Java file for the model.



179
180
181
182
183
184
185
# File 'lib/ontomde-java/java/xsd.rb', line 179

def xsd_generate_all
  each_value {|m|
    next unless m.kind_of?(Mxsd_Schema)
    #      puts "!!"
    m.xsd_generateSchema
  }
end

#xsd_generateSchemaElements!Object

parse model and generate file objects for elements



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
# File 'lib/ontomde-java/java/xsd.rb', line 188

def xsd_generateSchemaElements!
 
  #compute set of packages with elements of interest
  packages=Set.new
  uml_Class_all.each { |c|
    next if c.xsd_ignoreMe?
    packages.add(c.umlx_owner_one)
  }

  #
  global=Cxsd_Schema.new(self,"uri://globalXSD")
 
  #Create one xsd schema for each package
  xsdFiles=Set.new
  packages.each { |p|
    f=Cxsd_Schema.new(self,"#{p.rdf_uri}_xsdFile")
    xsdFiles.add(f)
    f.xsd_baseName=p
    p.uml_Class_all.each {|oe|
      next if oe.xsd_ignoreMe?
      f.xsd_types_add(oe)
    }
  }

  #
  d=global.nil? ? Cxsd_Schema.new(self,"defaultXSD") : global
  xsdFiles.each {  |xsd|
    xsd.xsd_computeDependencies!(d)
  }
end

#xsd_generateXSDFilesObject



219
220
221
222
223
224
# File 'lib/ontomde-java/java/xsd.rb', line 219

def xsd_generateXSDFiles
  each_value { |v|
    next unless v.kind_of?(Mxsd_Schema)
    v.generateXSDFile
  }
end

#xsd_transform!Object

trigger Muml_Classifier xsd_transform! for every class element



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/ontomde-java/java/xsd.rb', line 161

def xsd_transform!
  #must copy before transformation (hash modified runtime error)
  a=Array.new
  each { |k,c|
    next if c.kind_of?(Muml_Stereotype)
    next unless c.kind_of?(Muml_Class) || c.kind_of?(Muml_Interface)||c.kind_of?(Muml_Enumeration)
    a << c
  }
  a.each {|c|
    c.xsd_transform! unless c.xsd_ignoreMe?
  }

  #xsd_addPersistence!
  umlx_processStereotypes!
end