/** * Checks if the specified typeName is a collection. * * @param entityDataModel The entity data model. * @param typeName The type name to check. * @return True if the type is a collection, False if not */ public static boolean isCollection(EntityDataModel entityDataModel, String typeName) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName); if (entitySet != null) { return true; } try { if (Collection.class.isAssignableFrom(Class.forName(typeName)) || COLLECTION_PATTERN.matcher(typeName).matches()) { return true; } } catch (ClassNotFoundException e) { LOG.debug("Not possible to find class for type name: {}", typeName); } return false; }
/** * Checks if the specified typeName is a collection. * * @param entityDataModel The entity data model. * @param typeName The type name to check. * @return True if the type is a collection, False if not */ public static boolean isCollection(EntityDataModel entityDataModel, String typeName) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(typeName); if (entitySet != null) { return true; } try { if (Collection.class.isAssignableFrom(Class.forName(typeName)) || COLLECTION_PATTERN.matcher(typeName).matches()) { return true; } } catch (ClassNotFoundException e) { LOG.debug("Not possible to find class for type name: {}", typeName); } return false; }
/** * Gets the entity set with the specified name, throws an exception if no entity set with the specified name exists. * * @param entityDataModel The entity data model. * @param entitySetName The name of the entity set. * @return The entity set. * @throws ODataSystemException If the entity data model does not contain an entity set with the specified name. */ public static EntitySet getAndCheckEntitySet(EntityDataModel entityDataModel, String entitySetName) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(entitySetName); if (entitySet == null) { throw new ODataSystemException("Entity set not found in the entity data model: " + entitySetName); } return entitySet; }
/** * Gets the entity set with the specified name, throws an exception if no entity set with the specified name exists. * * @param entityDataModel The entity data model. * @param entitySetName The name of the entity set. * @return The entity set. * @throws ODataSystemException If the entity data model does not contain an entity set with the specified name. */ public static EntitySet getAndCheckEntitySet(EntityDataModel entityDataModel, String entitySetName) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(entitySetName); if (entitySet == null) { throw new ODataSystemException("Entity set not found in the entity data model: " + entitySetName); } return entitySet; }
private String getEntityTypeName(QueryOperation operation, EntityDataModel entityDataModel) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(operation.entitySetName()); // If the supplied entity is an EntitySet, return entity set type. Else check for Singleton if (entitySet != null) { return entitySet.getTypeName(); } else { Singleton singleton = entityDataModel.getEntityContainer().getSingleton(operation.entitySetName()); if (singleton != null) { return singleton.getTypeName(); } } return null; } }
private String getEntityTypeName(QueryOperation operation, EntityDataModel entityDataModel) { EntitySet entitySet = entityDataModel.getEntityContainer().getEntitySet(operation.entitySetName()); // If the supplied entity is an EntitySet, return entity set type. Else check for Singleton if (entitySet != null) { return entitySet.getTypeName(); } else { Singleton singleton = entityDataModel.getEntityContainer().getSingleton(operation.entitySetName()); if (singleton != null) { return singleton.getTypeName(); } } return null; } }