001/* 002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * bstefanescu 018 */ 019package org.nuxeo.ecm.automation.client.model; 020 021import java.util.ArrayList; 022 023/** 024 * @author <a href="mailto:[email protected]">Bogdan Stefanescu</a> 025 */ 026public class DocRefs extends ArrayList<DocRef> implements OperationInput { 027 028 private static final long serialVersionUID = 1L; 029 030 public DocRefs() { 031 } 032 033 public DocRefs(int size) { 034 super(size); 035 } 036 037 public DocRefs(DocRefs docs) { 038 super(docs); 039 } 040 041 public String getInputType() { 042 return "documents"; 043 } 044 045 public String getInputRef() { 046 StringBuilder buf = new StringBuilder("docs:"); 047 int size = size(); 048 if (size == 0) { 049 return buf.toString(); 050 } 051 buf.append(get(0).ref); 052 for (int i = 1; i < size; i++) { 053 buf.append(",").append(get(i).ref); 054 } 055 return buf.toString(); 056 } 057 058 public boolean isBinary() { 059 return false; 060 } 061 062 public String toString() { 063 StringBuilder buf = new StringBuilder(); 064 int size = size(); 065 if (size == 0) { 066 return buf.toString(); 067 } 068 buf.append(get(0).ref); 069 for (int i = 1; i < size; i++) { 070 buf.append(",").append(get(i).ref); 071 } 072 return buf.toString(); 073 } 074 075 public String dump() { 076 return super.toString(); 077 } 078}