Vicert @ “Berlin API DAYS 2014”

In May 2014, Berlin was the host of API Days convention, and this time it was pretty much developer oriented. Naturally, Vicert has sent one of its team members to attend. Here are the impressions.

Are Web APIs that big of a deal?

Yes, yes they are.

Web APIs are gaining in importance as a way of providing software, but also as an integral part of the web site. Developing and owning Web APIs can be very profitable (Google Maps comes to mind) so it is no surprise that there are more and more startups with Web API as their product.

Continue reading “Vicert @ “Berlin API DAYS 2014””

#2 Spring: Manipulating Salesforce objects

In Part 1 of this topic, we saw how to do OAuth authentication with Salesforce  using Spring. In this part, we’ll see how to fetch and update records  and upload documents to Salesforce using REST API.

Using REST API from Spring Web application – Part 2: Manipulating Salesforce objects  REST API Resources are used to manipulate objects, execute queries,  display API information etc. Each resource is tied with a specific resource URI which is used to read, create or update record. All URIs  have common base URI: “http://domain/services/data”. Domain is usually instance URL retrieved during authentication, or a domain pointing to some Salesforce instance.

Continue reading “#2 Spring: Manipulating Salesforce objects”

#1 Spring Web application: Authentication  REST API provides a simple and powerful way of communicating with It is a great way for a secure programmatic access and  interaction with from a Web or mobile application using REST-based web services.

Using REST API from Spring Web application – Part 1: Authentication

The API is based on using REST Resources. REST resource can be a single data record or a collection of records,  like Salesforce objects or custom objects. Each resource is identified  by a named URI, and is accessed using standard HTTP methods (HEAD, GET,  POST, PATCH, DELETE).

Continue reading “#1 Spring Web application: Authentication”

Spring: ServletContext attributes

Sometimes  you need to expose some Spring bean or property for parts of  application unaware of Spring. This can be easily achieved if the Spring  unaware code is aware of servlet API. Spring provides a way to expose  beans as ServletContext attributes using ServletContextAttributeExporter.


Let’s cut right to the chase.
Assume we have a properties file named containing name-value pairs which we want to expose to some Spring unaware code. We can create java.util.Properties bean using Springs <util:properties> tag. First, we must define util namespace in spring beans configuration file:

Continue reading “Spring: ServletContext attributes”

JHTML Porting – Drop out Droplets!

We will not go through explanation of what Droplets are; you can read ATG documentation for that, which is now available online for free after Oracle acquired ATG. We will just say that droplets can be great way to encapsulate most common things you need when rendering output. They can be viewed as custom tags in JSP. But as with JSP custom tags, no business logic or database manipulation should be put in them.

Unfortunately code which we received did not follow this convention. All functionalities you can imagine were put in the droplets. So as much as we wanted to drop them out from our code, we could not do that. There was no way to extract that logic to controller, it will add years to our release time.

Continue reading “JHTML Porting – Drop out Droplets!”

Form Handler Porting

Problem: Different concepts between ATG Form Handlers and Spring MVC

While Spring MVC entirely follows Model-View-Controller design pattern, ATG Form Handler architecture does not. Maybe we should rephrase that, “While Spring MVC makes your application follow MVC design pattern, ATG Form Handler does not”. Spring has a nice separation between Model, View and Controller. Spring has introduced nice abstractions for every part of MVC architecture, you have your controllers annotated with @Controller annotation, your model objects (often called command objects) annotated with @ModelAttribute and you decide which view will be rendered by returning View abstraction from your handle method. ATG does not have such a nice clean separation of concerns. In ATG, in most of applications,   Model and Controller are joined together.

Also ATG Form Handlers action/handle methods react somewhat similar to Struts actions. You decide which method will react to form submission with <dsp:input type=”submit”/> tag, by setting bean attribute to reference the component and method. In ATG targeted URL is not involved at all when making the decision which form handler will react. On the other side, in Spring every controller reaction is based on targeted URL by applying appropriate @RequestMapping annotations.

Continue reading “Form Handler Porting”

Hibernate and database triggers

Apart from being required for legal and regulatory reasons, audit logging is a very important feature of every good-quality information system. Initially, it always seems like a simple thing to do but, as the projects grow larger, audit logging often becomes an encumbrance for the software developers.

When it comes to the Spring/Hibernate-based applications, there are several solutions considered to be the best practices – Hibernate Interceptor Approach, Envers, database triggers, etc.

While working on a recent project for our major client, we had to review auditing approach in order to improve performance of some critical functionalities and to achieve requested SLA. After evaluating possible solutions and deliberating between the performance impact and ease of implementation, the decision was made to put the audit logging logic into the database triggers. The basic idea is – when a record in the target table is updated or inserted, the appropriate database triggers write necessary auditing information into separate audit tables.

Continue reading “Hibernate and database triggers”