Ejemplo n.º 1
0
  public void addArgument(IPeopleQueryArgument argument) {

    if (getArgumentMap().containsKey(argument.getName())) {
      throw new RuntimeException(
          "There is already exists an argument with name "
              + argument.getName()
              + " within the people query.");
    }

    List<Peoplequeryargument> peopleQueryArgEntities = peopleQueryEntity.getPeoplequeryarguments();

    /* If the people query doesn't contain any arguments yet the list
     * of people query arguments is null.
     */
    if (peopleQueryArgEntities == null) {
      peopleQueryArgEntities = new ArrayList<Peoplequeryargument>();
      peopleQueryEntity.setPeoplequeryarguments(peopleQueryArgEntities);
    }

    Peoplequeryargument peopleQueryArgEntity = (Peoplequeryargument) argument.getAdaptee();
    /*
     * There is a bidirectional relation between people
     * query entities and people query argument entities consequently
     * both sides of the relationship have to be set.
     */
    peopleQueryArgEntities.add(peopleQueryArgEntity);
    peopleQueryArgEntity.setPeoplequeryBean(peopleQueryEntity);
  }