Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block

package script;

import au.com.noojee.vaadin.views.scripts.BaseScreenLayoutAction;
import au.com.noojee.vaadin.views.scripts.JSCallback;
import elemental.json.JsonObject;
import elemental.json.JsonArray;
import au.com.noojee.vaadin.views.scripts.ScreenLayoutAction;
import com.vaadin.ui.Notification;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import java.util.LinkedList;

import java.lang.reflect.Type;
import com.google.gson.reflect.TypeToken;
import com.google.gson.Gson;

import java.text.SimpleDateFormat;
import java.util.Date;

public class getCustomer extends BaseScreenLayoutAction
{
	@Override
	public void exec(String argument,Map<String,String> fieldValues, JSCallback jsCallback) throws Exception
    {
		String searchFilter = argument;

        // Init api
		SomeExternalApi api = SomeExternalApi.init();

        Customer customer = api.getCustomer(searchFilter);
		
		Response response = new Response();	
		if (customer == null)
		{
				response.code = "Error";
				response.error = "Customer Not found";
		}
		else
		{
			response.code = "OK";
			response.customer = customer;
		}

		// Send the data back to the javascript callback.	
		jsCallback.callbackcall(response);

	}


	static	class Response
	{
		String code;
		String error;
		Customer customer;
	}
}


...