org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo.getFunctionImport()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(14.5k)|赞(0)|评价(0)|浏览(76)

本文整理了Java中org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo.getFunctionImport()方法的一些代码示例,展示了GetFunctionImportUriInfo.getFunctionImport()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GetFunctionImportUriInfo.getFunctionImport()方法的具体详情如下:
包路径:org.apache.olingo.odata2.api.uri.info.GetFunctionImportUriInfo
类名称:GetFunctionImportUriInfo
方法名:getFunctionImport

GetFunctionImportUriInfo.getFunctionImport介绍

[英]Gets the function import.
[中]获取函数导入。

代码示例

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata2.core

private List<KeyPredicate> getKeysFromFunctionImportParams(GetFunctionImportUriInfo uriInfo, boolean removeIsActiveEntity) throws EdmException {
  List<KeyPredicate> allKeys = new ArrayList<>();
  Map<String, EdmLiteral> parameters = uriInfo.getFunctionImportParameters();        
  List<EdmProperty> keyList = uriInfo.getFunctionImport().getEntitySet().getEntityType().getKeyProperties();
  Iterator<EdmProperty> keysPropItr = keyList.iterator();
  while(keysPropItr.hasNext()){
    EdmProperty property = keysPropItr.next();
    if(removeIsActiveEntity && DraftUtilsV2.DRAFTS_ISACTIVE_ENTITY.equalsIgnoreCase(property.getName())){
      continue;
    }
    String literal = parameters.get(property.getName()).getLiteral();            
    allKeys.add(new KeyPredicateImpl(literal, property));
  }
  return allKeys;
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata2.core

@Override
public IDataProviderResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, ODataContext context)
    throws ODataException {
  String functionName = uriInfo.getFunctionImport().getName();
  String draftActivate = "";
  String draftEdit = "";
  String draftPrepare = "";		
  if(uriInfo.getFunctionImport() != null && uriInfo.getFunctionImport().getEntitySet() != null){
    //V2 metadata function imports are embedded with entityset name.
    draftActivate = uriInfo.getFunctionImport().getEntitySet().getName() + "_" + "draftActivate";
    draftEdit = uriInfo.getFunctionImport().getEntitySet().getName() + "_" + "draftEdit";
    draftPrepare = uriInfo.getFunctionImport().getEntitySet().getName() + "_" + "draftPrepare";		
  }
  
  if(draftActivate.equals(functionName)){
    return handleActionForDraftActivate(uriInfo, context);
  }else if(draftEdit.equals(functionName)){
    return handleActionForDraftEdit(uriInfo, context);
  }else if(draftPrepare.equals(functionName)){
    return handleActionForDraftPrepare(uriInfo, context);
  }else{
    return handleFunctionGenericNormalFlow(uriInfo, context);
  }
}

代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core

@Override
public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType)
  throws ODataException {
 final EdmFunctionImport functionImport = uriInfo.getFunctionImport();
 final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType();
 final Object data = dataSource.readData(
   functionImport,
   mapFunctionParameters(uriInfo.getFunctionImportParameters()),
   null);
 if (data == null) {
  throw new ODataNotFoundException(ODataHttpException.COMMON);
 }
 ODataResponse response;
 if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) {
  response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData());
 } else {
  final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null);
  response = EntityProvider.writeText(value == null ? "" : value);
 }
 return ODataResponse.fromResponse(response).build();
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata-core

@Override
public IDataProviderResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, ODataContext context) throws ODataException {
  IDataProvider provider = getTargetDataProvider(uriInfo.getFunctionImport(), null);
  if (provider == null) {
    throw new DataProviderException(DataProviderException.NOT_IMPLEMENTED.addContent("executeFunctionImport"), context.getAcceptableLanguages().get(0));
  } else {
    return provider.executeFunctionImport(uriInfo, context);
  }
}

代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core-incubating

@Override
public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType)
  throws ODataException {
 final EdmFunctionImport functionImport = uriInfo.getFunctionImport();
 final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType();
 final Object data = dataSource.readData(
   functionImport,
   mapFunctionParameters(uriInfo.getFunctionImportParameters()),
   null);
 if (data == null) {
  throw new ODataNotFoundException(ODataHttpException.COMMON);
 }
 ODataResponse response;
 if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) {
  response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData());
 } else {
  final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null);
  response = EntityProvider.writeText(value == null ? "" : value);
 }
 return ODataResponse.fromResponse(response).build();
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata2.core

if (uriInfo.getFunctionImport().getEntitySet() != null) {
  List<String> propertNames = uriInfo.getFunctionImport().getEntitySet().getEntityType().getPropertyNames();
  for (String propertyName : propertNames) {
    if (uriInfo.getFunctionImport().getEntitySet().getEntityType().getProperty(propertyName)
        .getType() instanceof EdmGuid) {
      coloumnNames.add(propertyName);
String functionName = uriInfo.getFunctionImport().getName();
ExtensionHolder holder = null;
boolean withinChangeSet = extensionMethodForTransaction != null;
if (uriInfo.getFunctionImport().getHttpMethod().compareTo("GET") == 0) {
} else if (uriInfo.getFunctionImport().getHttpMethod().compareTo("POST") == 0) {

代码示例来源:origin: io.cronapp/olingo-odata2-annotation-processor-core

@Override
public ODataResponse executeFunctionImportValue(final GetFunctionImportUriInfo uriInfo, final String contentType)
  throws ODataException {
 final EdmFunctionImport functionImport = uriInfo.getFunctionImport();
 final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType();
 final Object data = dataSource.readData(
   functionImport,
   mapFunctionParameters(uriInfo.getFunctionImportParameters()),
   null);
 if (data == null) {
  throw new ODataNotFoundException(ODataHttpException.COMMON);
 }
 ODataResponse response;
 if (type == EdmSimpleTypeKind.Binary.getEdmSimpleTypeInstance()) {
  response = EntityProvider.writeBinary(((BinaryData) data).getMimeType(), ((BinaryData) data).getData());
 } else {
  final String value = type.valueToString(data, EdmLiteralKind.DEFAULT, null);
  response = EntityProvider.writeText(value == null ? "" : value);
 }
 return ODataResponse.fromResponse(response).build();
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odatav2-hybrid

@Override
public IDataProviderResponse executeFunctionImport(GetFunctionImportUriInfo uriInfo, ODataContext context)
    throws ODataException {
  IDataProvider dataProvider = null;
  dataProvider = getDataProvider(getFunctionFqn(uriInfo.getFunctionImport()));
  try{
    if (dataProvider !=null){
      return dataProvider.executeFunctionImport(uriInfo, context);
    }
    else return null;
  } catch (ODataException e) {
    logger.error("Error in executeFunctionImport",e);
    throw new ODataException(e.getMessage(),e);
  }
}

代码示例来源:origin: io.cronapp/olingo-odata2-annotation-processor-core

@Override
public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriInfo, final String contentType)
  throws ODataException {
 final EdmFunctionImport functionImport = uriInfo.getFunctionImport();
 final EdmType type = functionImport.getReturnType().getType();

代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core

@Override
public JPAMethodContext build() throws ODataJPAModelException, ODataJPARuntimeException {
 if (functionView != null) {
  functionImport = functionView.getFunctionImport();
  try {
   mapping = functionImport.getMapping();
   List<JPAFunction> jpaFunctionList = new ArrayList<JPAFunction>();
   jpaFunctionList.add(generateJPAFunction());
   setJpaFunction(jpaFunctionList);
   setEnclosingObject(generateEnclosingObject());
  } catch (EdmException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (InstantiationException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (IllegalAccessException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (IllegalArgumentException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (InvocationTargetException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (NoSuchMethodException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (SecurityException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
 }
 return JPAFunctionContext.this;
}

代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core

@Override
public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriInfo, final String contentType)
  throws ODataException {
 final EdmFunctionImport functionImport = uriInfo.getFunctionImport();
 final EdmType type = functionImport.getReturnType().getType();

代码示例来源:origin: io.cronapp/olingo-odata2-jpa-processor-core

@Override
public JPAMethodContext build() throws ODataJPAModelException, ODataJPARuntimeException {
 if (functionView != null) {
  functionImport = functionView.getFunctionImport();
  try {
   mapping = functionImport.getMapping();
   List<JPAFunction> jpaFunctionList = new ArrayList<JPAFunction>();
   jpaFunctionList.add(generateJPAFunction());
   setJpaFunction(jpaFunctionList);
   setEnclosingObject(generateEnclosingObject());
  } catch (EdmException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (InstantiationException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (IllegalAccessException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (IllegalArgumentException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (InvocationTargetException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (NoSuchMethodException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  } catch (SecurityException e) {
   throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
  }
 }
 return JPAFunctionContext.this;
}

代码示例来源:origin: org.apache.olingo/olingo-odata2-annotation-processor-core-incubating

@Override
public ODataResponse executeFunctionImport(final GetFunctionImportUriInfo uriInfo, final String contentType)
  throws ODataException {
 final EdmFunctionImport functionImport = uriInfo.getFunctionImport();
 final EdmType type = functionImport.getReturnType().getType();

代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core

Object[] args = jpaFunction.getArguments();
if (uriParserResultView.getFunctionImport().getReturnType()
  .getMultiplicity().equals(EdmMultiplicity.MANY)) {

代码示例来源:origin: io.cronapp/olingo-odata2-jpa-processor-core

Object[] args = jpaFunction.getArguments();
if (uriParserResultView.getFunctionImport().getReturnType()
  .getMultiplicity().equals(EdmMultiplicity.MANY)) {

代码示例来源:origin: io.cronapp/olingo-odata2-jpa-processor-core

.build();
functionImport = resultsView.getFunctionImport();
edmType = functionImport.getReturnType().getType();
  EntityProvider.writeFunctionImport(contentType, resultsView.getFunctionImport(), result, feedProperties);
odataResponse = ODataResponse.fromResponse(odataResponse).status(HttpStatusCodes.OK).build();

代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core

.build();
functionImport = resultsView.getFunctionImport();
edmType = functionImport.getReturnType().getType();
  EntityProvider.writeFunctionImport(contentType, resultsView.getFunctionImport(), result, feedProperties);
odataResponse = ODataResponse.fromResponse(odataResponse).status(HttpStatusCodes.OK).build();

代码示例来源:origin: org.apache.olingo/olingo-odata2-jpa-processor-core

@Override
public ODataResponse build(final GetFunctionImportUriInfo resultsView, final Object result)
  throws ODataJPARuntimeException {
 try {
  final EdmFunctionImport functionImport = resultsView.getFunctionImport();
  final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType();
  if (result != null) {
   ODataResponse response = null;
   if (type.getDefaultType().equals(byte[].class)) {
    response = EntityProvider.writeBinary("application/octet-stream", (byte[]) result);
   } else {
    final String value = type.valueToString(result, EdmLiteralKind.DEFAULT, null);
    response = EntityProvider.writeText(value);
   }
   return ODataResponse.fromResponse(response).build();
  } else {
   throw new ODataNotFoundException(ODataHttpException.COMMON);
  }
 } catch (EdmException e) {
  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
 } catch (EntityProviderException e) {
  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
 } catch (ODataException e) {
  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
 }
}

代码示例来源:origin: io.cronapp/olingo-odata2-jpa-processor-core

@Override
public ODataResponse build(final GetFunctionImportUriInfo resultsView, final Object result)
  throws ODataJPARuntimeException {
 try {
  final EdmFunctionImport functionImport = resultsView.getFunctionImport();
  final EdmSimpleType type = (EdmSimpleType) functionImport.getReturnType().getType();
  if (result != null) {
   ODataResponse response = null;
   if (type.getDefaultType().equals(byte[].class)) {
    response = EntityProvider.writeBinary("application/octet-stream", (byte[]) result);
   } else {
    final String value = type.valueToString(result, EdmLiteralKind.DEFAULT, null);
    response = EntityProvider.writeText(value);
   }
   return ODataResponse.fromResponse(response).build();
  } else {
   throw new ODataNotFoundException(ODataHttpException.COMMON);
  }
 } catch (EdmException e) {
  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
 } catch (EntityProviderException e) {
  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.GENERAL.addContent(e.getMessage()), e);
 } catch (ODataException e) {
  throw ODataJPARuntimeException.throwException(ODataJPARuntimeException.INNER_EXCEPTION, e);
 }
}

代码示例来源:origin: com.sap.cloud.servicesdk.prov/odata-core

this.gwlog.debug("executeFunctionImport: " + TraceUtil.getFunctionImportLog(uriInfo.getFunctionImport())
    + ", content type = " + (contentType == null ? "<null>" : contentType)+ "backendVersion = " + bepVersion);

相关文章

微信公众号

最新文章

更多