當前位置: 首頁>>代碼示例>>Java>>正文


Java Entry.getEntity方法代碼示例

本文整理匯總了Java中org.odata4j.format.Entry.getEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java Entry.getEntity方法的具體用法?Java Entry.getEntity怎麽用?Java Entry.getEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.odata4j.format.Entry的用法示例。


在下文中一共展示了Entry.getEntity方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRequestEntity

import org.odata4j.format.Entry; //導入方法依賴的package包/類
protected OEntity getRequestEntity(HttpHeaders httpHeaders, UriInfo uriInfo, InputStream payload, EdmDataServices metadata, String entitySetName, OEntityKey entityKey) throws UnsupportedEncodingException {
  // TODO validation of MaxDataServiceVersion against DataServiceVersion
  // see spec [ms-odata] section 1.7

  ODataVersion version = InternalUtil.getDataServiceVersion(httpHeaders.getRequestHeaders().getFirst(ODataConstants.Headers.DATA_SERVICE_VERSION));
  FormatParser<Entry> parser = FormatParserFactory.getParser(Entry.class, httpHeaders.getMediaType(),
      new Settings(version, metadata, entitySetName, entityKey, null, false));

  String charset = httpHeaders.getMediaType().getParameters().get("charset");
  if (charset == null) {
    charset = ODataConstants.Charsets.Upper.ISO_8859_1; // from HTTP 1.1
  }

  Entry entry = parser.parse(new BufferedReader(
      new InputStreamReader(payload, charset)));

  return entry.getEntity();
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:19,代碼來源:BaseResource.java

示例2: getRequest

import org.odata4j.format.Entry; //導入方法依賴的package包/類
private ODataClientRequest getRequest() {
  EdmEntitySet ees = metadata.getEdmEntitySet(entitySetName);
  Entry entry = client.createRequestEntry(ees, null, props, links);
  entity = entry.getEntity();
  StringBuilder url = new StringBuilder(serviceRootUri);
  if (parent != null) {
    url.append(InternalUtil.getEntityRelId(parent))
        .append("/")
        .append(navProperty);
  } else {
    url.append(entitySetName);
  }
  ODataClientRequest request;

  if (Boolean.TRUE.equals(ees.getType().getHasStream())) {
    setMediaStream(entity);
    request = new ODataClientRequest("POST", url.toString(), prepareSlugHeaders(ees), null, entity.getMediaLinkStream());
  } else {
    request = ODataClientRequest.post(url.toString(), entry);
  }
  return request;
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:23,代碼來源:ConsumerCreateEntityRequest.java

示例3: writeRequestEntry

import org.odata4j.format.Entry; //導入方法依賴的package包/類
public void writeRequestEntry(Writer w, Entry entry) {

    DateTime utc = new DateTime().withZone(DateTimeZone.UTC);
    String updated = InternalUtil.toString(utc);

    XMLWriter2 writer = XMLFactoryProvider2.getInstance().newXMLWriterFactory2().createXMLWriter(w);
    writer.startDocument();

    writer.startElement(new QName2("entry"), atom);
    writer.writeNamespace("d", d);
    writer.writeNamespace("m", m);

    OEntity entity = entry.getEntity();
    writeEntry(writer, null, entity.getProperties(), entity.getLinks(),
        null, updated, entity.getEntitySet(), false);
    writer.endDocument();

  }
 
開發者ID:teiid,項目名稱:oreva,代碼行數:19,代碼來源:AtomEntryFormatWriter.java

示例4: convertFromString

import org.odata4j.format.Entry; //導入方法依賴的package包/類
protected static OEntity convertFromString(String requestEntity, MediaType type, ODataVersion version, EdmDataServices metadata, String entitySetName, OEntityKey entityKey, Boolean isResponse) throws NotAcceptableException {
  //previously we are hard coding it to have false, since we always get the entity to be created as name, value pair. 
  //setting the isResponse to true only when we are building the OEntity from the response as it contain root element, metadata, data,etc
  FormatParser<Entry> parser = FormatParserFactory.getParser(Entry.class, type,
      new Settings(version, metadata, entitySetName, entityKey, null, isResponse));
  Entry entry = parser.parse(new StringReader(requestEntity));
  return entry.getEntity();
}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:9,代碼來源:BaseResource.java

示例5: getResult

import org.odata4j.format.Entry; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
private T getResult(ODataClientResponse response) {
  ODataVersion version = InternalUtil.getDataServiceVersion(response.getHeaders()
      .getFirst(ODataConstants.Headers.DATA_SERVICE_VERSION));

  Entry entry = getResult(version, client.getFeedReader(response));
  response.close();

  return (T) entry.getEntity();

}
 
開發者ID:teiid,項目名稱:oreva,代碼行數:12,代碼來源:ConsumerCreateEntityRequest.java


注:本文中的org.odata4j.format.Entry.getEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。