当前位置: 首页>>代码示例>>Java>>正文


Java ClientValue类代码示例

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


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

示例1: boundActionReturningColComplexTypeWithComplexTypeSegInAction

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void boundActionReturningColComplexTypeWithComplexTypeSegInAction() throws Exception {
  URIBuilder builder = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESMixPrimCollComp").
      appendKeySegment(32767).appendPropertySegment("CollPropertyComp").
      appendActionCallSegment("olingo.odata.test1.BAETMixPrimCollCompCTTWOPrimCompRTCollCTTwoPrim");
  final ClientComplexValue propertyComp = client.getObjectFactory().
      newComplexValue("olingo.odata.test1.CTTwoPrim");
  propertyComp.add(client.getObjectFactory().newPrimitiveProperty("PropertyInt16",
      client.getObjectFactory().newPrimitiveValueBuilder().buildInt16((short) 111)));
  propertyComp.add(client.getObjectFactory().newPrimitiveProperty("PropertyString",
      client.getObjectFactory().newPrimitiveValueBuilder().buildString("ABC")));
  
  Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  parameters.put("PropertyComp", propertyComp);
  
  final ODataInvokeRequest<ClientProperty> req =
      client.getInvokeRequestFactory().getActionInvokeRequest(builder.build(), ClientProperty.class, parameters);
  req.setFormat(ContentType.JSON_FULL_METADATA);
  req.setContentType(ContentType.APPLICATION_JSON.toContentTypeString() + ";odata.metadata=full");
  ClientProperty prop = req.execute().getBody();
  assertNotNull(prop);
  assertNotNull(prop.getCollectionValue());
  assertEquals(prop.getCollectionValue().asCollection().size(), 1);
  assertEquals(prop.getCollectionValue().getTypeName(), "Collection(olingo.odata.test1.CTTwoPrim)");
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:BasicBoundActionsITCase.java

示例2: boundActionReturningComplexDerivedTypeWithComplexTypeSegInAction

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void boundActionReturningComplexDerivedTypeWithComplexTypeSegInAction() throws Exception {
  Map<String, Object> segmentValues = new HashMap<String, Object>();
  segmentValues.put("PropertyInt16", 1);
  segmentValues.put("PropertyString", "1");
  URIBuilder builder = client.newURIBuilder(SERVICE_URI).appendEntitySetSegment("ESTwoKeyNav").
      appendKeySegment(segmentValues).appendPropertySegment("PropertyCompNav").
      appendDerivedEntityTypeSegment("olingo.odata.test1.CTTwoBasePrimCompNav").
      appendActionCallSegment("olingo.odata.test1."
          + "BAETTwoKeyNavCTBasePrimCompNavCTTwoBasePrimCompNavRTCTTwoBasePrimCompNav");
  
  Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  
  final ODataInvokeRequest<ClientEntity> req =
      client.getInvokeRequestFactory().getActionInvokeRequest(builder.build(), ClientEntity.class, parameters);
  req.setFormat(ContentType.JSON_FULL_METADATA);
  req.setContentType(ContentType.APPLICATION_JSON.toContentTypeString() + ";odata.metadata=full");
  ClientEntity entity = req.execute().getBody();
  assertNotNull(entity);
  assertEquals(entity.getProperties().size(), 2);
  assertEquals(entity.getTypeName().getFullQualifiedNameAsString(), 
      "olingo.odata.test1.CTTwoBasePrimCompNav");
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:24,代码来源:BasicBoundActionsITCase.java

示例3: updateComplexCollection

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void updateComplexCollection() throws Exception {
  final ODataPropertyUpdateRequest request =
      getClient().getCUDRequestFactory().getPropertyCollectionValueUpdateRequest(
          getClient().newURIBuilder(SERVICE_URI)
              .appendEntitySetSegment("ESMixPrimCollComp").appendKeySegment(7)
              .appendPropertySegment("CollPropertyComp")
              .build(),
          getFactory().newCollectionProperty("CollPropertyComp", getFactory().newCollectionValue(null)));
  assertNotNull(request);

  final ODataPropertyUpdateResponse response = request.execute();
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());

  final ClientProperty property = response.getBody();
  assertNotNull(property);
  final ClientCollectionValue<ClientValue> value = property.getCollectionValue();
  assertNotNull(value);
  assertFalse(value.iterator().hasNext());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:21,代码来源:PrimitiveComplexITCase.java

示例4: primitiveCollection

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void primitiveCollection() throws Exception {
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(
          getClient().newURIBuilder(TecSvcConst.BASE_URI).appendOperationCallSegment("FICRTCollString").build(),
          ClientProperty.class);
  assertNotNull(request);
  setCookieHeader(request);

  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());

  final ClientProperty property = response.getBody();
  assertNotNull(property);
  assertNotNull(property.getCollectionValue());
  assertEquals(3, property.getCollectionValue().size());
  Iterator<ClientValue> iterator = property.getCollectionValue().iterator();
  assertEquals("[email protected]", iterator.next().asPrimitive().toValue());
  assertEquals("[email protected]", iterator.next().asPrimitive().toValue());
  assertEquals("[email protected]", iterator.next().asPrimitive().toValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:FunctionImportITCase.java

示例5: FICRTStringTwoParamWithAliases

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void FICRTStringTwoParamWithAliases() {
  Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  parameters.put("ParameterInt16", getFactory().newPrimitiveValueBuilder().setValue(
      new ParameterAlias("first")).build());
  parameters.put("ParameterString", getFactory().newPrimitiveValueBuilder().setValue(
      new ParameterAlias("second")).build());
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory().getFunctionInvokeRequest(
      getClient().newURIBuilder(TecSvcConst.BASE_URI)
          .appendOperationCallSegment("FICRTStringTwoParam")
          .addParameterAlias("second", "'x'").addParameterAlias("first", "4")
          .build(),
      ClientProperty.class,
      parameters);
  setCookieHeader(request);
  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  assertEquals("\"x\",\"x\",\"x\",\"x\"", response.getBody().getPrimitiveValue().toValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:FunctionImportITCase.java

示例6: FICRTCollCTTwoPrimTwoParamNotNull

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void FICRTCollCTTwoPrimTwoParamNotNull() {
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
          .appendOperationCallSegment("FICRTCollCTTwoPrimTwoParam").build(),
      ClientProperty.class,
      buildTwoParameters(3, "TestString"));
  setCookieHeader(request);
  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  final ClientCollectionValue<ClientValue> collection = response.getBody().getCollectionValue().asCollection();
  final Iterator<ClientValue> iter = collection.iterator();

  ClientComplexValue complexValue = iter.next().asComplex();
  assertShortOrInt(1, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
  assertEquals("UFCRTCollCTTwoPrimTwoParam string value: TestString",
      complexValue.get("PropertyString").getPrimitiveValue().toValue());
  complexValue = iter.next().asComplex();
  assertShortOrInt(2, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
  assertEquals("UFCRTCollCTTwoPrimTwoParam string value: TestString",
      complexValue.get("PropertyString").getPrimitiveValue().toValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:FunctionImportITCase.java

示例7: FICRTCollCTTwoPrimTwoParamNull

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void FICRTCollCTTwoPrimTwoParamNull() {
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(getClient().newURIBuilder(TecSvcConst.BASE_URI)
          .appendOperationCallSegment("FICRTCollCTTwoPrimTwoParam").build(),
      ClientProperty.class,
      buildTwoParameters(2, null));
  setCookieHeader(request);
  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  final ClientCollectionValue<ClientValue> collection = response.getBody().getCollectionValue().asCollection();
  final Iterator<ClientValue> iter = collection.iterator();

  ClientComplexValue complexValue = iter.next().asComplex();
  assertShortOrInt(1, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
  assertEquals("UFCRTCollCTTwoPrimTwoParam int16 value: 2",
      complexValue.get("PropertyString").getPrimitiveValue().toValue());
  complexValue = iter.next().asComplex();
  assertShortOrInt(2, complexValue.get("PropertyInt16").getPrimitiveValue().toValue());
  assertEquals("UFCRTCollCTTwoPrimTwoParamstring value: null",
      complexValue.get("PropertyString").getPrimitiveValue().toValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:FunctionImportITCase.java

示例8: getObjectFromODataValue

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
public static Object getObjectFromODataValue(
    final ClientValue value,
    final Type typeRef,
    final AbstractService<?> service)
    throws InstantiationException, IllegalAccessException {

  Class<?> internalRef;
  if (typeRef == null) {
    internalRef = null;
  } else {
    try {
      internalRef = (Class<?>) ((ParameterizedType) typeRef).getActualTypeArguments()[0];
    } catch (ClassCastException e) {
      internalRef = (Class<?>) typeRef;
    }
  }

  return getObjectFromODataValue(value, internalRef, service);
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:20,代码来源:CoreUtils.java

示例9: StructuredComposableInvokerInvocationHandler

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
public StructuredComposableInvokerInvocationHandler(
        final URI uri,
        final Map<String, ClientValue> parameters,
        final Operation operation,
        final EdmOperation edmOperation,
        final Type[] references,
        final EdmTypeInfo returnType,
        final AbstractService<?> service) {

  super(uri, parameters, operation, edmOperation, references, service);

  if (!edmOperation.getReturnType().isCollection()) {
    if (returnType.isEntityType()) {
      this.structuredHandler = EntityInvocationHandler.getInstance(
              uri, targetRef, service);
    }
    if (returnType.isComplexType()) {
      this.structuredHandler = ComplexInvocationHandler.getInstance(
              targetRef, service, service.getClient().newURIBuilder(uri.toASCIIString()));
    }
  }
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:23,代码来源:StructuredComposableInvokerInvocationHandler.java

示例10: test2OLINGO753

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void test2OLINGO753() throws Exception {
  final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  Short parameterInt = 1;
  final ClientPrimitiveValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
      buildInt16(parameterInt);
  parameters.put("ParameterInt16", value);
  
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(
          getClient().newURIBuilder(TecSvcConst.BASE_URI).
          appendOperationCallSegment("FICRTETTwoKeyNavParam").appendPropertySegment("PropertyString").
          appendValueSegment().build(),
          ClientProperty.class, parameters);
  assertNotNull(request);
  request.setAccept("text/plain");
  setCookieHeader(request);

  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  String result = StringHelper.asString(response.getRawResponse());
  assertNotNull(result);
  assertEquals(2, Integer.parseInt(result));
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:FunctionImportITCase.java

示例11: test3OLINGO753

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void test3OLINGO753() throws Exception {
  final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  String parameterString = "1";
  final ClientPrimitiveValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
      buildString(parameterString);
  parameters.put("ParameterString", value);
  
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(
          getClient().newURIBuilder(TecSvcConst.BASE_URI).appendEntitySetSegment("ESKeyNav").
          appendOperationCallSegment("olingo.odata.test1.BFCESKeyNavRTETKeyNavParam").
          appendNavigationSegment("NavPropertyETTwoKeyNavMany").count().build(),
          ClientProperty.class, parameters);
  assertNotNull(request);
  request.setAccept("text/plain");
  setCookieHeader(request);

  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  String result = StringHelper.asString(response.getRawResponse());
  assertNotNull(result);
  assertEquals(3, Integer.parseInt(result));    
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:26,代码来源:FunctionImportITCase.java

示例12: test4OLINGO753

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void test4OLINGO753() throws Exception {
  final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  String parameterString = "1";
  final ClientPrimitiveValue value = getClient().getObjectFactory().newPrimitiveValueBuilder().
      buildString(parameterString);
  parameters.put("ParameterString", value);
  
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(
          getClient().newURIBuilder(TecSvcConst.BASE_URI).appendEntitySetSegment("ESKeyNav").
          appendOperationCallSegment("olingo.odata.test1.BFCESKeyNavRTETKeyNavParam").
          appendNavigationSegment("NavPropertyETTwoKeyNavMany").count().
          filter("substring(PropertyString,2) eq 'am String Property 1'").build(),
          ClientProperty.class, parameters);
  assertNotNull(request);
  request.setAccept("text/plain");
  setCookieHeader(request);

  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  String result = StringHelper.asString(response.getRawResponse());
  assertNotNull(result);
  assertEquals(1, Integer.parseInt(result));    
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:FunctionImportITCase.java

示例13: test5OLINGO753

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void test5OLINGO753() throws Exception {
  final Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  String parameterString = "'1'";
  parameters.put("ParameterString", getFactory().newPrimitiveValueBuilder().setValue(
      new ParameterAlias("first")).build());
  
  ODataInvokeRequest<ClientProperty> request = getClient().getInvokeRequestFactory()
      .getFunctionInvokeRequest(
          getClient().newURIBuilder(TecSvcConst.BASE_URI).appendEntitySetSegment("ESKeyNav").
          appendOperationCallSegment("olingo.odata.test1.BFCESKeyNavRTETKeyNavParam").
          appendNavigationSegment("NavPropertyETTwoKeyNavMany").count().
          addParameterAlias("first", parameterString).
          filter("substring(PropertyString,2) eq 'am String Property 1'").build(),
          ClientProperty.class, parameters);
  assertNotNull(request);
  request.setAccept("text/plain");
  setCookieHeader(request);

  final ODataInvokeResponse<ClientProperty> response = request.execute();
  saveCookieHeader(response);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  String result = StringHelper.asString(response.getRawResponse());
  assertNotNull(result);
  assertEquals(1, Integer.parseInt(result));    
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:27,代码来源:FunctionImportITCase.java

示例14: primitiveCollectionAction

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Test
public void primitiveCollectionAction() throws Exception {
  Map<String, ClientValue> parameters = new HashMap<String, ClientValue>();
  parameters.put("ParameterInt16", getFactory().newPrimitiveValueBuilder().buildInt16((short) 3));
  parameters.put("ParameterDuration", getFactory().newPrimitiveValueBuilder()
      .setType(EdmPrimitiveTypeKind.Duration).setValue(new BigDecimal(1)).build());
  final ODataInvokeResponse<ClientProperty> response =
      callAction("AIRTCollStringTwoParam", ClientProperty.class, parameters, false);
  assertEquals(HttpStatusCode.OK.getStatusCode(), response.getStatusCode());
  ClientCollectionValue<ClientValue> valueArray = response.getBody().getCollectionValue();
  assertEquals(3, valueArray.size());
  Iterator<ClientValue> iterator = valueArray.iterator();
  assertEquals("UARTCollStringTwoParam duration value: PT1S", iterator.next().asPrimitive().toValue());
  assertEquals("UARTCollStringTwoParam duration value: PT2S", iterator.next().asPrimitive().toValue());
  assertEquals("UARTCollStringTwoParam duration value: PT3S", iterator.next().asPrimitive().toValue());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:17,代码来源:ActionImportITCase.java

示例15: fetchPartial

import org.apache.olingo.client.api.domain.ClientValue; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public Triple<List<T>, URI, List<ClientAnnotation>> fetchPartial(final URI uri, final Class<T> typeRef) {
  final ODataPropertyRequest<ClientProperty> req =
          getClient().getRetrieveRequestFactory().getPropertyRequest(uri);
    req.setPrefer(getClient().newPreferences().includeAnnotations("*"));

  final ODataRetrieveResponse<ClientProperty> res = req.execute();

  final List<T> resItems = new ArrayList<T>();

  final ClientProperty property = res.getBody();
  if (property != null && !property.hasNullValue()) {
    for (ClientValue item : property.getCollectionValue()) {
      resItems.add((T) item.asPrimitive().toValue());
    }
  }

  return new ImmutableTriple<List<T>, URI, List<ClientAnnotation>>(
          resItems, null, Collections.<ClientAnnotation>emptyList());
}
 
开发者ID:apache,项目名称:olingo-odata4,代码行数:22,代码来源:PrimitiveCollectionInvocationHandler.java


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