Add function to ProjectType to get supported source types.

Required for https://github.com/zanata/zanata-server/pull/400
Lists.transform from guava supports transforming List<T> to List<F> and can be use in here since the function of the loop is just getting all type.getExtensions() into a list.
But as I said, if we've got guava dependency in API, otherwise, I'm fine with this.

Regards, 

Alex Eng 
Senior Software Engineer 
DID: +61 3514 8262 
Mobile: +614 2335 3457 
Email: aeng@redhat.com 

Red Hat, Asia-Pacific Pty Ltd 
Level 1, 193 North Quay 
Brisbane 4000 
Office: +61 7 3514 8100 
Fax: +61 7 3514 8199 
Website: www.redhat.com 

----- Original Message -----
From: "David Mason" <notifications@github.com>
To: "zanata/zanata-api" <zanata-api@noreply.github.com>
Cc: "Alex Eng" <aeng@redhat.com>
Sent: Wednesday, 6 August, 2014 5:44:55 PM
Subject: Re: [zanata-api] Add function to ProjectType to get supported source types. (#16)

> +                case File:
> +                    return fileProjectSourceFileTypes();
> +                default:
> +                    break;
> +            }
> +        }
> +        return Arrays.asList();
> +    }
> +
> +    private static List<String> fileProjectSourceFileTypes() {
> +        List<DocumentType> supported = Arrays.asList(XML_DOCUMENT_TYPE_DEFINITION,
> +                PLAIN_TEXT, IDML, HTML, OPEN_DOCUMENT_TEXT, OPEN_DOCUMENT_PRESENTATION,
> +                OPEN_DOCUMENT_GRAPHICS, SUBTITLE);
> +
> +        List<String> extensions = new ArrayList<String>();
> +        for (DocumentType type : supported) {

`Lists.transform` is a map operation, but this case need something more like bind since each `DocumentType` maps to a list of extensions, and we care about all of them (e.g. HTML documents have "htm" and "html").

---
Reply to this email directly or view it on GitHub:
https://github.com/zanata/zanata-api/pull/16/files#r15859870