Examples of NumericRange


Examples of org.apache.james.mailbox.SearchQuery.NumericRange

        if (crits.size() == && crits.get(0) instanceof UidCriterion) {
            final List<Long> uids = new ArrayList<Long>();
            UidCriterion uidCrit = (UidCriterion) crits.get(0);
            NumericRange[] ranges = uidCrit.getOperator().getRange();
            for (int i = 0; i < ranges.length; i++) {
                NumericRange r = ranges[i];
                messageMapper.findInMailbox(getMailboxEntity(), MessageRange.range(r.getLowValue(), r.getHighValue()), new MailboxMembershipCallback<Id>() {

                    public void onMailboxMembers(List<Message<Id>> list) throws MailboxException {
                        for (int i = 0; i < list.size(); i++) {
                            long uid = list.get(i).getUid();
                            if (uids.contains(uid) == false) {
View Full Code Here

Examples of org.apache.james.mailbox.SearchQuery.NumericRange

     */
    public static Query createUidQuery(SearchQuery.UidCriterion crit) throws UnsupportedSearchException {
        NumericRange[] ranges = crit.getOperator().getRange();
        BooleanQuery rangesQuery = new BooleanQuery();
        for (int i = 0; i < ranges.length; i++) {
            NumericRange range = ranges[i];
            rangesQuery.add(NumericRangeQuery.newLongRange(UID_FIELD, range.getLowValue(), range.getHighValue(), true, true), BooleanClause.Occur.SHOULD);
        }
        return rangesQuery;
    }
View Full Code Here

Examples of org.apache.james.mailbox.model.SearchQuery.NumericRange

            SearchQuery searchQuery = new SearchQuery();
            NumericRange[] nRanges = new NumericRange[ranges.size()];
            Set<Long> vanishedUids = new HashSet<Long>();
            for (int i = 0; i < ranges.size(); i++) {
                MessageRange r = ranges.get(i);
                NumericRange nr;
                if (r.getType() == Type.ONE) {
                    nr = new NumericRange(r.getUidFrom());
                } else {
                    nr = new NumericRange(r.getUidFrom(), r.getUidTo());
                }
                long from = nr.getLowValue();
                long to = nr.getHighValue();
                while(from <= to) {
                    vanishedUids.add(from++);
                }
                nRanges[i] = nr;
               
View Full Code Here

Examples of org.apache.james.mailbox.model.SearchQuery.NumericRange

        final NumericRange[] ranges = operator.getRange();
        final long uid = message.getUid();
        final int length = ranges.length;
        boolean result = false;
        for (int i = 0; i < length; i++) {
            final NumericRange numericRange = ranges[i];
            if (numericRange.isIn(uid)) {
                result = true;
                break;
            }
        }
        return result;
View Full Code Here

Examples of org.apache.james.mailbox.model.SearchQuery.NumericRange

        if (crits.size() == && crits.get(0) instanceof UidCriterion) {
            final List<Long> uids = new ArrayList<Long>();
            UidCriterion uidCrit = (UidCriterion) crits.get(0);
            NumericRange[] ranges = uidCrit.getOperator().getRange();
            for (int i = 0; i < ranges.length; i++) {
                NumericRange r = ranges[i];
                Iterator<Message<Id>> messages = mapper.findInMailbox(mailbox, MessageRange.range(r.getLowValue(), r.getHighValue()), FetchType.Metadata, -1);
               
                while(messages.hasNext()) {
                    long uid = messages.next().getUid();
                    if (uids.contains(uid) == false) {
                        uids.add(uid);
View Full Code Here

Examples of org.eclipse.sapphire.modeling.annotations.NumericRange

    @Override
    protected void initValidationService()
    {
        final PropertyDef property = context( PropertyDef.class );
        final Class<?> type = property.getTypeClass();
        final NumericRange rangeConstraintAnnotation = property.getAnnotation( NumericRange.class );
        final MasterConversionService converter = property.service( MasterConversionService.class );

        final String minStr = rangeConstraintAnnotation.min();
       
        if( minStr != null )
        {
            this.min = ( minStr.length() > 0 ? (Comparable) converter.convert( minStr, type ) : null );
        }
       
        final String maxStr = rangeConstraintAnnotation.max();
       
        if( maxStr != null )
        {
            this.max = ( maxStr.length() > 0 ? (Comparable) converter.convert( maxStr, type ) : null );
        }
View Full Code Here

Examples of org.eclipse.sapphire.modeling.annotations.NumericRange

    @Override
    protected void facts( final SortedSet<String> facts )
    {
        final ValueProperty property = context( ValueProperty.class );
        final NumericRange range = property.getAnnotation( NumericRange.class );
        final String min = range.min();
        final String max = range.max();
           
        if( min.length() > 0 )
        {
            facts.add( minValueStatement.format( new ValueSnapshot( property, min ) ) );
        }
View Full Code Here

Examples of org.eclipse.sapphire.modeling.annotations.NumericRange

        {
            final ValueProperty property = context.find( ValueProperty.class );
           
            if( property != null )
            {
                final NumericRange range = property.getAnnotation( NumericRange.class );
                return ( range != null && ( range.min().length() > 0 || range.max().length() > 0 ) );
            }
           
            return false;
        }
View Full Code Here

Examples of org.eclipse.sapphire.modeling.annotations.NumericRange

    }

    @Override
    protected void createContents( final Composite parent )
    {
        final NumericRange rangeAnnotation = property().definition().getAnnotation( NumericRange.class );
       
        try
        {
            this.minimum = Integer.parseInt( rangeAnnotation.min() );
            this.maximum = Integer.parseInt( rangeAnnotation.max() );
        }
        catch( NumberFormatException e )
        {
            // Should not happen here. We already checked this in property editor applicability test.
           
View Full Code Here

Examples of org.eclipse.sapphire.modeling.annotations.NumericRange

        {
            final PropertyDef property = part.property().definition();
           
            if( property.isOfType( Integer.class ) )
            {
                final NumericRange rangeAnnotation = property.getAnnotation( NumericRange.class );
               
                if( rangeAnnotation != null )
                {
                    final String minStr = rangeAnnotation.min();
                    final String maxStr = rangeAnnotation.max();
                   
                    if( minStr.length() > 0 && maxStr.length() > 0 )
                    {
                        return new ScalePropertyEditorPresentation( part, parent, composite );
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.