// Path: src/main/java/org/trend/hgraph/util/FindCandidateEntities.java
// static boolean isFileExists(String fileName) {
//   File file = new File(fileName);
//   if (file.exists()) {
//     System.err.println("file:" + fileName
//         + " already exists, pls change to another filepath");
//     return true;
//   }
//   return false;
// }


import static org.trend.hgraph.util.FindCandidateEntities.isFileExists;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.NavigableMap;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.trend.hgraph.util;




/**
 * @author scott_miao
 *
 */
public class MoveEntities extends Configured implements Tool {

  protected MoveEntities(Configuration conf) {
    super(conf);
  }

  /* (non-Javadoc)
   * @see org.apache.hadoop.util.Tool#run(java.lang.String[])
   */
  @Override
  public int run(String[] args) throws Exception {
    if (null == args || args.length != 6) {
      System.err.println("not all 6 options given !!");
      printUsage();
      return -1;
    }

    String vFile = args[0];
    String eFile = args[1];
    String srcVt = args[2];
    String srcEt = args[3];
    String destVt = args[4];
    String destEt = args[5];

// Path: src/main/java/org/trend/hgraph/util/FindCandidateEntities.java
// static boolean isFileExists(String fileName) {
//   File file = new File(fileName);
//   if (file.exists()) {
//     System.err.println("file:" + fileName
//         + " already exists, pls change to another filepath");
//     return true;
//   }
//   return false;
// }


// Path: src/main/java/org/trend/hgraph/util/MoveEntities.java
import static org.trend.hgraph.util.FindCandidateEntities.isFileExists;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.NavigableMap;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.trend.hgraph.util;




/**
 * @author scott_miao
 *
 */
public class MoveEntities extends Configured implements Tool {

  protected MoveEntities(Configuration conf) {
    super(conf);
  }

  /* (non-Javadoc)
   * @see org.apache.hadoop.util.Tool#run(java.lang.String[])
   */
  @Override
  public int run(String[] args) throws Exception {
    if (null == args || args.length != 6) {
      System.err.println("not all 6 options given !!");
      printUsage();
      return -1;
    }

    String vFile = args[0];
    String eFile = args[1];
    String srcVt = args[2];
    String srcEt = args[3];
    String destVt = args[4];
    String destEt = args[5];

    if (!isFileExists(vFile)) {