/*
 Script to activate the XLIFF 1.2 filter
 */
DECLARE
  tcount INTEGER;
BEGIN
  SELECT count(filterInfoId)
  INTO tcount
  FROM filterInfos
  WHERE name LIKE 'XLIFF 1.2 File Type' AND filterInfoId = 72;

  IF (nvl(tcount, 0) = 0)
  THEN
    dbms_output.put_line('-->Activating XLIFF 1.2 filter');

    INSERT INTO filterInfos
    (filterInfoId, name, filterClass, type)
    VALUES
      (72, 'XLIFF 1.2 File Type', 'com.idiominc.ws.filters.fts.FSXLIFFv1_2ProxyFilter', 2);

    INSERT INTO mediaTypes
    (mediaTypeId, mediaType, description, isText, defaultExtension, externalMediaType, filterInfoId) VALUES
    (46, 'text/xlif', 'XLIFF 1.2 File', 1, 'xlif', 'text/xlif', 72);

    INSERT INTO mediaTypeMappings (path, extension, mediaTypeId) VALUES
    ('', 'xlif', 46);
  ELSE
    dbms_output.put_line('-->XLIFF 1.2 filter already activated');
  END IF;
END;
/
commit;