001/* 002 * (C) Copyright 2009 Nuxeo SA (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * arussel 016 */ 017package org.nuxeo.ecm.platform.routing.core.impl; 018 019import java.io.Serializable; 020import java.util.List; 021 022import org.nuxeo.ecm.core.api.CoreSession; 023import org.nuxeo.ecm.core.api.DocumentModel; 024import org.nuxeo.ecm.platform.routing.api.DocumentRouteStepsContainer; 025import org.nuxeo.ecm.platform.routing.api.DocumentRoutingConstants; 026 027/** 028 * @author arussel 029 */ 030public class DocumentRouteStepsContainerImpl extends DocumentRouteElementImpl implements DocumentRouteStepsContainer { 031 032 private static final long serialVersionUID = 1L; 033 034 public DocumentRouteStepsContainerImpl(DocumentModel doc, ElementRunner runner) { 035 super(doc, runner); 036 } 037 038 public void setAttachedDocuments(List<String> documentIds) { 039 document.setPropertyValue(DocumentRoutingConstants.ATTACHED_DOCUMENTS_PROPERTY_NAME, 040 (Serializable) documentIds); 041 } 042 043 @SuppressWarnings("unchecked") 044 public List<String> getAttachedDocuments() { 045 return (List<String>) document.getPropertyValue(DocumentRoutingConstants.ATTACHED_DOCUMENTS_PROPERTY_NAME); 046 } 047 048 @Override 049 public void setDone(CoreSession session) { 050 followTransition(ElementLifeCycleTransistion.toDone, session, false); 051 } 052 053 @Override 054 public void validate(CoreSession session) { 055 // validate this routeModel 056 EventFirer.fireEvent(session, this, null, DocumentRoutingConstants.Events.beforeRouteValidated.name()); 057 setValidated(session); 058 EventFirer.fireEvent(session, this, null, DocumentRoutingConstants.Events.afterRouteValidated.name()); 059 setReadOnly(session); 060 } 061}