001/* 002 * (C) Copyright 2006-2016 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Tiago Cardoso <tcardoso@nuxeo.com> 018 */ 019package org.nuxeo.ecm.platform.threed.convert; 020 021import org.apache.commons.io.FilenameUtils; 022import org.nuxeo.ecm.core.api.Blob; 023import org.nuxeo.ecm.core.api.blobholder.BlobHolder; 024import org.nuxeo.ecm.core.api.blobholder.SimpleBlobHolderWithProperties; 025import org.nuxeo.ecm.core.api.impl.blob.FileBlob; 026import org.nuxeo.ecm.platform.commandline.executor.api.CmdParameters; 027import org.nuxeo.ecm.core.convert.api.ConversionException; 028 029import java.io.File; 030import java.io.Serializable; 031import java.util.ArrayList; 032import java.util.HashMap; 033import java.util.List; 034import java.util.Map; 035import java.util.stream.Collectors; 036 037import static org.nuxeo.ecm.platform.threed.convert.Constants.*; 038 039/** 040 * Batch conversion for 3D document types Generate thumbnail render, Collada version and LOD versions 041 * 042 * @since 8.4 043 */ 044public class BatchConverter extends BaseBlenderConverter { 045 046 @Override 047 protected Map<String, Blob> getCmdBlobParameters(BlobHolder blobHolder, Map<String, Serializable> parameters) 048 throws ConversionException { 049 return null; 050 } 051 052 @Override 053 protected Map<String, String> getCmdStringParameters(BlobHolder blobHolder, Map<String, Serializable> parameters) 054 throws ConversionException { 055 Map<String, String> cmdStringParams = new HashMap<>(); 056 057 String percPoly = null; 058 if (parameters.containsKey(PERC_POLY_PARAMETER)) { 059 percPoly = (String) parameters.get(PERC_POLY_PARAMETER); 060 } else if (initParameters.containsKey(PERC_POLY_PARAMETER)) { 061 percPoly = initParameters.get(PERC_POLY_PARAMETER); 062 } 063 cmdStringParams.put(PERC_POLY_PARAMETER, percPoly); 064 065 String maxPoly = null; 066 if (parameters.containsKey(MAX_POLY_PARAMETER)) { 067 maxPoly = (String) parameters.get(MAX_POLY_PARAMETER); 068 } else if (initParameters.containsKey(MAX_POLY_PARAMETER)) { 069 maxPoly = initParameters.get(MAX_POLY_PARAMETER); 070 } 071 cmdStringParams.put(MAX_POLY_PARAMETER, maxPoly); 072 073 String dimensions = null; 074 if (parameters.containsKey(DIMENSIONS_PARAMETER)) { 075 dimensions = (String) parameters.get(DIMENSIONS_PARAMETER); 076 } else if (initParameters.containsKey(DIMENSIONS_PARAMETER)) { 077 dimensions = initParameters.get(DIMENSIONS_PARAMETER); 078 } 079 cmdStringParams.put(DIMENSIONS_PARAMETER, dimensions); 080 081 return cmdStringParams; 082 } 083 084}