Ejemplo n.º 1
0
  private void onSubmit(Map<String, String> map) {
    PersistedObject po = (PersistedObject) getDefaultModelObject();

    if (!editorService.validateNameUpdate(po, map)) {
      editor.showError(
          new StringResourceModel(po.isBean() ? "beanNotUnique" : "endpointNotUnique", this, null)
              .getString());
      RequestCycle.get().setResponsePage(this);
      return;
    }

    editorService.updatePersistedObject(po, map);

    RequestCycle.get()
        .setResponsePage(new ShowServiceAssemblyPage(sadao.find(po.getServiceAssembly().getId())));
  }
Ejemplo n.º 2
0
  @SuppressWarnings("serial")
  public BeanEditorPage(PersistedObject po) {
    if (po.getId() != null) {
      setDefaultModel(Models.domain(dao, po));
    } else {
      setDefaultModel(Models.model(po));
    }

    final ComponentType ct = componentService.getComponent(po.getComponentType());

    add(new Label("name", ct.getName()));
    add(new Label("namespace", ct.getNamespace()));

    ArrayList<AbstractType> fields = Lists.newArrayList();
    String name = ct.getName() + '.';

    if (po.isBean()) {
      BeanType bt = ct.getBean(po.getDeclaredType());
      name += bt.getClazz();
      fields.addAll(bt.getProperties());
    } else {
      EndpointType et = ct.getEndpoint(po.getDeclaredType());
      name += et.getName();
      fields.addAll(et.getAttributes());
      fields.addAll(et.getProperties());
    }

    FieldInfos fi = new FieldInfos(name, fields);

    editor =
        new EditorPanel("editor", po.getServiceAssembly(), fi, po.getDetachedValues()) {
          @Override
          public void onSubmit() {
            BeanEditorPage.this.onSubmit(getValues());
          }
        };
    add(editor);
  }