X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fcom%2Findexdata%2Fmkjsf%2Ferrors%2FErrorCentral.java;h=b6bbd4787e320debf1742047e543dc781d82de16;hb=48ef3e8a3cd32eda3979082a7736cafd1862ae73;hp=5a0875ffb19622e3230bf9e7e77217a3d6696deb;hpb=ccb28ae8d5d46d29c40bd8b1637522c212b80636;p=mkjsf-moved-to-github.git diff --git a/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java b/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java index 5a0875f..b6bbd47 100644 --- a/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java +++ b/src/main/java/com/indexdata/mkjsf/errors/ErrorCentral.java @@ -4,7 +4,6 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; import javax.inject.Inject; import javax.inject.Named; @@ -12,28 +11,24 @@ import javax.inject.Named; import org.apache.log4j.Logger; import com.indexdata.mkjsf.config.ConfigurationReader; -import com.indexdata.mkjsf.pazpar2.data.Pazpar2Responses; +import com.indexdata.mkjsf.pazpar2.Pz2Service; -@Named("errors") @SessionScoped +@SessionScoped @Named public class ErrorCentral implements Serializable { private static final long serialVersionUID = -1658192041068396628L; private static Logger logger = Logger.getLogger(ErrorCentral.class); private ErrorHelper errorHelper = null; - - @Inject Pazpar2Responses pzresp; - @Inject ConfigurationReader configurator; + + @Inject ConfigurationReader configurator; private List configurationErrors = new ArrayList(); - public ErrorCentral() {} - - @PostConstruct - public void postConstruct() { - errorHelper = new ErrorHelper(configurator); - pzresp.setErrorHelper(errorHelper); + public ErrorCentral() { + logger.info("Instantiating ErrorCentral "+this); + errorHelper = new ErrorHelper(configurator); } - + public void addConfigurationError (ErrorInterface configError) { configError.setErrorHelper(errorHelper); configurationErrors.add(configError); @@ -44,11 +39,11 @@ public class ErrorCentral implements Serializable { } public boolean hasCommandErrors () { - return pzresp.hasApplicationError(); + return Pz2Service.get().getPzresp().hasApplicationError(); } public ErrorInterface getCommandError () { - return pzresp.getCommandError(); + return Pz2Service.get().getPzresp().getCommandError(); } /** @@ -62,6 +57,10 @@ public class ErrorCentral implements Serializable { public List getConfigurationErrors() { return configurationErrors; } + + public ErrorHelper getHelper () { + return errorHelper; + } }