Skip to content

New restlet features as per OData V3 specifications - #940

Open
Landmark-LGC wants to merge 4 commits into
restlet:masterfrom
Landmark-LGC:master
Open

New restlet features as per OData V3 specifications#940
Landmark-LGC wants to merge 4 commits into
restlet:masterfrom
Landmark-LGC:master

Conversation

@Landmark-LGC

Copy link
Copy Markdown

Added new restlet feaures as per odata V3 specifications.-

  1. Batch CRUD Support (http://www.odata.org/documentation/odata-version-3-0/batch-processing)
  2. MLE/Streaming Functionality (managing media link entities)
  3. Better support for complex properties
  4. Support for Actions & Functions (http://www.odata.org/documentation/odata-version-3-0/atom-format#functions)

Also enhanced and fixed -

  1. Support HTTP_NEGOTIATE method for form based authentication.
  2. Improved command line parsing through Apache commons cli.
  3. Improved feed parsing using STAX based model.
  4. User friendly parameters for calling functions.
  5. primitive -> wrapper class changes to fix null value being sent for empty fields in create/update

1. Batch CRUD Support (http://www.odata.org/documentation/odata-version-3-0/batch-processing)
2. MLE/Streaming Functionality (managing media link entities)
3. Better support complex properties
4. Support for Actions & Functions (http://www.odata.org/documentation/odata-version-3-0/atom-format#functions)
Also enhanced and fixed -
1. Support HTTP_NEGOTIATE method for form based authentication.
2. Improved command line parsing through Apache commons cli.
3. Improved feed parsing using STAX based model.
4. User friendly parameters for calling functions.
5. primitive -> wrapper class changes to fix null value being sent for empty fields in create/update
@jlouveljlouvel added this to the 2.2.4 milestone Aug 15, 2014
@jlouvel

Copy link
Copy Markdown
Collaborator

Thanks a lot, this looks awesome!!
Could you send us your signed JCA so we can merge your pull request into next 2.3 milestone?
http://restlet.com/participate/contribute#submit-contribution

@jlouveljlouvel mentioned this pull request Aug 15, 2014
@jlouveljlouvel changed the title New restlet feaures as per odata V3 specifications.New restlet features as per OData V3 specifications.Aug 15, 2014
@jlouveljlouvel changed the title New restlet features as per OData V3 specifications.New restlet features as per OData V3 specificationsAug 15, 2014
@Landmark-LGC

Copy link
Copy Markdown
Author

Thanks Jerome,
Our legal department is working on getting the required JCA signed which will take couple of days.
Will revert soon.

@jlouvel

Copy link
Copy Markdown
Collaborator

Hi @Landmark-LGC Do you have any update from your legal department? Your contribution would be really welcome.

@Landmark-LGC

Copy link
Copy Markdown
Author

Hi!
We are close to getting our legal approvals. Hopefully I can send you the doc this week – just one more signature to be obtained.

Thanks
srini

From: Jerome Louvel [mailto:notifications@github.com]
Sent: Tuesday, September 09, 2014 12:59 PM
To: restlet/restlet-framework-java
Cc: Srini Kethireddipalli
Subject: Re: [restlet-framework-java] New restlet features as per OData V3 specifications (#940)

Hi @Landmark-LGChttps://github.com/Landmark-LGC Do you have any update from your legal department? Your contribution would be really welcome.


Reply to this email directly or view it on GitHubhttps://github.com//pull/940#issuecomment-55009533.


This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

@jlouvel

Copy link
Copy Markdown
Collaborator

Excellent news, thanks Srini
On Sep 9, 2014 11:13 AM, "Landmark-LGC" notifications@github.com wrote:

Hi!
We are close to getting our legal approvals. Hopefully I can send you the
doc this week – just one more signature to be obtained.

Thanks
srini

From: Jerome Louvel [mailto:notifications@github.com]
Sent: Tuesday, September 09, 2014 12:59 PM
To: restlet/restlet-framework-java
Cc: Srini Kethireddipalli
Subject: Re: [restlet-framework-java] New restlet features as per OData V3
specifications (#940)

Hi @Landmark-LGChttps://github.com/Landmark-LGC Do you have any update
from your legal department? Your contribution would be really welcome.


Reply to this email directly or view it on GitHub<
https://github.com/restlet/restlet-framework-java/pull/940#issuecomment-55009533>.


This e-mail, including any attached files, may contain confidential and
privileged information for the sole use of the intended recipient. Any
review, use, distribution, or disclosure by others is strictly prohibited.
If you are not the intended recipient (or authorized to receive information
for the intended recipient), please contact the sender by reply e-mail and
delete all copies of this message.


Reply to this email directly or view it on GitHub
#940 (comment)
.

@Landmark-LGC

Copy link
Copy Markdown
Author

Jerome:

Attached is the joint copy right assignment approved and signed by Landmark.

Thanks
srini

From: Jerome Louvel [mailto:notifications@github.com]
Sent: Tuesday, September 09, 2014 2:35 PM
To: restlet/restlet-framework-java
Cc: Srini Kethireddipalli
Subject: Re: [restlet-framework-java] New restlet features as per OData V3 specifications (#940)

Excellent news, thanks Srini
On Sep 9, 2014 11:13 AM, "Landmark-LGC" <notifications@github.commailto:notifications@github.com> wrote:

Hi!
We are close to getting our legal approvals. Hopefully I can send you the
doc this week – just one more signature to be obtained.

Thanks
srini

From: Jerome Louvel [mailto:notifications@github.com]
Sent: Tuesday, September 09, 2014 12:59 PM
To: restlet/restlet-framework-java
Cc: Srini Kethireddipalli
Subject: Re: [restlet-framework-java] New restlet features as per OData V3
specifications (#940)

Hi @Landmark-LGChttps://github.com/Landmark-LGC Do you have any update
from your legal department? Your contribution would be really welcome.


Reply to this email directly or view it on GitHub<
https://github.com/restlet/restlet-framework-java/pull/940#issuecomment-55009533>.


This e-mail, including any attached files, may contain confidential and
privileged information for the sole use of the intended recipient. Any
review, use, distribution, or disclosure by others is strictly prohibited.
If you are not the intended recipient (or authorized to receive information
for the intended recipient), please contact the sender by reply e-mail and
delete all copies of this message.


Reply to this email directly or view it on GitHub
#940 (comment)
.


Reply to this email directly or view it on GitHubhttps://github.com//pull/940#issuecomment-55021259.

@Landmark-LGC

Copy link
Copy Markdown
Author

Please confirm that you received the JCA.

@jlouveljlouvel modified the milestones: 2.3 M4, 2.2.4Sep 25, 2014
@jlouvel

Copy link
Copy Markdown
Collaborator

Thanks so much for getting the JCA signed by your company. This is great as we'll be able to start working on the integration of your contribution.

@vvicky72

Copy link
Copy Markdown

Is there a working code for this that I can download? I need the ComplexType functionality as well. Help appreciated.

@Landmark-LGC

Copy link
Copy Markdown
Author

ComplexType functionality is supported. Did you try it and run into problems or are you asking how to use ComplexTypes with the OData extension?
If you encountered any problems using it, please post here.

From: vvicky72 [mailto:notifications@github.com]
Sent: Sunday, October 19, 2014 2:56 PM
To: restlet/restlet-framework-java
Cc: Srini Kethireddipalli
Subject: Re: [restlet-framework-java] New restlet features as per OData V3 specifications (#940)

Is there a working code for this that I can download? I need the ComplexType functionality as well. Help appreciated.


Reply to this email directly or view it on GitHubhttps://github.com//pull/940#issuecomment-59662653.


This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

@vvicky72

Copy link
Copy Markdown

Hmm,

Yes. This is what I have
We have MSCRM exposing rest based services. I am using restlet.
The code was generated using "org.restlet.ext.odata.Generator.main(arguments);"
In the generated code there is an addEntity function which adds an entity to the Http request xml.
The addEntity calls a toEntry function (the code for which is below).
The toEntry function does not include complex properties in the request.

Not sure if this is the same problem as pull #940
#940

Help Appreciated.

Thanks,

Vikas.

public Entry toEntry(final Object entity) {
Entry result = null;

 if (entity != null) {
Metadata metadata = (Metadata) getMetadata();
EntityType type = metadata.getEntityType(entity.getClass());
if (type != null) {
final SaxRepresentation r = new SaxRepresentation(
MediaType.APPLICATION_XML) {
@Override
public void write(XmlWriter writer) throws IOException {
try {
// Attribute for nullable values.
AttributesImpl nullAttrs = new AttributesImpl();
nullAttrs.addAttribute(
WCF_DATASERVICES_METADATA_NAMESPACE,
"null", null, "boolean", "true");
writer.forceNSDecl(
WCF_DATASERVICES_METADATA_NAMESPACE, "m");
writer.forceNSDecl(WCF_DATASERVICES_NAMESPACE, "d");
writer.startElement(
WCF_DATASERVICES_METADATA_NAMESPACE,
"properties");
write(writer, entity, nullAttrs);
writer.endElement(
WCF_DATASERVICES_METADATA_NAMESPACE,
"properties");
} catch (SAXException e) {
throw new IOException(e.getMessage());
}
}
private void write(XmlWriter writer, Object entity,
AttributesImpl nullAttrs) throws SAXException {
for (Field field : entity.getClass()
.getDeclaredFields()) {
String getter = "get"
+ field.getName().substring(0, 1)
.toUpperCase()
+ field.getName().substring(1);
Property prop = ((Metadata) getMetadata())
.getProperty(entity, field.getName());
System.out.println("My -->" + getter + " prop-->"+prop);
if (prop != null) {
writeProperty(writer, entity, prop, getter,
nullAttrs);
}
}
}
private void writeProperty(XmlWriter writer, Object entity,
Property prop, String getter,
AttributesImpl nullAttrs) throws SAXException {
for (Method method : entity.getClass()
.getDeclaredMethods()) {
if(getter.equals(method.getName())){
System.out.println(method.getReturnType()+" "+method.getName() + " " + method.getParameterTypes().length);
}
if (method.getReturnType() != null
&& getter.equals(method.getName())
&& method.getParameterTypes().length == 0) {
Object value = null;
try {
value = method.invoke(entity,
(Object[]) null);
System.out.println("Flow 1 -->"+method.getName()+"---"+value);
} catch (Exception e) {
}
if (value != null) {
writer.startElement(
WCF_DATASERVICES_NAMESPACE,
prop.getName());
if (prop instanceof ComplexProperty) {
write(writer, value, nullAttrs);
} else {
writer.characters(TypeUtils.toEdm(
value, prop.getType()));
}
writer.endElement(
WCF_DATASERVICES_NAMESPACE,
prop.getName());
} else {
if (prop.isNullable()) {
writer.emptyElement(
WCF_DATASERVICES_NAMESPACE,
prop.getName(), prop.getName(),
nullAttrs);
} else {
getLogger().warning(
"The following property has a null value but is not marked as nullable: "
+ prop.getName());
writer.emptyElement(
WCF_DATASERVICES_NAMESPACE,
prop.getName());
}
}
break;
}
}
}
};
if (type.isBlob()) {
result = new Entry() {
@Override
public void writeInlineContent(XmlWriter writer)
throws SAXException {
try {
r.write(writer);
} catch (IOException e) {
throw new SAXException(e);
}
}
};
Link editLink = new Link(getValueEditRef(entity),
Relation.EDIT_MEDIA, null);
result.getLinks().add(editLink);
Content content = new Content();
// Get the external blob reference
content.setExternalRef(getValueRef(entity));
content.setToEncode(false);
result.setContent(content);
} else {
result = new Entry();
Content content = new Content();
content.setInlineContent(r);
content.setToEncode(false);
result.setContent(content);
}
}
}
return result;
}

Date: Sun, 19 Oct 2014 19:23:52 -0700
From: notifications@github.com
To: restlet-framework-java@noreply.github.com
CC: vvicky72@hotmail.com
Subject: Re: [restlet-framework-java] New restlet features as per OData V3 specifications (#940)

ComplexType functionality is supported. Did you try it and run into problems or are you asking how to use ComplexTypes with the OData extension?

If you encountered any problems using it, please post here.

From: vvicky72 [mailto:notifications@github.com]

Sent: Sunday, October 19, 2014 2:56 PM

To: restlet/restlet-framework-java

Cc: Srini Kethireddipalli

Subject: Re: [restlet-framework-java] New restlet features as per OData V3 specifications (#940)

Is there a working code for this that I can download? I need the ComplexType functionality as well. Help appreciated.

Reply to this email directly or view it on GitHubhttps://github.com//pull/940#issuecomment-59662653.


This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient. Any review, use, distribution, or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.


Reply to this email directly or view it on GitHub. =

@jlouveljlouvel modified the milestones: 2.3 M4, UnplannedOct 28, 2014
@jlouvel

Copy link
Copy Markdown
Collaborator

@Landmark-LGC Sorry, we won't have the bandwidth to integrate this important but large contribution in 2.3 (due on 11/17). We'll take time to properly integrate it in 3.0 (and upgrade to 4.0) dev cycle which will start soon. See the road map here: https://github.com/restlet/restlet-framework-java/wiki/Road-map-of-version-3.0

@jlouveljlouvel modified the milestones: 3.0 M1, 2.3 M4Nov 2, 2014
@jlouveljlouvel modified the milestones: 3.0 M1, 3.0 M2Jan 20, 2015
@jlouveljlouvel modified the milestones: 3.0 M2, UnplannedMay 1, 2015
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@Landmark-LGC@jlouvel@vvicky72@thboileau@onkar-dhuri