001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     matic
011 */
012package org.nuxeo.ecm.automation.jaxrs.io.operations;
013
014import org.nuxeo.common.utils.StringUtils;
015import org.nuxeo.ecm.core.api.DocumentRefList;
016import org.nuxeo.ecm.core.api.impl.DocumentRefListImpl;
017
018/**
019 * @author matic
020 */
021public class DocumentsInputResolver implements InputResolver<DocumentRefList> {
022
023    @Override
024    public String getType() {
025        return "docs";
026    }
027
028    @Override
029    public DocumentRefList getInput(String input) {
030        String[] ar = StringUtils.split(input, ',', true);
031        DocumentRefList list = new DocumentRefListImpl(ar.length);
032        for (String s : ar) {
033            list.add(DocumentInputResolver.docRefFromString(s));
034        }
035        return list;
036    }
037
038}