Example usage for org.springframework.transaction.support DefaultTransactionDefinition setName

List of usage examples for org.springframework.transaction.support DefaultTransactionDefinition setName

Introduction

In this page you can find the example usage for org.springframework.transaction.support DefaultTransactionDefinition setName.

Prototype

public final void setName(String name) 

Source Link

Document

Set the name of this transaction.

Usage

From source file:org.ohmage.query.impl.UserQueries.java

/**
 * Deletes all of the users in a Collection.
 * //  w  ww  . j a  v  a  2  s .c  om
 * @param usernames A Collection of usernames for the users to delete.
 */
public void deleteUsers(Collection<String> usernames) throws DataAccessException {
    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Deleting a user.");

    try {
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        // Delete the users.
        for (String username : usernames) {
            try {
                getJdbcTemplate().update(SQL_DELETE_USER, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException("Error executing the following SQL '" + SQL_DELETE_USER
                        + "' with parameters: " + username, e);
            }
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:org.ohmage.query.impl.UserQueries.java

public void deleteExpiredRegistration(final long duration) throws DataAccessException {

    String sql = "DELETE u, ur " + "FROM user u, user_registration ur " + "WHERE u.id = ur.user_id "
            + "AND accepted_timestamp IS null " + "AND request_timestamp < ?";

    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Activating a user's account.");

    try {/*from  w  w w.  j av a  2s.  c om*/
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        long earliestTime = (new Date()).getTime() - duration;

        try {
            getJdbcTemplate().update(sql, earliestTime);
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException(
                    "Error while executing SQL '" + sql + "' with parameter: " + earliestTime, e);
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:org.ohmage.query.impl.UserQueries.java

/**
 * Updates a user's password.//from ww w .  ja  v  a  2  s. c o  m
 * 
 * @param username The username of the user to be updated.
 * 
 * @param hashedPassword The new, hashed password for the user.
 */
public void updateUserPassword(String username, String hashedPassword, boolean setNewAccount)
        throws DataAccessException {
    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Updating a user's password.");

    try {
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        // Update the password.
        try {
            getJdbcTemplate().update(SQL_UPDATE_PASSWORD, hashedPassword, username);
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error executing the following SQL '" + SQL_UPDATE_PASSWORD
                    + "' with parameters: " + hashedPassword + ", " + username, e);
        }

        // Ensure that this user is no longer a new user.
        try {
            getJdbcTemplate().update(SQL_UPDATE_NEW_ACCOUNT, setNewAccount, username);
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error executing the following SQL '" + SQL_UPDATE_NEW_ACCOUNT
                    + "' with parameters: " + setNewAccount + ", " + username, e);
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:org.ohmage.query.impl.UserQueries.java

public void activateUser(final String registrationId) throws DataAccessException {

    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Activating a user's account.");

    try {/*from  www  .  j a  v  a 2 s  .c  o m*/
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        // Make the account not disabled.
        try {
            getJdbcTemplate().update(SQL_UPDATE_ENABLED_FROM_REGISTRATION_ID,
                    new Object[] { true, registrationId });
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException(
                    "Error executing the following SQL '" + SQL_UPDATE_ENABLED_FROM_REGISTRATION_ID
                            + "' with parameters: " + true + ", " + registrationId,
                    e);
        }

        // Update the accepted timestamp in the registration table.
        try {
            getJdbcTemplate().update(SQL_UPDATE_ACCEPTED_TIMESTAMP,
                    new Object[] { (new Date()).getTime(), registrationId });
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error executing the following SQL '"
                    + SQL_UPDATE_ENABLED_FROM_REGISTRATION_ID + "' with parameter: " + registrationId, e);
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:org.ohmage.query.impl.UserQueries.java

public void createUser(final String username, final String hashedPassword, final String emailAddress,
        final Boolean admin, final Boolean enabled, final Boolean newAccount,
        final Boolean campaignCreationPrivilege) throws DataAccessException {

    Boolean tAdmin = admin;//from   ww  w  . ja v a 2s .c  o m
    if (tAdmin == null) {
        tAdmin = false;
    }

    Boolean tEnabled = enabled;
    if (tEnabled == null) {
        tEnabled = false;
    }

    Boolean tNewAccount = newAccount;
    if (tNewAccount == null) {
        tNewAccount = true;
    }

    Boolean tCampaignCreationPrivilege = campaignCreationPrivilege;
    if (tCampaignCreationPrivilege == null) {
        try {
            tCampaignCreationPrivilege = PreferenceCache.instance()
                    .lookup(PreferenceCache.KEY_DEFAULT_CAN_CREATE_PRIVILIEGE).equals("true");
        } catch (CacheMissException e) {
            throw new DataAccessException("Cache doesn't know about 'known' value: "
                    + PreferenceCache.KEY_DEFAULT_CAN_CREATE_PRIVILIEGE, e);
        }
    }

    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Creating a new user.");

    try {
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        // Insert the new user.
        try {
            getJdbcTemplate().update(SQL_INSERT_USER, new Object[] { username, hashedPassword, emailAddress,
                    tAdmin, tEnabled, tNewAccount, tCampaignCreationPrivilege });
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while executing SQL '" + SQL_INSERT_USER
                    + "' with parameters: " + username + ", " + hashedPassword + ", " + emailAddress + ", "
                    + tAdmin + ", " + tEnabled + ", " + tNewAccount + ", " + tCampaignCreationPrivilege, e);
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:org.ohmage.query.impl.UserQueries.java

public void createUserRegistration(final String username, final String hashedPassword,
        final String emailAddress, final String registrationId) throws DataAccessException {

    // Get the public class.
    String publicClassId;//  ww  w.ja  v  a  2s  . co  m
    try {
        publicClassId = PreferenceCache.instance().lookup(PreferenceCache.KEY_PUBLIC_CLASS_ID);
    } catch (CacheMissException e) {
        throw new DataAccessException("The public class is not configured");
    }

    Boolean defaultCampaignCreationPrivilege;
    try {
        String privilegeString = PreferenceCache.instance()
                .lookup(PreferenceCache.KEY_DEFAULT_CAN_CREATE_PRIVILIEGE);

        if (privilegeString == null) {
            throw new DataAccessException("The default campaign creation privilege is missing.");
        }

        defaultCampaignCreationPrivilege = StringUtils.decodeBoolean(privilegeString);

        if (defaultCampaignCreationPrivilege == null) {
            throw new DataAccessException("The default campaign creation privilege is not a valid boolean.");
        }
    } catch (CacheMissException e) {
        throw new DataAccessException(
                "Cache doesn't know about 'known' value: " + PreferenceCache.KEY_DEFAULT_CAN_CREATE_PRIVILIEGE,
                e);
    }

    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Creating a user registration request.");

    try {
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        // Insert the new user.
        try {
            getJdbcTemplate().update(SQL_INSERT_USER, new Object[] { username, hashedPassword, emailAddress,
                    false, false, false, defaultCampaignCreationPrivilege });
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while executing SQL '" + SQL_INSERT_USER
                    + "' with parameters: " + username + ", " + emailAddress + ", " + hashedPassword + ", "
                    + false + ", " + false + ", " + false + ", " + "null", e);
        }

        // Insert the new user into the class.
        try {
            getJdbcTemplate().update(SQL_INSERT_USER_CLASS,
                    new Object[] { username, publicClassId, Clazz.Role.RESTRICTED.toString() });
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException(
                    "Error while executing SQL '" + SQL_INSERT_USER_CLASS + "' with parameters: " + username
                            + ", " + publicClassId + ", " + Clazz.Role.RESTRICTED.toString(),
                    e);
        }

        // Get the list of campaigns for this class.
        String sqlGetCampaignIds = "SELECT ca.urn " + "FROM campaign ca, class cl, campaign_class cc "
                + "WHERE cl.urn = ? " + "AND cl.id = cc.class_id " + "AND ca.id = cc.campaign_id";
        List<String> campaignIds;
        try {
            campaignIds = getJdbcTemplate().query(sqlGetCampaignIds, new Object[] { publicClassId },
                    new SingleColumnRowMapper<String>());
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException(
                    "Error executing SQL '" + sqlGetCampaignIds + "' with parameter: " + publicClassId, e);
        }

        // Construct the parameter map for the batch update.
        List<Object[]> batchParameters = new ArrayList<Object[]>(campaignIds.size());
        for (String campaignId : campaignIds) {
            String[] parameters = new String[3];
            parameters[0] = username;
            parameters[1] = campaignId;
            parameters[2] = Campaign.Role.PARTICIPANT.toString();
            batchParameters.add(parameters);
        }

        // Perform the batch update.
        String sqlInsertUserCampaign = "INSERT INTO user_role_campaign"
                + "(user_id, campaign_id, user_role_id) " + "VALUES ("
                + "(SELECT id FROM user WHERE username = ?), " + "(SELECT id FROM campaign WHERE urn = ?), "
                + "(SELECT id FROM user_role WHERE role = ?)" + ")";
        try {
            getJdbcTemplate().batchUpdate(sqlInsertUserCampaign, batchParameters);
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error executing SQL '" + sqlInsertUserCampaign + "'.", e);
        }

        // Insert the user's registration information into the 
        try {
            getJdbcTemplate().update(SQL_INSERT_REGISTRATION,
                    new Object[] { username, registrationId, (new Date()).getTime() });
        } catch (org.springframework.dao.DataAccessException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while executing SQL '" + SQL_INSERT_REGISTRATION
                    + "' with parameters: " + username + ", " + registrationId + ", " + (new Date()).getTime(),
                    e);
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:org.ohmage.query.impl.UserQueries.java

@Override
public void updateUser(final String username, final String emailAddress, final Boolean admin,
        final Boolean enabled, final Boolean newAccount, final Boolean campaignCreationPrivilege,
        final Boolean classCreationPrivilege, final Boolean userSetupPrivilege, final String firstName,
        final String lastName, final String organization, final String personalId,
        final boolean deletePersonalInfo) throws DataAccessException {

    // Create the transaction.
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("Updating a user's privileges and information.");

    try {/*from w ww .ja  v  a2  s  . c  om*/
        // Begin the transaction.
        PlatformTransactionManager transactionManager = new DataSourceTransactionManager(getDataSource());
        TransactionStatus status = transactionManager.getTransaction(def);

        if (emailAddress != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_EMAIL_ADDRESS, emailAddress, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException("Error executing the following SQL '" + SQL_UPDATE_EMAIL_ADDRESS
                        + "' with parameters: " + emailAddress + ", " + username, e);
            }
        }

        // Update the admin value if it's not null.
        if (admin != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_ADMIN, admin, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException("Error executing the following SQL '" + SQL_UPDATE_ADMIN
                        + "' with parameters: " + admin + ", " + username, e);
            }
        }

        // Update the enabled value if it's not null.
        if (enabled != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_ENABLED, enabled, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException("Error executing the following SQL '" + SQL_UPDATE_ENABLED
                        + "' with parameters: " + enabled + ", " + username, e);
            }
        }

        // Update the new account value if it's not null.
        if (newAccount != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_NEW_ACCOUNT, newAccount, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException("Error executing the following SQL '" + SQL_UPDATE_NEW_ACCOUNT
                        + "' with parameters: " + newAccount + ", " + username, e);
            }
        }

        // Update the campaign creation privilege value if it's not null.
        if (campaignCreationPrivilege != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_CAMPAIGN_CREATION_PRIVILEGE, campaignCreationPrivilege,
                        username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException(
                        "Error executing the following SQL '" + SQL_UPDATE_CAMPAIGN_CREATION_PRIVILEGE
                                + "' with parameters: " + campaignCreationPrivilege + ", " + username,
                        e);
            }
        }

        // Update the class creation privilege value if it's not null.
        if (classCreationPrivilege != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_CLASS_CREATION_PRIVILEGE, classCreationPrivilege, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException(
                        "Error executing the following SQL '" + SQL_UPDATE_CLASS_CREATION_PRIVILEGE
                                + "' with parameters: " + classCreationPrivilege + ", " + username,
                        e);
            }
        }

        // Update the user setup privilege value if it's not null.
        if (userSetupPrivilege != null) {
            try {
                getJdbcTemplate().update(SQL_UPDATE_USER_SETUP_PRIVILEGE, userSetupPrivilege, username);
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException(
                        "Error executing the following SQL '" + SQL_UPDATE_USER_SETUP_PRIVILEGE
                                + "' with parameters: " + userSetupPrivilege + ", " + username,
                        e);
            }
        }

        // If we are deleting the user's personal information, then we 
        // won't add new or update existing personal information.
        if (deletePersonalInfo) {
            try {
                getJdbcTemplate().update(SQL_DELETE_USER_PERSONAL, new Object[] { username });
            } catch (org.springframework.dao.DataAccessException e) {
                transactionManager.rollback(status);
                throw new DataAccessException(
                        "Error executing SQL '" + SQL_DELETE_USER_PERSONAL + "' with parameter: " + username,
                        e);
            }
        } else {
            if (userHasPersonalInfo(username)) {
                if (firstName != null) {
                    try {
                        getJdbcTemplate().update(SQL_UPDATE_FIRST_NAME, firstName, username);
                    } catch (org.springframework.dao.DataAccessException e) {
                        transactionManager.rollback(status);
                        throw new DataAccessException("Error executing SQL '" + SQL_UPDATE_FIRST_NAME
                                + "' with parameters: " + firstName + ", " + username, e);
                    }
                }

                if (lastName != null) {
                    try {
                        getJdbcTemplate().update(SQL_UPDATE_LAST_NAME, lastName, username);
                    } catch (org.springframework.dao.DataAccessException e) {
                        transactionManager.rollback(status);
                        throw new DataAccessException("Error executing SQL '" + SQL_UPDATE_LAST_NAME
                                + "' with parameters: " + lastName + ", " + username, e);
                    }
                }

                if (organization != null) {
                    try {
                        getJdbcTemplate().update(SQL_UPDATE_ORGANIZATION, organization, username);
                    } catch (org.springframework.dao.DataAccessException e) {
                        transactionManager.rollback(status);
                        throw new DataAccessException("Error executing SQL '" + SQL_UPDATE_ORGANIZATION
                                + "' with parameters: " + organization + ", " + username, e);
                    }
                }

                if (personalId != null) {
                    try {
                        getJdbcTemplate().update(SQL_UPDATE_PERSONAL_ID, personalId, username);
                    } catch (org.springframework.dao.DataAccessException e) {
                        transactionManager.rollback(status);
                        throw new DataAccessException("Error executing SQL '" + SQL_UPDATE_PERSONAL_ID
                                + "' with parameters: " + personalId + ", " + username, e);
                    }
                }
            } else if ((firstName != null) && (lastName != null) && (organization != null)
                    && (personalId != null)) {

                try {
                    getJdbcTemplate().update(SQL_INSERT_USER_PERSONAL, username, firstName, lastName,
                            organization, personalId);
                } catch (org.springframework.dao.DataAccessException e) {
                    transactionManager.rollback(status);
                    throw new DataAccessException("Error executing SQL '" + SQL_INSERT_USER_PERSONAL
                            + "' with parameters: " + username + ", " + firstName + ", " + lastName + ", "
                            + organization + ", " + personalId, e);
                }
            }
        }

        // Commit the transaction.
        try {
            transactionManager.commit(status);
        } catch (TransactionException e) {
            transactionManager.rollback(status);
            throw new DataAccessException("Error while committing the transaction.", e);
        }
    } catch (TransactionException e) {
        throw new DataAccessException("Error while attempting to rollback the transaction.", e);
    }
}

From source file:com.krawler.spring.crm.leadModule.crmLeadCommonController.java

public ModelAndView deleteWTLForm(HttpServletRequest request, HttpServletResponse response)
        throws ServletException {
    JSONObject jobj = new JSONObject();
    //Create transaction
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("JE_Tx");
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
    TransactionStatus status = txnManager.getTransaction(def);
    try {//from   w  w w  .  ja v  a 2s  . co m
        String formid = request.getParameter("formid");
        jobj = webtoLeadFormHandlerObj.deleteWTLForm(formid);

        txnManager.commit(status);
    } catch (Exception e) {
        txnManager.rollback(status);
        logger.warn(e.getMessage(), e);
    }
    return new ModelAndView(successView, "model", jobj.toString());
}

From source file:com.krawler.spring.crm.leadModule.crmLeadCommonController.java

public ModelAndView saveEditWTLForm(HttpServletRequest request, HttpServletResponse response)
        throws ServletException {
    JSONObject jobj = new JSONObject();
    //Create transaction
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("JE_Tx");
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
    TransactionStatus status = txnManager.getTransaction(def);
    try {//from  w  w  w .j a va 2s .c om
        String formfields = request.getParameter("formfields");
        String formname = request.getParameter("formname");
        String formdomain = request.getParameter("formdomain");
        String redirecturl = request.getParameter("redirectURL");
        String leadowner = request.getParameter("leadowner");
        String companyid = sessionHandlerImpl.getCompanyid(request);
        String formid = request.getParameter("formid");

        jobj = webtoLeadFormHandlerObj.saveEditWTLForm(formname, formdomain, redirecturl, formfields, companyid,
                formid, leadowner);

        txnManager.commit(status);
    } catch (Exception e) {
        txnManager.rollback(status);
        logger.warn(e.getMessage(), e);
    }
    return new ModelAndView(successView, "model", jobj.toString());
}

From source file:com.krawler.spring.crm.leadModule.crmLeadCommonController.java

public ModelAndView getWebtoleadFormlist(HttpServletRequest request, HttpServletResponse response)
        throws ServletException {
    JSONObject jobjresult = new JSONObject();
    //Create transaction
    DefaultTransactionDefinition def = new DefaultTransactionDefinition();
    def.setName("JE_Tx");
    def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
    def.setIsolationLevel(TransactionDefinition.ISOLATION_READ_UNCOMMITTED);
    TransactionStatus status = txnManager.getTransaction(def);
    KwlReturnObject kmsg = null;/*  w  w  w  .  j a  v a 2 s  .  c o  m*/
    try {
        String dateFormatId = sessionHandlerImpl.getDateFormatID(request);
        String timeFormatId = sessionHandlerImpl.getUserTimeFormat(request);
        String timeZoneDiff = sessionHandlerImpl.getTimeZoneDifference(request);

        String companyid = sessionHandlerImpl.getCompanyid(request);
        HashMap<String, Object> requestParams = new HashMap<String, Object>();
        requestParams.put("companyid", companyid);
        if (request.getParameter("ss") != null && !StringUtil.isNullOrEmpty(request.getParameter("ss"))) {
            requestParams.put("ss", request.getParameter("ss"));
        }
        requestParams.put("start", StringUtil.checkForNull(request.getParameter("start")));
        requestParams.put("limit", StringUtil.checkForNull(request.getParameter("limit")));
        kmsg = webtoLeadFormHandlerObj.getWebtoleadFormlist(requestParams);
        Iterator itr = kmsg.getEntityList().iterator();
        while (itr.hasNext()) {
            JSONObject jobj = new JSONObject();
            webtoleadform wtlformObj = (webtoleadform) itr.next();
            jobj.accumulate("formname", wtlformObj.getFormname());
            jobj.accumulate("formdomain", wtlformObj.getFormdomain());
            jobj.accumulate("redirecturl", wtlformObj.getRedirecturl());
            jobj.accumulate("formid", wtlformObj.getFormid());
            jobj.accumulate("lastupdatedon",
                    kwlCommonTablesDAOObj.getUserDateFormatter(dateFormatId, timeFormatId, timeZoneDiff)
                            .format(wtlformObj.getLastupdatedon()));
            jobj.accumulate("formfields", wtlformObj.getFormfield());
            jobj.accumulate("leadowner", ((User) wtlformObj.getLeadowner()).getUserID());
            jobjresult.append("data", jobj);
        }
        if (!jobjresult.has("data")) {
            jobjresult.put("data", "");
        }
        jobjresult.accumulate("totalCount", kmsg.getRecordTotalCount());
        jobjresult.accumulate("success", true);
        txnManager.commit(status);
    } catch (Exception e) {
        txnManager.rollback(status);
        logger.warn(e.getMessage(), e);
    }
    return new ModelAndView(successView, "model", jobjresult.toString());
}