/**
   * Pozor, skonzumuje vstupny parameter a znehodnoti ho. Pouzit treba dalej navratovy objekt.
   *
   * @param configuration
   */
  public ConfigurationType process(ConfigurationType configuration) {
    // Vezme polozku pre BTEConfiguration
    ConfigurationType BTE = getBTE(configuration);
    // a zmeni zobrazenie typu cieloveho jazykoveho elementu na "key"
    BTE.getMappingOfTargetElement().setTargetElementName("key");
    BTE.getMappingOfTargetElement().setTargetNameType(TargetNameType.USER_DEFINED);

    configuration.getChildren().remove(BTE);

    // Naklonujem si strom (bez BTE)
    ConfigurationType clone = configuration.cloneBranch();
    // Vytvorim si wrapper pre annotatcne typy
    ConfigurationType annType = generateWrapperForType();
    // a vlozim ho pod BTE
    BTE.getChildren().add(annType);
    annType.setParent(BTE);
    // K nemu pripojim polozky, ktore mozu byt aplikovane na anotacny typ
    addAnnTypes(annType, configuration, BTE);

    // Obdobne pre vlastnost
    ConfigurationType property = generateWrapperForProperty();
    annType.getChildren().add(property);
    property.setParent(annType);
    // Tu mozu ist aj niektore polozky, ktore uz boli pridane pod annType,
    // preto sa spracuvaju a pridavaju klony - kopie
    addMethodTypes(property, clone, BTE);

    configuration.getChildren().add(BTE);

    // A nakoniec este spracuje mapovanie na nazvy
    processMapsTo(configuration);

    return configuration;
  }
 /**
  * Metoda prida z modelu pod propType ako potomkov polozky aplikovatelne na vlasnost.
  *
  * @param annType
  * @param model
  * @param BTE
  */
 private void addMethodTypes(
     ConfigurationType propType, ConfigurationType model, ConfigurationType BTE) {
   for (ConfigurationType child : model.getChildren()) {
     // Vyber poloziek, ktore maju medzi cielovymi jazykovymi elementami
     // metodu
     if (child.getMappingOfTargetElement().getTargetElements() != null
         && Arrays.asList(child.getMappingOfTargetElement().getTargetElements())
             .contains(ElementType.METHOD)) {
       propType.getChildren().add(child);
       child.setParent(propType);
       changeTravelerMeth(child, BTE);
     }
   }
   // Invalidacia modelu, pre istotu
   model.setChildren(new ArrayList<ConfigurationType>());
 }
 /**
  * Metoda pre spracovanie mapovania nazvov.
  *
  * @param model
  */
 private void processMapsTo(ConfigurationType model) {
   MapsTo mt = findMapsTo(model);
   if (mt != null) {
     // Ak sa najde anotacia MapsTo tak sa podla nej zmeni nazov
     model.getMappingOfConfigurationToXML().setName(mt.name());
     model.getMappingOfConfigurationToXML().setTypeName(mt.typeName());
   }
   for (ConfigurationType child : model.getChildren()) processMapsTo(child);
 }
 /**
  * Metoda prehlada strom a najde konfiguraciu pre BTEConfiguration
  *
  * @param configuration
  * @return
  */
 private ConfigurationType getBTE(ConfigurationType configuration) {
   for (ConfigurationType conf : configuration.getChildren()) {
     if (conf.getMappingOfConfigurationToSources()
         .getConfAnnotation()
         .equals(BTEConfiguration.class)) {
       return conf;
     }
   }
   throw new RuntimeException(
       "ERROR:: MetaProcessor: No Configuration for BTEConfiguration" + " was found.");
 }
 /**
  * Metoda prida z modelu pod annType ako potomkov polozky aplikovatelne na anotacny typ.
  *
  * @param annType
  * @param model
  * @param BTE
  */
 private void addAnnTypes(
     ConfigurationType annType, ConfigurationType model, ConfigurationType BTE) {
   for (ConfigurationType child : model.getChildren()) {
     // Vyber poloziek, ktore maju medzi cielovymi jazykovymi elementami
     // anotacny typ, pritom sa nesmiem spoliehat, ze getTargetElements
     // mi nevrati null
     if (child.getMappingOfTargetElement().getTargetElements() != null
         && (Arrays.asList(child.getMappingOfTargetElement().getTargetElements())
                 .contains(ElementType.ANNOTATION_TYPE)
             || Arrays.asList(child.getMappingOfTargetElement().getTargetElements())
                 .contains(ElementType.TYPE))) {
       annType.getChildren().add(child);
       child.setParent(annType);
       changeTravelerAnn(child, BTE);
     }
     // Ostatne sa nepridaju
   }
   // Invalidacia modelu, pre istotu
   model.setChildren(new ArrayList<ConfigurationType>());
 }