public Object getElement(SchemaEntry schemaEntry) {

    String elementName = schemaEntry.getElementName();
    String elementParentName = schemaEntry.getElementParentName();

    if (elementName.compareTo(Tag.elementoParam) == 0) {

      return (String) schemaEntry.getInstanceElement();
    }

    if (elementName.compareTo(Tag.guard) == 0) {

      String guard = ((ElementoMessaggio) schemaEntry.getParent().getInstanceElement()).getGuard();
      if (guard.equals("")) return null;
      return guard;
    }

    if (elementName.compareTo(Tag.operations) == 0) {
      String operation =
          ((ElementoMessaggio) schemaEntry.getParent().getInstanceElement()).getOperations();

      if (operation.equals("")) return null;
      return operation;
    }

    if (elementName.compareTo(Tag.onEntryCode) == 0) {

      return ((ElementoStato) schemaEntry.getParent().getInstanceElement()).getOnEntryCode();
    }

    if (elementName.compareTo(Tag.onExitCode) == 0) {

      return ((ElementoStato) schemaEntry.getParent().getInstanceElement()).getOnExitCode();
    }

    return null;
  }
  public SimpleValue getAttributeValue(SchemaEntry schemaEntry, String attributeName) {

    String elementName = schemaEntry.getElementName();
    Object instanceElement = schemaEntry.getInstanceElement();
    Object parentInstanceElement = null;
    if (schemaEntry.getParent() != null)
      parentInstanceElement = schemaEntry.getParent().getInstanceElement();

    if ((elementName.compareTo(Tag.listaThread) == 0)
        && (attributeName.compareTo(Tag.att_LT_processo) == 0))
      return new SimpleValue(
          (Tag.att_EPR_pre_id + ((ListaThread) instanceElement).getIdProcesso()));

    if ((elementName.compareTo(Tag.threadElement) == 0)
        && (attributeName.compareTo(Tag.att_TE_nome) == 0))
      return new SimpleValue((((ThreadElement) instanceElement).getNomeThread()));

    if ((elementName.compareTo(Tag.threadElement) == 0)
        && (attributeName.compareTo(Tag.att_TE_numStato) == 0))
      return new SimpleValue(
          (new Long(((ThreadElement) instanceElement).getNumStato()).toString()));

    if ((elementName.compareTo(Tag.elementoStato) == 0)
        && (attributeName.compareTo(Tag.att_EST_id) == 0))
      return new SimpleValue((Tag.att_EST_pre_id + ((ElementoStato) instanceElement).getId()));

    if ((elementName.compareTo(Tag.elementoStato) == 0)
        && (attributeName.compareTo(Tag.att_EST_tipo) == 0))
      return new SimpleValue((((ElementoStato) instanceElement).getTipo()));

    if ((elementName.compareTo(Tag.elementoStato) == 0)
        && (attributeName.compareTo(Tag.att_EST_nome) == 0))
      return new SimpleValue((((ElementoStato) instanceElement).getName()));

    if ((elementName.compareTo(Tag.elementoMessaggio) == 0)
        && (attributeName.compareTo(Tag.att_EME_tipo) == 0))
      return new SimpleValue((((ElementoMessaggio) instanceElement).getTipo()));

    if ((elementName.compareTo(Tag.elementoMessaggio) == 0)
        && (attributeName.compareTo(Tag.att_EME_nome) == 0))
      return new SimpleValue((((ElementoMessaggio) instanceElement).getName()));

    if ((elementName.compareTo(Tag.elementoMessaggio) == 0)
        && (attributeName.compareTo(Tag.att_EME_flussodiretto) == 0))
      return new SimpleValue((((ElementoMessaggio) instanceElement).getFlussoDiretto()));

    if ((elementName.compareTo(Tag.elementoMessaggio) == 0)
        && (attributeName.compareTo(Tag.att_EME_sendReceive) == 0))
      return new SimpleValue((((ElementoMessaggio) instanceElement).getSendReceive()));

    if ((elementName.compareTo(Tag.elementoMessaggio) == 0)
        && (attributeName.compareTo(Tag.att_EME_rff) == 0))
      return new SimpleValue((((ElementoMessaggio) instanceElement).getMsgRRF()));

    if ((elementName.compareTo(Tag.elementoMessaggio) == 0)
        && (attributeName.compareTo(Tag.att_EME_id) == 0))
      return new SimpleValue((Tag.att_EME_pre_id + ((ElementoMessaggio) instanceElement).getId()));

    if ((elementName.compareTo(Tag.elementoStatoFrom) == 0)
        && (attributeName.compareTo(Tag.att_ESFrom_idref) == 0))
      return new SimpleValue(
          (Tag.att_EST_pre_id
              + ((ElementoMessaggio) parentInstanceElement).getElementFrom().getId()));

    if ((elementName.compareTo(Tag.elementoStatoTo) == 0)
        && (attributeName.compareTo(Tag.att_ESTo_idref) == 0))
      return new SimpleValue(
          (Tag.att_EST_pre_id
              + ((ElementoMessaggio) parentInstanceElement).getElementTo().getId()));

    return null;
  }