001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.repository.capabilities;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.kernel.repository.model.RepositoryModelOperation;
019    
020    import java.util.Date;
021    
022    /**
023     * @author Adolfo P??rez
024     */
025    public interface BulkOperationCapability extends Capability {
026    
027            public void execute(
028                            Filter<?> filter, RepositoryModelOperation repositoryModelOperation)
029                    throws PortalException;
030    
031            public void execute(RepositoryModelOperation repositoryModelOperation)
032                    throws PortalException;
033    
034            public interface Field<T> {
035    
036                    public interface CreateDate extends Field<Date> {
037                    }
038    
039            }
040    
041            public class Filter<T> {
042    
043                    public Filter(
044                            Class<? extends Field<T>> field, Operator operator, T value) {
045    
046                            _field = field;
047                            _operator = operator;
048                            _value = value;
049                    }
050    
051                    public Class<? extends Field<T>> getField() {
052                            return _field;
053                    }
054    
055                    public Operator getOperator() {
056                            return _operator;
057                    }
058    
059                    public T getValue() {
060                            return _value;
061                    }
062    
063                    private final Class<? extends Field<T>> _field;
064                    private final Operator _operator;
065                    private final T _value;
066    
067            }
068    
069            public enum Operator {
070    
071                    LT, LE, GT, GE, EQ
072    
073            }
074    
075    }