Exemplo 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);
  }
Exemplo n.º 2
0
  protected String getPeopleQueryArgumentName(Peoplequeryargument peoplequeryArgument) {

    /* The lpg argument definition contains the name of the people query argument. */
    LpgArgumentdef lpgArgumentDef = peoplequeryArgument.getLpgArgumentdef();
    /* Should always evaluate to true since a people query argument can only be created based on
     * an lpg argument definition */
    if (lpgArgumentDef != null) {
      return lpgArgumentDef.getName();
    }
    return null;
  }