Package com.cxy.redisclient.domain

Examples of com.cxy.redisclient.domain.ContainerKey


 
  public ContainerKeyInfo() {
    super();
    this.id = -1;
    this.db = -1;
    this.container = new ContainerKey("");
  }
View Full Code Here


  public void setContainer(ContainerKey container) {
    this.container = container;
  }
  public void setContainer(ContainerKey container, String key) {
    String con = container == null?"":container.getContainerKey();
    this.container = new ContainerKey(con + key);
  }
View Full Code Here

import junit.framework.TestCase;

public class ExportTest extends TestCase {

  public void testExport() throws IOException {
    ExportService service = new ExportService("C:\\Users\\xinyu\\Desktop\\export", 5, 7, new ContainerKey(""));
    service.export();
  }
View Full Code Here

      }
    }else{
      Iterator<String> it = nodekeys.iterator();
      while (it.hasNext()) {
        String ckey = it.next().substring(length);
        ContainerKey containerKey = new ContainerKey(ckey);
        String container = containerKey.getContainerOnly();
       
        if (container.length() > 0) {
          NodeType nodeType = NodeType.CONTAINER;
 
          Node node = new Node(id, db, container, nodeType, order);
View Full Code Here

  }
 
  public String pasteContainer(int sourceId, int sourceDb, String sourceContainer, int targetId, int targetDb, String targetContainer, boolean copy, boolean overwritten) {
    Set<Node> nodes = listContainerAllKeys(sourceId, sourceDb, sourceContainer);
   
    if(sourceId == targetId && sourceDb == targetDb && targetContainer.equals(new ContainerKey(sourceContainer).getUpperContainer())){
      if(!copy)
        return null;
      if(sourceContainer.equals(""))
        return null;
      else {
        String target = new ContainerKey(sourceContainer).appendLastContainer(String.valueOf(System.currentTimeMillis()));
       
        for(Node node: nodes) {
          String targetKey = node.getKey().replaceFirst(sourceContainer, target);
          pasteKey(sourceId, sourceDb, node.getKey(), targetId, targetDb, targetKey, copy, overwritten);
        }
        return target;
      }
    } else {
      for(Node node: nodes) {
        String targetKey = targetContainer + new ContainerKey(node.getKey()).getRelativeContainer(sourceContainer);
        pasteKey(sourceId, sourceDb, node.getKey(), targetId, targetDb, targetKey, copy, overwritten);
      }
      return null;
    }
  }
View Full Code Here

    boolean changeTarget = false;
   
    if(sourceId == targetId && sourceDb == targetDb && sourceKey.equals(targetKey)) {
      if(!copy)
        return null;
      String key = new ContainerKey(sourceKey).getKeyOnly();
     
      String source = key + String.valueOf(System.currentTimeMillis());
      targetKey = sourceKey.replaceFirst(key, source);
      changeTarget = true;
    }
View Full Code Here

    TreeItem parent = item.getParentItem();
    if (item.getData(NODE_TYPE) == NodeType.CONTAINER) {
      String container = item.getText();
      if (info.getContainerStr() != null) {
        if (!flatView)
          info.setContainer(new ContainerKey(container + ":"
              + info.getContainerStr()));
        else
          info.setContainer(new ContainerKey(container
              + info.getContainerStr()));
      } else {
        if (!flatView)
          info.setContainer(new ContainerKey(container + ":"));
        else
          info.setContainer(new ContainerKey(container));
      }
      parseContainer(parent, info);
    } else if (item.getData(NODE_TYPE) == NodeType.DATABASE) {
      int db = (Integer) item.getData(NODE_ID);
      info.setDb(db);
View Full Code Here

      }
    }
  }

  private void exportOne(ContainerKeyInfo cinfo, String file, Item item) {
    ContainerKey containerKey = cinfo.getContainer();
   
    if (item instanceof TableItem) {
      NodeType type = (NodeType) item.getData(NODE_TYPE);
      if (type != NodeType.CONTAINER && type != NodeType.DATABASE) {
        String con = containerKey == null ? "" : containerKey
            .getContainerKey();
        containerKey = new ContainerKey(con + item.getText());
      }
    }

    ExportService service = new ExportService(file, cinfo.getId(),
        cinfo.getDb(), containerKey);
View Full Code Here

            break;
          }
        }
      } else {
        for (TreeItem dataItem : dataItems) {
          String containerOnly = new ContainerKey(container)
              .getContainerOnly();
          if (dataItem.getText().equals(containerOnly)) {
            tree.setSelection(dataItem);
            dbContainerTreeItemSelected(dataItem, false);
            dataItems = dataItem.getItems();
            dataItemSelected = dataItem;
            break;
          }
        }

        TableItem[] tableItems = table.getItems();
        for (TableItem tableItem : tableItems) {
          NodeType type = (NodeType) tableItem.getData(NODE_TYPE);
          String keyOnly = new ContainerKey(container).getKeyOnly();
          if (type != NodeType.SERVER && type != NodeType.DATABASE
              && type != NodeType.CONTAINER
              && tableItem.getText().equals(keyOnly)) {
            table.setSelection(tableItem);
            table.setFocus();
View Full Code Here

   
    final Button btnCheckButton1 = new Button(composite, SWT.CHECK);
    btnCheckButton1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    btnCheckButton1.setSelection(true);
    btnCheckButton1.setText(RedisClient.i18nFile.getText(I18nFile.RENAMESUB));
    final boolean isKey = new ContainerKey(oldContainer).isKey();
    if(isKey)
      btnCheckButton1.setVisible(false);
    else
      btnCheckButton1.setVisible(true);
   
View Full Code Here

TOP

Related Classes of com.cxy.redisclient.domain.ContainerKey

Copyright © 2018 www.massapicom. 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.