44import com .box .l10n .mojito .entity .TMTextUnit ;
55import com .box .l10n .mojito .entity .TMTextUnitVariantComment ;
66import com .box .l10n .mojito .service .tm .TMTextUnitRepository ;
7- import com .google .common .io .CharStreams ;
8- import java .io .IOException ;
97import java .util .HashMap ;
10- import java .util .List ;
118import java .util .Map ;
129import java .util .Set ;
1310import net .sf .okapi .common .Event ;
1613import net .sf .okapi .common .pipeline .annotations .StepParameterMapping ;
1714import net .sf .okapi .common .pipeline .annotations .StepParameterType ;
1815import net .sf .okapi .common .resource .ITextUnit ;
19- import net .sf .okapi .common .resource .RawDocument ;
2016import net .sf .okapi .common .resource .TextContainer ;
2117import org .slf4j .Logger ;
2218import org .slf4j .LoggerFactory ;
2723 * @author aloison
2824 */
2925@ Configurable
30- public class IntegrityCheckStep extends BasePipelineStep {
26+ public class TextUnitIntegrityCheckStep extends BasePipelineStep {
3127
3228 /** Logger */
33- static Logger logger = LoggerFactory .getLogger (IntegrityCheckStep .class );
29+ static Logger logger = LoggerFactory .getLogger (TextUnitIntegrityCheckStep .class );
3430
3531 @ Autowired TMTextUnitRepository tmTextUnitRepository ;
3632
@@ -39,50 +35,22 @@ public class IntegrityCheckStep extends BasePipelineStep {
3935 Map <Long , Set <TextUnitIntegrityChecker >> textUnitIntegrityCheckerMap = new HashMap <>();
4036
4137 private LocaleId targetLocale ;
42- private RawDocument rawDocument ;
4338
4439 @ SuppressWarnings ("deprecation" )
4540 @ StepParameterMapping (parameterType = StepParameterType .TARGET_LOCALE )
4641 public void setTargetLocale (LocaleId targetLocale ) {
4742 this .targetLocale = targetLocale ;
4843 }
4944
50- @ StepParameterMapping (parameterType = StepParameterType .INPUT_RAWDOC )
51- public void setInputDocument (RawDocument rawDocument ) {
52- this .rawDocument = rawDocument ;
53- }
54-
5545 @ Override
5646 public String getName () {
57- return "Integrity Check" ;
47+ return "Text Unit Integrity Check" ;
5848 }
5949
6050 @ Override
6151 public String getDescription () {
6252 return "Updates the TM with the extracted new/changed variants."
63- + " Expects: raw document. Sends back: original events." ;
64- }
65-
66- @ Override
67- protected Event handleStartDocument (Event event ) {
68- logger .debug ("Check integrity of document" );
69-
70- String documentContent = null ;
71- try {
72- documentContent = CharStreams .toString (rawDocument .getReader ());
73- } catch (IOException e ) {
74- logger .error ("Error reading document content" , e );
75- throw new RuntimeException ("Error reading document content" , e );
76- }
77-
78- // TODO(P1): do not hardcode the type here
79- List <DocumentIntegrityChecker > documentIntegrityCheckers =
80- integrityCheckerFactory .getDocumentCheckers ("xliff" );
81- for (DocumentIntegrityChecker checker : documentIntegrityCheckers ) {
82- checker .check (documentContent );
83- }
84-
85- return super .handleStartDocument (event );
53+ + " Expects: Text unit events. Sends back: original events." ;
8654 }
8755
8856 @ Override
0 commit comments