Module: Mrdf_Model

Defined in:
lib/ontomde-uml2-flex/main.rb,
lib/ontomde-uml2-flex/main.rb,
lib/ontomde-uml2-flex/Editor.mxml.rb,
lib/ontomde-uml2-flex/ImportationAS.rb,
lib/ontomde-uml2-flex/ValueObjectAS.rb

Constant Summary collapse

ACTIONSCRIPT_JAVA_ADAPTER_ID =

Name of action script adapter

"java-dao"

Instance Method Summary collapse

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-uml2-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-uml2-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-uml2-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-uml2-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-uml2-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

#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-uml2-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-uml2-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-uml2-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-uml2-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