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 * bstefanescu 011 */ 012package org.nuxeo.ecm.automation.client.model; 013 014/** 015 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 016 */ 017public class DocRef implements OperationInput { 018 019 private static final long serialVersionUID = 1L; 020 021 protected final String ref; 022 023 public static DocRef newRef(String ref) { 024 if (ref.startsWith("/")) { 025 return new PathRef(ref); 026 } else { 027 return new IdRef(ref); 028 } 029 } 030 031 public DocRef(String ref) { 032 this.ref = ref; 033 } 034 035 public String getInputType() { 036 return "document"; 037 } 038 039 public String getInputRef() { 040 return "doc:" + ref; 041 } 042 043 public boolean isBinary() { 044 return false; 045 } 046 047 @Override 048 public String toString() { 049 return ref; 050 } 051 052}