AngularJS + Rule Engine - angularjs

Is there any way to integrate Rule Engine (or Rule Engine concept to apply Business Rules) with AngularJS application?
I have heard about Drools. Is there any API provided by Drools which can be used in Angular Project?
My requirement is any input given by the user should first go to match the applicable rules, then it should pass to the angular-controller. Is this possible?
Thanks in advance.!

You just need to write a REST (or other HTTP-based) service to wrap your Drools rules. That way a client-side JavaScript framework such as Angular JS can call your REST operations.
The following is an example of an Angular JS client-side application integrating with Drools on the server: https://github.com/gratiartis/qzr
Although I should warn you that it's a work in progress, so please don't complain about lack of features or documentation. :)

you can also try IBM ODM (Operational Decision Manager), available on-premise or in IBM Cloud Bluemix.
http://bluemixtips.blogspot.co.uk/2014/05/rules-on-bluemix.html
http://www.ibm.com/developerworks/cloud/library/cl-hotel-rules-app/index.html (NodeJS sample)
Cheers
--Yves
#ylecleach

For drools, there are two possibilities:
First solution, as mentioned by Steve, is to write your own REST service to wrap drools engine.
The other solution is to use Drools Camel Server, which provides REST interface out of the box.
In contrary to other drools' document, the document of Camel server is a bit too short.

You can use JavaScript client to talk to a decision-as-a-service platform. Which the business rule/decision server hosts all your related business rules and make them available as a REST API interface. Then you can execute, manage and monitor those business rules via REST API interface.

Related

liferay like restfull api mobile

I have a app and I need develop a restfull api to be used for this app.
Is liferay a valid option to develop this (using the service builder and persistence layer of liferay) to expose my service api to be used for the app?
I have in mind the performance and availability to this services.
what another option (to develop the api rest) i should consider for this purpose
Thanks
I expect for your replies.
Regards
Liferay can act as a rest server by service buider (I'm not sure it will support any RESTful operation, but only GET/POST).
By this way you can inherit the interesting features provided such as:
- users, roles and groups
- ready scalable platform
- hibernate+ehcache already configured
Ecc... by the other hand, it will bring a great burden to you... so in my mind, if you are interested to other Liferay native features, then you can use it.
On contrary, there are other ligther frameworks for achieving your needs (just think to Spring MVC, it can implement any other restful method, like so PUT/DELETE... and it is more configurable)... so in this case it will ask you to do a bit more work by hand... but you will not "fight" with a complex platform if it is not necessary.
(In the first hypothesis, don't forget to give an eye to the "Liferay Mobile SDK")
thanks for answer.
In fact, I am interested in use the features of liferay like users, groups, profiles, persistence layer and the web content to manager some resources in the app.
My question is thinking in the performance and scalability of the services layer for this app, if is factible use only liferay to expose all the service to the app need and if her performance will be appropriate.
regards.

Is there any restful api for postgresql?

Im trying to develop a web app using angularjs, restangular and postgresql, im using ubuntu and xampp for development. I found ArrestDB, a restful api for postgresql. In its documentation,
# Get all rows from the "customers" table where the "country" field matches "Australia" (LIKE)
GET http://api.example.com/customers/country/Australia/
https://github.com/alixaxel/ArrestDB
While in restangular documentation,
// Just ONE GET to /accounts/123/buildings/456
Restangular.one('accounts', 123).one('buildings', 456).get()
https://github.com/mgonto/restangular
Do you guys know a free RESTful api for postgresql that works well with restangular?
ArrestDB interprets api/{Table}/{Field}/{....} while Restangular interprets api/{table}/{id}/{relations table}. I also tried api/{table}/{id}/{relations table} in ArrestDB but I get error 404.
I also found Postgrest in github but its in haskel, and i'm not familiar with haskel.
Thanks...
Postgrest seems to be a very viable choice. There is no knowledge of Haskell required to interact with it.
I have used PostgREST and recommend it. It is written in Haskell but requires no knowledge of Haskell (in the same way that pg is written in C, but no knowledge of C is required to use it). The documentation at postgrest.com is quite helpful and I've been able to get up to speed with it quickly. Best practices are to run pgREST through a reverse proxy (Apache, Nginx, etc.) to control web authentication and authorization. PostgreSQL will enforce permissions GRANTed to the configured pgREST user (INSERT, UPDATE, DELETE, etc.) on the DB served up by pgREST. There are a number of access control options listed in the pgREST documentation for switching user roles as requests come in, so the access control is pretty flexible in accommodating different usage scenarios.
You can use Express.js and Node.js to create RESTful API for example. It works with PostgreSQL well. I am using it now for my application, so I have a PostgreSQL DB, back-end in Express.js with pg-promise and Node.js and front-end in AngularJS with Restangular.
You can try
this tutorial,
this guy has a quite good blog about building API and other useful things.

OWASP top 10 web app security risks mitigation in AngularJS

I'm using HDIV for JSF and Spring MVC applications to mitigate OWASP top 10 security risks. Now I have to implement the same in AngularJS.
Is there any library avilable similar to HDIV for AngularJS?
For client-mvc scenarios such as AngularJS Spring-Hateoas approach fits well with HDIV. Actually, HDIV has a module for that integration: https://github.com/hdiv/hdiv/tree/hdiv-hateoas
It’s not totally finished yet but the integration of URL resources works (see ResourceRequestDataValueProcessor) but it’s not finished the support for forms. When we started this module this data format for forms was not finished or defined, and that’s why we did not continue this work.
We think it could be possible a very integrated solution with HDIV following Hypermedia and HATEOAS
approach for client-mvc apps or also for native mobile apps. In other words, within REST Hypermedia approach all URLs or forms, excepting the first URL, are created in the server side, in a similar way of traditional server side MVC web technologies.
Please take a look to this module (hdiv-hateoas) and we can support you if you have any doubts.
Roberto Velasco (HDIV team)

Authorisation framework for GAE Java

I am trying to choose an auth framework for GAE and would be very interested in other people's experiences on this subject.
I had a look into Shiro and Spring-Security so far. What could you recommend?
Luke Taylor wrote a good blog post explaining how to use Spring Security and GAE together. I believe that both Shiro and Spring Security would be suitable for GAE so it's really a question of what you need. Shiro is simple to implement but limited. In contrast Spring Security is a lot more powerful but this brings some additional complexity. Having said that, recent releases have been much simpler to use (especially since the introduction of namespaces).
Personally I would go for Spring
Personally, I would go with GAE + Guice (ligthweight dependecy injection by Google) + Objectify 5 + JAx-Rs implementation (RestEasy or Jersey) + Shiro.
You can find a good example over here - http://hackersv.blogspot.de/2014/02/shiro-guice-maven-and-google-app-engine.html
Jello-framework is a new Java framework for Google App Engine that includes comprehensive Data Authorization model. One of Jello's key features is its inline Authorization Model. With Jello you can assign different access levels for data elements at any resolution (Namespaces, Entities, Fields, Actions) and specify who is authorized to access the data via the REST API.

Is it possible to use the Google App Engine as a backend database for Android applications?

I would like to write a client application for Android that uses the Google App Engine as a database backend. My Android client would connect to the App Engine to save information, then it would connect later for reports. Is it possible to use the App Engine as a backend like this?
If you're looking for something like the remote api that the App Engine has in python, then you'll be disappointed to find it missing in Java.
That said, absolutely nothing stops your from hitting your app and posting data either through POST / JSON / XML / any other format you can think of. The same thing goes for getting your reports back.
If security is a concern, the OAuth protocol allows you to authenticate to app engine from your android device.
This is an aside, but as far as reporting is concerned, you might not find the app engine a very suitable platform for reporting type apps. Just make sure you understand its limitations - the lack of joins, 1000 object limit, no sum / average, necessary indexes, etc. It's certainly not impossible, but do think carefully about how you're going to model your data.
Yes, it is possible.
Without more details in your question, any more details in the answer would be speculation.
Yes, its very much possible. It's something I am also currently working on.
My code uses HTTP GET and HTTP POST and I am using a RESTful service on the GAE.
I'm sorry I can't provide any code because I am still learning however the library I'm using is called RESTLET. They have libraries for both GAE and Android however I'm only using RESTLET on the GAE and I'm just using the HTTP library in the Android SDK for the client.
http://www.restlet.org/
The version you require is 2.0 M6 and not the stable release.
No.
In your response to Laurence, you said you want a direct DB connetion. A client cannot connect directly to the GAE datastore. You must write web handlers to interface between the client and your data. It doesn't have to be much, but it must be something.
Yes, it is very possible. You would not connect directly to the GAE database though. A better architecture would be to make your app hit a URL that writes to the DB. For example, you could set up a Struts 2 action that takes the values of your query parameters and then mutates and validates them as necessary before persisting them.

Resources