Function bodies 69 total
com.accountabilityatlas.videoservice.config.LenientJwtAuthenticationFilter.doFilterInternal method · java · L36-L58 (23 LOC)src/main/java/com/accountabilityatlas/videoservice/config/LenientJwtAuthenticationFilter.java
protected void doFilterInternal(
@NonNull HttpServletRequest request,
@NonNull HttpServletResponse response,
@NonNull FilterChain filterChain)
throws ServletException, IOException {
String authHeader = request.getHeader(HttpHeaders.AUTHORIZATION);
if (authHeader != null && authHeader.startsWith(BEARER_PREFIX)) {
String token = authHeader.substring(BEARER_PREFIX.length());
try {
Jwt jwt = jwtDecoder.decode(token);
SecurityContextHolder.getContext().setAuthentication(new JwtAuthenticationToken(jwt));
} catch (JwtException e) {
SecurityContextHolder.clearContext();
}
}
try {
filterChain.doFilter(request, response);
} finally {
SecurityContextHolder.clearContext();
}
}com.accountabilityatlas.videoservice.config.SqsConfig.sqsTemplate method · java · L37-L46 (10 LOC)src/main/java/com/accountabilityatlas/videoservice/config/SqsConfig.java
public SqsTemplate sqsTemplate(SqsAsyncClient sqsAsyncClient, ObjectMapper objectMapper) {
return SqsTemplate.builder()
.sqsAsyncClient(sqsAsyncClient)
.configureDefaultConverter(
converter -> {
converter.setObjectMapper(objectMapper);
converter.setPayloadTypeHeaderValueFunction(message -> null);
})
.build();
}com.accountabilityatlas.videoservice.config.SqsConfig.sqsMessagingMessageConverter method · java · L54-L59 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/config/SqsConfig.java
public SqsMessagingMessageConverter sqsMessagingMessageConverter(ObjectMapper objectMapper) {
SqsMessagingMessageConverter converter = new SqsMessagingMessageConverter();
converter.setObjectMapper(objectMapper);
converter.setPayloadTypeMapper(message -> null);
return converter;
}com.accountabilityatlas.videoservice.event.ModerationEventHandler.handleModerationEvent method · java · L28-L33 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/event/ModerationEventHandler.java
public void handleModerationEvent(ModerationEvent event) {
switch (event) {
case VideoApprovedEvent approved -> handleVideoApproved(approved);
case VideoRejectedEvent rejected -> handleVideoRejected(rejected);
}
}com.accountabilityatlas.videoservice.event.ModerationEventHandler.handleVideoApproved method · java · L35-L42 (8 LOC)src/main/java/com/accountabilityatlas/videoservice/event/ModerationEventHandler.java
private void handleVideoApproved(VideoApprovedEvent event) {
log.info(
"Received VideoApproved event from SQS: videoId={}, reviewerId={}",
event.videoId(),
event.reviewerId());
videoService.updateVideoStatus(event.videoId(), VideoStatus.APPROVED, null);
log.info("Updated video {} status to APPROVED", event.videoId());
}com.accountabilityatlas.videoservice.event.ModerationEventHandler.handleVideoRejected method · java · L44-L52 (9 LOC)src/main/java/com/accountabilityatlas/videoservice/event/ModerationEventHandler.java
private void handleVideoRejected(VideoRejectedEvent event) {
log.info(
"Received VideoRejected event from SQS: videoId={}, reviewerId={}, reason={}",
event.videoId(),
event.reviewerId(),
event.reason());
videoService.updateVideoStatus(event.videoId(), VideoStatus.REJECTED, event.reason());
log.info("Updated video {} status to REJECTED (reason: {})", event.videoId(), event.reason());
}com.accountabilityatlas.videoservice.event.VideoEventPublisher.publishVideoSubmitted method · java · L42-L70 (29 LOC)src/main/java/com/accountabilityatlas/videoservice/event/VideoEventPublisher.java
public void publishVideoSubmitted(
Video video, String submitterTrustTier, List<UUID> locationIds) {
VideoSubmittedEvent event =
new VideoSubmittedEvent(
video.getId(),
video.getSubmittedBy(),
submitterTrustTier,
video.getTitle(),
video.getAmendments().stream().map(Amendment::name).collect(Collectors.toSet()),
locationIds,
Instant.now());
log.info(
"Publishing VideoSubmitted event for video {} to SQS queue {}",
video.getId(),
videoEventsQueue);
try {
sqsTemplate.send(videoEventsQueue, event);
sqsTemplate.send(userVideoEventsQueue, event);
log.debug("Published VideoSubmitted event: {}", event);
} catch (Exception e) {
log.error(
"Failed to publish VideoSubmitted event for video {}: {}",
video.getId(),
e.getMessage(),
e);
throw e;
}
}Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
com.accountabilityatlas.videoservice.event.VideoEventPublisher.publishVideoStatusChanged method · java · L82-L110 (29 LOC)src/main/java/com/accountabilityatlas/videoservice/event/VideoEventPublisher.java
public void publishVideoStatusChanged(
UUID videoId,
UUID submittedBy,
List<UUID> locationIds,
String previousStatus,
String newStatus) {
VideoStatusChangedEvent event =
new VideoStatusChangedEvent(
videoId, submittedBy, locationIds, previousStatus, newStatus, Instant.now());
log.info(
"Publishing VideoStatusChanged event for video {} ({} -> {}) to SQS queue {}",
videoId,
previousStatus,
newStatus,
videoStatusEventsQueue);
try {
sqsTemplate.send(videoStatusEventsQueue, event);
sqsTemplate.send(userVideoStatusEventsQueue, event);
log.debug("Published VideoStatusChanged event: {}", event);
} catch (Exception e) {
log.error(
"Failed to publish VideoStatusChanged event for video {}: {}",
videoId,
e.getMessage(),
e);
throw e;
}
}com.accountabilityatlas.videoservice.event.VideoStatusChangedEvent function · java · L7-L13 (7 LOC)src/main/java/com/accountabilityatlas/videoservice/event/VideoStatusChangedEvent.java
public record VideoStatusChangedEvent(
UUID videoId,
UUID submittedBy,
List<UUID> locationIds,
String previousStatus,
String newStatus,
Instant timestamp) {}com.accountabilityatlas.videoservice.event.VideoSubmittedEvent function · java · L9-L16 (8 LOC)src/main/java/com/accountabilityatlas/videoservice/event/VideoSubmittedEvent.java
public record VideoSubmittedEvent(
UUID videoId,
UUID submitterId,
String submitterTrustTier,
String title,
Set<String> amendments,
List<UUID> locationIds,
Instant timestamp) {}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleInvalidYouTubeUrl method · java · L38-L43 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleInvalidYouTubeUrl(InvalidYouTubeUrlException ex) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(
new ErrorResponse(
"INVALID_YOUTUBE_URL", ex.getMessage(), null, UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleYouTubeVideoNotFound method · java · L46-L52 (7 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleYouTubeVideoNotFound(
YouTubeVideoNotFoundException ex) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(
new ErrorResponse(
"YOUTUBE_VIDEO_UNAVAILABLE", ex.getMessage(), null, UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleLocationNotFound method · java · L55-L60 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleLocationNotFound(LocationNotFoundException ex) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(
new ErrorResponse(
"LOCATION_NOT_FOUND", ex.getMessage(), null, UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleLocationAlreadyLinked method · java · L63-L69 (7 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleLocationAlreadyLinked(
LocationAlreadyLinkedException ex) {
return ResponseEntity.status(HttpStatus.CONFLICT)
.body(
new ErrorResponse(
"LOCATION_ALREADY_LINKED", ex.getMessage(), null, UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleMetadataExtraction method · java · L72-L77 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleMetadataExtraction(MetadataExtractionException ex) {
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE)
.body(
new ErrorResponse(
"AI_SERVICE_UNAVAILABLE", ex.getMessage(), null, UUID.randomUUID().toString()));
}Repobility — the code-quality scanner for AI-generated software · https://repobility.com
com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleCircuitBreakerOpen method · java · L80-L85 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleCircuitBreakerOpen(CallNotPermittedException ex) {
return ResponseEntity.status(HttpStatus.SERVICE_UNAVAILABLE)
.body(
new ErrorResponse(
"SERVICE_UNAVAILABLE", ex.getMessage(), null, UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleValidation method · java · L94-L106 (13 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleValidation(MethodArgumentNotValidException ex) {
List<FieldError> details =
ex.getBindingResult().getFieldErrors().stream()
.map(e -> new FieldError(e.getField(), e.getDefaultMessage()))
.toList();
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(
new ErrorResponse(
VALIDATION_ERROR,
"Request validation failed",
details,
UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleConstraintViolation method · java · L109-L121 (13 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleConstraintViolation(ConstraintViolationException ex) {
List<FieldError> details =
ex.getConstraintViolations().stream()
.map(v -> new FieldError(v.getPropertyPath().toString(), v.getMessage()))
.toList();
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(
new ErrorResponse(
VALIDATION_ERROR,
"Request validation failed",
details,
UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.exception.GlobalExceptionHandler.handleMessageNotReadable method · java · L124-L133 (10 LOC)src/main/java/com/accountabilityatlas/videoservice/exception/GlobalExceptionHandler.java
public ResponseEntity<ErrorResponse> handleMessageNotReadable(
HttpMessageNotReadableException ignored) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(
new ErrorResponse(
VALIDATION_ERROR,
"Malformed or missing request body",
null,
UUID.randomUUID().toString()));
}com.accountabilityatlas.videoservice.service.LocationClient.getLocation method · java · L27-L39 (13 LOC)src/main/java/com/accountabilityatlas/videoservice/service/LocationClient.java
public Optional<LocationSummary> getLocation(UUID locationId) {
try {
return Optional.ofNullable(
webClient
.get()
.uri("/locations/{id}", locationId)
.retrieve()
.bodyToMono(LocationSummary.class)
.block());
} catch (WebClientResponseException.NotFound e) {
return Optional.empty();
}
}com.accountabilityatlas.videoservice.service.MetadataExtractionService.MetadataExtractionService method · java · L251-L263 (13 LOC)src/main/java/com/accountabilityatlas/videoservice/service/MetadataExtractionService.java
public MetadataExtractionService(AnthropicProperties properties, ObjectMapper objectMapper) {
this.properties = properties;
this.objectMapper = objectMapper;
if (properties.getApiKey() == null || properties.getApiKey().isBlank()) {
this.client = null;
} else {
this.client =
AnthropicOkHttpClient.builder()
.apiKey(properties.getApiKey())
.timeout(properties.getTimeout())
.build();
}
}com.accountabilityatlas.videoservice.service.MetadataExtractionService.extract method · java · L267-L303 (37 LOC)src/main/java/com/accountabilityatlas/videoservice/service/MetadataExtractionService.java
public ExtractionResult extract(String title, String description, String publishedAt) {
if (client == null) {
throw new MetadataExtractionException(
"AI extraction is not configured. Set the ANTHROPIC_API_KEY environment variable.");
}
String userMessage =
USER_PROMPT_TEMPLATE
.replace("{{title}}", title != null ? title : "")
.replace("{{description}}", description != null ? description : "")
.replace("{{published}}", publishedAt != null ? publishedAt : "unknown");
log.debug("Extraction request for video: {}", title);
log.debug("User message sent to Claude:\n{}", userMessage);
try {
MessageCreateParams params =
MessageCreateParams.builder()
.model(properties.getModel())
.maxTokens(properties.getMaxTokens())
.addUserMessage(userMessage)
.build();
Message response = client.messages().create(params);
String text = excom.accountabilityatlas.videoservice.service.MetadataExtractionService.extractText method · java · L305-L312 (8 LOC)src/main/java/com/accountabilityatlas/videoservice/service/MetadataExtractionService.java
private String extractText(Message response) {
for (ContentBlock block : response.content()) {
if (block.isText()) {
return block.asText().text();
}
}
throw new MetadataExtractionException("No text content in AI response");
}Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
com.accountabilityatlas.videoservice.service.MetadataExtractionService.extractJson method · java · L319-L353 (35 LOC)src/main/java/com/accountabilityatlas/videoservice/service/MetadataExtractionService.java
private String extractJson(String text) {
String trimmed = text.strip();
// Handle code fences if present
if (trimmed.startsWith("```")) {
int firstNewline = trimmed.indexOf('\n');
if (firstNewline >= 0) {
int lastFence = trimmed.lastIndexOf("```");
if (lastFence > firstNewline) {
trimmed = trimmed.substring(firstNewline + 1, lastFence).strip();
}
}
}
// Find the last '}' and walk back to find its matching '{'
int lastBrace = trimmed.lastIndexOf('}');
if (lastBrace < 0) {
return trimmed;
}
int depth = 0;
for (int i = lastBrace; i >= 0; i--) {
char c = trimmed.charAt(i);
if (c == '}') {
depth++;
} else if (c == '{') {
depth--;
if (depth == 0) {
return trimmed.substring(i, lastBrace + 1);
}
}
}
return trimmed;
}com.accountabilityatlas.videoservice.service.MetadataExtractionService.ExtractionResult method · java · L356-L361 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/MetadataExtractionService.java
public record ExtractionResult(
List<String> amendments,
List<String> participants,
String videoDate,
LocationSuggestion location,
ConfidenceScores confidence) {}com.accountabilityatlas.videoservice.service.VideoLocationService.getVideoLocations method · java · L28-L33 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoLocationService.java
public List<VideoLocation> getVideoLocations(UUID videoId) {
if (!videoRepository.existsById(videoId)) {
throw new VideoNotFoundException(videoId);
}
return videoLocationRepository.findByVideoId(videoId);
}com.accountabilityatlas.videoservice.service.VideoLocationService.addLocation method · java · L36-L47 (12 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoLocationService.java
public VideoLocation addLocation(
UUID videoId, UUID locationId, boolean isPrimary, UUID currentUserId) {
Video video =
videoRepository.findById(videoId).orElseThrow(() -> new VideoNotFoundException(videoId));
if (mayNotModify(video, currentUserId)) {
throw new UnauthorizedException("You do not have permission to modify this video");
}
return addLocationInternal(video, locationId, isPrimary);
}com.accountabilityatlas.videoservice.service.VideoLocationService.addLocationInternal method · java · L56-L83 (28 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoLocationService.java
private VideoLocation addLocationInternal(Video video, UUID locationId, boolean isPrimary) {
if (videoLocationRepository.existsByVideoIdAndLocationId(video.getId(), locationId)) {
throw new LocationAlreadyLinkedException(video.getId(), locationId);
}
LocationSummary location =
locationClient
.getLocation(locationId)
.orElseThrow(() -> new LocationNotFoundException(locationId));
if (isPrimary) {
videoLocationRepository.clearPrimaryForVideo(video.getId());
}
VideoLocation videoLocation = new VideoLocation();
videoLocation.setVideo(video);
videoLocation.setLocationId(locationId);
videoLocation.setPrimary(isPrimary);
videoLocation.setDisplayName(location.displayName());
videoLocation.setCity(location.city());
videoLocation.setState(location.state());
if (location.coordinates() != null) {
videoLocation.setLatitude(location.coordinates().latitude());
videoLocation.setLongitude(loccom.accountabilityatlas.videoservice.service.VideoLocationService.removeLocation method · java · L86-L95 (10 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoLocationService.java
public void removeLocation(UUID videoId, UUID locationId, UUID currentUserId) {
Video video =
videoRepository.findById(videoId).orElseThrow(() -> new VideoNotFoundException(videoId));
if (mayNotModify(video, currentUserId)) {
throw new UnauthorizedException("You do not have permission to modify this video");
}
doRemoveLocation(videoId, locationId);
}com.accountabilityatlas.videoservice.service.VideoLocationService.doRemoveLocation method · java · L102-L109 (8 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoLocationService.java
private void doRemoveLocation(UUID videoId, UUID locationId) {
VideoLocation location =
videoLocationRepository
.findByVideoIdAndLocationId(videoId, locationId)
.orElseThrow(() -> new LocationNotFoundException(locationId));
videoLocationRepository.delete(location);
}com.accountabilityatlas.videoservice.service.VideoLocationService.mayNotModify method · java · L111-L116 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoLocationService.java
private boolean mayNotModify(Video video, UUID currentUserId) {
if (!video.getSubmittedBy().equals(currentUserId)) {
return true;
}
return video.getStatus() == VideoStatus.APPROVED;
}Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
com.accountabilityatlas.videoservice.service.VideoService.listVideos method · java · L43-L48 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public Page<Video> listVideos(VideoStatus status, Pageable pageable) {
if (status == null) {
status = VideoStatus.APPROVED;
}
return videoRepository.findByStatusOrderByCreatedAtDesc(status, pageable);
}com.accountabilityatlas.videoservice.service.VideoService.listVideosByUser method · java · L51-L56 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public Page<Video> listVideosByUser(UUID userId, VideoStatus status, Pageable pageable) {
if (status != null) {
return videoRepository.findBySubmittedByAndStatus(userId, status, pageable);
}
return videoRepository.findBySubmittedBy(userId, pageable);
}com.accountabilityatlas.videoservice.service.VideoService.createVideo method · java · L71-L115 (45 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public Video createVideo(
String youtubeUrl,
Set<Amendment> amendments,
Set<Participant> participants,
LocalDate videoDate,
UUID submittedBy,
String submitterTrustTier,
List<UUID> locationIds) {
String videoId = youTubeService.extractVideoId(youtubeUrl);
if (videoRepository.existsByYoutubeId(videoId)) {
throw new VideoAlreadyExistsException(videoId);
}
YouTubeMetadata metadata = youTubeService.fetchMetadata(videoId);
Video video = new Video();
video.setYoutubeId(videoId);
video.setTitle(metadata.title());
video.setDescription(metadata.description());
video.setThumbnailUrl(metadata.thumbnailUrl());
video.setDurationSeconds(metadata.durationSeconds());
video.setChannelId(metadata.channelId());
video.setChannelName(metadata.channelName());
video.setPublishedAt(metadata.publishedAt());
video.setVideoDate(videoDate);
video.setAmendments(amendments);
video.setParticipants(parcom.accountabilityatlas.videoservice.service.VideoService.updateVideo method · java · L118-L142 (25 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public Video updateVideo(
UUID id,
Set<Amendment> amendments,
Set<Participant> participants,
LocalDate videoDate,
UUID currentUserId) {
Video video = findVideoOrThrow(id);
if (mayNotModify(video, currentUserId)) {
throw new UnauthorizedException("You do not have permission to modify this video");
}
if (amendments != null && !amendments.isEmpty()) {
video.setAmendments(amendments);
}
if (participants != null && !participants.isEmpty()) {
video.setParticipants(participants);
}
if (videoDate != null) {
video.setVideoDate(videoDate);
}
return videoRepository.save(video);
}com.accountabilityatlas.videoservice.service.VideoService.deleteVideo method · java · L145-L154 (10 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public void deleteVideo(UUID id, UUID currentUserId) {
Video video = findVideoOrThrow(id);
if (mayNotModify(video, currentUserId)) {
throw new UnauthorizedException("You do not have permission to delete this video");
}
video.setStatus(VideoStatus.DELETED);
videoRepository.save(video);
}com.accountabilityatlas.videoservice.service.VideoService.updateVideoInternal method · java · L157-L173 (17 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public Video updateVideoInternal(
UUID id, Set<Amendment> amendments, Set<Participant> participants, LocalDate videoDate) {
Video video = findVideoOrThrow(id);
if (amendments != null && !amendments.isEmpty()) {
video.setAmendments(amendments);
}
if (participants != null && !participants.isEmpty()) {
video.setParticipants(participants);
}
if (videoDate != null) {
video.setVideoDate(videoDate);
}
return videoRepository.save(video);
}com.accountabilityatlas.videoservice.service.VideoService.updateVideoStatus method · java · L176-L199 (24 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public Video updateVideoStatus(UUID id, VideoStatus newStatus, String rejectionReason) {
Video video =
videoRepository.findByIdWithLocations(id).orElseThrow(() -> new VideoNotFoundException(id));
VideoStatus previousStatus = video.getStatus();
video.setStatus(newStatus);
if (rejectionReason != null) {
video.setRejectionReason(rejectionReason);
}
Video saved = videoRepository.save(video);
// Publish status change event for downstream services
List<UUID> locationIds =
saved.getLocations().stream().map(VideoLocation::getLocationId).toList();
if (previousStatus != newStatus) {
videoEventPublisher.publishVideoStatusChanged(
saved.getId(),
saved.getSubmittedBy(),
locationIds,
previousStatus.name(),
newStatus.name());
}
return saved;
}com.accountabilityatlas.videoservice.service.VideoService.mayNotModify method · java · L205-L210 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
private boolean mayNotModify(Video video, UUID currentUserId) {
if (!video.getSubmittedBy().equals(currentUserId)) {
return true;
}
return video.getStatus() == VideoStatus.APPROVED;
}Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
com.accountabilityatlas.videoservice.service.VideoService.canView method · java · L212-L218 (7 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
public boolean canView(Video video, UUID currentUserId, String trustTier) {
return switch (video.getStatus()) {
case APPROVED -> true;
case PENDING, REJECTED -> isOwnerOrModerator(video, currentUserId, trustTier);
case DELETED -> "ADMIN".equals(trustTier);
};
}com.accountabilityatlas.videoservice.service.VideoService.isOwnerOrModerator method · java · L220-L225 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/VideoService.java
private boolean isOwnerOrModerator(Video video, UUID currentUserId, String trustTier) {
if (video.getSubmittedBy().equals(currentUserId)) {
return true;
}
return Set.of("MODERATOR", "ADMIN").contains(trustTier);
}com.accountabilityatlas.videoservice.service.YouTubeService.extractVideoId method · java · L48-L61 (14 LOC)src/main/java/com/accountabilityatlas/videoservice/service/YouTubeService.java
public String extractVideoId(String url) {
if (url == null || url.isBlank()) {
throw new InvalidYouTubeUrlException(url);
}
for (Pattern pattern : YOUTUBE_PATTERNS) {
Matcher matcher = pattern.matcher(url);
if (matcher.find()) {
return matcher.group(1);
}
}
throw new InvalidYouTubeUrlException(url);
}com.accountabilityatlas.videoservice.service.YouTubeService.fetchMetadata method · java · L66-L106 (41 LOC)src/main/java/com/accountabilityatlas/videoservice/service/YouTubeService.java
public YouTubeMetadata fetchMetadata(String videoId) {
try {
var response =
webClient
.get()
.uri(
uriBuilder ->
uriBuilder
.path("/videos")
.queryParam("id", videoId)
.queryParam("key", properties.getApiKey())
.queryParam("part", "snippet,contentDetails,recordingDetails")
.build())
.retrieve()
.bodyToMono(YouTubeApiResponse.class)
.block(properties.getTimeout());
if (response == null || response.items() == null || response.items().isEmpty()) {
throw new YouTubeVideoNotFoundException(videoId);
}
var item = response.items().getFirst();
var snippet = item.snippet();
var contentDetails = item.contentDetails();
var recordingDetails = item.recordingDetails();
return new YouTubeMetacom.accountabilityatlas.videoservice.service.YouTubeService.selectBestThumbnail method · java · L108-L114 (7 LOC)src/main/java/com/accountabilityatlas/videoservice/service/YouTubeService.java
private String selectBestThumbnail(Thumbnails thumbnails) {
if (thumbnails.maxres() != null) return thumbnails.maxres().url();
if (thumbnails.high() != null) return thumbnails.high().url();
if (thumbnails.medium() != null) return thumbnails.medium().url();
if (thumbnails.standard() != null) return thumbnails.standard().url();
return thumbnails.defaultThumb() != null ? thumbnails.defaultThumb().url() : null;
}com.accountabilityatlas.videoservice.service.YouTubeService.parseDuration method · java · L116-L123 (8 LOC)src/main/java/com/accountabilityatlas/videoservice/service/YouTubeService.java
private Integer parseDuration(String isoDuration) {
if (isoDuration == null) return null;
try {
return (int) Duration.parse(isoDuration).toSeconds();
} catch (Exception e) {
return null;
}
}com.accountabilityatlas.videoservice.service.YouTubeService.Snippet method · java · L130-L136 (7 LOC)src/main/java/com/accountabilityatlas/videoservice/service/YouTubeService.java
record Snippet(
String title,
String description,
String channelId,
String channelTitle,
String publishedAt,
Thumbnails thumbnails) {}com.accountabilityatlas.videoservice.service.YouTubeService.Thumbnails method · java · L142-L147 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/service/YouTubeService.java
record Thumbnails(
Thumbnail defaultThumb,
Thumbnail medium,
Thumbnail high,
Thumbnail standard,
Thumbnail maxres) {}Repobility — the code-quality scanner for AI-generated software · https://repobility.com
com.accountabilityatlas.videoservice.web.InternalVideoController.updateVideo method · java · L40-L53 (14 LOC)src/main/java/com/accountabilityatlas/videoservice/web/InternalVideoController.java
public ResponseEntity<Void> updateVideo(
@PathVariable UUID id, @RequestBody UpdateVideoRequest request) {
Set<Amendment> amendments =
request.amendments() != null
? request.amendments().stream().map(Amendment::valueOf).collect(Collectors.toSet())
: null;
Set<Participant> participants =
request.participants() != null
? request.participants().stream().map(Participant::valueOf).collect(Collectors.toSet())
: null;
videoService.updateVideoInternal(id, amendments, participants, request.videoDate());
return ResponseEntity.noContent().build();
}com.accountabilityatlas.videoservice.web.InternalVideoController.updateStatus method · java · L56-L61 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/web/InternalVideoController.java
public ResponseEntity<Void> updateStatus(
@PathVariable UUID id, @RequestBody UpdateStatusRequest request) {
VideoStatus status = VideoStatus.valueOf(request.status());
videoService.updateVideoStatus(id, status, null);
return ResponseEntity.noContent().build();
}com.accountabilityatlas.videoservice.web.InternalVideoController.addLocation method · java · L64-L69 (6 LOC)src/main/java/com/accountabilityatlas/videoservice/web/InternalVideoController.java
public ResponseEntity<VideoLocation> addLocation(
@PathVariable UUID id, @RequestBody AddLocationRequest request) {
VideoLocation location =
videoLocationService.addLocationInternal(id, request.locationId(), request.isPrimary());
return ResponseEntity.status(HttpStatus.CREATED).body(location);
}page 1 / 2next ›