public static Direction getConnectionDirection(IActivity activity, IData data) {
    boolean inDirection = false;
    boolean outDirection = hasExceptionHandlers(activity, data);

    Iterator mappings = activity.findDataMappings(data, null);
    while (mappings.hasNext()) {
      IDataMapping mapping = (IDataMapping) mappings.next();
      if (mapping.getDirection().equals(Direction.IN)) {
        inDirection = true;
      } else {
        outDirection = true;
      }
    }
    if (inDirection) {

      if (outDirection) {
        return Direction.IN_OUT;
      } else {
        return Direction.IN;
      }
    } else {
      if (outDirection) {
        return Direction.OUT;
      } else {
        return null;
      }
    }
  }
 private void generateDefaultInMapping() {
   Iterator inMappings = getActivity().getAllInDataMappings();
   boolean matchFound = false;
   while (inMappings.hasNext()) {
     IDataMapping mapping = (IDataMapping) inMappings.next();
     if (mapping.getData().equals(getData())) {
       matchFound = true;
       break;
     }
   }
   if (!matchFound) {
     IDataMapping mapping =
         getActivity()
             .createDataMapping(getData().getId(), getData().getName(), getData(), Direction.IN);
     if (getActivity().isInteractive()) {
       mapping.setContext(PredefinedConstants.DEFAULT_CONTEXT);
     } else {
       mapping.setContext(PredefinedConstants.ENGINE_CONTEXT);
     }
   }
 }