class FileResourceConverter extends ResourceConverterImpl<FileResource, ClientFile> {

    @Override
    protected ClientFile resourceSpecificFieldsToClient(ClientFile client, FileResource serverObject, ToClientConversionOptions options) {
        String type;
        if (serverObject.isReference()){
            FileResource referenced = (FileResource)repositoryService.getResource(null, serverObject.getReferenceURI());
            type = referenced.getFileType();
        } else {
            type = serverObject.getFileType();
        }
        ClientFile.FileType clientFileType;
        try{
            clientFileType = ClientFile.FileType.valueOf(type);
        }catch (Exception e){
            // if no appropriate client type in an enum, then let it be unspecified
            clientFileType  = ClientFile.FileType.unspecified;
        }
        client.setType(clientFileType);
        return client;
    }

}