protected void parseActivityInputMap()

in taverna-scufl2-t2flow/src/main/java/org/apache/taverna/scufl2/translator/t2flow/T2FlowParser.java [545:586]


	protected void parseActivityInputMap(
			org.apache.taverna.scufl2.xml.t2flow.jaxb.Map inputMap)
			throws ReaderException {
		for (Mapping mapping : inputMap.getMap()) {
			String fromProcessorOutput = mapping.getFrom();
			String toActivityOutput = mapping.getTo();
			ProcessorInputPortBinding processorInputPortBinding = new ProcessorInputPortBinding();

			InputProcessorPort inputProcessorPort = findNamed(parserState.get()
					.getCurrentProcessor().getInputPorts(), fromProcessorOutput);
			if (inputProcessorPort == null) {
				String message = "Invalid input port binding, "
						+ "unknown processor port: " + fromProcessorOutput
						+ "->" + toActivityOutput + " in "
						+ parserState.get().getCurrentProcessor();
				if (isStrict())
					throw new ReaderException(message);
				logger.warning(message);
				continue;
			}

			InputActivityPort inputActivityPort = parserState.get()
					.getCurrentActivity().getInputPorts()
					.getByName(toActivityOutput);
			if (inputActivityPort == null) {
				inputActivityPort = new InputActivityPort();
				inputActivityPort.setName(toActivityOutput);
				inputActivityPort.setParent(parserState.get()
						.getCurrentActivity());
				parserState.get().getCurrentActivity().getInputPorts()
						.add(inputActivityPort);
			}

			if (inputActivityPort.getDepth() == null)
				inputActivityPort.setDepth(inputProcessorPort.getDepth());

			processorInputPortBinding.setBoundActivityPort(inputActivityPort);
			processorInputPortBinding.setBoundProcessorPort(inputProcessorPort);
			parserState.get().getCurrentProcessorBinding()
					.getInputPortBindings().add(processorInputPortBinding);
		}
	}