Example #1
0
  @Override
  public void fillSlotValues(
      ChunkTypeRequest mutableRequest,
      IIdentifier identifier,
      IChunk encodedChunk,
      ChunkTypeRequest originalSearchRequest) {
    String[] kinds = _currentKindMap.get(identifier);

    if (kinds != null)
      for (String kind : kinds)
        try {
          // attempt to resolve it..
          IChunkType chunkType =
              encodedChunk.getModel().getDeclarativeModule().getChunkType(kind).get();

          Object kindValue = kind;
          if (chunkType != null) {
            if (LOGGER.isDebugEnabled())
              LOGGER.debug("Got chunktype " + chunkType + " for " + kind);
            kindValue = chunkType;
          } else if (LOGGER.isDebugEnabled())
            LOGGER.debug("No chunktype matching " + kind + " could be found, using string value");

          if (kindMatchesPattern(originalSearchRequest, kindValue)) {
            mutableRequest.addSlot(new BasicSlot(IAuralModule.KIND_SLOT, kindValue));
            return;
          }
        } catch (Exception e) {
          throw new RuntimeException("Failed to get kind ", e);
        }
  }