001/** 002 * Copyright 2014 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.facebookjazz; 017 018import javax.xml.bind.annotation.XmlAccessType; 019import javax.xml.bind.annotation.XmlAccessorType; 020import javax.xml.bind.annotation.XmlElement; 021import javax.xml.bind.annotation.XmlRootElement; 022 023import org.apache.commons.lang3.StringUtils; 024 025import service.tut.pori.contentanalysis.AbstractTaskDetails; 026import service.tut.pori.contentanalysis.AsyncTask.TaskType; 027import service.tut.pori.contentanalysis.Definitions; 028import service.tut.pori.contentanalysis.MediaObjectList; 029 030/** 031 * Task details for a Facebook feedback task. 032 * 033 * <h3>XML Example</h3> 034 * 035 * {@doc.restlet service="[service.tut.pori.facebookjazz.reference.Definitions#SERVICE_FBJ_REFERENCE_EXAMPLE]" method="[service.tut.pori.contentanalysis.Definitions#ELEMENT_TASK_DETAILS]" type="GET" query="[service.tut.pori.facebookjazz.reference.Definitions#PARAMETER_TASK_TYPE]=[service.tut.pori.contentanalysis.AsyncTask$TaskType#FACEBOOK_PROFILE_SUMMARIZATION_FEEDBACK]" body_uri=""} 036 * 037 * @see service.tut.pori.contentanalysis.MediaObjectList 038 */ 039@XmlRootElement(name=Definitions.ELEMENT_TASK_DETAILS) 040@XmlAccessorType(XmlAccessType.NONE) 041public final class FBFeedbackTaskDetails extends AbstractTaskDetails { 042 @XmlElement(name=Definitions.ELEMENT_MEDIA_OBJECTLIST) 043 private MediaObjectList _tags = null; 044 045 /** 046 * 047 */ 048 public FBFeedbackTaskDetails(){ 049 setTaskType(TaskType.FACEBOOK_PROFILE_SUMMARIZATION_FEEDBACK); 050 } 051 052 /** 053 * @return the tags 054 * @see #setTags(MediaObjectList) 055 */ 056 public MediaObjectList getTags() { 057 return _tags; 058 } 059 060 /** 061 * @param tags the tags to set 062 * @see #getTags() 063 */ 064 public void setTags(MediaObjectList tags) { 065 _tags = tags; 066 } 067 068 @XmlElement(name = service.tut.pori.contentanalysis.Definitions.ELEMENT_CALLBACK_URI) 069 @Override 070 public String getCallbackUri() { 071 String callbackUri = super.getCallbackUri(); 072 return (StringUtils.isBlank(callbackUri) ? FBSummarizationTaskDetails.generateFinishedCallbackUri() : callbackUri); 073 } 074 075 /** 076 * for sub-classing, use the static 077 * 078 * @return true if this task has no content 079 * @see #isEmpty(FBFeedbackTaskDetails) 080 */ 081 protected boolean isEmpty() { 082 return MediaObjectList.isEmpty(_tags); 083 } 084 085 /** 086 * 087 * @param details 088 * @return true if the given list was null or contained no data 089 */ 090 public static boolean isEmpty(FBFeedbackTaskDetails details){ 091 return (details == null || details.isEmpty()); 092 } 093 094 @Override 095 public TaskParameters getTaskParameters() { 096 return null; 097 } 098 099 @Override 100 public void setTaskParameters(TaskParameters parameters) { 101 throw new UnsupportedOperationException("Method not supported."); 102 } 103}