@Test public void testExpandEdmComplexType() { ComplexType complexType = new ComplexType(); List<Property> properties = new ArrayList<Property>(); JPAEdmMapping mapping1 = new JPAEdmMappingImpl(); mapping1.setJPAColumnName("LINEITEMID"); ((Mapping) mapping1).setInternalName("LineItemKey.LiId"); JPAEdmMapping mapping2 = new JPAEdmMappingImpl(); mapping2.setJPAColumnName("LINEITEMNAME"); ((Mapping) mapping2).setInternalName("LineItemKey.LiName"); properties.add(new SimpleProperty().setName("LIID").setMapping((Mapping) mapping1)); properties.add(new SimpleProperty().setName("LINAME").setMapping((Mapping) mapping2)); complexType.setProperties(properties); List<Property> expandedList = null; try { objComplexType.expandEdmComplexType(complexType, expandedList, "SalesOrderItemKey"); } catch (ClassCastException e) { assertTrue(false); } assertTrue(true); }
@Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } }
JPAEdmComplexType extends JPAEdmBaseViewImpl implements JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } }
JPAEdmComplexType extends JPAEdmBaseViewImpl implements JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } JPAEdmComplexType(final JPAEdmSchemaView view);  JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); }
JPAEdmComplexType extends JPAEdmBaseViewImpl implements JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } JPAEdmComplexType(final JPAEdmSchemaView view);  JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override boolean isReferencedInKey(final String complexTypeName); @Override void setReferencedInKey(final String complexTypeName); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList,
      final String embeddablePropertyName); }
JPAEdmComplexType extends JPAEdmBaseViewImpl implements JPAEdmComplexTypeView { @Override public void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList, final String embeddablePropertyName) { if (expandedList == null) { expandedList = new ArrayList<Property>(); } for (Property property : complexType.getProperties()) { try { SimpleProperty newSimpleProperty = new SimpleProperty(); SimpleProperty oldSimpleProperty = (SimpleProperty) property; newSimpleProperty.setAnnotationAttributes(oldSimpleProperty.getAnnotationAttributes()); newSimpleProperty.setAnnotationElements(oldSimpleProperty.getAnnotationElements()); newSimpleProperty.setCustomizableFeedMappings(oldSimpleProperty.getCustomizableFeedMappings()); newSimpleProperty.setDocumentation(oldSimpleProperty.getDocumentation()); newSimpleProperty.setFacets(oldSimpleProperty.getFacets()); newSimpleProperty.setMimeType(oldSimpleProperty.getMimeType()); newSimpleProperty.setName(oldSimpleProperty.getName()); newSimpleProperty.setType(oldSimpleProperty.getType()); JPAEdmMappingImpl newMapping = new JPAEdmMappingImpl(); Mapping mapping = oldSimpleProperty.getMapping(); JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); expandedList.add(newSimpleProperty); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name); } } } JPAEdmComplexType(final JPAEdmSchemaView view);  JPAEdmComplexType(final JPAEdmSchemaView view, final Attribute<?, ?> complexAttribute); @Override boolean isReferencedInKey(final String complexTypeName); @Override void setReferencedInKey(final String complexTypeName); @Override JPAEdmBuilder getBuilder(); @Override ComplexType getEdmComplexType(); @Override ComplexType searchEdmComplexType(final String embeddableTypeName); @Override EmbeddableType<?> getJPAEmbeddableType(); @Override List<ComplexType> getConsistentEdmComplexTypes(); @Override ComplexType searchEdmComplexType(final FullQualifiedName type); @Override void addJPAEdmCompleTypeView(final JPAEdmComplexTypeView view); @Override void expandEdmComplexType(final ComplexType complexType, List<Property> expandedList,
      final String embeddablePropertyName);  }