001/** 002 * 003 * Copyright 2023 Florian Schmaus 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.commands.packet; 018 019import java.util.List; 020import java.util.Set; 021 022import org.jivesoftware.smack.packet.IqView; 023 024import org.jivesoftware.smackx.commands.AdHocCommandNote; 025import org.jivesoftware.smackx.commands.packet.AdHocCommandData.Action; 026import org.jivesoftware.smackx.commands.packet.AdHocCommandData.AllowedAction; 027import org.jivesoftware.smackx.commands.packet.AdHocCommandData.Status; 028import org.jivesoftware.smackx.xdata.packet.DataForm; 029 030public interface AdHocCommandDataView extends IqView { 031 032 /** 033 * Returns the identifier of the command. 034 * 035 * @return the node. 036 */ 037 String getNode(); 038 039 /** 040 * Returns the human name of the command. 041 * 042 * @return the name of the command. 043 */ 044 String getName(); 045 046 String getSessionId(); 047 048 /** 049 * Returns the list of notes that the command has. 050 * 051 * @return the notes. 052 */ 053 List<AdHocCommandNote> getNotes(); 054 055 /** 056 * Returns the form of the command. 057 * 058 * @return the data form associated with the command. 059 */ 060 DataForm getForm(); 061 062 /** 063 * Returns the action to execute. The action is set only on a request. 064 * 065 * @return the action to execute. 066 */ 067 Action getAction(); 068 069 /** 070 * Returns the status of the execution. 071 * 072 * @return the status. 073 */ 074 Status getStatus(); 075 076 Set<AllowedAction> getActions(); 077 078 AllowedAction getExecuteAction(); 079 080 default boolean isCompleted() { 081 return getStatus() == Status.completed; 082 } 083 084 default boolean isExecuting() { 085 return getStatus() == Status.executing; 086 } 087}