class FossologyFileHandler {

    public Release getStatusInFossology(String releaseId, User user, String clearingTeam) throws TException {
        final Release release;
        final ComponentService.Iface componentClient;

        try {
            componentClient = thriftClients.makeComponentClient();
            release = componentClient.getReleaseById(releaseId, user);
            assertNotNull(release);
        } catch (TException e) {
            log.error("cannot get release " + releaseId, e);
            throw e;
        }

        if (release.isSetFossologyId()) {
            int fossologyId = CommonUtils.toUnsignedInt(release.getFossologyId());

            boolean updateInDb = true;
            for (String allClearingTeam : getAllClearingTeams(release, clearingTeam)) {
                final FossologyStatus status = fossologyUploader.getStatusInFossology(fossologyId, allClearingTeam);
                setFossologyStatus(release, allClearingTeam, status);

                if (isError(status)) {
                    updateInDb = false;
                }
            }
            Optional<FossologyStatus> maxStatus = nullToEmptyMap(release.getClearingTeamToFossologyStatus())
                    .values()
                    .stream()
                    .max(FossologyStatus::compareTo);
            updateReleaseClearingState(release, maxStatus);

            if (updateInDb) {
                updateRelease(release, user, componentClient);
            }
        }

        getReleaseAndUnlockIt(releaseId, user, componentClient); // just unlockit

        return release;
    }

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

}