private Set<PortableParameterDefinition> convertWorkItemParameters(
     final Set<ParameterDefinition> parameters) {
   final Set<PortableParameterDefinition> pps = new HashSet<PortableParameterDefinition>();
   for (ParameterDefinition pd : parameters) {
     final DataType pdt = pd.getType();
     PortableParameterDefinition ppd = null;
     if (pdt instanceof BooleanDataType) {
       ppd = new PortableBooleanParameterDefinition();
     } else if (pdt instanceof FloatDataType) {
       ppd = new PortableFloatParameterDefinition();
     } else if (pdt instanceof IntegerDataType) {
       ppd = new PortableIntegerParameterDefinition();
     } else if (pdt instanceof ObjectDataType) {
       ppd = new PortableObjectParameterDefinition();
       final PortableObjectParameterDefinition oppd = (PortableObjectParameterDefinition) ppd;
       final ObjectDataType odt = (ObjectDataType) pdt;
       oppd.setClassName(odt.getClassName());
     } else if (pd.getType() instanceof StringDataType) {
       ppd = new PortableStringParameterDefinition();
     }
     if (ppd != null) {
       ppd.setName(pd.getName());
       pps.add(ppd);
     }
   }
   return pps;
 }
  protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    composite.setLayout(gridLayout);

    Work work = (Work) getValue();

    Label nameLabel = new Label(composite, SWT.NONE);
    nameLabel.setText("Name: ");
    Text nameText = new Text(composite, SWT.NONE);
    nameText.setEditable(false);
    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    nameText.setLayoutData(gridData);
    String name = work.getName();
    nameText.setText(name == null ? "" : name);

    Set<ParameterDefinition> parameters = workDefinition.getParameters();
    for (ParameterDefinition param : parameters) {
      Label label = new Label(composite, SWT.NONE);
      label.setText(param.getName() + ": ");
      Text text = new Text(composite, SWT.NONE);
      gridData = new GridData();
      gridData.grabExcessHorizontalSpace = true;
      gridData.horizontalAlignment = GridData.FILL;
      text.setLayoutData(gridData);
      texts.put(param.getName(), text);
      Object value = work.getParameter(param.getName());
      text.setText(value == null ? "" : value.toString());
    }

    return composite;
  }
Beispiel #3
0
 public Work getWork() {
   if (work == null) {
     work = new WorkImpl();
     Work sourceWork = getDefinition().getWork();
     work.setName(sourceWork.getName());
     for (ParameterDefinition pd : sourceWork.getParameterDefinitions()) {
       work.addParameterDefinition(new ParameterDefinitionImpl(pd.getName(), pd.getType()));
     }
     for (Entry<String, Object> entry : sourceWork.getParameters().entrySet()) {
       work.setParameter(entry.getKey(), entry.getValue());
     }
     work.setParameter("NodeName", getName());
     work.setParameter(
         PeopleAssignmentHelper.BUSINESSADMINISTRATOR_ID, TableItem.getPlannerRoles(this));
   }
   return work;
 }