@Override
 protected void doProcess() {
   List<AnnotationValue> annotationValueList = new ArrayList<AnnotationValue>();
   if (!StringHelper.isEmpty(elementCollection.getTargetClass())) {
     MockHelper.classValue(
         "targetClass",
         elementCollection.getTargetClass(),
         annotationValueList,
         getDefaults(),
         indexBuilder.getServiceRegistry());
   }
   if (elementCollection.getType() != null) {
     parseType(elementCollection.getType().getName(), getTarget());
   }
   if (elementCollection.getCollectionType() != null) {
     // TODO: Move this to a helper?
     String collectionTypeName =
         MockHelper.getCollectionType(elementCollection.getCollectionType().getName());
     List<AnnotationValue> collectionTypeAnnotationValueList = new ArrayList<AnnotationValue>();
     MockHelper.stringValue("type", collectionTypeName, collectionTypeAnnotationValueList);
     create(COLLECTION_TYPE, collectionTypeAnnotationValueList);
   }
   MockHelper.enumValue("fetch", FETCH_TYPE, elementCollection.getFetch(), annotationValueList);
   create(ELEMENT_COLLECTION, annotationValueList);
   parseLob(elementCollection.getLob(), getTarget());
   parseEnumType(elementCollection.getEnumerated(), getTarget());
   parseColumn(elementCollection.getColumn(), getTarget());
   parseTemporalType(elementCollection.getTemporal(), getTarget());
   parseCollectionTable(elementCollection.getCollectionTable(), getTarget());
   parseAssociationOverrides(elementCollection.getAssociationOverride(), getTarget());
   parseAttributeOverrides(elementCollection.getAttributeOverride(), getTarget());
   if (elementCollection.getOrderBy() != null) {
     create(
         JPADotNames.ORDER_BY,
         MockHelper.stringValueArray("value", elementCollection.getOrderBy()));
   }
   parseAttributeOverrides(elementCollection.getMapKeyAttributeOverride(), getTarget());
   parseMapKeyJoinColumnList(elementCollection.getMapKeyJoinColumn(), getTarget());
   parseMapKey(elementCollection.getMapKey(), getTarget());
   parseMapKeyColumn(elementCollection.getMapKeyColumn(), getTarget());
   parseMapKeyClass(elementCollection.getMapKeyClass(), getTarget());
   parseMapKeyType(elementCollection.getMapKeyType(), getTarget());
   parseMapKeyEnumerated(elementCollection.getMapKeyEnumerated(), getTarget());
   parseMapKeyTemporal(elementCollection.getMapKeyTemporal(), getTarget());
 }
Exemplo n.º 2
0
 static void cascadeValue(
     String name,
     JaxbCascadeType cascadeType,
     boolean isCascadePersistDefault,
     List<AnnotationValue> annotationValueList) {
   List<Enum> enumList = new ArrayList<Enum>();
   if (isCascadePersistDefault) {
     enumList.add(javax.persistence.CascadeType.PERSIST);
   }
   if (cascadeType != null) {
     addIfNotNull(cascadeType.getCascadeAll(), enumList, CascadeType.ALL);
     addIfNotNull(cascadeType.getCascadePersist(), enumList, CascadeType.PERSIST);
     addIfNotNull(cascadeType.getCascadeMerge(), enumList, CascadeType.MERGE);
     addIfNotNull(cascadeType.getCascadeRemove(), enumList, CascadeType.REMOVE);
     addIfNotNull(cascadeType.getCascadeRefresh(), enumList, CascadeType.REFRESH);
     addIfNotNull(cascadeType.getCascadeDetach(), enumList, CascadeType.DETACH);
   }
   if (!enumList.isEmpty()) {
     MockHelper.enumArrayValue(name, JPADotNames.CASCADE_TYPE, enumList, annotationValueList);
   }
 }