/******************************************************************************* *******************************************************************************/ package at.gv.egiz.eaaf.core.impl.idp.process.spring.test.task; import java.io.IOException; import java.io.InputStream; import java.util.Objects; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import at.gv.egiz.eaaf.core.api.IRequest; import at.gv.egiz.eaaf.core.api.idp.process.ExecutionContext; import at.gv.egiz.eaaf.core.api.idp.process.Task; import at.gv.egiz.eaaf.core.exceptions.TaskExecutionException; /** * A dummy task simulating the retrieval of an IdentityLink. *

* Asynchonous *

* Requires context data: *

*

*

* Enriches context data with: *

*

* * @author tknall * */ @Service("GetIdentityLinkTask") public class GetIdentityLinkTask implements Task { private Logger log = LoggerFactory.getLogger(getClass()); @Override public IRequest execute(IRequest penReq, ExecutionContext executionContext) throws TaskExecutionException { Objects.requireNonNull(executionContext.get("bkuURL")); log.debug("Using bkuURL in order to retrieve IdentityLink."); try (InputStream in = getClass().getResourceAsStream("/process/spring/test/task/IdentityLink_Max_Mustermann.xml")) { executionContext.put("IdentityLink", IOUtils.toString(in, "UTF-8")); } catch (IOException e) { throw new TaskExecutionException(null, "", e); } return null; } }