Skip to main content

Posts

Showing posts from August 16, 2010

Email Validation using Callouts in Openbravo

Hi all, I have a written a simple java code that validates an email ID. This is not a completely validated one, but a basic validated one. This can also be also used as a template for creating callouts in Openbravo. special mention to my colleague pandi and one more thanks to ivan from Openbravo in helping me accomplish this task...:)

package org.openbravo.erpCommon.ad_callouts;

import javax.servlet.ServletException;
import org.apache.log4j.Logger;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.openbravo.erpCommon.ad_callouts.SimpleCallout;
import org.openbravo.erpCommon.utility.SequenceIdData;
import org.openbravo.erpCommon.utility.OBError;
import org.openbravo.scheduling.ProcessBundle;

public class Email_CL extends SimpleCallout {

    private static final long serialVersionUID = 1L;
    private static Logger log = Logger.getLogger(Email_CL.class);
    @Override
    protected void execute(CalloutInfo info) throws ServletException {

   …

Phone Number Validation in postgres

I took a simple number validation code across net and modified it to check phone numbers. It allows only numbers,plus symbol(+) and underscore(_) operators

-- Function: isphoneno(character varying)

-- DROP FUNCTION isphoneno(character varying);

CREATE OR REPLACE FUNCTION isphoneno(character varying)
  RETURNS boolean AS
$BODY$
BEGIN
    RETURN $1 ~ '^[0-9,+,-,.]+$';
END;
$BODY$
  LANGUAGE 'plpgsql' IMMUTABLE
  COST 100;
ALTER FUNCTION isphoneno(character varying) OWNER TO tad;