/**
   * Allows to remove unset features from the model.
   *
   * <p>To guarantee insertion order in the wizard, one can preset all the values in {@link
   * #presetServiceValues(AbstractEndpoint)}. The insertion order must respect the one in XML
   * schema.
   *
   * <p>This method allows to remove the values that were not set or that should not be written.
   *
   * @param ae
   * @param features
   */
  protected void hackEmfModel(AbstractEndpoint ae, EStructuralFeature... features) {

    if (features == null) return;

    for (EStructuralFeature feature : features) {
      if (feature.isUnsettable()) continue;

      Object value = ae.eGet(feature);
      if (value == null || value instanceof String && StringUtils.isEmpty((String) value))
        ae.eSet(feature, null);
    }
  }
  /*
   * (non-Javadoc)
   * @see com.ebmwebsourcing.petals.services.su.wizards.AbstractServiceUnitWizard
   * #performLastActions(org.eclipse.core.resources.IFolder, com.sun.java.xml.ns.jbi.AbstractEndpoint,
   * org.eclipse.core.runtime.IProgressMonitor)
   */
  @Override
  protected IStatus performLastActions(
      IFolder resourceDirectory, AbstractEndpoint ae, IProgressMonitor monitor) {

    ae.eSet(Cdk5Package.Literals.CDK5_CONSUMES__OPERATION, this.settings.invokedOperation);
    Cdk5Utils.setMep(ae, this.settings.invocationMep);

    return Status.OK_STATUS;
  }
  /*
   * (non-Javadoc)
   * @see com.ebmwebsourcing.petals.services.su.wizards.AbstractServiceUnitWizard
   * #predefineJbiValues(com.sun.java.xml.ns.jbi.AbstractEndpoint)
   */
  @Override
  public void presetServiceValues(AbstractEndpoint ae) {
    ae.setInterfaceName(new QName("http://petals.ow2.org/components/mail/version-3", "Mail"));
    ae.setServiceName(new QName("http://petals.ow2.org/components/mail/version-3", "change-it"));

    Cdk5Utils.setInitialProvidesValues((Provides) ae);
    ae.eSet(Cdk5Package.Literals.CDK5_PROVIDES__WSDL, "MailService.wsdl");

    ae.eSet(MailPackage.Literals.MAIL_PROVIDES__SCHEME, Scheme.SMTP);
    ae.eSet(MailPackage.Literals.MAIL_PROVIDES__HOST, "");
    ae.eSet(MailPackage.Literals.MAIL_PROVIDES__PORT, 25);
    ae.eSet(MailPackage.Literals.MAIL_PROVIDES__TO, "");
    ae.eSet(MailPackage.Literals.MAIL_PROVIDES__FROM, "");
    ae.eSet(MailPackage.Literals.MAIL_PROVIDES__SEND_MODE, SendMode.CONTENT_AND_ATTACHMENTS);
  }