public UserPortalLoginModel() {
    setChangePasswordCommand(new UICommand("ChangePassword", this));

    setNewPassword(new EntityModel());
    setVerifyPassword(new EntityModel());

    EntityModel tempVar = new EntityModel();
    tempVar.setEntity(true);
    setIsENGINEUser(tempVar);
    EntityModel tempVar2 = new EntityModel();
    tempVar2.setEntity(true);
    setIsAutoConnect(tempVar2);
  }
  public void PostManage(java.util.ArrayList<network> networkList, ListModel model) {
    Collections.sort(networkList, new Linq.NetworkByNameComparer());

    java.util.ArrayList<EntityModel> items = new java.util.ArrayList<EntityModel>();
    for (network a : networkList) {
      if (!a.getname().equals("engine")) {
        EntityModel tempVar = new EntityModel();
        tempVar.setEntity(a);
        tempVar.setTitle(a.getname());
        items.add(tempVar);
      }
    }
    model.setItems(items);

    boolean noItems = items.isEmpty();

    java.util.ArrayList<network> networks = Linq.<network>Cast(getItems());
    java.util.ArrayList<EntityModel> selectedItems = new java.util.ArrayList<EntityModel>();
    for (EntityModel item : items) {
      network net = (network) item.getEntity();
      boolean value = false;
      for (network a : networks) {
        if (a.getId().equals(net.getId())) {
          value = true;
          break;
        }
      }
      item.setIsSelected(value);
      if (value) {
        selectedItems.add(item);
      }
    }

    model.setSelectedItems(selectedItems);

    UICommand tempVar2 = new UICommand("Cancel", this);
    tempVar2.setTitle("Cancel");
    tempVar2.setIsDefault(noItems);
    tempVar2.setIsCancel(true);
    model.getCommands().add(tempVar2);

    if (!noItems) {
      UICommand tempVar3 = new UICommand("OnManage", this);
      tempVar3.setTitle("OK");
      tempVar3.setIsDefault(true);
      model.getCommands().add(0, tempVar3);
    }
  }
Esempio n. 3
0
  public static <T> ArrayList<EntityModel> ToEntityModelList(ArrayList<T> list) {
    ArrayList<EntityModel> entityModelList = new ArrayList<EntityModel>();

    if (list != null) {
      for (Object item : list) {
        EntityModel model = new EntityModel();
        model.setEntity(item);
        entityModelList.add(model);
      }
    }

    return entityModelList;
  }
 private void addBondOptionIfMissing(
     String candidateOption, boolean doesBondHaveVmNetworkAttached) {
   if (doesBondHaveVmNetworkAttached && !BondMode.isBondModeValidForVmNetwork(candidateOption)) {
     return;
   }
   if (!pairForBondOption.containsKey(candidateOption)) {
     EntityModel<String> entityModel = new EntityModel<String>();
     entityModel.setEntity(candidateOption);
     Entry<String, EntityModel<String>> newPair =
         new KeyValuePairCompat<String, EntityModel<String>>("custom", entityModel); // $NON-NLS-1$
     bondOptions.add(newPair);
     pairForBondOption.put(candidateOption, newPair);
   }
 }
 @Override
 protected void addUsersToModel(VdcQueryReturnValue returnValue, Set<String> excludeUsers) {
   Iterable<DbUser> filteredUsers =
       Linq.where(
           (ArrayList<DbUser>) returnValue.getReturnValue(),
           new Linq.DbUserPredicate(getTargetDbUser()));
   for (DbUser dbUser : filteredUsers) {
     if (!excludeUsers.contains(dbUser.getExternalId())) {
       EntityModel tempVar2 = new EntityModel();
       tempVar2.setEntity(dbUser);
       getusers().add(tempVar2);
     }
   }
 }
  public ListModel getEntityListModel() {
    ListModel listModel = new ListModel();
    ArrayList arrayList = new ArrayList();

    for (Object object : (List) getEntity()) {
      EntityModel entityModel = new EntityModel();
      entityModel.setEntity(object);

      arrayList.add(entityModel);
    }
    listModel.setItems(arrayList);

    return listModel;
  }
  @Override
  protected void addGroupsToModel(VdcQueryReturnValue returnValue, Set<String> excludeUsers) {
    Iterable<DbGroup> filteredGroups =
        Linq.where(
            (ArrayList<DbGroup>) returnValue.getReturnValue(),
            new Linq.DbGroupPredicate(getTargetDbGroup()));

    for (DbGroup group : filteredGroups) {
      if (!excludeUsers.contains(group.getId().toString())) {
        DbUser dbUser = new DbUser();
        dbUser.setExternalId(group.getExternalId());
        dbUser.setFirstName(group.getName());
        dbUser.setLastName(""); // $NON-NLS-1$
        dbUser.setLoginName(""); // $NON-NLS-1$
        dbUser.setDomain(group.getDomain());
        dbUser.setNamespace(group.getNamespace());

        EntityModel entity = new EntityModel();
        entity.setEntity(dbUser);
        getgroups().add(entity);
      }
    }
  }
Esempio n. 8
0
  public static DiskModel DiskToModel(Disk disk) {
    DiskModel diskModel = new DiskModel();
    diskModel.setIsNew(true);
    diskModel.getAlias().setEntity(disk.getDiskAlias());

    if (disk.getDiskStorageType() == DiskStorageType.IMAGE) {
      DiskImage diskImage = (DiskImage) disk;
      EntityModel sizeEntity = new EntityModel();
      sizeEntity.setEntity(diskImage.getSizeInGigabytes());
      diskModel.setSize(sizeEntity);
      ListModel volumeList = new ListModel();
      volumeList.setItems(
          (diskImage.getvolume_type() == VolumeType.Preallocated
              ? new ArrayList<VolumeType>(Arrays.asList(new VolumeType[] {VolumeType.Preallocated}))
              : DataProvider.GetVolumeTypeList()));
      volumeList.setSelectedItem(diskImage.getvolume_type());
      diskModel.setVolumeType(volumeList);
    }

    diskModel.setDisk(disk);

    return diskModel;
  }