• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badetitou / Casino / 7139683462

08 Dec 2023 09:32AM UTC coverage: 46.082% (+0.003%) from 46.079%
7139683462

push

github

badetitou
update path test ressource

1 of 1 new or added line in 1 file covered. (100.0%)

41 existing lines in 1 file now uncovered.

7203 of 15631 relevant lines covered (46.08%)

0.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.4
/src/Casino-Model-CoreWeb-Importer/CSNWebModelJava.class.st
1
"
2
TinyLogger
3
        default ensureFileLoggerNamed: 'Casino.log'.
4

5
        self
6
                execute: [ metamodel := FMMetaModelBuilder metamodelFromPackages: CSNBModel packagesToProcessToCreateMetamodel , CRFModel packagesToProcessToCreateMetamodel.
7
                        'D:\Developpement\mse\VerveineJNicolas\KitchenGWT.mse' asFileReference readStreamDo: [ :stream | gwtMooseModel := CRFModel new importFromMSEStream: stream ].
8
                        gwtMooseModel rootFolder: 'D:\Developpement\mse\VerveineJNicolas' ]
9
                recordedAs: 'load Model'.
10

11
        ""Generate Bl Model""
12
        gwtModel := CSNUICWModel new
13
                name: 'Showroom';
14
                yourself.
15
        gwtModel metamodel: metamodel.
16
        CSNMooseModelCreatorAngular
17
                runOn: gwtModel
18
                fromSourceModel: gwtMooseModel
19
                and: 'D:\Developpement\mse\KitchenGWT\BLCoreIncubatorGwt\src\fr\bl\application.module.xml'.
20

21

22
        behavioralModel := behavioralImporter resetUIAndGenerateBehavioralModel.
23
        behavioralImporter := CSNBehaviorModelImporterJava new
24
                uiModel: gwtModel;
25
                sourceCodeModel: gwtMooseModel;
26
                yourself.
27

28

29
        CSNModelExporterAngular export: gwtModel.
30

31
        CSNModelExporterAngularBLSpecific export: gwtModel.
32

33

34
        gwtModel := nil.
35
        gwtMooseModel := nil.
36

37
        CSNBehaviorModelGenerator generate.
38

39
        gwtMooseModel flushPrivateState.
40
        gwtModel flushPrivateState
41
"
42
Class {
43
        #name : #CSNWebModelJava,
44
        #superclass : #CSNJavaImporter,
45
        #instVars : [
46
                'xml',
47
                'xmlUiLink',
48
                'modelWidgetCache',
49
                'xmlUiWidgetLink',
50
                'customWidgetClassDictionnary'
51
        ],
52
        #category : #'Casino-Model-CoreWeb-Importer'
53
}
54

55
{ #category : #adding }
56
CSNWebModelJava >> addLinkForAbstractTabPhase [
×
57
        self linkForAbstractTabPhase
×
58
                do: [ :assoc | 
×
59
                        (self getPhaseFromClass: assoc key)
×
60
                                do: [ :phase | 
×
61
                                        (self getPageMetierFromClass: assoc value)
×
62
                                                do: [ :pageMetier | phase addBusinessPage: pageMetier ] ] ]
×
63
                displayingProgress: [ :assoc | 'compute ' , assoc name ]
×
64
                every: 1000
×
65
]
×
66

67
{ #category : #adding }
68
CSNWebModelJava >> addLinkPageMetierToPageMetier [
×
69
        self linkPageMetierToPageMetier
×
70
                do: [ :assoc | assoc key do: [ :businessPage | assoc value do: [ :widget | businessPage addWidget: widget ] ] ]
×
71
]
×
72

73
{ #category : #adding }
74
CSNWebModelJava >> addLinkPhaseToPageMetier [
×
75
        (self computeAllConstructorsLink
×
76
                collect: [ :a | (self getPhaseFromClass: a key) -> (self getPageMetierFromClass: a value) ]
×
77
                thenSelect: [ :a | a key isNotNil and: [ a value isNotNil ] ])
×
78
                do: [ :assoc | 
×
79
                        assoc key
×
80
                                do: [ :page | assoc value do: [ :businessPage | page addBusinessPage: businessPage ] ] ]
×
81
]
×
82

83
{ #category : #adding }
84
CSNWebModelJava >> addLinkXmlUi [
×
85

×
86
        xmlUiLink := CSNMultiValueDictionary newFrom: self linkXmlUiPhaseAndPageMetier.
×
87
        xmlUiWidgetLink := (CSNMultiValueDictionary newFrom: self linkXmlUiWidget)
×
88
                                   addAllMulti: xmlUiLink;
×
89
                                   yourself
×
90
]
×
91

92
{ #category : #adding }
93
CSNWebModelJava >> addPPPToWidget [
×
94

×
95
        | col |
×
96
        col := (self model allCSNWidgetExceptPage select: [ :widget | 
×
97
                        widget parents isEmpty ]) asOrderedCollection.
×
98
        col withIndexDo: [ :widget :index | 
×
99
                | founds |
×
100
                founds := self
×
101
                                  widgetOwnerCase1: widget source source
×
102
                                  maxLevel: 15
×
103
                                  level: 0.
×
104
                founds do: [ :found | 
×
105
                        (found isKindOf: CSNBusinessPage) ifTrue: [ " found addWidget: widget"
×
106
                                self addWidgetVisitor
×
107
                                        addWidget: widget
×
108
                                        to: found
×
109
                                        withInvocationOfAdd: nil
×
110
                                        usingFactory: self factory ] ].
×
111
                index \\ 200 = 0 ifTrue: [ 
×
112
                        ((index / col size) asFloat * 100) record ] ]
×
113
]
×
114

115
{ #category : #adding }
UNCOV
116
CSNWebModelJava >> addWidgetAttributes [
×
117

×
118
        (self model allCSNWidgetExceptPage select: [ :widget | 
×
119
                 widget variable isNotNil and: [ widget variable isNotFound not ] ]) 
×
120
                do: [ :widget | 
×
121
                        widget variable receivingInvocations do: [ :invoc | 
×
122
                                invoc signature = 'getFlexCellFormatter()'
×
123
                                        ifTrue: [ 
×
124
                                                invoc affectation
×
125
                                                        ifNotNil: [ :variableWithFlexCellFormater | 
×
126
                                                                | variable |
×
127
                                                                variable := variableWithFlexCellFormater isAccess
×
128
                                                                                    ifTrue: [ variableWithFlexCellFormater variable ]
×
129
                                                                                    ifFalse: [ variableWithFlexCellFormater ].
×
130
                                                                variable receivingInvocations do: [ :invocOnFlexCellVariable | 
×
131
                                                                        invocOnFlexCellVariable parameters size >= 2 ifTrue: [ 
×
132
                                                                                self factory
×
133
                                                                                        createAttributeFrom: invocOnFlexCellVariable
×
134
                                                                                        forCellOf: widget ] ] ]
×
135
                                                        ifNil: [ 
×
136
                                                                (invoc previous isNotNil and: [ 
×
137
                                                                         invoc previous receiver
×
138
                                                                                 ifNotNil: [ :receiver | receiver isImplicitVariable not ]
×
139
                                                                                 ifNil: [ true ] ]) ifTrue: [ 
×
140
                                                                        self factory
×
141
                                                                                createAttributeFrom: invoc previous
×
142
                                                                                forCellOf: widget ] ] ]
×
143
                                        ifFalse: [ self factory createAttributeFor: widget from: invoc ] ] ]
×
144
]
×
145

146
{ #category : #adding }
UNCOV
147
CSNWebModelJava >> addWidgetDefaultAttributes [
×
148
        self model allCSNWidgetExceptPage do: #addDefaultAttribute displayingProgress: [ :widget | 'DefaultAttribute for ' , widget asString ] every: 1000
×
149
]
×
150

151
{ #category : #adding }
UNCOV
152
CSNWebModelJava >> addWidgetsActions [
×
153
        self sourceModel allClasses
×
154
                detect: [ :c | #'com::google::gwt::event::shared::EventHandler' = c mooseName ]
×
155
                ifFound: [ :eventHandlerClass | 
×
156
                        eventHandlerClass subclassHierarchy
×
157
                                select: [ :class | self isElementFromApplication: class ]
×
158
                                thenDo: [ :class |
×
159
                                        (self tryGetWidgetFromUsages: class allUsages)
×
160
                                                ifNotNil: [ :found | self factory createActionFromClass: class for: found ]
×
161
                                                ifNil: [ ('no widget found for ' , class asString) record ] ] ]
×
162
]
×
163

164
{ #category : #accessing }
UNCOV
165
CSNWebModelJava >> applicationSource [
×
166
        "name of the directory with the GWT application"
×
167
        ^  'BLCoreIncubatorGwt'
×
168
]
×
169

170
{ #category : #'private - accessing' }
UNCOV
171
CSNWebModelJava >> buisinessPageWithSources [
×
172
        "I extract this method for optimisations purpose"
×
173

×
174
        ^ self model
×
175
                cacheAt: #buisinessPageWithSources
×
176
                ifAbsentPut: [ self model allCSNPageMetier
×
177
                                reject: [ :businessPage | businessPage sources isEmpty ] ]
×
178
]
×
179

180
{ #category : #'private - postImport' }
UNCOV
181
CSNWebModelJava >> cleanImportCache [
×
182
        self model removeCache: #buisinessPageWithSources
×
183
]
×
184

185
{ #category : #adding }
UNCOV
186
CSNWebModelJava >> computeAllConstructorsLink [
×
187
        ^ self sourceModel constructors
×
188
                flatCollect: [ :method | 
×
189
                        | got |
×
190
                        got := (method queryAll: #in) atScope: FamixTClass.
×
191
                        got collect: [ :p | p -> method parentType ] ]
×
192
]
×
193

194
{ #category : #initialization }
195
CSNWebModelJava >> createFactory [
1✔
196
        factory := CSNWidgetFactoryAngular new
1✔
197
                model: model;
1✔
198
                importer: self;
1✔
199
                addVisitorImporter: CSNModelImporterCoreWebVisitor new;
1✔
200
                yourself
1✔
201
]
1✔
202

203
{ #category : #'private - accessing' }
UNCOV
204
CSNWebModelJava >> customWidgetClassDictionnary [
×
205
        ^ customWidgetClassDictionnary
×
206
                ifNil: [ customWidgetClassDictionnary := (CSNMultiValueDictionary
×
207
                                newFrom:
×
208
                                ((self model allWithType: CSNUICustomWidget)
×
209
                                reject: [ :widget | widget source isClass ]
×
210
                                thenCollect:
×
211
                                        [ :custom | (custom source target first atScope: FamixTClass) anyOne -> custom ]))
×
212
                                removeKey: nil ifAbsent: [  ];
×
213
                                yourself ]
×
214
]
×
215

216
{ #category : #adding }
UNCOV
217
CSNWebModelJava >> domBuildingMethods [
×
218
        "setWidgetDetail and setListe are for the ListAndDetails"
×
219

×
220
        ^ {'setWidget(' . 'setWidgets('. 'add(' . 'setRecto(' . 'setListe' . 'setWidgetDetail'.
×
221
        'initWidget('}
×
222
]
×
223

224
{ #category : #'private - actions' }
UNCOV
225
CSNWebModelJava >> generateActionAppel [
×
226
        self linkFromWidgetActionAppel
×
227
                do: [ :el | 
×
228
                        | action |
×
229
                        action := (self factory create: CSNActionAppel).
×
230
                        el key addAction: action.
×
231
                        el value ifNotNil: [ action call: el value ] ]
×
232
]
×
233

234
{ #category : #'private - actions' }
235
CSNWebModelJava >> generatePageMetier [
1✔
236

1✔
237
        (sourceModel allWithSubTypesOf: FamixJavaType) asSet
1✔
238
                detect: [ :class | class name = #IPageMetier ]
1✔
239
                ifFound: [ :iPageMetierInterface | 
1✔
240
                        ((iPageMetierInterface isKindOf: FamixJavaInterface)
1✔
241
                                 ifTrue: [ 
1✔
242
                                         (iPageMetierInterface implementations collect: [ :a | 
1✔
243
                                                  a implementingClass subclassHierarchy ]) flattened ]
1✔
244
                                 ifFalse: [ "iPageMetierInterface is probable a class like in Moose9" 
1✔
245
                                         iPageMetierInterface subclassHierarchy ])
1✔
246
                                reject: [ :class | 
1✔
247
                                class isStub or: [ class name endsWith: 'XMLUi' ] ]
1✔
248
                                thenDo: [ :aPageMetier | 
1✔
249
                                        self factory createBusinessPageFromFAMIXClass: aPageMetier ] ]
1✔
250
                ifNone: [ 
1✔
251
                Exception signal: 'No IPageMetier abstract interface found' ]
1✔
252
]
1✔
253

254
{ #category : #'private - actions' }
255
CSNWebModelJava >> generatePhase [
1✔
256

1✔
257
        xml allNodesDo: [ :aXmlNode | (aXmlNode isElement and: [ aXmlNode name = 'phase' ]) ifTrue: [ self factory createPageFromXMLElement: aXmlNode ] ]
1✔
258
]
1✔
259

260
{ #category : #'private - actions' }
UNCOV
261
CSNWebModelJava >> generateService [
×
262

×
263
        | uc createdServices |
×
264
        "BVER 20/05/2022 ! I should take the subclass of the interface for the method parameter names ""interfaceService := self sourceModel allModelClasses asSet select: [ 
×
265
                                    :e | 
×
266
                                    (e superclassHierarchy anySatisfy: [ :a | 
×
267
                                             #( 'RestService' 'RemoteService' ) includes:
×
268
                                                     a name ]) and: [ e isInterface not ] ].
×
269
        interfaceService addAll: ((interfaceService flatCollect: [ :class | 
×
270
                          class classes flatCollect: #attributes ]) collect: #declaredType)."
×
271
        uc := self sourceModel allModelClasses select: [ :class | 
×
272
                      (class name beginsWith: 'Uc') and: [ 
×
273
                              (class name endsWith: 'Test') not ] ].
×
274
        createdServices := uc
×
275
                                   reject: [ :service | 
×
276
                                   service name endsWith: 'Async' ]
×
277
                                   thenCollect: [ :aServiceClass | 
×
278
                                           self factory createServiceFromServiceClass:
×
279
                                                   aServiceClass ].
×
280

×
281
        createdServices do: [ :service | 
×
282
                createdServices
×
283
                        detect: [ :owner | 
×
284
                                owner source = ((service source superclass isKindOf: FamixJavaParameterizedType)
×
285
                                         ifTrue: [ service source superclass parameterizableClass ]
×
286
                                         ifFalse: [ service source superclass ]) ]
×
287
                        ifFound: [ :owner | owner addChildService: service ]
×
288
                        ifNone: [ "no parent" ] ].
×
289
        ^ createdServices
×
290
]
×
291

292
{ #category : #'private - actions' }
UNCOV
293
CSNWebModelJava >> generateServiceAPIParameter [
×
294
        (self model allWithSubTypesOf: CSNServiceAPI)
×
295
                withIndexDo: [ :e :index | 
×
296
                        e source parameters
×
297
                                do: [ :parameter | 
×
298
                                        e
×
299
                                                addParameter:
×
300
                                                        ((self factory create: CSNServiceAPIParameter fromSource: parameter)
×
301
                                                                name: parameter name;
×
302
                                                                yourself) ].
×
303
                        index \\ 100 = 0 ifTrue: [ ((index / self model allCSNServiceAPI size) asFloat * 100) record ] ]
×
304
]
×
305

306
{ #category : #'private - actions' }
UNCOV
307
CSNWebModelJava >> generateServiceAction [
×
308
        self model allCSNService
×
309
                withIndexDo: [ :e :index | 
×
310
                        self model addAll: (e addAllActions: (self getListOfServiceActionForServiceClass: e source)).
×
311
                        index \\ 10 = 0 ifTrue: [ ((index / self model allCSNService size) asFloat * 100) record ] ]
×
312
]
×
313

314
{ #category : #'private - actions' }
UNCOV
315
CSNWebModelJava >> generateWidget [
×
316

×
317
        | col |
×
318
        col := self widgetConstructorsInvocation
×
319
               , self widgetAnonymousSubclasses
×
320
               , self widgetFactoryInvocation reject: [ :invocationOrClass | 
×
321
                       (invocationOrClass source mooseName beginsWithAnyOf:
×
322
                                self widgetNamespaces) or: [ 
×
323
                               (invocationOrClass asString includesSubstring:
×
324
                                        'noname#super') or: [ 
×
325
                                       (invocationOrClass asString includesSubstring:
×
326
                                                'noname#this') or: [ self isInFactory: invocationOrClass ] ] ] ].
×
327
        col asOrderedCollection withIndexDo: [ :invocation :index | 
×
328
                | blWidget |
×
329
                blWidget := self factoryCreateWidgetFrom: invocation.
×
330
                blWidget affectedActions: invocation affectation.
×
331
                (blWidget affectedActions isNotNil and: [ 
×
332
                         blWidget affectedActions isNotFound not and: [ 
×
333
                                 blWidget affectedActions isInvocation not ] ]) ifTrue: [ 
×
334
                        blWidget name: blWidget affectedActions name ].
×
335
                index \\ 200 = 0 ifTrue: [ 
×
336
                        ((index / col size) asFloat * 100) record ] ]
×
337
]
×
338

339
{ #category : #adding }
UNCOV
340
CSNWebModelJava >> generateWidgetsLink [
×
341

×
342
        | widgets |
×
343
        widgets := (self model allWithSubTypesOf: CSNContainer) iterator
×
344
                   | [ :containers | 
×
345
                           (containers isKindOf: CSNBusinessPage) or: [ 
×
346
                                   containers isKindOf: CSNPage ] ] rejectIt > Array.
×
347
        widgets withIndexDo: [ :widget :index | 
×
348
                self computeChildrenOf: widget.
×
349
                index \\ 200 = 0 ifTrue: [ 
×
350
                        ((index / widgets size) asFloat * 100) record ] ]
×
351
]
×
352

353
{ #category : #accessing }
354
CSNWebModelJava >> getClassNamed: aClassName [
1✔
355
        ^ self sourceModel allModelClasses
1✔
356
                detect: [ :a | a mooseName = aClassName ]
1✔
357
]
1✔
358

359
{ #category : #accessing }
UNCOV
360
CSNWebModelJava >> getCustomWidgetFromClass: aClass [
×
361
        ^ self customWidgetClassDictionnary at: aClass ifAbsent: [ nil ]
×
362
]
×
363

364
{ #category : #accessing }
UNCOV
365
CSNWebModelJava >> getFromSource: listofSourcedElement forClass: aClass [
×
366

×
367
        ^ (xmlUiLink at: aClass ifAbsent: [ ^ (listofSourcedElement select: [ :a | a source = aClass ]) ifEmpty: [ ^ nil ] ifNotEmpty: [ :a | { (a at: 1) } ] ]) 
×
368
                  collect: [ :class | (listofSourcedElement select: [ :a | a source = class ]) ifEmpty: [ ^ nil ] ifNotEmpty: [ :a | a at: 1 ] ]
×
369
]
×
370

371
{ #category : #'private - actions' }
UNCOV
372
CSNWebModelJava >> getListOfEndpointForServiceClass: aServiceClass [
×
373

×
374
        ^ aServiceClass methods reject: [ :method | 
×
375
                  method isConstructor or: [ 
×
376
                          method sourceAnchor isNil or: [ 
×
377
                                  method sourceAnchor hasSource not "sourceText isEmpty" "reject method from src/target/... In source" ] ] ]
×
378
]
×
379

380
{ #category : #accessing }
UNCOV
381
CSNWebModelJava >> getListOfServiceActionForServiceClass: aServiceClass [
×
382

×
383
        ^ (self getListOfEndpointForServiceClass: aServiceClass) collect: [ 
×
384
                  :method | CSNServiceAPI newFor: method ] "sourceText isEmpty" "reject method from src/target/... In source"
×
385
]
×
386

387
{ #category : #accessing }
UNCOV
388
CSNWebModelJava >> getPageMetierFromClass: aClass [
×
389
        ^ self getFromSource: self buisinessPageWithSources forClass: aClass
×
390
]
×
391

392
{ #category : #private }
UNCOV
393
CSNWebModelJava >> getPhaseCallInvocations [
×
394

×
395
        ^ (((Smalltalk includesKey: #FamixJavaInterface)
×
396
                    ifTrue: [ self sourceModel allWithType: FamixJavaInterface ]
×
397
                    ifFalse: [ self sourceModel allWithType: FamixJavaClass ])
×
398
                   detect: [ :a | a mooseName endsWith: 'ConstantsPhase' ]
×
399
                   ifNone: [ self error: 'No call invocation strategy' ]) methods 
×
400
                  flatCollect: #incomingInvocations
×
401
]
×
402

403
{ #category : #accessing }
UNCOV
404
CSNWebModelJava >> getPhaseFromClass: aClass [
×
405
        ^ self getFromSource: self model allCSNPage forClass: aClass
×
406
]
×
407

408
{ #category : #private }
UNCOV
409
CSNWebModelJava >> getPhaseNamed: aCodePhase [
×
410
        ^ self model allCSNPage detect: [ :e | e codePhase = aCodePhase ] ifNone: [ nil ]
×
411
]
×
412

413
{ #category : #'private - adding' }
414
CSNWebModelJava >> getWidgetContainerOfWidgetWithoutAffectation: widget [
1✔
415

1✔
416
        | containerInvocation found |
1✔
417
        containerInvocation := widget source isType
1✔
418
                                       ifTrue: [ 
1✔
419
                                               widget source typeContainer isInitializer
1✔
420
                                                       ifTrue: [ widget source ]
1✔
421
                                                       ifFalse: [ (widget source typeContainer atScope: FamixTClass) anyOne incomingInstanciations anyOne ] ]
1✔
422
                                       ifFalse: [ 
1✔
423
                                               widget source isReturned
1✔
424
                                                       ifTrue: [ 
1✔
425
                                                               widget source sender allUsages
1✔
426
                                                                       ifNotEmpty: [ :col | col anyOne ]
1✔
427
                                                                       ifEmpty: [ nil ] ]
1✔
428
                                                       ifFalse: [ widget source container ] ].
1✔
429
        [ containerInvocation isNotNil ] whileTrue: [ 
1✔
430
                found := (self widgetInVariable: containerInvocation affectation) 
1✔
431
                                 ifNil: [ 
1✔
432
                                 self widgetInVariable: containerInvocation receiver ].
1✔
433
                found
1✔
434
                        ifNotNil: [ 
1✔
435
                                ^ { 
1✔
436
                                          found.
1✔
437
                                          containerInvocation } ]
1✔
438
                        ifNil: [ containerInvocation := containerInvocation container ] ].
1✔
439
        ^ nil
1✔
440
]
1✔
441

442
{ #category : #accessing }
443
CSNWebModelJava >> gwtWidgetNamespace [
1✔
444
        ^ 'com::google::gwt::user::client::ui'
1✔
445
]
1✔
446

447
{ #category : #api }
UNCOV
448
CSNWebModelJava >> import [
×
449

×
450
        self execute: [ self generatePhase ] recordedAs: '1/15 generatePhase'.
×
451
        self
×
452
                execute: [ self generatePageMetier ]
×
453
                recordedAs: '2/15 generatePageMetier'.
×
454
        self execute: [ self addLinkXmlUi ] recordedAs: '3/15 addLinkXmlUi'.
×
455
        self
×
456
                execute: [ self addLinkForAbstractTabPhase ]
×
457
                recordedAs: '4/15 addLinkForAbstractTabPhase'.
×
458
        self
×
459
                execute: [ self addLinkPhaseToPageMetier ]
×
460
                recordedAs: '5/15 addLinkPhaseToPageMetier'.
×
461
        self
×
462
                execute: [ self addLinkPageMetierToPageMetier ]
×
463
                recordedAs: '6/15 addLinkPageMetierToPageMetier'.
×
464
        self
×
465
                execute: [ self generateWidget ]
×
466
                recordedAs: '7/15 generateWidget'.
×
467
        "keep this order for the widget adding. The second one depends on the first one.... Maybe i should create one method 'generate widgetlink'"
×
468
        self
×
469
                execute: [ self generateWidgetsLink ]
×
470
                recordedAs: '8/15 generateWidgetsLink'.
×
471
        self
×
472
                execute: [ self addPPPToWidget ]
×
473
                recordedAs: '9/15 addPPPToWidget'.
×
474
        self
×
475
                execute: [ self generateActionAppel ]
×
476
                recordedAs: '10/15 generateBLActionAppel'.
×
477
        self
×
478
                execute: [ self generateService ]
×
479
                recordedAs: '11/15 generateService'.
×
480
        self
×
481
                execute: [ self generateServiceAction ]
×
482
                recordedAs: '12/15 generateServiceAction'.
×
483
        self
×
484
                execute: [ self generateServiceAPIParameter ]
×
485
                recordedAs: '12/15 generateServiceAPIParameter'.
×
486
        "this last two should stay at the end"
×
487
        self
×
488
                execute: [ self addWidgetAttributes ]
×
489
                recordedAs: '13/15 addWidgetAttributes'.
×
490
        self
×
491
                execute: [ self addWidgetsActions ]
×
492
                recordedAs: '14/15 addWidgetsActions'.
×
493
        self
×
494
                execute: [ self addWidgetDefaultAttributes ]
×
495
                recordedAs: '15/15 addWidgetDefaultAttributes'
×
496
]
×
497

498
{ #category : #accessing }
499
CSNWebModelJava >> initialize [
1✔
500
        super initialize.
1✔
501
        possibleAddInvocationVisitorClass := CSNCoreWebPossibleAddInvocationVisitor
1✔
502
]
1✔
503

504
{ #category : #accessing }
505
CSNWebModelJava >> isElementFromApplication: e [
1✔
506
        ^ e hasSourceAnchor and: [ e sourceAnchor fileName includesSubstring: self applicationSource ]
1✔
507
]
1✔
508

509
{ #category : #'private - actions' }
UNCOV
510
CSNWebModelJava >> isInFactory: invocationOrClass [
×
511
        "used in PostOffice cause some factory are defined inside the PostOffice application \ie createBLLinkLabel"
×
512
        ^ false
×
513
]
×
514

515
{ #category : #accessing }
516
CSNWebModelJava >> isWidgetFromApplication: e [
1✔
517
        ^ (self isElementFromApplication: e)
1✔
518
                and: [ (e name endsWith: 'Ui') not
1✔
519
                                and: [ ((self model allCSNPage , self model allCSNPageMetier
1✔
520
                                                collect: #source) includes: e) not ] ]
1✔
521
]
1✔
522

523
{ #category : #private }
UNCOV
524
CSNWebModelJava >> linkForAbstractTabPhase [
×
525
        ^ (self modelPhases 
×
526
                select: [ :a | 
×
527
                        (a withSuperclassHierarchy collect: #name)
×
528
                                anySatisfy: [ :name | 'AbstractTabPhaseController' = name ] ]
×
529
                thenCollect: [ :class | 
×
530
                        class withSuperclassHierarchy
×
531
                                collect: [ :c | 
×
532
                                        ((c queryLocalOutgoing: FamixTInvocation)
×
533
                                                reject: [ :invoc | invoc receiver ifNotNil: [ :el | el name = #super ] ifNil: [ false ] ]
×
534
                                                thenCollect: [ :invoc | invoc candidates at: 1 ])
×
535
                                                select: [ :e | e isConstructor and: [ self modelPageMetier includes: e parentType ] ]
×
536
                                                thenCollect: [ :e | class -> e parentType ] ] ]) flattened
×
537
]
×
538

539
{ #category : #private }
UNCOV
540
CSNWebModelJava >> linkFromWidgetActionAppel [
×
541
        ^ self getPhaseCallInvocations
×
542
                collect: [ :el | 
×
543
                        | widget |
×
544
                        widget := self linkFromWidgetActionAppelCase1: el.
×
545
                        "link ifNil: [ link := self linkFromWidgetActionAppelCase2: el ]."
×
546
                        widget -> (self searchCalledPhaseFromInvocation: el) ]
×
547
                thenSelect: [ :a | a key isNotNil and: [ a value isNotNil ] ]
×
548
]
×
549

550
{ #category : #private }
UNCOV
551
CSNWebModelJava >> linkFromWidgetActionAppelCase1: anInvocation [
×
552
        "Return the found association
×
553
        case 1 and 4
×
554
        new Widget ( new blabla ( new bleble ( CP)))"
×
555

×
556
        | found |
×
557
        found := self searchWidgetFromConstructorInvocation: anInvocation.
×
558
        found
×
559
                ifNotNil: [ ^ found ]
×
560
                ifNil: [ | elContainer |
×
561
                        elContainer := anInvocation container.
×
562
                        ^ elContainer ifNotNil: [ self linkFromWidgetActionAppelCase1: elContainer ] ]
×
563
]
×
564

565
{ #category : #private }
UNCOV
566
CSNWebModelJava >> linkFromWidgetActionAppelCase2: anInvocation [
×
567

×
568
        "Return the found association
×
569
        case 2
×
570
        var i = new Widget ()
×
571
        i.addHandler..(BlBl)"
×
572

×
573
        anInvocation source parentType isHandlerClass ifFalse: [ ^ nil ].
×
574
        (self widgetInVariable: (anInvocation source parentType typeContainer outgoingInvocations
×
575
                          detect: [ :invoc | 
×
576
                                  invoc sourceAnchor isNotNil and: [ 
×
577
                                          invoc sourceAnchor startPos < anInvocation sourceAnchor startPos and: [ invoc sourceAnchor endPos > anInvocation sourceAnchor endPos ] ] ]
×
578
                          ifNone: [ ^ nil ]) receiver)
×
579
                ifNotNil: [ :widgetContainer | ^ widgetContainer -> (self searchCalledPhaseFromInvocation: anInvocation) ]
×
580
                ifNil: [ ^ nil ]
×
581
]
×
582

583
{ #category : #private }
UNCOV
584
CSNWebModelJava >> linkPageMetierToPageMetier [
×
585
        ^ ((self model allCSNPageMetier collect: #source) , xmlUiLink keys
×
586
                flatCollect: [ :pageMetier | 
×
587
                        pageMetier incomingInstanciations
×
588
                                reject: [ :invoc | invoc signature matchesRegex: '.*this\(.*|.*super\(.*' ]
×
589
                                thenCollect: [ :invoc | 
×
590
                                        ((self getPageMetierFromClass: (invoc target at: 1) parentType) at: 1) affectedActions: (invoc affectation ifNil: [ invoc ]).
×
591
                                        (self getPageMetierFromClass: invoc source parentType) -> (self getPageMetierFromClass: (invoc target at: 1) parentType) ] ])
×
592
                select: [ :assoc | assoc key isNotNil ]
×
593
]
×
594

595
{ #category : #private }
UNCOV
596
CSNWebModelJava >> linkXmlUiPhaseAndPageMetier [
×
597

×
598
        ^ (self modelPhases , self modelPageMetier) asSet
×
599
                  select: [ :a | a superclass mooseName endsWith: 'Ui' ]
×
600
                  thenCollect: [ :a | a superclass -> a ]
×
601
]
×
602

603
{ #category : #adding }
UNCOV
604
CSNWebModelJava >> linkXmlUiWidget [
×
605

×
606
        ^ self modelWidget flatCollect: [ :widget | 
×
607
                  widget superclassHierarchy
×
608
                          select: [ :class | (self isElementFromApplication: class) or: [ class mooseName endsWith: 'Ui' ] ]
×
609
                          thenCollect: [ :class | class -> widget ] ]
×
610
]
×
611

612
{ #category : #'private - accessing' }
UNCOV
613
CSNWebModelJava >> modelPageMetier [
×
614
        ^ self model allCSNPageMetier collect: #source
×
615
]
×
616

617
{ #category : #'private - accessing' }
UNCOV
618
CSNWebModelJava >> modelPhases [
×
619
        "support the C/S Phase (see application RH)"
×
620
        ^ self model allCSNPage collect: #source thenReject: #isNil 
×
621
]
×
622

623
{ #category : #'private - accessing' }
624
CSNWebModelJava >> modelWidget [
1✔
625

1✔
626
        ^ modelWidgetCache ifNil: [ 
1✔
627
                  modelWidgetCache := self sourceModel allClasses select: [ :e | 
1✔
628
                                              (e superclassHierarchy anySatisfy: [ :a | a name = 'Widget' ]) and: [ 
1✔
629
                                                      (e typeContainer mooseName beginsWithAnyOf: self widgetNamespaces) or: [ 
1✔
630
                                                              (e typeContainer mooseName beginsWith: self gwtWidgetNamespace) or: [ self isWidgetFromApplication: e ] ] ] ] ]
1✔
631
]
1✔
632

633
{ #category : #api }
UNCOV
634
CSNWebModelJava >> postImport [
×
635
        | currentStep maxStep |
×
636
        currentStep := 0.
×
637
        maxStep := 3.
×
638
        'PostImport'
×
639
                displayProgressFrom: 0
×
640
                to: maxStep
×
641
                during: [ :bar | 
×
642
                        currentStep := currentStep + 1.
×
643
                        bar current: currentStep.
×
644
                        bar label: currentStep printString , '/' , maxStep printString , ' for widgets'.
×
645
                        self model allCSNWidget do: #postImport displayingProgress: [:wid | 'post import widgets : ', wid name asString ].
×
646
                        currentStep := currentStep + 1.
×
647
                        bar current: currentStep.
×
648
                        bar label: currentStep printString , '/' , maxStep printString , ' for layouts'.
×
649
                        self model allCSNLayout do: #postImport displayingProgress: [:wid | 'post import layout : ', wid name asString ].
×
650
                        currentStep := currentStep + 1.
×
651
                        bar current: currentStep.
×
652
                        bar label: currentStep printString , '/' , maxStep printString , ' for pages'.
×
653
                        self model allCSNPage do: #postImport displayingProgress: [:wid | 'post import page : ', wid name asString ].
×
654
        ].
×
655

×
656
        self cleanImportCache
×
657
        
×
658
]
×
659

660
{ #category : #private }
UNCOV
661
CSNWebModelJava >> searchCalledPhase: aSignature [
×
662
        ^  self getPhaseNamed: (aSignature removeSuffix: '()')
×
663
]
×
664

665
{ #category : #private }
UNCOV
666
CSNWebModelJava >> searchCalledPhaseFromInvocation: invoc [
×
667
        ^ self searchCalledPhase: invoc target first signature
×
668
]
×
669

670
{ #category : #private }
UNCOV
671
CSNWebModelJava >> searchWidgetFromConstructorInvocation: anInvocation [
×
672
        ^ self model allCSNWidget detect: [ :widget | widget sources isNotEmpty and: [ widget source = anInvocation ] ] ifNone: [ nil ]
×
673
]
×
674

675
{ #category : #adding }
UNCOV
676
CSNWebModelJava >> tryGetWidgetFromUsages: usages [
×
677
        | widget |
×
678
        usages
×
679
                detect: [ :usage | (widget := (self linkFromWidgetActionAppelCase1: usage)) isNotNil ]
×
680
                ifFound: [ :found | ^ widget ]
×
681
                ifNone: [ (usages collect: #receiver) do: [ :receiver | (self widgetInVariable: receiver) ifNotNil: [ :found | ^ found ] ] ].
×
682
        ^ nil
×
683
]
×
684

685
{ #category : #accessing }
UNCOV
686
CSNWebModelJava >> widgetAnonymousSubclasses [
×
687
        ^ ((self modelWidget flatCollect: [ :widget | widget withSubclassHierarchy ]) select: #isAnonymousClass)
×
688
]
×
689

690
{ #category : #accessing }
UNCOV
691
CSNWebModelJava >> widgetConstructorsInvocation [
×
692

×
693
        "Get the constructor and try to determine the stub constructor"
×
694

×
695
        ^ (self modelWidget collect: [ :widget | 
×
696
                   widget methods
×
697
                           select: #isConstructor
×
698
                           thenCollect: #incomingInvocations ]) flattened asSet reject: [ 
×
699
                  :invoc | 
×
700
                        "I reject the BLLabel that will be added in ComponentUtils
×
701
                        Stuff like `ComponentUtils.getLibelleItem(new BLLabel(""Blabla""));`                        
×
702
"
×
703
                  (invoc signature beginsWith: 'BLLabel') and: [ 
×
704
                          invoc container isNotNil and: [ 
×
705
                                  invoc container signature beginsWith: 'getLibelleItem' ] ] ]
×
706
]
×
707

×
708
{ #category : #accessing }
×
709
CSNWebModelJava >> widgetFactoryInvocation [
×
710
        ^ (((self sourceModel allModelClasses
×
711
                select: [ :a | #(#FactoryBLLabel #ComponentUtils) includes: a name ])
×
712
                flatCollect: #methods)
×
713
                select: [ :m | m name = 'create' or: [ m name beginsWith: 'getLibelleItem'] ]
×
714
                thenCollect: #incomingInvocations) flatten
×
715
]
×
716

×
717
{ #category : #accessing }
×
718
CSNWebModelJava >> widgetInVariable: aVariable [
×
719
        "First check if the variable is the variable for a widget.
×
720
        If not check at the type level.
×
721
THIS CANNOT BE IN THE OTHER WAY"
×
722
        aVariable ifNil: [ ^ nil ].
×
723
        ^ self model allCSNWidget
×
724
                  detect: [ :el | el variable = aVariable ]
×
725
                  ifNone: [ 
×
726
                          self model allCSNWidget
×
727
                                  detect: [ :el | 
×
728
                                          aVariable name ~= 'content' and: [ 
×
729
                                                  (aVariable atScope: FamixTType) anyOne = el realClass ] ]
×
730
                                  ifNone: [ nil ] ]
×
731
]
×
732

×
733
{ #category : #accessing }
×
734
CSNWebModelJava >> widgetNamespaces [
×
735

×
736
        ^ { 'fr::bl::client::core::refui'. 'fr::bl::client::core::tasks'. 'fr::bl::client::core::phasecontrol::impl'. 'fr::bl::client::sedit::refui' }
×
737
]
×
738

×
739
{ #category : #accessing }
×
740
CSNWebModelJava >> widgetOwnerCase1: invocation maxLevel: maxLevel level: level [
×
741
        | found |
×
742
        level = maxLevel ifTrue: [ ^ {} ].
×
743
        (invocation isNil or: [ invocation isOfType: FamixTPackage ]) ifTrue: [ ^ {} ].
×
744
        invocation isClass
×
745
                ifFalse: [ (invocation atScope: FamixTClass) ifEmpty: [ ^ {} ].
×
746
                        ^ self widgetOwnerCase1: (invocation atScope: FamixTClass) anyOneIfOnlyOneElement maxLevel: maxLevel level: level + 1 ]
×
747
                ifTrue: [ found := self getPhaseFromClass: invocation.
×
748
                        found
×
749
                                ifNotNil: [ ^ found ]
×
750
                                ifNil: [ found := self getPageMetierFromClass: invocation.
×
751
                                        found
×
752
                                                ifNotNil: [ ^ found ]
×
753
                                                ifNil: [ found := self getCustomWidgetFromClass: invocation.
×
754
                                                        found ifNotNil: [ ^ found ].
×
755
                                                        invocation incomingReferences
×
756
                                                                ifNotEmpty: [ :references | ^ self widgetOwnerCase1: (references at: 1) source belongsTo maxLevel: maxLevel level: level + 1 ] ] ] ].
×
757
        ^ self widgetOwnerCase1: invocation maxLevel: maxLevel level: level + 1
×
758
]
×
759

×
760
{ #category : #accessing }
×
761
CSNWebModelJava >> xml [
×
762
        ^ xml
×
763
]
×
764

×
765
{ #category : #accessing }
×
766
CSNWebModelJava >> xml: anObject [
×
767
        xml := anObject
×
768
]
×
769

×
770
{ #category : #accessing }
×
771
CSNWebModelJava >> xmlUiLink [
×
772

×
773
        ^ xmlUiLink
×
774
]
×
775

×
776
{ #category : #accessing }
×
777
CSNWebModelJava >> xmlUiLink: anObject [
×
778

×
779
        xmlUiLink := anObject
×
780
]
×
781

×
782
{ #category : #accessing }
×
783
CSNWebModelJava >> xmlUiWidgetLink [
×
784

×
785
        ^ xmlUiWidgetLink
×
786
]
×
787

×
788
{ #category : #accessing }
×
789
CSNWebModelJava >> xmlUiWidgetLink: anObject [
×
790

×
791
        xmlUiWidgetLink := anObject
×
792
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc