protected String runActualizeBuildTypes()

in tcbot-teamcity-ignited/src/main/java/org/apache/ignite/ci/teamcity/ignited/buildtype/BuildTypeSync.java [152:190]


    protected String runActualizeBuildTypes(int srvIdMaskHigh, String projectId, ITeamcityConn conn) {
        Map<String, Boolean> buildTypeIds = buildTypeRefDao.allBuildTypeIds(srvIdMaskHigh, projectId);

        int updated = 0;
        int removed = 0;

        for (Map.Entry<String, Boolean> entry : buildTypeIds.entrySet()) {
            String id = entry.getKey();
            boolean rmv = entry.getValue();

            if (rmv)
                removed += markRemoved(srvIdMaskHigh, id) ? 1 : 0;
            else {
                try {
                    BuildTypeFull buildType = conn.getBuildType(id);

                    BuildTypeCompacted exBuildType = buildTypeDao.getFatBuildType(srvIdMaskHigh, id);

                    updated += (buildTypeDao.saveBuildType(srvIdMaskHigh, buildType, exBuildType) != null) ? 1 : 0;
                } catch (Exception e) {
                    if (Throwables.getRootCause(e) instanceof FileNotFoundException) {
                        logger.info("Loading buildType [" + id + "] for server [" + conn.serverCode() + "] failed:" +
                            e.getMessage(), e);

                        removed += markRemoved(srvIdMaskHigh, id) ? 1 : 0;
                    } else
                        throw ExceptionUtil.propagateException(e);
                }
            }

        }

        if (updated != 0 || removed != 0)
            actualizeSavedCompositeBuildTypesIds(srvIdMaskHigh, projectId);

        return "BuildTypes updated " + updated +
            (removed == 0 ? "" : " and mark as removed " + removed) +
            " from " + buildTypeIds.size() + " requested";
    }