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 // the document is referenced by it's repository, principal and UUID 039 int INSTANCE = 3; 040 /** 041 * Gets the type of the reference. 042 * 043 * @return the type of the reference 044 */ 045 int type(); 046 047 /** 048 * Gets the reference value. 049 * <p> 050 * For an ID reference, this is the document UUID. 051 * <p> 052 * For a PATH reference, this is the document path. 053 * <p> 054 * For an INSTANCE reference this is the document itself. 055 * 056 * @return the reference value 057 */ 058 Object reference(); 059 060}