• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java EdmException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.olingo.odata2.api.edm.EdmException的典型用法代码示例。如果您正苦于以下问题:Java EdmException类的具体用法?Java EdmException怎么用?Java EdmException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EdmException类属于org.apache.olingo.odata2.api.edm包,在下文中一共展示了EdmException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: formatPropertyHeader

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private static String formatPropertyHeader(EdmProperty property) throws EdmException
{
   StringBuilder property_header = new StringBuilder();
   if (property.getType().getKind().equals(EdmTypeKind.COMPLEX))
   {
      EdmComplexType property_type = (EdmComplexType) property.getType();
      for (String complex_property_name: property_type.getPropertyNames())
      {
         property_header.append(property.getName())
               .append(":")
               .append(complex_property_name)
               .append(SEPARATOR);
      }
   }
   else
   {
      property_header.append(property.getName()).append(SEPARATOR);
   }
   return property_header.toString();
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:21,代码来源:CsvFormatter.java


示例2: visitLiteral

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public Object visitLiteral(LiteralExpression literal, EdmLiteral edm_literal)
{
   try
   {
      // A literal is a Provider<?> (Functional Java)
      // Returns a Node<?> (Expression Tree)
      Object o = edm_literal.getType().valueOfString(
            edm_literal.getLiteral(),
            EdmLiteralKind.DEFAULT,
            null,
            edm_literal.getType().getDefaultType());
      return ExecutableExpressionTree.Node.createLeave(ConstantFactory.constantFactory(o));
   }
   catch (EdmException ex)
   {
      throw new RuntimeException(ex);
   }
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:20,代码来源:FunctionalVisitor.java


示例3: readEntry

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
public ODataEntry readEntry(String serviceUri, String contentType,
		String entitySetName, String keyValue, SystemQueryOptions options)
		throws IllegalStateException, IOException, EdmException,
		EntityProviderException {
	EdmEntityContainer entityContainer = readEdm()
			.getDefaultEntityContainer();
	logger.info("Entity container is => " + entityContainer.getName());
	String absolutUri = createUri(serviceUri, entitySetName, keyValue,
			options);

	InputStream content = executeGet(absolutUri, contentType);

	return EntityProvider.readEntry(contentType,
			entityContainer.getEntitySet(entitySetName), content,
			EntityProviderReadProperties.init().build());
}
 
开发者ID:SAP,项目名称:C4CODATAAPIDEVGUIDE,代码行数:17,代码来源:ServiceTicketODataConsumer.java


示例4: readData

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public Object readData(final EdmEntitySet entitySet, final Map<String, Object> keys)
    throws ODataNotFoundException, EdmException, ODataApplicationException {

  DataStore<Object> store = getDataStore(entitySet);
  if (store != null) {
    Object keyInstance = store.createInstance();
    ANNOTATION_HELPER.setKeyFields(keyInstance, keys);

    Object result = store.read(keyInstance);
    if (result != null) {
      return result;
    }
  }

  throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
}
 
开发者ID:mibo,项目名称:janos,代码行数:18,代码来源:AnnotationDataSource.java


示例5: readRelatedData

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public Object readRelatedData(final EdmEntitySet sourceEntitySet, final Object sourceData,
    final EdmEntitySet targetEntitySet,
    final Map<String, Object> targetKeys)
    throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {

  DataStore<?> sourceStore = dataStoreManager.getDataStore(sourceEntitySet.getName());
  DataStore<?> targetStore = dataStoreManager.getDataStore(targetEntitySet.getName());

  AnnotationHelper.AnnotatedNavInfo navInfo = ANNOTATION_HELPER.getCommonNavigationInfo(
      sourceStore.getDataTypeClass(), targetStore.getDataTypeClass());
  final Field sourceField;
  if(navInfo.isBiDirectional()) {
    sourceField = navInfo.getToField();
  } else {
    sourceField = navInfo.getFromField();
  }
  if (sourceField == null) {
    throw new AnnotationRuntimeException("Missing source field for related data (sourceStore='" + sourceStore
        + "', targetStore='" + targetStore + "').");
  }

  List<Object> resultData = readResultData(targetStore, sourceData, sourceField, navInfo);
  return extractResultData(targetStore, targetKeys, navInfo, resultData);
}
 
开发者ID:mibo,项目名称:janos,代码行数:26,代码来源:AnnotationDataSource.java


示例6: readBinaryData

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public BinaryData readBinaryData(final EdmEntitySet entitySet, final Object mediaLinkEntryData)
    throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {

  Object data = ANNOTATION_HELPER.getValueForField(mediaLinkEntryData, EdmMediaResourceContent.class);
  Object mimeType = ANNOTATION_HELPER.getValueForField(mediaLinkEntryData, EdmMediaResourceMimeType.class);

  if (data == null && mimeType == null) {
    DataStore<Object> dataStore = getDataStore(entitySet);
    Object readEntry = dataStore.read(mediaLinkEntryData);
    if (readEntry != null) {
      data = ANNOTATION_HELPER.getValueForField(readEntry, EdmMediaResourceContent.class);
      mimeType = ANNOTATION_HELPER.getValueForField(readEntry, EdmMediaResourceMimeType.class);
    }
  }

  return new BinaryData((byte[]) data, String.valueOf(mimeType));
}
 
开发者ID:mibo,项目名称:janos,代码行数:19,代码来源:AnnotationDataSource.java


示例7: writeBinaryData

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public void writeBinaryData(final EdmEntitySet entitySet, final Object mediaEntityInstance,
    final BinaryData binaryData)
    throws ODataNotImplementedException, ODataNotFoundException, EdmException, ODataApplicationException {

  try {
    DataStore<Object> dataStore = getDataStore(entitySet);
    Object readEntry = dataStore.read(mediaEntityInstance);
    if (readEntry == null) {
      throw new ODataNotFoundException(ODataNotFoundException.ENTITY);
    } else {
      ANNOTATION_HELPER.setValueForAnnotatedField(
          mediaEntityInstance, EdmMediaResourceContent.class, binaryData.getData());
      ANNOTATION_HELPER.setValueForAnnotatedField(
          mediaEntityInstance, EdmMediaResourceMimeType.class, binaryData.getMimeType());
    }
  } catch (AnnotationHelper.ODataAnnotationException e) {
    throw new AnnotationRuntimeException("Invalid media resource annotation at entity set '" + entitySet.getName()
        + "' with message '" + e.getMessage() + "'.", e);
  }
}
 
开发者ID:mibo,项目名称:janos,代码行数:22,代码来源:AnnotationDataSource.java


示例8: getEntityContainerHierachy

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private List<EntityContainer> getEntityContainerHierachy() throws ODataException {
  if (entityContainerHierachy != null) {
    return entityContainerHierachy;
  }

  entityContainerHierachy = new ArrayList<EntityContainer>();
  Map<String, EntityContainer> name2Container = getEntityContainerMap();
  String currentName = getName();
  while (currentName != null) {
    EntityContainer currentContainer = name2Container.get(currentName);
    entityContainerHierachy.add(currentContainer);
    currentName = currentContainer.getExtendz();
  }

  if (entityContainerHierachy.isEmpty()) {
    throw new EdmException(EdmException.PROVIDERPROBLEM, "No container at all found.");
  }
  return entityContainerHierachy;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:20,代码来源:EdmEntityContainerImplProv.java


示例9: Test

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Test
public void Test() {

  EdmEntitySet edmEntitySet = EasyMock.createMock(EdmEntitySet.class);
  try {
    EasyMock.expect(edmEntitySet.getName()).andReturn("SalesOrder");
    EasyMock.replay(edmEntitySet);
  } catch (EdmException e) {
    fail("Not Expected");
  }
  GetEntitySetUriInfo resultsView = EasyMock.createMock(GetEntitySetUriInfo.class);
  EasyMock.expect(resultsView.getTargetEntitySet()).andReturn(edmEntitySet);
  EasyMock.replay(resultsView);
  JPATombstoneCallBack tombStoneCallBack = new JPATombstoneCallBack("/sample/", resultsView, "1");

  TombstoneCallbackResult result = tombStoneCallBack.getTombstoneCallbackResult();
  assertEquals("/sample/SalesOrder?!deltatoken=1", result.getDeltaLink());
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:JPATombstoneCallBackTest.java


示例10: writeProperties

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private void writeProperties(final EntityInfoAggregator entityInfo, final Map<String, Object> data,
    final EdmEntityType type, boolean containsMetadata) throws EdmException, EntityProviderException, IOException {
  // if the payload contains metadata we must not omit the first comm as it separates the _metadata object form the
  // properties
  boolean omitComma = !containsMetadata;

  List<String> propertyNames = type.getPropertyNames();
  for (final String propertyName : propertyNames) {
    if (properties.isDataBasedPropertySerialization() && ((Map<?,?>)data).containsKey(propertyName)) {
      omitComma = appendPropertyNameValue(entityInfo, data, omitComma, propertyName);
    } else if (!properties.isDataBasedPropertySerialization() && entityInfo.getSelectedPropertyNames()
        .contains(propertyName)) {
      omitComma = appendPropertyNameValue(entityInfo, data, omitComma, propertyName);
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:JsonEntryEntityProducer.java


示例11: createSelectTree

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private void createSelectTree(final ExpandSelectTreeNodeImpl root) throws EdmException {
  for (SelectItem item : initialSelect) {
    ExpandSelectTreeNodeImpl actualNode = root;

    for (NavigationPropertySegment navSegement : item.getNavigationPropertySegments()) {
      actualNode = addSelectNode(actualNode, navSegement.getNavigationProperty().getName());
    }

    if (item.getProperty() != null) {
      actualNode.addProperty(item.getProperty());
    } else if (item.isStar()) {
      actualNode.setAllExplicitly();
    } else {
      // The actual node is a navigation property and has no property or star so it is explicitly selected
      actualNode.setExplicitlySelected();
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:ExpandSelectTreeCreator.java


示例12: getEdmProperty

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private EdmProperty getEdmProperty() {
  EdmProperty edmTyped = EasyMock.createMock(EdmProperty.class);

  JPAEdmMappingImpl edmMapping = EasyMock.createMock(JPAEdmMappingImpl.class);
  EasyMock.expect(edmMapping.getInternalName()).andStubReturn("Field1");
  EasyMock.expect(((JPAEdmMappingImpl) edmMapping).isVirtualAccess()).andStubReturn(false);
  EasyMock.replay(edmMapping);

  EdmType edmType = EasyMock.createMock(EdmType.class);

  try {
    EasyMock.expect(edmType.getKind()).andStubReturn(EdmTypeKind.SIMPLE);
    EasyMock.expect(edmType.getName()).andStubReturn("identifier");
    EasyMock.expect(edmTyped.getName()).andStubReturn("SalesOrderHeader");
    EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);

    EasyMock.expect(edmTyped.getType()).andStubReturn(edmType);
    EasyMock.expect(edmTyped.getMapping()).andStubReturn(edmMapping);

  } catch (EdmException e) {
    fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
  }
  EasyMock.replay(edmType);
  EasyMock.replay(edmTyped);
  return edmTyped;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:27,代码来源:JPAEntityParserTest.java


示例13: parseLinkUri

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private Map<String, Object> parseLinkUri(final EdmEntitySet targetEntitySet, final String uriString)
    throws EdmException {
  ODataContext context = getContext();
  final int timingHandle = context.startRuntimeMeasurement("UriParser", "getKeyPredicatesFromEntityLink");

  List<KeyPredicate> key = null;
  try {
    key = UriParser.getKeyPredicatesFromEntityLink(targetEntitySet, uriString,
        context.getPathInfo().getServiceRoot());
  } catch (ODataException e) {
    // We don't understand the link target. This could also be seen as an error.
  }

  context.stopRuntimeMeasurement(timingHandle);

  return key == null ? null : mapKey(key);
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:18,代码来源:ListsProcessor.java


示例14: EdmEntityContainerImplProv

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
public EdmEntityContainerImplProv(final EdmImplProv edm, final EntityContainerInfo entityContainerInfo)
    throws EdmException {
  this.edm = edm;
  this.entityContainerInfo = entityContainerInfo;
  edmEntitySets = new HashMap<String, EdmEntitySet>();
  edmAssociationSets = new HashMap<String, EdmAssociationSet>();
  edmFunctionImports = new HashMap<String, EdmFunctionImport>();
  isDefaultContainer = entityContainerInfo.isDefaultEntityContainer();

  if (entityContainerInfo.getExtendz() != null) {
    edmExtendedEntityContainer = edm.getEntityContainer(entityContainerInfo.getExtendz());
    if (edmExtendedEntityContainer == null) {
      throw new EdmException(EdmException.COMMON);
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:EdmEntityContainerImplProv.java


示例15: getLocalEdmEntityType

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private EdmEntityType getLocalEdmEntityType() {
  EdmEntityType objEdmEntityType = EasyMock.createMock(EdmEntityType.class);
  try {
    EasyMock.expect(objEdmEntityType.getName()).andStubReturn("SalesOderHeaders");
    EasyMock.expect(objEdmEntityType.getNamespace()).andStubReturn("SalesOderHeaders");
    EasyMock.expect(objEdmEntityType.hasStream()).andStubReturn(false);
    EasyMock.expect(objEdmEntityType.hasStream()).andStubReturn(false);
    ArrayList<String> propertyNames = new ArrayList<String>();
    propertyNames.add("ID");
    EasyMock.expect(objEdmEntityType.getProperty("ID")).andStubReturn(getEdmPropertyForSelect());
    EasyMock.expect(objEdmEntityType.getPropertyNames()).andStubReturn(propertyNames);
    EasyMock.expect(objEdmEntityType.getNavigationPropertyNames()).andStubReturn(new ArrayList<String>());
    EasyMock.expect(objEdmEntityType.getKeyPropertyNames()).andStubReturn(propertyNames);
    EasyMock.expect(objEdmEntityType.getKeyProperties()).andStubReturn(getKeyProperties());
  } catch (EdmException e) {
    fail(ODataJPATestConstants.EXCEPTION_MSG_PART_1 + e.getMessage() + ODataJPATestConstants.EXCEPTION_MSG_PART_2);
  }
  EasyMock.replay(objEdmEntityType);
  return objEdmEntityType;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:21,代码来源:ODataJPAResponseBuilderTest.java


示例16: getPropertyName

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private static String getPropertyName(final CommonExpression whereExpression) throws EdmException,
    ODataJPARuntimeException {
  EdmTyped edmProperty = ((PropertyExpression) whereExpression).getEdmProperty();
  EdmMapping mapping;
  if (edmProperty instanceof EdmNavigationProperty) {
    EdmNavigationProperty edmNavigationProperty = (EdmNavigationProperty) edmProperty;
    mapping = edmNavigationProperty.getMapping();
  } else if(edmProperty instanceof EdmProperty) {
    EdmProperty property = (EdmProperty) edmProperty;
    mapping = property.getMapping();
  } else {
    throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL, null);
  }

  return mapping != null ? mapping.getInternalName() : edmProperty.getName();
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:17,代码来源:ODataExpressionParser.java


示例17: writeFunctionImport

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public ODataResponse writeFunctionImport(final EdmFunctionImport functionImport, final Object data,
    final EntityProviderWriteProperties properties) throws EntityProviderException {
  try {
    final EdmType type = functionImport.getReturnType().getType();
    final boolean isCollection = functionImport.getReturnType().getMultiplicity() == EdmMultiplicity.MANY;

    if (type.getKind() == EdmTypeKind.ENTITY) {
      @SuppressWarnings("unchecked")
      Map<String, Object> map = (Map<String, Object>) data;
      return writeEntry(functionImport.getEntitySet(), map, properties);
    }

    final EntityPropertyInfo info = EntityInfoAggregator.create(functionImport);
    if (isCollection) {
      return writeCollection(info, (List<?>) data);
    } else {
      return writeSingleTypedElement(info, data);
    }
  } catch (EdmException e) {
    throw new EntityProviderProducerException(e.getMessageReference(), e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:24,代码来源:AtomEntityProvider.java


示例18: getKeyPropertyNames

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
@Override
public List<String> getKeyPropertyNames() throws EdmException {
  if (edmKeyPropertyNames == null) {
    if (edmBaseType != null) {
      return ((EdmEntityType) edmBaseType).getKeyPropertyNames();
    }

    edmKeyPropertyNames = new ArrayList<String>();

    if (entityType.getKey() != null) {
      for (final PropertyRef keyProperty : entityType.getKey().getKeys()) {
        edmKeyPropertyNames.add(keyProperty.getName());
      }
    } else {
      // Entity Type does not define a key
      throw new EdmException(EdmException.COMMON);
    }
  }

  return edmKeyPropertyNames;
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:22,代码来源:EdmEntityTypeImplProv.java


示例19: readData

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
public List<?> readData(final EdmEntitySet entitySet) throws ODataNotImplementedException, ODataNotFoundException,
    EdmException {
  if (ENTITYSET_1_1.equals(entitySet.getName())) {
    return Arrays.asList(dataContainer.getEmployees().toArray());
  } else if (ENTITYSET_1_2.equals(entitySet.getName())) {
    return Arrays.asList(dataContainer.getTeams().toArray());
  } else if (ENTITYSET_1_3.equals(entitySet.getName())) {
    return Arrays.asList(dataContainer.getRooms().toArray());
  } else if (ENTITYSET_1_4.equals(entitySet.getName())) {
    return Arrays.asList(dataContainer.getManagers().toArray());
  } else if (ENTITYSET_1_5.equals(entitySet.getName())) {
    return Arrays.asList(dataContainer.getBuildings().toArray());
  } else if (ENTITYSET_2_1.equals(entitySet.getName())) {
    return Arrays.asList(dataContainer.getPhotos().toArray());
  } else {
    throw new ODataNotImplementedException();
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:19,代码来源:ScenarioDataSource.java


示例20: normalizeInlineEntries

import org.apache.olingo.odata2.api.edm.EdmException; //导入依赖的package包/类
private void normalizeInlineEntries(final Map<String, Object> oDataEntryProperties) throws ODataJPARuntimeException {
  List<ODataEntry> entries = null;
  try {
    for (String navigationPropertyName : oDataEntityType.getNavigationPropertyNames()) {
      Object inline = oDataEntryProperties.get(navigationPropertyName);
      if (inline instanceof ODataFeed) {
        entries = ((ODataFeed) inline).getEntries();
      } else if (inline instanceof ODataEntry) {
        entries = new ArrayList<ODataEntry>();
        entries.add((ODataEntry) inline);
      }
      if (entries != null) {
        oDataEntryProperties.put(navigationPropertyName, entries);
        entries = null;
      }
    }
  } catch (EdmException e) {
    throw ODataJPARuntimeException
        .throwException(ODataJPARuntimeException.GENERAL
            .addContent(e.getMessage()), e);
  }
}
 
开发者ID:apache,项目名称:olingo-odata2,代码行数:23,代码来源:JPAEntity.java



注:本文中的org.apache.olingo.odata2.api.edm.EdmException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Responses类代码示例发布时间:2022-05-22
下一篇:
Java Summary类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap