public void New() {
    if (getWindow() != null) {
      return;
    }

    ClusterNetworkModel clusterModel = new ClusterNetworkModel();
    setWindow(clusterModel);
    clusterModel.setTitle("New Logical Network");
    clusterModel.setHashName("new_logical_network");
    clusterModel.setIsNew(true);
    if (getEntity().getstorage_pool_id() != null) {
      AsyncQuery _asyncQuery = new AsyncQuery();
      _asyncQuery.setModel(clusterModel);
      _asyncQuery.asyncCallback =
          new INewAsyncCallback() {
            public void OnSuccess(Object model, Object result) {
              ClusterNetworkModel clusterNetworkModel = (ClusterNetworkModel) model;
              storage_pool dataCenter = (storage_pool) result;
              clusterNetworkModel.setDataCenterName(dataCenter.getname());
            }
          };
      AsyncDataProvider.GetDataCenterById(_asyncQuery, getEntity().getstorage_pool_id().getValue());
    }
    UICommand tempVar = new UICommand("OnSave", this);
    tempVar.setTitle("OK");
    tempVar.setIsDefault(true);
    clusterModel.getCommands().add(tempVar);

    UICommand tempVar2 = new UICommand("Cancel", this);
    tempVar2.setTitle("Cancel");
    tempVar2.setIsCancel(true);
    clusterModel.getCommands().add(tempVar2);
  }
  public void Manage() {
    if (getWindow() != null) {
      return;
    }

    Guid storagePoolId =
        (getEntity().getstorage_pool_id() != null)
            ? getEntity().getstorage_pool_id().getValue()
            : Guid.Empty;

    AsyncQuery _asyncQuery = new AsyncQuery();
    _asyncQuery.setModel(this);
    _asyncQuery.asyncCallback =
        new INewAsyncCallback() {
          public void OnSuccess(Object model, Object result) {
            ClusterNetworkListModel clusterNetworkListModel = (ClusterNetworkListModel) model;
            java.util.ArrayList<network> networkList = (java.util.ArrayList<network>) result;
            ListModel listModel = new ListModel();
            clusterNetworkListModel.setWindow(listModel);
            listModel.setTitle("Assign/Detach Networks");
            listModel.setHashName("assign_networks");
            clusterNetworkListModel.PostManage(networkList, listModel);
          }
        };
    AsyncDataProvider.GetNetworkList(_asyncQuery, storagePoolId);
  }
  @Override
  protected void SyncSearch() {
    if (getEntity() == null) {
      return;
    }

    super.SyncSearch();

    AsyncQuery _asyncQuery = new AsyncQuery();
    _asyncQuery.setModel(this);
    _asyncQuery.asyncCallback =
        new INewAsyncCallback() {
          public void OnSuccess(Object model, Object ReturnValue) {
            SearchableListModel searchableListModel = (SearchableListModel) model;
            searchableListModel.setItems(
                (java.util.ArrayList<network>)
                    ((VdcQueryReturnValue) ReturnValue).getReturnValue());
          }
        };

    VdsGroupQueryParamenters tempVar = new VdsGroupQueryParamenters(getEntity().getID());
    tempVar.setRefresh(getIsQueryFirstTime());
    Frontend.RunQuery(VdcQueryType.GetAllNetworksByClusterId, tempVar, _asyncQuery);
  }