Package edu.isi.karma.controller.command.worksheet.selection

Source Code of edu.isi.karma.controller.command.worksheet.selection.RefreshSelectionCommandFactory

package edu.isi.karma.controller.command.worksheet.selection;

import javax.servlet.http.HttpServletRequest;

import org.json.JSONArray;
import org.json.JSONException;

import edu.isi.karma.controller.command.Command;
import edu.isi.karma.controller.command.JSONInputCommandFactory;
import edu.isi.karma.rep.Workspace;
import edu.isi.karma.util.CommandInputJSONUtil;
import edu.isi.karma.webserver.KarmaException;

public class RefreshSelectionCommandFactory extends JSONInputCommandFactory {

  private enum Arguments {
    worksheetId, hNodeId, selectionName
  }
 
  @Override
  public Command createCommand(JSONArray inputJson, Workspace workspace)
      throws JSONException, KarmaException {
    String worksheetId = CommandInputJSONUtil.getStringValue(Arguments.worksheetId.name(), inputJson);
    String selectionName = CommandInputJSONUtil.getStringValue(Arguments.selectionName.name(), inputJson);
    String hNodeId = CommandInputJSONUtil.getStringValue(Arguments.hNodeId.name(), inputJson);
    Command cmd = new RefreshSelectionCommand(getNewId(workspace), worksheetId, selectionName, hNodeId);
    cmd.setInputParameterJson(inputJson.toString());
    return cmd;
  }

  @Override
  public Command createCommand(HttpServletRequest request, Workspace workspace) {
    return null;
  }

  @Override
  public Class<? extends Command> getCorrespondingCommand() {
    return RefreshSelectionCommand.class;
  }

}
TOP

Related Classes of edu.isi.karma.controller.command.worksheet.selection.RefreshSelectionCommandFactory

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.