Example usage for org.hibernate.criterion Restrictions like

List of usage examples for org.hibernate.criterion Restrictions like

Introduction

In this page you can find the example usage for org.hibernate.criterion Restrictions like.

Prototype

public static SimpleExpression like(String propertyName, String value, MatchMode matchMode) 

Source Link

Document

Apply a "like" constraint to the named property using the provided match mode

Usage

From source file:com.certus.actions.mainSearchBarAction.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    try {/*from w  w  w . j  a  v a2 s . co m*/
        Session s = com.certus.connection.HibernateUtil.getSessionFactory().openSession();
        String pNameMatch = request.getParameter("pName");
        // System.out.println("Start");
        Criteria cr = s.createCriteria(ProductHasSize.class, "phs");
        cr.createAlias("phs.product", "product").createAlias("phs.size", "size")
                .createAlias("product.brand", "brand").add(Restrictions.eq("product.availability", true))
                .add(Restrictions.eq("brand.availability", true))
                .add(Restrictions.like("product.name", pNameMatch, MatchMode.ANYWHERE))
                .setProjection(Projections.groupProperty("product"));
        // System.out.println("End");

        List<Product> pros = cr.list();

        String html = "";
        html += "<div class=\"items\">\n" + " <div class=\"container\">\n" + "   <div class=\"row\">\n"
                + "   <div class=\"col-md-12\">\n" + "   <h3 class=\"title\">Search Results</h3>\n"
                + "     </div>";

        Context env1 = (Context) new InitialContext().lookup("java:comp/env");
        String productsPath1 = (String) env1.lookup("uploadpathproducts");

        for (Product pro : pros) {
            ProductHasSize ph = productDetails(pro, s);

            html += "<div class='col-md-3 col-sm-4'>" + " <div class=\"item\">\n" + "     <!-- Item image -->\n"
                    + "     \n";
            if (ph.getProduct().getDiscountPrice() != 0) {

                html += "<span class=\"ico pull-right\"><img src=\"img/sale.png\" alt=\"\"></span>\n";
            }
            html += "   <div class=\"item-image\">\n" + "       \n" + "       <a href=\"single-item.jsp?cat="
                    + ph.getProduct().getSubCategory().getCategory().getId() + "&sub="
                    + ph.getProduct().getSubCategory().getId() + "&pid=" + ph.getProduct().getId()
                    + "\"><img src=\"" + productsPath1 + ph.getProduct().getImageMain()
                    + "\" alt=\"\" class=\"img-responsive\"></a>\n" + "   </div>\n"
                    + "   <!-- Item details -->\n" + "   <div class=\"item-details\">\n" + " <!-- Name -->\n"
                    + " <!-- Use the span tag with the class \"ico\" and icon link (hot, sale, deal, new) -->\n"
                    + " <div id=\"quickfit\">\n"
                    + "     <h5 style=\"white-space: nowrap;overflow: hidden;\"><a href=\"single-item.jsp?cat="
                    + ph.getProduct().getSubCategory().getCategory().getId() + "&sub="
                    + ph.getProduct().getSubCategory().getId() + "&pid=" + ph.getProduct().getId() + "\">"
                    + ph.getProduct().getName() + "</a></h5>\n" + " </div>\n"
                    + " <div class=\"clearfix\"></div>\n" + " <!-- Para. Note more than 2 lines. -->\n" + " <p>"
                    + ph.getProduct().getBrand().getBrandName() + "</p>\n" + " <hr>\n" + " <!-- Price -->\n"
                    + "       <div class=\"item-price pull-left\">\n";
            if (ph.getProduct().getDiscountPrice() != 0.0) {
                html += "   <del>Rs.&nbsp;" + ph.getPrice() + "</del>\n"
                        + "   <p style=\"color: #F25758;\">Rs.&nbsp;"
                        + ph.getDiscountPrice(ph.getPrice(), ph.getProduct().getDiscountPrice()) + "</p>\n";
            } else {
                html += "Rs " + ph.getPrice();
            }
            html += "</div>\n" + " <form action=\"addToCartAction\" method=\"GET\">\n"
                    + " <input name=\"pro_id\" value=\"" + ph.getProduct().getId() + "\" type=\"hidden\">\n"
                    + " <input name=\"size\" value=\""
                    + ph.getSize(ph.getProduct().getProductHasSizes(), ph.getProduct().getId())
                    + "\" type=\"hidden\">\n" + " <input name=\"qnty\" value=\"1\" type=\"hidden\">\n"
                    + " <input name=\"dom\" value=\"tyt\" type=\"hidden\">\n"
                    + " <div class=\"button pull-right\">\n"
                    + "     <button class=\"btn\" style=\"background-color: #F25758; color: #efd8d8;\" type=\"submit\">Add to Cart</button>\n"
                    + " </div>\n" + "        </form>\n" + "        <div class=\"clearfix\"></div>\n"
                    + "    </div>\n" + "</div>\n" + "</div>";
        }

        html += "</div></div>";
        s.close();
        response.getWriter().write(html);
    } catch (NamingException ex) {
        Logger.getLogger(mainSearchBarAction.class.getName()).log(Level.SEVERE, null, ex);
    }

}

From source file:com.certus.test.Test3.java

public static void main(String[] args) {
    //    Session s = com.certus.connection.HibernateUtil.getSessionFactory().openSession();
    //        List<Product> proList = s.createCriteria(Product.class).list();
    //        GsonBuilder gsonBuilder = new GsonBuilder();
    //        Gson gson = gsonBuilder.registerTypeAdapter(Product.class, new CustomTypeAdapter()).create();
    //        String element = gson.toJson(proList);
    //        System.out.println(element);

    //        A a = new A();
    //        a.setAge("23");
    //        a.setName("aaa");
    //        a.setSchool("bbb college");
    //        try {
    //            Map<String, String> map = BeanUtils.describe(a);
    ////from  ww w . j a v  a 2s.  c  o  m
    //            for (Map.Entry<String, String> entry : map.entrySet()) {
    //                System.out.println(entry.getKey() + "/" + entry.getValue());
    //            }
    //
    //            Field[] allFields = a.getClass().getFields();
    //            for (Field field : allFields) {
    //                System.out.println(field.getName());
    //            }
    //
    //        } catch (Exception e) {
    //        }
    String pNameMatch = "top";
    Session s = com.certus.connection.HibernateUtil.getSessionFactory().openSession();
    Criteria cr = s.createCriteria(ProductHasSize.class, "phs");
    cr.createAlias("phs.product", "product").createAlias("phs.size", "size")
            .createAlias("product.brand", "brand").add(Restrictions.eq("product.availability", true))
            .add(Restrictions.eq("brand.availability", true))
            .add(Restrictions.like("product.name", pNameMatch, MatchMode.ANYWHERE))
            .setProjection(Projections.groupProperty("product"));

    List<Product> phs = cr.list();
    for (Product ph : phs) {
        ProductHasSize pp = new Test3().productDetails(ph, s);
        String sl = pp.getPrice() + " - " + pp.getProduct().getName();
        System.out.println(sl);
    }
    //System.out.println(phs.toArray());
    //  Map stateMap = new HashMap();
    //    for (Object[] obj : phs) {
    //        DownloadState downloadState = (DownloadState) obj[0];
    //        stateMap.put(downloadState.getDescription().toLowerCase() (Integer) obj[1]);
    //    }

}

From source file:com.cimmyt.model.dao.impl.AbstractDAO.java

License:Apache License

/**
 * adds a criterion to a Junction(conjunction/disjunction), based on the meta-data passed.
 * //from  w w  w  .ja v a 2  s.c  om
 * @param junction The Junction to conditionally add a criterion
 * @param condition The type of criterion: like, equals, etc.
 * @param dataType Indicates if its a numeric or character value for a filter
 * @param qualifiedParam the qualified parameter for a query
 * @param value The string value to use in the criterion
 */
public void addDynamicCriterion(Junction junction, Operator condition, DataType dataType, String qualifiedParam,
        String value) {
    if (!qualifiedParam.equals("sample.studysampleid")) {

        if (dataType == DataType.STRING) {
            if (condition == Operator.TypeString.LIKE) {
                junction.add(Restrictions.like(qualifiedParam, value, MatchMode.ANYWHERE));
            } else if (condition == Operator.TypeString.EQUAL) {
                junction.add(Restrictions.like(qualifiedParam, value, MatchMode.EXACT));
            } else if (condition == Operator.TypeString.NOT_EQUAL) {
                junction.add(Restrictions.ne(qualifiedParam, value));
            } else if (condition == Operator.TypeString.NOT_LIKE) {
                junction.add(Restrictions.not(Restrictions.like(qualifiedParam, value, MatchMode.ANYWHERE)));
            }

        } else if (dataType == DataType.NUMBER) {
            if (condition == Operator.TypeNumber.EQUALS) {
                junction.add(Restrictions.eq(qualifiedParam, Integer.valueOf(value)));
            } else if (condition == Operator.TypeNumber.GREATER) {
                junction.add(Restrictions.ge(qualifiedParam, Integer.valueOf(value)));
            }
            if (condition == Operator.TypeNumber.LESS) {
                junction.add(Restrictions.le(qualifiedParam, Integer.valueOf(value)));
            } else if (condition == Operator.TypeNumber.NOT_EQUALS) {
                junction.add(Restrictions.ne(qualifiedParam, Integer.valueOf(value)));
            } else if (condition == Operator.TypeNumber.IN) {
                List<Integer> listStr = new ArrayList<Integer>();
                String[] arr = value.split(",");
                for (int i = 0; i < arr.length; i++) {
                    try {
                        if (!arr[i].trim().equals(""))
                            listStr.add(Integer.parseInt(arr[i]));
                    } catch (Exception ex) {
                        ex.printStackTrace();
                    }
                }
                junction.add(Restrictions.in(qualifiedParam, listStr));
            }

        }
    } else {
        String prefix = StrUtils.getPrefixSampleFindString(value);
        int id = StrUtils.getSampleIDFindString(value);
        if (prefix.trim().equals(""))
            prefix = value;
        if (condition == Operator.TypeString.LIKE) {
            junction.add(Restrictions.like("study.prefix", prefix, MatchMode.ANYWHERE));
            if (id > 0)
                junction.add(Restrictions.eq("sample.samplegid", id));
        } else if (condition == Operator.TypeString.EQUAL) {
            junction.add(Restrictions.eq("study.prefix", prefix));
            if (id > 0)
                junction.add(Restrictions.eq("sample.samplegid", id));
        } else if (condition == Operator.TypeString.NOT_EQUAL) {
            junction.add(Restrictions.ne("study.prefix", prefix));
            if (id > 0)
                junction.add(Restrictions.ne("sample.samplegid", id));
        } else if (condition == Operator.TypeString.NOT_LIKE) {
            junction.add(Restrictions.not(Restrictions.like("study.prefix", prefix, MatchMode.ANYWHERE)));
            if (id > 0)
                junction.add(Restrictions.not(Restrictions.eq("sample.samplegid", id)));
        }
    }
}

From source file:com.court.controller.MemberfxmlController.java

private Loan getGurantorTransLoan(Session s) {
    Criteria c = s.createCriteria(Loan.class);
    c.add(Restrictions.like("loanName", "GUARANTOR", MatchMode.START));
    c.setMaxResults(1);//  w  ww. ja  v a2s .c om
    Loan gl = (Loan) c.uniqueResult();
    System.out.println("LOAN - " + gl.getLoanName());
    return gl;
}

From source file:com.dell.asm.asmcore.asmmanager.db.BaseDAO.java

License:Open Source License

/**
 * Helper method for adding filter criteria.
 * /*  w w  w.j  ava2 s.c o m*/
 * @param criteria
 *            the filter criteria
 * @param filterInfos
 *            list for filter specifications. filter info are added in the order in the list.
 */
@SuppressWarnings("unchecked")
static <E extends Enum<E>> List<FilterParamParser.FilterInfo> addFilterCriteria(Criteria criteria,
        List<FilterParamParser.FilterInfo> filterInfos, Class persistentClass) {

    LinkedList<FilterParamParser.FilterInfo> notFound = new LinkedList<FilterParamParser.FilterInfo>();

    ArrayList<Class<?>> enumClasses = new ArrayList<>();
    enumClasses.add(DiscoveryStatus.class);
    enumClasses.add(DeviceType.class);
    enumClasses.add(ManagedState.class);
    enumClasses.add(DeviceState.class);
    enumClasses.add(CompliantState.class);
    enumClasses.add(ConfigureStatus.class);

    for (FilterParamParser.FilterInfo filterInfo : filterInfos) {
        List<?> values = filterInfo.getColumnValue();

        //
        // Cast strings to the property type
        //
        try {
            Method m = null;
            // can be getXXX or isXXX
            try {
                m = persistentClass.getMethod("get" + StringUtils.capitalize(filterInfo.getColumnName()));
            } catch (NoSuchMethodException nm) {
                m = persistentClass.getMethod("is" + StringUtils.capitalize(filterInfo.getColumnName()));
            }
            Class<?> typeClass = m.getReturnType();

            if (!typeClass.isAssignableFrom(String.class)) {

                // byte/short/int/long
                if (typeClass == byte.class || typeClass == short.class || typeClass == int.class
                        || typeClass == long.class) {
                    LinkedList<Long> castedValues = new LinkedList<Long>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.add(Long.valueOf(stringValue));
                    }
                    // Set casted values
                    values = castedValues;
                    // float/double
                } else if (typeClass == float.class || typeClass == double.class) {
                    LinkedList<Double> castedValues = new LinkedList<Double>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.add(Double.valueOf(stringValue));
                    }
                    // Set casted values
                    values = castedValues;
                    // boolean
                } else if (typeClass == boolean.class) {
                    LinkedList<Boolean> castedValues = new LinkedList<Boolean>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.add(Boolean.valueOf(stringValue));
                    }
                    // Set casted values
                    values = castedValues;
                    // char
                } else if (typeClass == char.class) {
                    LinkedList<Character> castedValues = new LinkedList<Character>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.add(Character.valueOf(stringValue.charAt(0)));
                    }
                    // Set casted values
                    values = castedValues;
                } else if (typeClass == DiscoveryStatus.class) {
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                DiscoveryStatus.class));
                    }
                    values = castedValues;
                } else if (typeClass == DeviceType.class) {
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                DeviceType.class));
                    }
                    values = castedValues;
                } else if (typeClass == ManagedState.class) {
                    // ManagedState factored out of DeviceState as of 8.3.1
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                ManagedState.class));
                    }
                    values = castedValues;
                } else if (typeClass == DeviceState.class) {
                    // ManagedState factored out of DeviceState as of 8.3.1
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                DeviceState.class));
                    }
                    values = castedValues;
                } else if (typeClass == CompliantState.class) {
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                CompliantState.class));
                    }
                    values = castedValues;
                } else if (typeClass == ConfigureStatus.class) {
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                ConfigureStatus.class));
                    }
                    values = castedValues;
                } else if (typeClass == DeviceHealth.class) {
                    LinkedList<E> castedValues = new LinkedList<E>();
                    for (String stringValue : filterInfo.getColumnValue()) {
                        castedValues.addAll((Collection<? extends E>) findDeviceTypeSequence(stringValue,
                                DeviceHealth.class));
                    }
                    values = castedValues;
                } else {
                    continue;
                }
            }

            //
            // Translate filters to Hibernate Criteria
            //
            if (enumClasses.contains(typeClass)) {
                criteria.add(Restrictions.in(filterInfo.getColumnName(), values));
            } else {
                if (values.size() == 0) {
                    continue;
                } else if (values.size() > 1) {
                    if (FilterParamParser.FilterOperator.EQUAL.equals(filterInfo.getFilterOperator())) {
                        criteria.add(Restrictions.in(filterInfo.getColumnName(), values));
                    } else {
                        throw new IllegalArgumentException(
                                "filter operation '" + filterInfo.getFilterOperator() + "' is not recognized.");
                    }
                } else {

                    if (FilterParamParser.FilterOperator.EQUAL.equals(filterInfo.getFilterOperator())) {
                        criteria.add(Restrictions.eq(filterInfo.getColumnName(), values.get(0)));
                    } else if (FilterParamParser.FilterOperator.CONTAIN
                            .equals(filterInfo.getFilterOperator())) {

                        // Escape '_', '%', and '\' for Hibernate.
                        String escapedString = values.get(0).toString();
                        escapedString = escapedString.replace("\\", "\\\\").replace("_", "\\_").replace("%",
                                "\\%");

                        criteria.add(Restrictions.like(filterInfo.getColumnName(), escapedString,
                                MatchMode.ANYWHERE));
                    } else {
                        throw new IllegalArgumentException(
                                "filter operation '" + filterInfo.getFilterOperator() + "' is not recognized.");
                    }
                }
            }

        } catch (NoSuchMethodException e) {
            LOGGER.info("cannot find a method for " + filterInfo.getColumnName() + " in "
                    + persistentClass.toString());
            notFound.add(filterInfo);
            continue;
        }
    }

    return notFound;
}

From source file:com.dell.asm.asmcore.asmmanager.db.DeviceGroupDAO.java

License:Open Source License

/**
 * Helper method for adding filter criteria
 * //from ww w  .ja  va  2 s  .c o  m
 * @param criteria
 *            - the filter criteria
 * @param filterInfos
 *            - list for filter specifications. filter info are added in the order in the list
 *            
 * @return List<FilterParamParser.FilterInfo>
 *                             - list of added filters
 * 
 * @throws IllegalArgumentException
 */
@SuppressWarnings("unchecked")
private List<FilterParamParser.FilterInfo> addFilterCriteria(Criteria criteria,
        List<FilterParamParser.FilterInfo> filterInfos, Class persistentClass) {

    LinkedList<FilterParamParser.FilterInfo> notFound = new LinkedList<>();

    for (FilterParamParser.FilterInfo filterInfo : filterInfos) {
        String columnName = filterInfo.getColumnName();
        List<?> values = filterInfo.getColumnValue();

        //
        // Cast strings to the property type by scanning the persistent class
        //
        Class<?> typeClass = null;
        // try non-boolean-type naming.
        try {
            typeClass = persistentClass.getMethod("get" + StringUtils.capitalize(columnName)).getReturnType();
        } catch (NoSuchMethodException e) {
            logger.info("cannot find a method for " + columnName + " in " + persistentClass.toString());

        }
        // try boolean-type naming.
        if (typeClass == null) {
            try {
                typeClass = persistentClass.getMethod("is" + StringUtils.capitalize(columnName))
                        .getReturnType();
            } catch (NoSuchMethodException e) {
                logger.info("cannot find a method for " + columnName + " in " + persistentClass.toString());
            }
        }
        // property not found. skip.
        if (typeClass == null) {
            notFound.add(filterInfo);
            continue;
        }
        if (!typeClass.isAssignableFrom(String.class)) {

            // byte/short/int/long
            if (typeClass == byte.class || typeClass == short.class || typeClass == int.class
                    || typeClass == long.class) {
                LinkedList<Long> castedValues = new LinkedList<>();
                for (String stringValue : filterInfo.getColumnValue()) {
                    castedValues.add(Long.valueOf(stringValue));
                }
                // Set casted values
                values = castedValues;

                // float/double
            } else if (typeClass == float.class || typeClass == double.class) {
                LinkedList<Double> castedValues = new LinkedList<>();
                for (String stringValue : filterInfo.getColumnValue()) {
                    castedValues.add(Double.valueOf(stringValue));
                }
                // Set casted values
                values = castedValues;
                // boolean
            } else if (typeClass == boolean.class) {
                LinkedList<Boolean> castedValues = new LinkedList<>();
                for (String stringValue : filterInfo.getColumnValue()) {
                    castedValues.add(Boolean.valueOf(stringValue));
                }
                // Set casted values
                values = castedValues;
                // char
            } else if (typeClass == char.class) {
                LinkedList<Character> castedValues = new LinkedList<>();
                for (String stringValue : filterInfo.getColumnValue()) {
                    castedValues.add(Character.valueOf(stringValue.charAt(0)));
                }
                // Set casted values
                values = castedValues;
            }
        }

        //
        // Translate filters to Hibernate Criteria
        //
        if (values.size() > 1) {
            if (FilterParamParser.FilterOperator.EQUAL.equals(filterInfo.getFilterOperator())) {
                criteria.add(Restrictions.in(columnName, values));
            } else {
                throw new IllegalArgumentException(
                        "filter operation '" + filterInfo.getFilterOperator() + "' is not recognized.");
            }
        } else if (values.size() == 1) {
            if (FilterParamParser.FilterOperator.EQUAL.equals(filterInfo.getFilterOperator())) {
                criteria.add(Restrictions.eq(columnName, values.get(0)));
            } else if (FilterParamParser.FilterOperator.CONTAIN.equals(filterInfo.getFilterOperator())) {

                // Escape '_', '%', and '\' for Hibernate.
                String escapedString = values.get(0).toString();
                escapedString = escapedString.replace("\\", "\\\\").replace("_", "\\_").replace("%", "\\%");

                criteria.add(Restrictions.like(columnName, escapedString, MatchMode.ANYWHERE));
            } else {
                throw new IllegalArgumentException(
                        "filter operation '" + filterInfo.getFilterOperator() + "' is not recognized.");
            }
        }
    }

    return notFound;
}

From source file:com.dentinium.customer.UserDataController.java

public List<Users> searchUser(String name) {
    Session session = createSession();//from w  ww  .  java 2 s .  co m
    Criteria query = session.createCriteria(Users.class);
    query.add(Restrictions.like("name", name, MatchMode.START));

    List users = query.list();

    if (users.size() >= 1) {
        session.close();
        return users;
    } else {
        System.out.println("USERs COULDN'T BE FOUND!");
        session.close();
        return null;
    }

}

From source file:com.dinesh.placementcell.dao.AdvisorDAOImpl.java

@Override
public List<AdvisorDetails> getAdvisorDetailsByName(String name) {
    Criteria criteria = createEntityCriteria();
    criteria.add(Restrictions.like("name", name, MatchMode.ANYWHERE));
    return criteria.list();
}

From source file:com.dinesh.placementcell.dao.StudentDAOImpl.java

@Override
public List<Student> getStudentsByName(String name) {
    Criteria criteria = createEntityCriteria();
    criteria.add(Restrictions.like("name", name, MatchMode.ANYWHERE));
    return criteria.list();
}

From source file:com.emergya.persistenceGeo.dao.impl.AbstractGenericDaoHibernateImpl.java

License:Open Source License

/**
* Lista todos con los elementos like a los pasados como argumento
* 
* @param filtros a ejecutar//from   ww  w  .  j  a v  a 2  s  .co m
* 
* @return todas las entidades en session que cumplan los filtros
*/
@SuppressWarnings("unchecked")
public List<T> findLike(Map<String, Object> filtros) {
    Criteria crit = getSession().createCriteria(persistentClass);

    for (String key : filtros.keySet()) {
        if (filtros.get(key) == null) {
            crit.add(Restrictions.isNull(key));
        } else {
            //crit.add(new LikeSpecialCharsExpression(key, filtros.get(key).toString(), MatchMode.ANYWHERE));
            crit.add(Restrictions.like(key, filtros.get(key).toString(), MatchMode.ANYWHERE));
        }
    }

    return (List<T>) crit.list();
}