Skip to content

Commit

Permalink
#150 IDocumentViewSelection.getByIds
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Feb 19, 2017
1 parent 2749c0e commit 559eb42
Showing 1 changed file with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@

import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;

import org.adempiere.util.Check;
import org.adempiere.util.GuavaCollectors;
import org.adempiere.util.lang.impl.TableRecordReference;
import org.compiere.util.Evaluatee;

import de.metas.ui.web.exceptions.EntityNotFoundException;
Expand All @@ -26,11 +30,11 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
Expand Down Expand Up @@ -60,6 +64,24 @@ default IDocumentView getById(final int documentIdInt) throws EntityNotFoundExce
return getById(DocumentId.of(documentIdInt));
}

default List<IDocumentView> getByIds(final Set<DocumentId> documentIds)
{
Check.assumeNotEmpty(documentIds, "documentIds is not empty");
return documentIds.stream()
.map(documentId -> {
try
{
return getById(documentId);
}
catch (final EntityNotFoundException e)
{
return null;
}
})
.filter(document -> document != null)
.collect(GuavaCollectors.toImmutableList());
}

LookupValuesList getFilterParameterDropdown(String filterId, String filterParameterName, Evaluatee ctx);

LookupValuesList getFilterParameterTypeahead(String filterId, String filterParameterName, String query, Evaluatee ctx);
Expand Down

0 comments on commit 559eb42

Please sign in to comment.