1 19 package org.openharmonise.rm.commands; 20 21 import org.openharmonise.rm.DataAccessException; 22 import org.openharmonise.rm.resources.lifecycle.Editable; 23 24 25 33 public class CmdGetPendingVersions extends AbstractCmd { 34 35 39 public CmdGetPendingVersions() { 40 super(); 41 } 42 43 46 public Object execute(Context context) throws CommandException { 47 if ((m_commandObj instanceof Editable) == false) { 48 throw new InvalidCommandException( 49 "Command is not valid for this object:" 50 + m_commandObj.getClass()); 51 } 52 53 if (isAvailable(context) == false) { 54 throw new InvalidCommandException("Command is not available for this object"); 55 } 56 57 Editable editable = (Editable) getCommandObject(context); 58 Object cmdResult = null; 59 60 try { 61 cmdResult = editable.getPendingVersions(); 62 } catch (DataAccessException e) { 63 throw new CommandExecutionException( 64 "Error getting historical versions", 65 e); 66 } 67 68 return cmdResult; 69 } 70 71 74 public String getName() { 75 return "GetPendingVersions"; 76 } 77 78 81 public boolean isValidCommandObject(Object obj) { 82 return (obj instanceof Editable); 83 } 84 } | Popular Tags |