1 19 package org.openharmonise.rm.commands; 20 21 import org.openharmonise.rm.resources.lifecycle.*; 22 23 24 31 public class CmdReactivate extends AbstractCmd { 32 33 37 public CmdReactivate() { 38 super(); 39 } 40 41 44 public Object execute(Context context) throws CommandException { 45 if((m_commandObj instanceof Editable) == false) { 46 throw new InvalidCommandException("Command is not valid for this object:" + m_commandObj.getClass()); 47 } 48 49 if (isAvailable(context) == false) { 50 throw new InvalidCommandException("Command is not available for this object"); 51 } 52 53 Editable eObj = (Editable)getCommandObject(context); 54 Editable rtnObj = null; 55 56 try { 57 rtnObj = eObj.reactivate(); 58 } catch(Exception e) { 59 throw new CommandException(e.getMessage()); 60 } 61 62 return rtnObj; 63 } 64 65 68 public String getName() { 69 70 return "Reactivate"; 71 } 72 73 76 public boolean isValidCommandObject(Object obj) { 77 return (obj instanceof Editable); 78 } 79 } | Popular Tags |