View Javadoc
1   package org.kuali.coeus.s2sgen.impl.validate;
2   
3   import org.kuali.coeus.propdev.api.s2s.S2sErrorContract;
4   import org.kuali.coeus.propdev.api.s2s.S2sErrorService;
5   import org.kuali.coeus.s2sgen.api.core.AuditError;
6   
7   import org.springframework.beans.factory.annotation.Autowired;
8   import org.springframework.beans.factory.annotation.Qualifier;
9   import org.springframework.stereotype.Component;
10  
11  @Component("s2SErrorHandlerService")
12  public class S2SErrorHandlerServiceImpl implements S2SErrorHandlerService {
13  
14      @Autowired
15      @Qualifier("s2sErrorService")
16      private S2sErrorService s2sErrorService;
17  
18      @Override
19      public AuditError getError(String key) {
20          final S2sErrorContract s2sError = s2sErrorService.findS2sErrorByKey(key);
21          return s2sError == null ? new AuditError(AuditError.NO_FIELD_ERROR_KEY, key + " is not valid", AuditError.GG_LINK) :
22                  new AuditError(s2sError.getKey(), s2sError.getMessage(), s2sError.getLink());
23      }
24  }