001/** 002 * Copyright 2015 Tampere University of Technology, Pori Department 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 */ 016package service.tut.pori.fuzzyvisuals; 017 018import core.tut.pori.http.annotations.HTTPAuthenticationParameter; 019import core.tut.pori.http.annotations.HTTPMethodParameter; 020import core.tut.pori.http.annotations.HTTPService; 021import core.tut.pori.http.annotations.HTTPServiceMethod; 022import core.tut.pori.http.parameters.AuthenticationParameter; 023import core.tut.pori.http.parameters.InputStreamParameter; 024import core.tut.pori.utils.XMLFormatter; 025 026/** 027 * FuzzyVisuals back-end service 028 * 029 */ 030@HTTPService(name = Definitions.SERVICE_FV) 031public class FuzzyVisualsService { 032 private XMLFormatter _formatter = new XMLFormatter(); 033 034 /** 035 * 036 * @param authenticatedUser 037 * @param xml 038 */ 039 @HTTPServiceMethod(name = service.tut.pori.contentanalysis.Definitions.METHOD_ADD_TASK, acceptedMethods={core.tut.pori.http.Definitions.METHOD_POST}) 040 public void addTask( 041 @HTTPAuthenticationParameter AuthenticationParameter authenticatedUser, // accept any authorized user 042 @HTTPMethodParameter(name = InputStreamParameter.PARAMETER_DEFAULT_NAME, bodyParameter = true) InputStreamParameter xml) 043 { 044 FuzzyVisualsCore.addTask(_formatter.toObject(xml.getValue(), TaskDetails.class)); 045 } 046}