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 * Nuxeo - initial API and implementation 011 * 012 * $Id$ 013 */ 014 015package org.nuxeo.ecm.core.api; 016 017import java.io.Serializable; 018 019/** 020 * A reference to a core document. 021 * <p> 022 * The following two types of references are supported: 023 * <ul> 024 * <li> <code>ID</code> references. Refers to the core document by its UUID. See {@link IdRef}. 025 * <li> <code>PATH</code> references. Refers to the core document by its path. See {@link PathRef}. 026 * </ul> 027 * 028 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 029 */ 030public interface DocumentRef extends Serializable { 031 032 // the document is specified by its UUID 033 int ID = 1; 034 035 // the document is specified by its path 036 int PATH = 2; 037 038 /** 039 * Gets the type of the reference. 040 * 041 * @return the type of the reference 042 */ 043 int type(); 044 045 /** 046 * Gets the reference value. 047 * <p> 048 * For an ID reference, this is the document UUID. 049 * <p> 050 * For a PATH reference, this is the document path. 051 * <p> 052 * For an INSTANCE reference this is the document itself. 053 * 054 * @return the reference value 055 */ 056 Object reference(); 057 058}