class FossologyFileHandler {

    public RequestStatus sendToFossology(String releaseId, User user, String clearingTeam) throws TException {
        Release release;
        final ComponentService.Iface componentClient = thriftClients.makeComponentClient();

        release = getReleaseAndUnlockIt(releaseId, user, componentClient);

        Set<Attachment> sourceAttachments = getSourceAttachment(releaseId, user, componentClient);

        if (sourceAttachments.size() != 1) {
            log.error("release " + releaseId + " does not have a single source attachment");
            return RequestStatus.FAILURE; //TODO return a summary and better fitting status
        }

        final Attachment attachment = getFirst(sourceAttachments);
        final FilledAttachment filledAttachment = fillAttachment(attachment);

        if (!release.isSetFossologyId()) {
            /* send the attachment as a new upload */
            AttachmentContent attachmentContent = filledAttachment.getAttachmentContent();
            return sendToFossologyNewUpload(release, user, clearingTeam, attachmentContent, componentClient);
        } else {
            if (!checkSourceAttachment(release, filledAttachment)) {
                return RequestStatus.FAILURE; // TODO summary
            } else {
                /* duplicate the old upload making it visible for clearingTeam */
                return sendToFossologyExistingUpload(release, user, clearingTeam, componentClient);
            }
        }
    }

    @Autowired public  FossologyFileHandler(AttachmentConnector attachmentConnector, FossologyUploader fossologyUploader, ThriftClients thriftClients);

}