private EntitySet createEntitySet(final FullQualifiedName typeName, final Class<?> entitySetClass) { String entitySetName = ANNOTATION_HELPER.extractEntitySetName(entitySetClass); return new EntitySet().setName(entitySetName).setEntityType(typeName); }
private EntitySet createEntitySet(final FullQualifiedName typeName, final Class<?> entitySetClass) { String entitySetName = ANNOTATION_HELPER.extractEntitySetName(entitySetClass); return new EntitySet().setName(entitySetName).setEntityType(typeName); }
private EntitySet createEntitySet(final FullQualifiedName typeName, final Class<?> entitySetClass) { String entitySetName = ANNOTATION_HELPER.extractEntitySetName(entitySetClass); return new EntitySet().setName(entitySetName).setEntityType(typeName); }
private EntitySet readEntitySet(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ENTITY_SET); EntitySet entitySet = new EntitySet(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); entitySet.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); String entityType = reader.getAttributeValue(null, XmlMetadataConstants.EDM_ENTITY_TYPE); if (entityType != null) { FullQualifiedName fqName = extractFQName(entityType); entitySet.setEntityType(fqName); } else { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE .addContent(XmlMetadataConstants.EDM_ENTITY_TYPE).addContent(XmlMetadataConstants.EDM_ENTITY_SET)); } entitySet.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_ENTITY_SET.equals(reader.getLocalName()))) { reader.next(); if (reader.isStartElement()) { extractNamespaces(reader); annotationElements.add(readAnnotationElement(reader)); } } if (!annotationElements.isEmpty()) { entitySet.setAnnotationElements(annotationElements); } return entitySet; }
private EntitySet readEntitySet(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ENTITY_SET); EntitySet entitySet = new EntitySet(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); entitySet.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); String entityType = reader.getAttributeValue(null, XmlMetadataConstants.EDM_ENTITY_TYPE); if (entityType != null) { FullQualifiedName fqName = extractFQName(entityType); entitySet.setEntityType(fqName); } else { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE .addContent(XmlMetadataConstants.EDM_ENTITY_TYPE).addContent(XmlMetadataConstants.EDM_ENTITY_SET)); } entitySet.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_ENTITY_SET.equals(reader.getLocalName()))) { reader.next(); if (reader.isStartElement()) { extractNamespaces(reader); annotationElements.add(readAnnotationElement(reader)); } } if (!annotationElements.isEmpty()) { entitySet.setAnnotationElements(annotationElements); } return entitySet; }
private void readEntitySets(final JsonReader reader) throws IOException, EntityProviderException, EdmException { while (reader.hasNext()) { currentHandledObjectName = reader.nextString(); if (currentHandledObjectName != null) { // Looking for the last dot: "\\.(?=[^.]+$)" String[] names = currentHandledObjectName.split("\\" + Edm.DELIMITER + "(?=[^" + Edm.DELIMITER + "]+$)"); if (names.length == 1) { EntitySet entitySet = new EntitySet().setName(names[0]); EntityContainerInfo container = new EntityContainerInfo().setDefaultEntityContainer(true); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } else { EntitySet entitySet = new EntitySet().setName(names[1]); EntityContainerInfo container = new EntityContainerInfo().setName(names[0]).setDefaultEntityContainer(false); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } } } }
private EntitySet readEntitySet(final XMLStreamReader reader) throws XMLStreamException, EntityProviderException { reader.require(XMLStreamConstants.START_ELEMENT, edmNamespace, XmlMetadataConstants.EDM_ENTITY_SET); EntitySet entitySet = new EntitySet(); List<AnnotationElement> annotationElements = new ArrayList<AnnotationElement>(); entitySet.setName(reader.getAttributeValue(null, XmlMetadataConstants.EDM_NAME)); String entityType = reader.getAttributeValue(null, XmlMetadataConstants.EDM_ENTITY_TYPE); if (entityType != null) { FullQualifiedName fqName = extractFQName(entityType); entitySet.setEntityType(fqName); } else { throw new EntityProviderException(EntityProviderException.MISSING_ATTRIBUTE .addContent(XmlMetadataConstants.EDM_ENTITY_TYPE).addContent(XmlMetadataConstants.EDM_ENTITY_SET)); } entitySet.setAnnotationAttributes(readAnnotationAttribute(reader)); while (reader.hasNext() && !(reader.isEndElement() && edmNamespace.equals(reader.getNamespaceURI()) && XmlMetadataConstants.EDM_ENTITY_SET.equals(reader.getLocalName()))) { reader.next(); if (reader.isStartElement()) { extractNamespaces(reader); annotationElements.add(readAnnotationElement(reader)); } } if (!annotationElements.isEmpty()) { entitySet.setAnnotationElements(annotationElements); } return entitySet; }
private void readEntitySets(final JsonReader reader) throws IOException, EntityProviderException, EdmException { while (reader.hasNext()) { currentHandledObjectName = reader.nextString(); if (currentHandledObjectName != null) { // Looking for the last dot: "\\.(?=[^.]+$)" String[] names = currentHandledObjectName.split("\\" + Edm.DELIMITER + "(?=[^" + Edm.DELIMITER + "]+$)"); if (names.length == 1) { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[0])); EntityContainerInfo container = new EntityContainerInfo().setDefaultEntityContainer(true); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } else { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[1])); EntityContainerInfo container = new EntityContainerInfo().setName(Decoder.decode(names[0])).setDefaultEntityContainer(false); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } } } }
public List<EdmEntitySetInfo> getEntitySetsInfo() throws EntityProviderException { List<EdmEntitySetInfo> entitySets = new ArrayList<EdmEntitySetInfo>(); for (Workspace workspace : workspaces) { for (Collection collection : workspace.getCollections()) { String[] names = collection.getHref().split("\\" + Edm.DELIMITER + "(?=[^" + Edm.DELIMITER + "]+$)"); try { if (names.length == 1) { EntitySet entitySet = new EntitySet().setName(names[0]); EntityContainerInfo container = new EntityContainerInfo().setDefaultEntityContainer(true); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } else if (names.length == 2) { EntitySet entitySet = new EntitySet().setName(names[1]); EntityContainerInfo container = new EntityContainerInfo().setName(names[0]).setDefaultEntityContainer(false); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } } catch (EdmException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } } } return entitySets; } }
private void readEntitySets(final JsonReader reader) throws IOException, EntityProviderException, EdmException { while (reader.hasNext()) { currentHandledObjectName = reader.nextString(); if (currentHandledObjectName != null) { // Looking for the last dot: "\\.(?=[^.]+$)" String[] names = currentHandledObjectName.split("\\" + Edm.DELIMITER + "(?=[^" + Edm.DELIMITER + "]+$)"); if (names.length == 1) { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[0])); EntityContainerInfo container = new EntityContainerInfo().setDefaultEntityContainer(true); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } else { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[1])); EntityContainerInfo container = new EntityContainerInfo().setName(Decoder.decode(names[0])).setDefaultEntityContainer(false); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } } } }
public List<EdmEntitySetInfo> getEntitySetsInfo() throws EntityProviderException { List<EdmEntitySetInfo> entitySets = new ArrayList<EdmEntitySetInfo>(); for (Workspace workspace : workspaces) { for (Collection collection : workspace.getCollections()) { String[] names = collection.getHref().split("\\" + Edm.DELIMITER + "(?=[^" + Edm.DELIMITER + "]+$)"); try { if (names.length == 1) { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[0])); EntityContainerInfo container = new EntityContainerInfo().setDefaultEntityContainer(true); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } else if (names.length == 2) { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[1])); EntityContainerInfo container = new EntityContainerInfo().setName(Decoder.decode(names[0])).setDefaultEntityContainer(false); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } } catch (EdmException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } } } return entitySets; } }
public List<EdmEntitySetInfo> getEntitySetsInfo() throws EntityProviderException { List<EdmEntitySetInfo> entitySets = new ArrayList<EdmEntitySetInfo>(); for (Workspace workspace : workspaces) { for (Collection collection : workspace.getCollections()) { String[] names = collection.getHref().split("\\" + Edm.DELIMITER + "(?=[^" + Edm.DELIMITER + "]+$)"); try { if (names.length == 1) { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[0])); EntityContainerInfo container = new EntityContainerInfo().setDefaultEntityContainer(true); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } else if (names.length == 2) { EntitySet entitySet = new EntitySet().setName(Decoder.decode(names[1])); EntityContainerInfo container = new EntityContainerInfo().setName(Decoder.decode(names[0])).setDefaultEntityContainer(false); EdmEntitySetInfo entitySetInfo = new EdmEntitySetInfoImplProv(entitySet, container); entitySets.add(entitySetInfo); } } catch (EdmException e) { throw new EntityProviderException(EntityProviderException.COMMON, e); } } } return entitySets; } }
@Override public void build() throws ODataJPAModelException, ODataJPARuntimeException { if (consistentEntitySetList == null) { consistentEntitySetList = new ArrayList<EntitySet>(); } entityTypeView = new JPAEdmEntityType(schemaView); entityTypeView.getBuilder().build(); if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) { String nameSpace = schemaView.getEdmSchema().getNamespace(); for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) { currentEntitySet = new EntitySet(); currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName())); JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView); consistentEntitySetList.add(currentEntitySet); } isConsistent = true; } else { isConsistent = false; return; } }
@Override public void build() throws ODataJPAModelException, ODataJPARuntimeException { if (consistentEntitySetList == null) { consistentEntitySetList = new ArrayList<EntitySet>(); } entityTypeView = new JPAEdmEntityType(schemaView); entityTypeView.getBuilder().build(); if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) { String nameSpace = schemaView.getEdmSchema().getNamespace(); for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) { currentEntitySet = new EntitySet(); currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName())); JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView); consistentEntitySetList.add(currentEntitySet); } isConsistent = true; } else { isConsistent = false; return; } }
private EntitySet clone(EntitySet set) { if (set == null) { return null; } EntitySet newSet = new EntitySet(); newSet.setAnnotationAttributes(set.getAnnotationAttributes()); newSet.setAnnotationElements(set.getAnnotationElements()); newSet.setDocumentation(set.getDocumentation()); newSet.setEntityType(set.getEntityType()); newSet.setMapping(set.getMapping()); newSet.setName(set.getName()); return newSet; }