/** Returns a collection of session names. */
  Collection<String> getPoolNames() {

    return CollectionTools.collection(
        new TransformationIterator(pools()) {
          protected Object transform(Object next) {
            return ((ConnectionPoolAdapter) next).getName();
          }
        });
  }
示例#2
0
  /** From a collection of adapters extract the modelObjects. */
  protected Collection modelObjectsFrom(Collection adapters) {

    Iterator iterator =
        new TransformationIterator(adapters.iterator()) {

          protected Object transform(Object next) {
            return ((SCAdapter) next).getModel();
          }
        };
    return CollectionTools.collection(iterator);
  }
  protected void addField() {
    Iterator selectedFields = this.returningPolicy().updateFields();

    DefaultListChooserDialog dialog =
        RelationalDescriptorComponentFactory.buildReturningPolicyFieldDialog(
            (MWRelationalClassDescriptor) returningPolicy().getParent(),
            CollectionTools.collection(selectedFields),
            getWorkbenchContext(),
            "descriptor.relational.returningPolicy");

    dialog.show();

    if (dialog.wasConfirmed()) {
      MWColumn column = (MWColumn) dialog.selection();
      ((MWRelationalReturningPolicy) this.returningPolicy()).addUpdateField(column);
    }
  }
  public void testNappingHasFieldAssociationsProblem() {
    String problem = ProblemConstants.MAPPING_QUERY_KEY_ASSOCIATIONS_NOT_SPECIFIED;

    SimpleContactProject project = new SimpleContactProject();
    MWVariableOneToOneMapping mapping =
        (MWVariableOneToOneMapping) project.getPersonImplDescriptor().mappingNamed("contact");

    assertTrue(
        "The mapping should not have the problem: " + problem, !hasProblem(problem, mapping));

    Iterator associations = CollectionTools.collection(mapping.columnQueryKeyPairs()).iterator();
    while (associations.hasNext()) {
      mapping.removeColumnQueryKeyPair((MWColumnQueryKeyPair) associations.next());
    }

    assertTrue("The mapping should have the problem: " + problem, hasProblem(problem, mapping));
  }
 public static Collection getJ2CAdapterNames() {
   return CollectionTools.collection(j2cAdapterNames);
 }
    /**
     * Invoked when the user selects the Remove button.
     *
     * @param listSelectionModel The model containing the selected items
     */
    public void removeSelectedItems(ObjectListSelectionModel listSelectionModel) {
      Collection sessions = CollectionTools.collection(listSelectionModel.getSelectedValues());

      if (canRemoveSessions(sessions)) removeSessions(sessions);
    }