Package com.salas.bb.domain.query

Examples of com.salas.bb.domain.query.IProperty


     */
    public void testUnpersistingMissingOperation()
    {
        Query query = new Query();
        Collection availableProperties = query.getAvailableProperties();
        IProperty existingProperty = (IProperty)availableProperties.iterator().next();

        Query.addCriteria(query, existingProperty.getDescriptor(), "missingOperation", null);
        assertEquals("Criteria using missing operation should be skipped.",
            0, query.getCriteriaCount());
    }
View Full Code Here


        return buf.toString();
    }

    private String serializeToString(ICriteria aCriteria)
    {
        IProperty property = aCriteria.getProperty();
        IComparisonOperation operation = aCriteria.getComparisonOperation();
        String value = aCriteria.getValue();

        StringBuffer buf = new StringBuffer();

        buf.append(property.getDescriptor()).append(':');
        buf.append(operation.getDescriptor()).append(':');
        buf.append(escapeValue(value));

        return buf.toString();
    }
View Full Code Here

    }

    static void addCriteria(Query aQuery, String propertyDescriptor,
        String operationDescriptor, String value)
    {
        IProperty property = aQuery.getPropertyByDescriptor(propertyDescriptor);
        if (property != null)
        {
            IComparisonOperation operation =
                property.getComparsonOperationByDescriptor(operationDescriptor);

            if (operation != null)
            {
                ICriteria criteria = aQuery.addCriteria();
                criteria.setProperty(property);
View Full Code Here

    private void setCriteria(ICriteria aCriteria)
    {
        criteria = aCriteria;

        IProperty property = criteria.getProperty();
        IComparisonOperation operation = criteria.getComparisonOperation();

        if (property != null)
        {
            if (!getSelectedProperty().equals(property))
            {
                cbProperty.setSelectedItem(property);
                valueEditor.setType(property.getType());
            } else
            {
                propertySelected(property);
            }
View Full Code Here

        cbOperation.addItemListener(new OperationSelectionListener());
    }

    private void propertySelected(IProperty property)
    {
        IProperty criteriaProperty = criteria.getProperty();
        boolean differentProperty = criteriaProperty == null || !criteriaProperty.equals(property);

        if (differentProperty) criteria.setProperty(property);
        fillComparisonOperations(property);
        if (differentProperty)
        {
            String currentValue = criteria.getValue();
            if (StringUtils.isEmpty(currentValue) ||
                (criteriaProperty == null || INCOMPATIBLE.contains(criteriaProperty.getClass())) ||
                (INCOMPATIBLE.contains(property.getClass())) ||
                property.validateValue(criteria.getComparisonOperation(), currentValue) != null)
            {
                criteria.setValue(property.getDefaultValue());
            }
View Full Code Here

     * Adds new criteria and corresponding row to the table.
     */
    void addEmptyCriteria()
    {
        // We want Article Text to be the first because it is the most obvious and helps the user understand the dialog box.
        IProperty firstProperty = ArticleTextProperty.INSTANCE;
        IComparisonOperation firstOperation =
            (IComparisonOperation)firstProperty.getComparsonOperations().iterator().next();
        String defaultValue = firstProperty.getDefaultValue();

        ICriteria criteria = query.addCriteria();
        criteria.setProperty(firstProperty);
        criteria.setComparisonOperation(firstOperation);
        criteria.setValue(defaultValue);
View Full Code Here

        ICriteria criteria = query.addCriteria();

        assertNotNull("Criteria is bad.", SmartFeedDialog.validateSearchFeedData(query, true, 1));

        IProperty someProperty = (IProperty)query.getAvailableProperties().toArray()[0];
        IComparisonOperation someOperation = (IComparisonOperation)someProperty.getComparsonOperations().toArray()[0];
        criteria.setProperty(someProperty);
        criteria.setComparisonOperation(someOperation);
        criteria.setValue("1");

        assertEquals("Query is ok.", null, SmartFeedDialog.validateSearchFeedData(query, true, 1));
View Full Code Here

    private static SearchFeed searchFeed(int n)
    {
        // Create Query
        Query q = new Query();
        Collection props = q.getAvailableProperties();
        IProperty p = (IProperty)props.iterator().next();
        IComparisonOperation op = (IComparisonOperation)p.getComparsonOperations().iterator().next();
        ICriteria c = q.addCriteria();
        c.setProperty(p);
        c.setComparisonOperation(op);
        c.setValue(Integer.toString(n));
View Full Code Here

TOP

Related Classes of com.salas.bb.domain.query.IProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.