Example usage for java.text NumberFormat parse

List of usage examples for java.text NumberFormat parse

Introduction

In this page you can find the example usage for java.text NumberFormat parse.

Prototype

public Number parse(String source) throws ParseException 

Source Link

Document

Parses text from the beginning of the given string to produce a number.

Usage

From source file:web.DeletebusinessController.java

/**
 * This method is called by the spring framework. The configuration
 * for this controller to be invoked is based on the pagetype and
 * is set in the urlMapping property in the spring config file.
 *
 * @param request the <code>HttpServletRequest</code>
 * @param response the <code>HttpServletResponse</code>
 * @throws ServletException/*w  w w .j a  v a  2s . c o  m*/
 * @throws IOException
 * @return ModelAndView this instance is returned to spring
 */
public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    // ***************************************************************************
    // This is the only line of code you need to get all session info initialized!
    // Always be the first line before anything else is done. Add to each controller's
    // handlRequest method. Also remember to extend SessionObject.
    // ***************************************************************************
    //initSession(request, response);

    try {
        ModelAndView m = super.handleRequest(request, response);
    } catch (Exception e) {
        return handleError("error in handleRequest", e);
    }
    outOfSession(request, response);

    if (!DiaryAdmin.isDiaryAdmin(login)) {
        return handleError("Access denied as the user is not diary admin, adding business" + login);
    }

    if (!WebUtil.isProductPremiumSubscription()) {
        return handleError("Cannot access this feature in non premimu subscription version.");
    }

    if (loginInfo == null || RegexStrUtil.isNull(login)) {
        return handleError("loginInfo/login is null");
    }

    String bid = request.getParameter(DbConstants.BID);
    if (RegexStrUtil.isNull(bid)) {
        return handleError("bid is null in DeletebusinessController.");
    }
    bid = RegexStrUtil.goodNameStr(bid);

    try {
        NumberFormat nf = NumberFormat.getInstance();
        Number myNum = nf.parse(bid);
    } catch (ParseException e) {
        return handleError("bid has other than [0-9] characters, DeletebusinessController.", e);
    }

    if (getDaoMapper() == null) {
        return handleError("DaoMapper is null, in DeletebusinessController." + login);
    }

    List bizList = null;
    try {
        BusinessDao businessDao = (BusinessDao) getDaoMapper().getDao(DbConstants.BUSINESS);
        if (businessDao == null) {
            return handleError("BusinessDao is null, in DeletebusinessController." + login);
        }
        businessDao.deleteBusiness(login, bid);
        bizList = businessDao.getBizList(login, DbConstants.READ_FROM_MASTER);
    } catch (BaseDaoException e) {
        return handleError("Exception occurred in deleteBusiness login " + login, e);
    }
    if (bizList == null) {
        return handleError("bizList is null, DeletebusinessController");
    }

    /** 
     * cobrand
     */
    Userpage cobrand = null;
    CobrandDao cobrandDao = (CobrandDao) getDaoMapper().getDao(DbConstants.COBRAND);
    if (cobrandDao == null) {
        return handleError("CobrandDao is null, DeletebusinessController");
    }
    try {
        cobrand = cobrandDao.getUserCobrand(loginInfo.getValue(DbConstants.LOGIN_ID));
    } catch (BaseDaoException e) {
        return handleError("cobrand is null, DeletebusinessController.", e);
    }

    String viewName = DbConstants.LIST_BUSINESS;
    Map myModel = new HashMap();
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.COBRAND, cobrand);
    myModel.put(DbConstants.LOGIN_INFO, loginInfo);
    myModel.put(DbConstants.DIR_EXISTS, rbDirectoryExists);
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.BUSINESS_EXISTS, isBizExists(login));
    myModel.put(DbConstants.BIZ_LIST, bizList);
    return new ModelAndView(viewName, "model", myModel);
}

From source file:savant.chromatogram.ChromatogramPlugin.java

/**
 * The start field has changed or a chromatogram has been loaded.  Update the end field appropriately.
 *///from ww  w .  ja v a 2  s  .c  o m
private void updateEndField() {
    try {
        NumberFormat numberParser = NumberFormat.getIntegerInstance();
        int startBase = numberParser.parse(startField.getText()).intValue();
        if (chromatogram != null) {
            endField.setText(String.valueOf(startBase + chromatogram.getSequenceLength()));
            if (canvas != null) {
                canvas.updatePos(startBase);
            }
        }
    } catch (ParseException x) {
        Toolkit.getDefaultToolkit().beep();
    }
}

From source file:web.ShoweditcontactController.java

/**
 * This method is called by the spring framework. The configuration
 * for this controller to be invoked is based on the pagetype and
 * is set in the urlMapping property in the spring config file.
 *
 * @param request the <code>HttpServletRequest</code>
 * @param response the <code>HttpServletResponse</code>
 * @throws ServletException//w  ww .  j av a  2 s  . c om
 * @throws IOException
 * @return ModelAndView this instance is returned to spring
 */
public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    // ***************************************************************************
    // This is the only line of code you need to get all session info initialized!
    // Always be the first line before anything else is done. Add to each controller's
    // handlRequest method. Also remember to extend SessionObject.
    // ***************************************************************************

    try {
        ModelAndView m = super.handleRequest(request, response);
    } catch (Exception e) {
        return handleError("error in handleRequest");
    }

    outOfSession(request, response);

    if (RegexStrUtil.isNull(login) || (loginInfo == null)) {
        return handleUserpageError("Login/loginInfo is null, ShoweditcontactController.");
    }

    String contactId = request.getParameter(DbConstants.CONTACT_ID);
    if (RegexStrUtil.isNull(contactId)) {
        return handleUserpageError("contactId null, ShoweditcontactController.");
    }
    if (contactId.length() > GlobalConst.contactIdSize) {
        return handleError("contactId.length > WebConstants.contactIdSize, ShoweditcontactController");
    }

    NumberFormat nf = NumberFormat.getInstance();
    try {
        Number myNum = nf.parse(contactId);
    } catch (ParseException e) {
        return handleError("contactId has other than [0-9] characters, ShoweditcontactController", e);
    }
    contactId = RegexStrUtil.goodNameStr(contactId);

    Contact contact = null;
    if (getDaoMapper() == null) {
        return handleError("DaoMapper is null, in ShoweditcontactController." + login);
    }
    ContactDao contactDao = (ContactDao) getDaoMapper().getDao(DbConstants.CONTACT);
    if (contactDao == null) {
        return handleError("ContactDao is null, ShoweditcontactController");
    }
    try {
        contact = contactDao.getOneContact(contactId, loginInfo.getValue(DbConstants.LOGIN_ID),
                DbConstants.READ_FROM_SLAVE);
    } catch (BaseDaoException e) {
        return handleError("cobrand is null, ShoweditcontactController.", e);
    }

    /** 
     * cobrand
     */
    Userpage cobrand = null;
    CobrandDao cobrandDao = (CobrandDao) getDaoMapper().getDao(DbConstants.COBRAND);
    if (cobrandDao == null) {
        return handleError("CobrandDao is null, ShoweditcontactController");
    }
    try {
        cobrand = cobrandDao.getUserCobrand(loginInfo.getValue(DbConstants.LOGIN_ID));
    } catch (BaseDaoException e) {
        return handleError("cobrand is null, ShoweditcontactController.", e);
    }

    String published = request.getParameter(DbConstants.PUBLISHED);
    String viewName = DbConstants.EDIT_CONTACT;
    if (!RegexStrUtil.isNull(published) && published.equals("1")) {
        viewName = DbConstants.PUBLISH_CONTACT;
    }

    Map myModel = new HashMap();
    myModel.put(DbConstants.COBRAND, cobrand);
    myModel.put(DbConstants.LOGIN_INFO, loginInfo);
    myModel.put(DbConstants.CONTACT, contact);
    myModel.put(DbConstants.DIR_EXISTS, rbDirectoryExists);
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.SHARE_INFO, shareInfo);
    myModel.put(DbConstants.VISITOR_PAGE, memberUserpage);
    return new ModelAndView(viewName, "model", myModel);
}

From source file:fr.eoit.activity.fragment.mining.session.AddItemToCargoDialog.java

@Override
protected void onSubmit() {
    EditText edit = (EditText) inflatedLayout.findViewById(R.id.item_quantity);
    String valueStr = edit.getText().toString().replaceAll(" ", "");

    NumberFormat nf = new DecimalFormat(EOITConst.VALUES_WITHOUT_SEPARATOR_PATTERN);

    try {/*from   www  . j a va2  s  . c o  m*/
        returnObject.quantity = (Long) nf.parse(valueStr);
    } catch (ParseException e) {
        returnObject.quantity = 0;
    }
}

From source file:moe.encode.airblock.commands.arguments.types.PrimitiveParser.java

@Override
public Object convert(Executor executor, ArgumentConverter parser, Type type, String value) {
    Class<?> cls = ReflectionUtils.toClass(type);
    if (ClassUtils.isPrimitiveWrapper(cls))
        cls = ClassUtils.wrapperToPrimitive(cls);

    if (cls.equals(boolean.class))
        return this.isTrue(executor, value);
    else if (cls.equals(char.class)) {
        if (value.length() > 0)
            throw new NumberFormatException("Character arguments cannot be longer than one characters");
        return value.charAt(0);
    }/*  w ww.  ja  v a  2 s .c om*/

    // Get the locale of the user and get a number-format according to it.
    LocaleResolver resolver = TranslationManager.getResolver(executor);
    Locale locale;
    if (resolver != null)
        locale = resolver.getLocale();
    else
        locale = Locale.ENGLISH;

    NumberFormat nf = NumberFormat.getNumberInstance(locale);
    nf.setGroupingUsed(true);

    // Parse the value.
    Number result;
    try {
        result = nf.parse(value);
    } catch (ParseException e) {
        NumberFormatException nfe = new NumberFormatException("Invalid number");
        nfe.initCause(e);
        throw nfe;
    }

    // Returns the value in the correct type.
    if (cls.equals(int.class))
        return result.intValue();
    else if (cls.equals(float.class))
        return result.floatValue();
    else if (cls.equals(double.class))
        return result.doubleValue();
    else if (cls.equals(byte.class))
        return result.byteValue();
    else if (cls.equals(short.class))
        return result.shortValue();
    else if (cls.equals(long.class))
        return result.longValue();

    throw new NumberFormatException("Unknown primitive type.");
}

From source file:forge.util.FileSection.java

/**
 * Gets the double.//from ww  w . j  a  va  2  s  . com
 *
 * @param fieldName the field name
 * @param defaultValue the default value
 * @return the int
 */
public double getDouble(final String fieldName, final double defaultValue) {
    try {
        if (this.get(fieldName) == null) {
            return defaultValue;
        }

        NumberFormat format = NumberFormat.getInstance(Locale.US);
        Number number = format.parse(this.get(fieldName));

        return number.doubleValue();
    } catch (final NumberFormatException | ParseException ex) {
        return defaultValue;
    }
}

From source file:web.ClonecontactController.java

/**
 * This method is called by the spring framework. The configuration
 * for this controller to be invoked is based on the pagetype and
 * is set in the urlMapping property in the spring config file.
 *
 * @param request the <code>HttpServletRequest</code>
 * @param response the <code>HttpServletResponse</code>
 * @throws ServletException/*from ww w . j  a  va  2  s  . co m*/
 * @throws IOException
 * @return ModelAndView this instance is returned to spring
 */
public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    // ***************************************************************************
    // This is the only line of code you need to get all session info initialized!
    // Always be the first line before anything else is done. Add to each controller's
    // handlRequest method. Also remember to extend SessionObject.
    // ***************************************************************************

    try {
        ModelAndView m = super.handleRequest(request, response);
    } catch (Exception e) {
        return handleError("error in handleRequest", e);
    }

    outOfSession(request, response);
    if (loginInfo == null) {
        return handleError("loginInfo is null in ClonecontactController.");
    }

    if (RegexStrUtil.isNull(login)) {
        return handleUserpageError("Login is null in ClonecontactController.");
    }

    if (getDaoMapper() == null) {
        return handleError("DaoMapper is null, in ClonecontactController." + login);
    }

    ContactDao contactDao = (ContactDao) getDaoMapper().getDao(DbConstants.CONTACT);
    if (contactDao == null) {
        return handleError("ContactDao is null, in ClonecontactController." + login);
    }

    String fname = request.getParameter(DbConstants.FIRST_NAME);
    if (!RegexStrUtil.isNull(fname) && (fname.length() > GlobalConst.firstNameSize)) {
        fname = fname.substring(0, GlobalConst.firstNameSize);
    }

    String lname = request.getParameter(DbConstants.LAST_NAME);
    if (!RegexStrUtil.isNull(lname) && (lname.length() > GlobalConst.lastNameSize)) {
        lname = lname.substring(0, GlobalConst.lastNameSize);
    }

    String contactId = request.getParameter(DbConstants.CONTACT_ID);
    if (RegexStrUtil.isNull(contactId)) {
        return handleError("contactId is null in savecontactController");
    }

    if (contactId.length() > GlobalConst.entryIdSize) {
        return handleError("contactId > WebConstants.entryIdSize" + contactId);
    }

    try {
        NumberFormat nf = NumberFormat.getInstance();
        Number myNum = nf.parse(contactId);
    } catch (ParseException e) {
        return handleError("contactId has other than [0-9] characters, DeletecontactController.", e);
    }

    List contacts = null;
    List sharedContacts = null;
    try {

        String alphabet = "a";
        if (!RegexStrUtil.isNull(fname)) {
            alphabet = fname.substring(0, 1);
        } else {
            if (!RegexStrUtil.isNull(lname)) {
                alphabet = lname.substring(0, 1);
            }
        }
        contactDao.cloneOneContact(RegexStrUtil.goodNameStr(contactId),
                loginInfo.getValue(DbConstants.LOGIN_ID), alphabet);
        contacts = contactDao.getAllContacts(loginInfo.getValue(DbConstants.LOGIN_ID),
                DbConstants.READ_FROM_MASTER);
        sharedContacts = contactDao.getSharedContacts(loginInfo.getValue(DbConstants.LOGIN_ID));
    } catch (BaseDaoException e) {
        return handleError("Exception in cloneOneContact(), ClonecontactController, for login " + login, e);
    }

    /** 
     * cobrand
     */
    Userpage cobrand = null;
    CobrandDao cobrandDao = (CobrandDao) getDaoMapper().getDao(DbConstants.COBRAND);
    if (cobrandDao == null) {
        return handleError("CobrandDao is null, ClonecontactController");
    }
    try {
        cobrand = cobrandDao.getUserCobrand(loginInfo.getValue(DbConstants.LOGIN_ID));
    } catch (BaseDaoException e) {
        return handleError("cobrand is null, ClonecontactController.", e);
    }

    String viewName = "showcontacts";
    Map myModel = new HashMap();
    myModel.put(DbConstants.COBRAND, cobrand);
    myModel.put(DbConstants.PUBLISHED, "0");
    myModel.put(DbConstants.LOGIN_INFO, loginInfo);
    myModel.put(DbConstants.CONTACTS, contacts);
    myModel.put(DbConstants.SHARED_CONTACTS, sharedContacts);
    myModel.put(DbConstants.HIGHLIGHT, "all");
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.SHARE_INFO, shareInfo);
    myModel.put(DbConstants.VISITOR_PAGE, memberUserpage);
    myModel.put(DbConstants.DIR_EXISTS, rbDirectoryExists);
    myModel.put(DbConstants.BUSINESS_EXISTS, isBizExists(login));
    return new ModelAndView(viewName, "model", myModel);
}

From source file:org.kuali.ext.mm.web.format.MMDecimalFormatter.java

/**
 * begin Kuali Foundation modification Unformats its argument and returns a MMDecimal instance initialized with the resulting
 * string value// ww  w  .j  av a  2s  .com
 * 
 * @see org.kuali.rice.kns.web.format.Formatter#convertToObject(java.lang.String) end Kuali Foundation modification
 */
@Override
protected Object convertToObject(String target) {
    // begin Kuali Foundation modification
    MMDecimal value = null;

    LOG.debug("convertToObject '" + target + "'");

    if (target != null) {
        target = target.trim();

        String rawString = target;

        // parseable values are $1.23 and ($1.23), not (1.23)
        if (target.startsWith("(")) {
            if (!target.startsWith("($")) {
                target = "($" + StringUtils.substringAfter(target, "(");
            }
        }

        // Insert currency symbol if absent
        if (!(target.startsWith("(") || target.startsWith(getSymbol()))) {
            target = interpolateSymbol(target);
        }

        // preemptively detect non-numeric-related symbols, since NumberFormat.parse seems to be silently deleting them
        // (i.e. 9aaaaaaaaaaaaaaa is silently converted into 9)
        if (!CURRENCY_PATTERN.matcher(target).matches()) {
            throw new FormatException("parsing", RiceKeyConstants.ERROR_CURRENCY, rawString);
        }

        // preemptively detect String with excessive digits after the decimal, to prevent them from being silently rounded
        if (rawString.contains(".") && !TRAILING_DECIMAL_PATTERN.matcher(rawString).matches()) {
            throw new FormatException("parsing", RiceKeyConstants.ERROR_CURRENCY_DECIMAL, rawString);
        }

        // actually reformat the numeric value
        NumberFormat formatter = getCurrencyInstanceUsingParseBigDecimal();
        try {
            Number parsedNumber = formatter.parse(target);
            value = new MMDecimal(parsedNumber.toString());
        } catch (NumberFormatException e) {
            throw new FormatException("parsing", RiceKeyConstants.ERROR_CURRENCY, rawString, e);
        } catch (ParseException e) {
            throw new FormatException("parsing", RiceKeyConstants.ERROR_CURRENCY, rawString, e);
        }
    }

    return value;
    // end Kuali Foundation modification
}

From source file:org.jboss.richfaces.integrationTest.dataTable.ExtendedDataModelTestCase.java

/**
 * Get a actual highest bid and try to enter own bid less than highest. The
 * validation message should appear. So try to enter higher bid than highest
 * and checks that bid is saved like a new highest bid.
 *///from ww w.ja va 2s  . c o m
@Test
public void testExtendedDataTable() {
    final NumberFormat numberFormat = DecimalFormat.getInstance();

    // get a actual value of highest bid in specified row
    double highestBid;
    try {
        highestBid = numberFormat.parse(selenium.getText(LOC_TD_HIGHEST_BID).replace("$", "")).doubleValue();
    } catch (ParseException e) {
        fail("Cannot parse a highest bid", e);
        return;
    }

    // asserts blank value of "amount" cell
    assertTrue(StringUtils.isBlank(selenium.getText(LOC_TD_CELL_AMOUNT)), "Amount should be blank");

    // fill new highest bid like a number smaller than actual highest bid
    selenium.type(LOC_INPUT_YOUR_BID, Double.toString(highestBid - 1));
    selenium.click(LOC_LINK_PLACE_BID);

    // waits for validation fails message
    waitForText(MSG_MESSAGE_LOWER_BID);

    // fix your bid to number greater than actual bid
    selenium.type(LOC_INPUT_YOUR_BID, Double.toString(highestBid + 1));
    selenium.click(LOC_LINK_PLACE_BID);

    // test that amount was saved as a highest bid
    final String yourBid = format(MSG_INPUT_AMOUNT_PREFORMATTED, highestBid + 1);

    Wait.until(new Condition() {
        public boolean isTrue() {
            String actual = selenium.getText(LOC_TD_CELL_AMOUNT);
            if (StringUtils.isNotBlank(actual)) {
                assertEquals(yourBid, actual);
                return true;
            }
            return false;
        }
    });
    assertEquals(yourBid, selenium.getText(LOC_TD_HIGHEST_BID));

    // relocate on second page
    selenium.click(LOC_BUTTON_NEXT_PAGE);

    Wait.until(new Condition() {
        public boolean isTrue() {
            return "2".equals(selenium.getText(LOC_OUTPUT_ACTIVE_PAGE));
        }
    });

    // relocate on first page
    selenium.click(LOC_BUTTON_PREVIOUS_PAGE);

    Wait.until(new Condition() {
        public boolean isTrue() {
            return "1".equals(selenium.getText(LOC_OUTPUT_ACTIVE_PAGE));
        }
    });

    // check if all things stay changed
    String highestBidString = selenium.getText(LOC_TD_CELL_AMOUNT);
    assertEquals(yourBid, highestBidString);
    highestBidString = selenium.getText(LOC_TD_HIGHEST_BID);
    assertEquals(yourBid, highestBidString);
}

From source file:web.DeletecontactController.java

/**
 * This method is called by the spring framework. The configuration
 * for this controller to be invoked is based on the pagetype and
 * is set in the urlMapping property in the spring config file.
 *
 * @param request the <code>HttpServletRequest</code>
 * @param response the <code>HttpServletResponse</code>
 * @throws ServletException/* ww w.j av a  2  s . c  o  m*/
 * @throws IOException
 * @return ModelAndView this instance is returned to spring
 */
public synchronized ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    // ***************************************************************************
    // This is the only line of code you need to get all session info initialized!
    // Always be the first line before anything else is done. Add to each controller's
    // handlRequest method. Also remember to extend SessionObject.
    // ***************************************************************************
    //initSession(request, response);

    try {
        ModelAndView m = super.handleRequest(request, response);
    } catch (Exception e) {
        return handleError("error in handleRequest", e);
    }

    outOfSession(request, response);

    if (RegexStrUtil.isNull(login) || (loginInfo == null)) {
        return handleUserpageError("Login/loginInfo is null in DeletecontactController.");
    }

    String contactId = request.getParameter(DbConstants.CONTACT_ID);
    if (RegexStrUtil.isNull(contactId)) {
        return handleError("contactId is null in DeletecontactController.");
    }

    try {
        NumberFormat nf = NumberFormat.getInstance();
        Number myNum = nf.parse(contactId);
    } catch (ParseException e) {
        return handleError("contactId has other than [0-9] characters, DeletecontactController.", e);
    }

    /*
            String published = request.getParameter(DbConstants.PUBLISHED);
            if (!RegexStrUtil.isNull(published)) {
               if (!published.equals("0") && !published.equals("1")) {
      return handleError("published is neither 0 nor 1, DeletecontactController");
               }
            } else {
               return handleError("published is null, DeletecontactController");
            }
    */

    if (getDaoMapper() == null) {
        return handleError("DaoMapper is null, in DeletecontactController." + login);
    }

    List contacts = null;
    List sharedContacts = null;
    try {
        String fname = request.getParameter(DbConstants.FIRST_NAME);
        if (!RegexStrUtil.isNull(fname) && (fname.length() > GlobalConst.firstNameSize)) {
            fname = fname.substring(0, GlobalConst.firstNameSize);
        }

        String lname = request.getParameter(DbConstants.LAST_NAME);
        if (!RegexStrUtil.isNull(lname) && (lname.length() > GlobalConst.lastNameSize)) {
            lname = lname.substring(0, GlobalConst.lastNameSize);
        }

        String alphabet = "";
        if (!RegexStrUtil.isNull(fname)) {
            alphabet = fname.substring(0, 1);
        } else {
            if (!RegexStrUtil.isNull(lname)) {
                alphabet = lname.substring(0, 1);
            }
        }
        ContactDao contactDao = (ContactDao) getDaoMapper().getDao(DbConstants.CONTACT);
        if (contactDao == null) {
            return handleError("ContactDao is null, in DeletecontactController." + login);
        }
        contactDao.deleteOneContact(loginInfo.getValue(DbConstants.LOGIN_ID),
                RegexStrUtil.goodNameStr(contactId), alphabet);
        contacts = contactDao.getAllContacts(loginInfo.getValue(DbConstants.LOGIN_ID),
                DbConstants.READ_FROM_MASTER);
        sharedContacts = contactDao.getSharedContacts(loginInfo.getValue(DbConstants.LOGIN_ID));
    } catch (BaseDaoException e) {
        return handleError(
                "Exception occurred in deleteOneContacts/getAllContacts/getSharedContacts(), DeletecontactController, for login "
                        + login,
                e);
    }

    /** 
     * cobrand
     */
    Userpage cobrand = null;
    CobrandDao cobrandDao = (CobrandDao) getDaoMapper().getDao(DbConstants.COBRAND);
    if (cobrandDao == null) {
        return handleError("CobrandDao is null, DeletecontactController");
    }
    try {
        cobrand = cobrandDao.getUserCobrand(loginInfo.getValue(DbConstants.LOGIN_ID));
    } catch (BaseDaoException e) {
        return handleError("cobrand is null, DeletecontactController.", e);
    }

    String viewName = "showcontacts";
    Map myModel = new HashMap();
    myModel.put(DbConstants.COBRAND, cobrand);
    myModel.put(DbConstants.LOGIN_INFO, loginInfo);
    myModel.put(DbConstants.CONTACTS, contacts);
    myModel.put(DbConstants.SHARED_CONTACTS, sharedContacts);
    myModel.put(DbConstants.PUBLISHED, "0");
    myModel.put(DbConstants.HIGHLIGHT, "all");
    myModel.put(DbConstants.DIR_EXISTS, rbDirectoryExists);
    myModel.put(DbConstants.USER_PAGE, userpage);
    myModel.put(DbConstants.SHARE_INFO, shareInfo);
    myModel.put(DbConstants.VISITOR_PAGE, memberUserpage);
    myModel.put(DbConstants.BUSINESS_EXISTS, isBizExists(login));
    return new ModelAndView(viewName, "model", myModel);
}