use of jetbrains.buildServer.vcs.SingleVersionRepositoryStateAdapter in project teamcity-rest by JetBrains.
the class VcsRootInstance method setFieldValue.
public static void setFieldValue(final jetbrains.buildServer.vcs.VcsRootInstance rootInstance, final String field, final String newValue, @NotNull final BeanContext beanContext) {
if (LAST_VERSION_INTERNAL.equals(field) || (LAST_VERSION.equals(field) && StringUtil.isEmpty(newValue))) {
if (!StringUtil.isEmpty(newValue)) {
beanContext.getSingletonService(RepositoryStateManager.class).setRepositoryState(rootInstance, new SingleVersionRepositoryStateAdapter(newValue));
Loggers.VCS.info("Repository state is set to \"" + newValue + "\" via REST API call for " + rootInstance.describe(false) + " by " + beanContext.getSingletonService(PermissionChecker.class).getCurrentUserDescription());
} else {
beanContext.getSingletonService(RepositoryStateManager.class).setRepositoryState(rootInstance, new SingleVersionRepositoryStateAdapter((String) null));
Loggers.VCS.info("Repository state is reset via REST API call for " + rootInstance.describe(false) + " by " + beanContext.getSingletonService(PermissionChecker.class).getCurrentUserDescription());
}
return;
} else if (COMMIT_HOOK_MODE.equals(field)) {
boolean pollingMode = !Locator.getStrictBooleanOrReportError(newValue);
((VcsRootInstanceEx) rootInstance).setPollingMode(pollingMode);
Loggers.VCS.info("Poling mode is set to \"" + pollingMode + "\" via REST API call for " + rootInstance.describe(false) + " by " + beanContext.getSingletonService(PermissionChecker.class).getCurrentUserDescription());
return;
}
throw new NotFoundException("Setting of field '" + field + "' is not supported. Supported are: " + LAST_VERSION_INTERNAL + ", " + COMMIT_HOOK_MODE);
}
Aggregations