/* * Copyright (C) 2005-2015 Alfresco Software Limited. * * This file is part of Alfresco * * Alfresco is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alfresco is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ package org.alfresco.rest.api.cmm; import java.util.Collections; import java.util.List; import org.alfresco.rest.api.CustomModels; import org.alfresco.rest.api.model.CustomModelDownload; import org.alfresco.rest.framework.WebApiDescription; import org.alfresco.rest.framework.resource.RelationshipResource; import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction; import org.alfresco.rest.framework.resource.parameters.Parameters; import org.alfresco.util.PropertyCheck; import org.springframework.beans.factory.InitializingBean; /** * @author Jamal Kaabi-Mofrad */ @RelationshipResource(name = "download", entityResource = CustomModelEntityResource.class, title = "Custom Model Download") public class CustomModelDownloadRelation implements RelationshipResourceAction.Create, InitializingBean { private CustomModels customModels; public void setCustomModels(CustomModels customModels) { this.customModels = customModels; } @Override public void afterPropertiesSet() throws Exception { PropertyCheck.mandatory(this, "customModels", customModels); } @Override @WebApiDescription(title = "Creates download node containing the custom model file and if specified, its associated Share extension module file.") public List create(String modelName, List download, Parameters parameters) { CustomModelDownload result = customModels.createDownload(modelName, parameters); return Collections.singletonList(result); } }