My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 1 attachment: roo_layering.diff (31.9 KB)

1
2
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
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
Index: src/main/java/org/springframework/roo/addon/graph/GraphMetadataProviderImpl.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/GraphMetadataProviderImpl.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/GraphMetadataProviderImpl.java (working copy)
@@ -1,13 +1,35 @@
package org.springframework.roo.addon.graph;

import static java.util.Arrays.asList;
-import static org.springframework.roo.addon.graph.support.MetaDataFactory.*;
-import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.*;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.annotation;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.getAnnotation;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.hasAnnotation;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.hasName;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.hasType;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.type;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.COUNT_ALL_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.FIND_ALL_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.FIND_ENTRIES_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.FIND_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.FLUSH_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.IDENTIFIER_ACCESSOR_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.IDENTIFIER_FIELD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.MANY_TO_MANY_FIELD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.MERGE_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.ONE_TO_ONE_FIELD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.PERSIST_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.REMOVE_METHOD;
+import static org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys.TRANSIENT_FIELD;
import static org.springframework.roo.classpath.details.MemberFindingUtils.getDeclaredTypeAnnotation;
import static org.springframework.roo.model.JavaType.LONG_OBJECT;
import static org.springframework.roo.model.JavaType.LONG_PRIMITIVE;
-import static org.springframework.roo.model.JavaType.STRING_OBJECT;
+import static org.springframework.roo.model.JavaType.STRING;

+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
@@ -15,25 +37,30 @@
import org.springframework.roo.addon.configurable.ConfigurableMetadataProvider;
import org.springframework.roo.addon.entity.AbstractIdentifierServiceAwareMetadataProvider;
import org.springframework.roo.addon.entity.EntityMetadataProvider;
+import org.springframework.roo.addon.entity.JpaCrudAnnotationValues;
import org.springframework.roo.addon.graph.support.MatcherCallback;
-import org.springframework.roo.addon.graph.support.MetaDataFactory;
import org.springframework.roo.addon.plural.PluralMetadata;
import org.springframework.roo.addon.plural.PluralMetadataProvider;
-import org.springframework.roo.classpath.*;
+import org.springframework.roo.classpath.PhysicalTypeDetails;
+import org.springframework.roo.classpath.PhysicalTypeIdentifier;
+import org.springframework.roo.classpath.PhysicalTypeMetadata;
+import org.springframework.roo.classpath.TypeLocationService;
+import org.springframework.roo.classpath.TypeManagementService;
import org.springframework.roo.classpath.customdata.PersistenceCustomDataKeys;
-import org.springframework.roo.classpath.customdata.taggers.*;
-import org.springframework.roo.classpath.details.*;
+import org.springframework.roo.classpath.customdata.taggers.AnnotatedTypeMatcher;
+import org.springframework.roo.classpath.customdata.taggers.ConstructorMatcher;
+import org.springframework.roo.classpath.customdata.taggers.CustomDataKeyDecorator;
+import org.springframework.roo.classpath.customdata.taggers.FieldMatcher;
+import org.springframework.roo.classpath.customdata.taggers.Matcher;
+import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails;
+import org.springframework.roo.classpath.details.FieldMetadata;
+import org.springframework.roo.classpath.details.MethodMetadata;
import org.springframework.roo.classpath.details.annotations.AnnotationMetadata;
import org.springframework.roo.classpath.itd.ItdTypeDetailsProvidingMetadataItem;
import org.springframework.roo.model.JavaType;
import org.springframework.roo.project.Path;
import org.springframework.roo.project.ProjectMetadata;

-import java.lang.reflect.Modifier;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
@Component( immediate = true )
@Service
public final class GraphMetadataProviderImpl extends
@@ -54,16 +81,19 @@

// FIXME: get the GraphDatabaseProvider from the configuration
private final GraphDatabaseProvider graphdbProvider = GraphDatabaseProvider.NEO4J;
- private boolean visualize = true;

- protected void activate( final ComponentContext context )
- {
+ protected void activate( final ComponentContext context ) {
metadataDependencyRegistry.registerDependency(PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType() );
-
registerForTypes(GRAPH_ENTITY_TYPE, GRAPH_RELATIONSHIP_TYPE);
registerNodeEntityMatchers();
registerRelationshipEntityMatchers();
}
+
+ protected void deactivate( final ComponentContext context ) {
+ metadataDependencyRegistry.deregisterDependency(PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType() );
+ unregisterForTypes(GRAPH_ENTITY_TYPE,GRAPH_RELATIONSHIP_TYPE);
+ unregisterMatchers();
+ }

private void registerMatcher(final Matcher<?>... matchers) {
registerMatcher(getClass().getName(), matchers);
@@ -84,7 +114,7 @@
}

private void registerNodeEntityMatchers() {
- registerNodeEntityMatcher(new TypeMatcher(PersistenceCustomDataKeys.PERSISTENT_TYPE, GraphMetadata.class.getName()));
+ registerNodeEntityMatcher(new AnnotatedTypeMatcher(PersistenceCustomDataKeys.PERSISTENT_TYPE, GRAPH_ENTITY_TYPE));
registerMatcher(new ConstructorMatcher(PersistenceCustomDataKeys.NO_ARG_CONSTRUCTOR, Collections.<JavaType>emptyList()));
registerMatchers();

@@ -92,7 +122,7 @@
@Override
protected boolean matchesField(final FieldMetadata fieldMetadata) {
final JavaType type = fieldMetadata.getFieldType();
- if (type.isPrimitive() || hasType(type, STRING_OBJECT)) return false;
+ if (type.isPrimitive() || hasType(type, STRING)) return false;
if (hasType(fieldMetadata, type(Set.class), type(Iterable.class))) {
final List<JavaType> typeParams = fieldMetadata.getFieldType().getParameters();
if (!typeParams.isEmpty()) {
@@ -117,7 +147,7 @@
@Override
protected boolean matchesField(final FieldMetadata fieldMetadata) {
final JavaType type = fieldMetadata.getFieldType();
- if (type.isPrimitive() || type.isCommonCollectionType() || hasType(type, STRING_OBJECT, type(Set.class), type(Iterable.class)))
+ if (type.isPrimitive() || type.isCommonCollectionType() || hasType(type, STRING, type(Set.class), type(Iterable.class)))
return false;
if (hasAnnotation(fieldMetadata, Type.Annotations.RelatedTo)) return true;
final ClassOrInterfaceTypeDetails targetTypeDetails = typeLocationService.findClassOrInterface(type);
@@ -152,8 +182,9 @@
registerNodeEntityMatcher(persistMatcher.forKey(FLUSH_METHOD).asMethodMatcher());
registerNodeEntityMatcher(persistMatcher.forKey(MERGE_METHOD).asMethodMatcher());
}
- private void registerRelationshipEntityMatchers() {
- registerRelationshipEntityMatcher(new TypeMatcher(PersistenceCustomDataKeys.PERSISTENT_TYPE, Type.RELATIONSHIP_ENTITY.getFullyQualifiedTypeName()));
+ @SuppressWarnings("unchecked")
+ private void registerRelationshipEntityMatchers() {
+ registerRelationshipEntityMatcher(new AnnotatedTypeMatcher(PersistenceCustomDataKeys.PERSISTENT_TYPE, Type.RELATIONSHIP_ENTITY));
registerMatchers();
registerRelationshipEntityMatcher(new FieldMatcher(ONE_TO_ONE_FIELD, asList(annotation(Type.Annotations.StartNode), annotation(Type.Annotations.EndNode))));
}
@@ -225,14 +256,6 @@
}
}

- protected void deactivate( final ComponentContext context )
- {
- unregisterForTypes(GRAPH_ENTITY_TYPE,GRAPH_RELATIONSHIP_TYPE);
-
- metadataDependencyRegistry.deregisterDependency(PhysicalTypeIdentifier.getMetadataIdentiferType(), getProvidesType() );
- unregisterMatchers();
- }
-
private void unregisterForTypes(final JavaType...unregisterTypes) {
for (final JavaType unregisterType : unregisterTypes) {
configurableMetadataProvider.removeMetadataTrigger( unregisterType );
@@ -259,8 +282,6 @@
return null;
}

-
-
final String pluralIdentifier = PluralMetadata.createIdentifier(GraphMetadata.getJavaType(metadataIdentificationString), GraphMetadata.getPath(metadataIdentificationString));
final PluralMetadata pluralMetadata = (PluralMetadata) metadataService.get(pluralIdentifier);
if (pluralMetadata==null) {
@@ -290,7 +311,11 @@
return metadata;
}

- @Override
+ public JpaCrudAnnotationValues getAnnotationValues(JavaType arg0) {
+ return null;
+ }
+
+ @Override
protected String createLocalIdentifier( final JavaType javaType, final Path path )
{
return GraphMetadata.createIdentifier( javaType, path );
Index: src/main/java/org/springframework/roo/addon/graph/Type.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/Type.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/Type.java (working copy)
@@ -21,13 +21,15 @@
*/
public enum Type {
NODE() {
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
public AnnotationMetadataBuilder getGraphAnnotation() {
//return annotationBuilder(type(ANNOTATION_API + "NodeEntity"),_("fullIndex",index));
return annotationBuilder(NODE_ENTITY);
}
}, RELATIONSHIP() {
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
public AnnotationMetadataBuilder getGraphAnnotation() {
return annotationBuilder(RELATIONSHIP_ENTITY);
}
@@ -72,11 +74,13 @@
private Annotations() {
}

- public static AnnotationMetadataBuilder StartNodeAnnotation() {
+ @SuppressWarnings("unchecked")
+ public static AnnotationMetadataBuilder StartNodeAnnotation() {
return annotationBuilder(StartNode);
}

- public static AnnotationMetadataBuilder EndNodeAnnotation() {
+ @SuppressWarnings("unchecked")
+ public static AnnotationMetadataBuilder EndNodeAnnotation() {
return annotationBuilder(EndNode);
}

Index: src/main/java/org/springframework/roo/addon/graph/GraphMetadata.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/GraphMetadata.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/GraphMetadata.java (working copy)
@@ -2,7 +2,13 @@

import static java.lang.reflect.Modifier.PUBLIC;
import static java.util.Arrays.asList;
-import static org.springframework.roo.addon.graph.support.MetaDataFactory.*;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.annotation;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.annotationBuilder;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.collectionType;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.hasAnnotation;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.hasType;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.symbol;
+import static org.springframework.roo.addon.graph.support.MetaDataFactory.type;
import static org.springframework.roo.addon.graph.support.MethodBuilder.method;
import static org.springframework.roo.addon.graph.support.Tuple2._;
import static org.springframework.roo.model.JavaType.INT_PRIMITIVE;
@@ -11,23 +17,33 @@

import java.io.File;
import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;

import javax.annotation.Resource;

import org.springframework.roo.addon.graph.support.BuildingItdTypeDetailsProvidingMetadataItem;
-import org.springframework.roo.addon.graph.support.Tuple2;
-import org.springframework.roo.classpath.*;
-import org.springframework.roo.classpath.details.*;
-import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType;
+import org.springframework.roo.classpath.PhysicalTypeCategory;
+import org.springframework.roo.classpath.PhysicalTypeIdentifierNamingUtils;
+import org.springframework.roo.classpath.PhysicalTypeMetadata;
+import org.springframework.roo.classpath.TypeLocationService;
+import org.springframework.roo.classpath.TypeManagementService;
+import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails;
+import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetailsBuilder;
+import org.springframework.roo.classpath.details.ConstructorMetadataBuilder;
import org.springframework.roo.classpath.details.FieldMetadata;
import org.springframework.roo.classpath.details.FieldMetadataBuilder;
import org.springframework.roo.classpath.details.ItdTypeDetailsBuilder;
+import org.springframework.roo.classpath.details.MemberFindingUtils;
+import org.springframework.roo.classpath.details.annotations.AnnotatedJavaType;
import org.springframework.roo.classpath.details.annotations.AnnotationAttributeValue;
import org.springframework.roo.classpath.details.annotations.AnnotationMetadata;
import org.springframework.roo.classpath.itd.InvocableMemberBodyBuilder;
import org.springframework.roo.metadata.MetadataIdentificationUtils;
-import org.springframework.roo.model.*;
+import org.springframework.roo.model.ImportRegistrationResolver;
+import org.springframework.roo.model.JavaSymbolName;
+import org.springframework.roo.model.JavaType;
import org.springframework.roo.project.Path;

public abstract class GraphMetadata extends
@@ -74,7 +90,8 @@
return new GraphMetadata(identifier, aspectName,
governorPhysicalTypeMetadata, governorTypeDetails,
Type.NODE) {
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
public void buildDetails() {
final JavaType target = getJavaType();
final String targetClass = target.getSimpleTypeName();
@@ -111,30 +128,28 @@

// TODO REMOVE, we have to cope with the inability of roo to integrate externally introduced (AJ) methods
// so I have to redeclare our methods here :(
- method("getId").returns(JavaType.LONG_OBJECT).line(
- "return getNodeId();").add(getId(), builder);
- method("save").returns(getJavaType()).line(
- "return (%s)persist();",targetClass).add(getId(), builder);
- method("delete").line(
- "remove();", targetClass).add(getId(), builder);
- method("findPaged",_(INT_PRIMITIVE,symbol("start")),_(INT_PRIMITIVE,symbol("pageSize"))).isStatic().returns(collectionType(Collection.class, target)).line(
- "return "+asCollection("%s.repository().findAll(new PageRequest(start/pageSize,pageSize))")+";", repositoryHolder
+ JavaType targetType = getJavaType();
+ method("getId").returns(JavaType.LONG_OBJECT).line("return getNodeId();").add(getId(), builder);
+ method(GraphLayerMethod.PERSIST.getName(targetType)).returns(targetType).line("return (%s)persist();",targetClass).add(getId(), builder);
+ method(GraphLayerMethod.REMOVE.getName(targetType)).line("remove();", targetClass).add(getId(), builder);
+ method(GraphLayerMethod.FIND_ENTRIES.getName(targetType),_(INT_PRIMITIVE,symbol("start")),_(INT_PRIMITIVE,symbol("pageSize"))).isStatic().returns(collectionType(Collection.class, target)).line("return "+asCollection("%s.repository().findAll(new PageRequest(start/pageSize,pageSize))")+";", repositoryHolder
).add(getId(), builder);

- method("find"+ simpleTypeName, _(LONG_OBJECT,symbol("id"))).returns(getJavaType()).isStatic().line(
+ method(GraphLayerMethod.FIND.getName(targetType), _(LONG_OBJECT,symbol("id"))).returns(getJavaType()).isStatic().line(
"return %s.repository().findOne(:param1);", repositoryHolder
).add(getId(), builder);
- method("count").returns(LONG_PRIMITIVE).isStatic().line(
+ method(GraphLayerMethod.COUNT_ALL.getName(targetType)).returns(LONG_PRIMITIVE).isStatic().line(
"return %s.repository().count();", repositoryHolder
).add(getId(), builder);
- method("findAll").isStatic().returns(collectionType(Collection.class, target)).line(
+ method(GraphLayerMethod.FIND_ALL.getName(targetType)).isStatic().returns(collectionType(Collection.class, target)).line(
"return " + asCollection("%s.repository().findAll()") + ";", repositoryHolder
).add(getId(), builder);
}

private String asCollection(final String inner) { return "IteratorUtil.asCollection("+inner+")"; }

- private ClassOrInterfaceTypeDetails createRepositoryType(final JavaType repositoryHolderType) {
+ @SuppressWarnings("unchecked")
+ private ClassOrInterfaceTypeDetails createRepositoryType(final JavaType repositoryHolderType) {
final String repositoryHolderTypeName = repositoryHolderType.getSimpleTypeName();
if (MemberFindingUtils.getDeclaredInnerType(governorTypeDetails, repositoryHolderType) != null) {
return null;
@@ -165,7 +180,8 @@
return classBuilder.build();
}

- private void addRelationshipMethods(final ItdTypeDetailsBuilder builder, final FieldMetadata fieldMetadata, final AnnotationMetadata annotation, final TypeLocationService typeLocationService) {
+ @SuppressWarnings("unchecked")
+ private void addRelationshipMethods(final ItdTypeDetailsBuilder builder, final FieldMetadata fieldMetadata, final AnnotationMetadata annotation, final TypeLocationService typeLocationService) {
final JavaType relationshipEntity = getRelationshipEntity(fieldMetadata, annotation, typeLocationService);
final ClassOrInterfaceTypeDetails relationshipEntityDetails = typeLocationService.getClassOrInterface(relationshipEntity);
final JavaType targetNode=getOtherNodeType(relationshipEntityDetails);
@@ -228,7 +244,7 @@
// already done in constructor builder.addAnnotation(Type.RELATIONSHIP.getGraphAnnotation());
final ConstructorMetadataBuilder constructor = new ConstructorMetadataBuilder(getId());
constructor.setModifier(PUBLIC);
- constructor.addParameterType(new AnnotatedJavaType(type("org.neo4j.graphdb.Relationship"),null));
+ constructor.addParameterType(new AnnotatedJavaType(type("org.neo4j.graphdb.Relationship")));
constructor.addParameterName(symbol("r"));
constructor.setBodyBuilder(new InvocableMemberBodyBuilder().appendFormalLine("setPersistentState(r);"));
builder.addConstructor(constructor.build());
Index: src/main/java/org/springframework/roo/addon/graph/GraphCommands.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/GraphCommands.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/GraphCommands.java (working copy)
@@ -65,7 +65,7 @@
throw new IllegalArgumentException("Automatic tests cannot be created for an abstract entity; remove the --testAutomatically or --abstract option");
}
final ClassOrInterfaceTypeDetailsBuilder details = graphOperations.createClassDetails(name, superclass, createAbstract, Type.NODE.getGraphAnnotation(), null);
- typeManagementService.generateClassFile(details.build());
+ typeManagementService.createOrUpdateTypeOnDisk(details.build());

if (testAutomatically) {
integrationTestOperations.newIntegrationTest(name);
@@ -104,7 +104,7 @@
graphOperations.newRelationshipField(via, symbolTo, to, Type.Annotations.EndNodeAnnotation()));

final ClassOrInterfaceTypeDetailsBuilder details = graphOperations.createClassDetails(via, null, false, Type.RELATIONSHIP.getGraphAnnotation(), fields);
- typeManagementService.generateClassFile(details.build());
+ typeManagementService.createOrUpdateTypeOnDisk(details.build());

graphOperations.addRelationshipVia(from, to, via, fieldName, relationshipName, cardinality, direction);
}
Index: src/main/java/org/springframework/roo/addon/graph/GraphOperationsImpl.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/GraphOperationsImpl.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/GraphOperationsImpl.java (working copy)
@@ -101,7 +101,8 @@
typeManagementService.addField(relationshipField.build());
}

- public ClassOrInterfaceTypeDetailsBuilder createClassDetails(final JavaType type, final JavaType superclass, final boolean createAbstract, final AnnotationMetadataBuilder entityType, final List<FieldMetadataBuilder> fields) {
+ @SuppressWarnings("unchecked")
+ public ClassOrInterfaceTypeDetailsBuilder createClassDetails(final JavaType type, final JavaType superclass, final boolean createAbstract, final AnnotationMetadataBuilder entityType, final List<FieldMetadataBuilder> fields) {
int modifier = PUBLIC;
if (createAbstract) {
modifier |= ABSTRACT;
@@ -114,7 +115,7 @@
}
}
if (superclass!=null) cid.setExtendsTypes(asList(superclass));
- cid.setAnnotations(asList(entityType,annotationBuilder(RooToString.class), annotationBuilder(RooJavaBean.class)));
+ cid.setAnnotations(asList(entityType, annotationBuilder(RooToString.class), annotationBuilder(RooJavaBean.class)));
return cid;
}

Index: src/main/java/org/springframework/roo/addon/graph/support/MatcherCallback.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/support/MatcherCallback.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/support/MatcherCallback.java (working copy)
@@ -1,47 +1,57 @@
package org.springframework.roo.addon.graph.support;

+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
import org.springframework.roo.classpath.customdata.taggers.FieldMatcher;
import org.springframework.roo.classpath.customdata.taggers.Matcher;
import org.springframework.roo.classpath.customdata.taggers.MethodMatcher;
-import org.springframework.roo.classpath.details.*;
+import org.springframework.roo.classpath.details.ConstructorMetadata;
+import org.springframework.roo.classpath.details.FieldMetadata;
+import org.springframework.roo.classpath.details.MemberHoldingTypeDetails;
+import org.springframework.roo.classpath.details.MethodMetadata;
import org.springframework.roo.classpath.details.annotations.AnnotationMetadata;
import org.springframework.roo.model.CustomDataAccessor;
import org.springframework.roo.model.CustomDataKey;
-import org.springframework.roo.model.JavaSymbolName;
-import org.springframework.roo.model.JavaType;

-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
/**
* @author mh
* @since 06.07.11
*/
public class MatcherCallback<T extends CustomDataAccessor> implements Matcher<T> {

- public MethodMatcher asMethodMatcher() {
+ @SuppressWarnings("unchecked")
+ public MethodMatcher asMethodMatcher() {
return new MethodMatcher(Collections.<FieldMatcher>emptyList(), (CustomDataKey<MethodMetadata>) key, false) {
- public List<MethodMetadata> matches(List<MemberHoldingTypeDetails> memberHoldingTypeDetailsList) {
+ public List<MethodMetadata> matches(List<MemberHoldingTypeDetails> memberHoldingTypeDetailsList) {
return (List<MethodMetadata>) MatcherCallback.this.matches(memberHoldingTypeDetailsList);
}

@Override
- public List<MethodMetadata> matches(List<MemberHoldingTypeDetails> memberHoldingTypeDetailsList, HashMap<String, String> pluralMap) {
+ public List<MethodMetadata> matches(List<MemberHoldingTypeDetails> memberHoldingTypeDetailsList, Map<String, String> pluralMap) {
return matches(memberHoldingTypeDetailsList);
}
};
}
- public FieldMatcher asFieldMatcher() {
+ @SuppressWarnings("unchecked")
+ public FieldMatcher asFieldMatcher() {
return new FieldMatcher((CustomDataKey<FieldMetadata>) key, Collections.<AnnotationMetadata>emptyList()) {
public List<FieldMetadata> matches(List<MemberHoldingTypeDetails> memberHoldingTypeDetailsList) {
return (List<FieldMetadata>) MatcherCallback.this.matches(memberHoldingTypeDetailsList);
}
};
}
- private final CustomDataKey<T> key;
+
+ public Object getTagValue(T arg0) {
+ return null;
+ }

+
+
+ private final CustomDataKey<T> key;
+
public MatcherCallback(CustomDataKey<T> key) {
this.key = key;
}
Index: src/main/java/org/springframework/roo/addon/graph/support/MethodBuilder.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/support/MethodBuilder.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/support/MethodBuilder.java (working copy)
@@ -66,7 +66,7 @@
for (final Tuple2<JavaType, JavaSymbolName> param : params) {
Assert.notNull(param._1);
Assert.notNull(param._2);
- this.params.add(_(new AnnotatedJavaType(param._1,null),param._2));
+ this.params.add(_(new AnnotatedJavaType(param._1),param._2));
}
return this;
}
@@ -84,7 +84,7 @@
builder.addMethod(toMethod(id));
}

- public void add(final String id, final MutableClassOrInterfaceTypeDetails cid) {
+ public void add(final String id, final ClassOrInterfaceTypeDetailsBuilder cid) {
Assert.notNull(cid);
cid.addMethod(toMethod(id));
}
Index: src/main/java/org/springframework/roo/addon/graph/support/BuildingItdTypeDetailsProvidingMetadataItem.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/support/BuildingItdTypeDetailsProvidingMetadataItem.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/support/BuildingItdTypeDetailsProvidingMetadataItem.java (working copy)
@@ -2,12 +2,7 @@

import org.springframework.roo.classpath.PhysicalTypeMetadata;
import org.springframework.roo.classpath.details.ClassOrInterfaceTypeDetails;
-import org.springframework.roo.classpath.details.DefaultItdTypeDetails;
-import org.springframework.roo.classpath.details.ItdTypeDetailsBuilder;
-import org.springframework.roo.classpath.details.ItdTypeDetails;
import org.springframework.roo.classpath.itd.AbstractItdTypeDetailsProvidingMetadataItem;
-import org.springframework.roo.classpath.itd.ItdTypeDetailsProvidingMetadataItem;
-import org.springframework.roo.metadata.AbstractMetadataItem;
import org.springframework.roo.model.JavaType;

/**
Index: src/main/java/org/springframework/roo/addon/graph/support/AppContextConfig.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/support/AppContextConfig.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/support/AppContextConfig.java (working copy)
@@ -1,16 +1,17 @@
package org.springframework.roo.addon.graph.support;

+import static org.springframework.roo.addon.graph.support.Tuple2._;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
import org.springframework.roo.process.manager.FileManager;
import org.springframework.roo.process.manager.MutableFile;
+import org.springframework.roo.support.util.DomUtils;
import org.springframework.roo.support.util.XmlUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import static org.springframework.roo.addon.graph.support.Tuple2._;
-
/**
* @author Michael Hunger
* @since 02.09.2010
@@ -114,7 +115,7 @@
}

protected void cleanUpAndWriteContext(final MutableFile contextMutableFile, final Element parent) {
- XmlUtils.removeTextNodes(parent);
+ DomUtils.removeTextNodes(parent);

XmlUtils.writeXml(contextMutableFile.getOutputStream(), appContext);
}
@@ -123,7 +124,8 @@
return XmlUtils.findFirstElement(xPathExpression, parent);
}

- protected Element bean(final String id, final String beanClass, final Element... properties) {
+ @SuppressWarnings("unchecked")
+ protected Element bean(final String id, final String beanClass, final Element... properties) {
return bean(id, beanClass, attributes(), properties);
}

Index: src/main/java/org/springframework/roo/addon/graph/support/GraphAppContextConfig.java
===================================================================
--- src/main/java/org/springframework/roo/addon/graph/support/GraphAppContextConfig.java (revision 396)
+++ src/main/java/org/springframework/roo/addon/graph/support/GraphAppContextConfig.java (working copy)
@@ -1,11 +1,10 @@
package org.springframework.roo.addon.graph.support;

+import static org.springframework.roo.addon.graph.support.Tuple2._;
+
import org.springframework.roo.addon.graph.GraphProvider;
import org.springframework.roo.process.manager.FileManager;
-import org.w3c.dom.Element;

-import static org.springframework.roo.addon.graph.support.Tuple2._;
-
/**
* @author Michael Hunger
* @since 02.09.2010
@@ -15,7 +14,8 @@
super(fileManager, contextPath);
}

- public void updateApplicationContext(final GraphProvider graphProvider) {
+ @SuppressWarnings("unchecked")
+ public void updateApplicationContext(final GraphProvider graphProvider) {
removeBean(beans, "/beans/bean[@id = 'dataSource']");
removeBean(beans, "/beans/jndi-lookup[@id = 'dataSource']");

Index: pom.xml
===================================================================
--- pom.xml (revision 396)
+++ pom.xml (working copy)
@@ -19,7 +19,7 @@
<description>Roo Addon for Graph Persistence using Spring-Data-Graph</description>
<url>http://springsource.com/spring-data</url>
<properties>
- <roo.version>1.1.5.RELEASE</roo.version>
+ <roo.version>1.2.0.M1</roo.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<google.code.project.name>spring-roo-addon-graph</google.code.project.name>
<repo.folder>org/springframework/data</repo.folder>
Powered by Google Project Hosting