diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 230c13899..d6645cdd5 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,8 @@ # Description -> Please provide only as much detail as needed to justify the changes. +> Please provide as much detail as needed to explain the changes. # Supporting Material -> Please provide the links necessary to support the claims made in description above. +> Please provide any links, screenshots, etc. as necessary to support the description. # Additional Comments > Please provide any additional feedback here. @@ -10,6 +10,5 @@ # Helper Checklist (optional) > Please ensure the following has been completed. -- [ ] Changes reviewed and are acceptable to the best of your understanding. -- [ ] Changes are documented where necessary. -- [ ] Contacted code owners to evaluate. +- [ ] Changes are documented to the best of your understanding. +- [ ] Changes are reviewed and accepted. diff --git a/checkstyles.xml b/checkstyles.xml new file mode 100644 index 000000000..723d79a33 --- /dev/null +++ b/checkstyles.xml @@ -0,0 +1,336 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 520bebffb..fb06295f3 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,19 @@ VIVO Scholars Middleware + + Texas A&M University Libraries + https://library.tamu.edu + + + + + + + + + + MIT @@ -29,9 +42,15 @@ UTF-8 + + 4.9.0 4.23.2 2.17.2 - 4.9.0 + + 3.3.1 + + 2.0.0 + 9.1.1 @@ -106,7 +125,19 @@ org.springframework.data spring-data-rest-hal-explorer - + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + ${springdoc.version} + + + + org.springdoc + springdoc-openapi-starter-webflux-ui + ${springdoc.version} + + com.fasterxml.jackson.core jackson-core @@ -315,6 +346,31 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} + + org/springframework/**/* + checkstyles.xml + true + warning + true + true + false + false + + + + validate + prepare-package + + check + + + + + org.liquibase diff --git a/src/main/java/edu/tamu/scholars/middleware/MiddlewareApplication.java b/src/main/java/edu/tamu/scholars/middleware/MiddlewareApplication.java index 12827bc21..e5040f65b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/MiddlewareApplication.java +++ b/src/main/java/edu/tamu/scholars/middleware/MiddlewareApplication.java @@ -5,20 +5,27 @@ import static edu.tamu.scholars.middleware.auth.AuthConstants.PASSWORD_MIN_LENGTH; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.EXPORT_INDIVIDUAL_KEY; -import java.util.TimeZone; - import javax.annotation.PostConstruct; +import java.util.TimeZone; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.scheduling.annotation.EnableScheduling; +import org.springframework.scheduling.annotation.Scheduled; import edu.tamu.scholars.middleware.auth.config.AuthConfig; import edu.tamu.scholars.middleware.auth.config.PasswordConfig; import edu.tamu.scholars.middleware.config.model.ExportConfig; import edu.tamu.scholars.middleware.config.model.MiddlewareConfig; +import edu.tamu.scholars.middleware.discovery.service.IndexService; +/** + * Scholars middleware application and initialization. + * + *

Enables {@link Scheduled} annotation used in {@link IndexService}.

+ */ @EnableScheduling @SpringBootApplication public class MiddlewareApplication { diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/AuthConstants.java b/src/main/java/edu/tamu/scholars/middleware/auth/AuthConstants.java index eaec436c2..4c8ba1c0b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/AuthConstants.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/AuthConstants.java @@ -1,5 +1,12 @@ package edu.tamu.scholars.middleware.auth; +import edu.tamu.scholars.middleware.MiddlewareApplication; +import edu.tamu.scholars.middleware.auth.details.CustomUserDetails; + +/** + * Application initialized constants for use at runtime statically. + * These are set in {@link MiddlewareApplication} and used in {@link CustomUserDetails}. + */ public class AuthConstants { public static int PASSWORD_DURATION_IN_DAYS; diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/annotation/AvailableEmail.java b/src/main/java/edu/tamu/scholars/middleware/auth/annotation/AvailableEmail.java index eb5cc3655..f49f72e59 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/annotation/AvailableEmail.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/annotation/AvailableEmail.java @@ -3,15 +3,19 @@ import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.RetentionPolicy.RUNTIME; +import javax.validation.Constraint; +import javax.validation.Payload; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - +import edu.tamu.scholars.middleware.auth.model.User; import edu.tamu.scholars.middleware.auth.validator.EmailConstraintValidator; +/** + * Annotation to declare validated {@link User} model email is available. + */ @Documented @Target(FIELD) @Retention(RUNTIME) diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/annotation/ValidPassword.java b/src/main/java/edu/tamu/scholars/middleware/auth/annotation/ValidPassword.java index 615a152e8..ade60f69b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/annotation/ValidPassword.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/annotation/ValidPassword.java @@ -3,15 +3,19 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; +import javax.validation.Constraint; +import javax.validation.Payload; + import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; - +import edu.tamu.scholars.middleware.auth.model.User; import edu.tamu.scholars.middleware.auth.validator.PasswordConstraintValidator; +/** + * Annotation to declare validated {@link User} model password is available. + */ @Documented @Target(TYPE) @Retention(RUNTIME) diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/config/AuthConfig.java b/src/main/java/edu/tamu/scholars/middleware/auth/config/AuthConfig.java index a2ab268ec..0bc6dda58 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/config/AuthConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/config/AuthConfig.java @@ -3,6 +3,12 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware configuration to specify properties relating to + * authentication and authorization. + * + *

See `middleware.auth` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.auth") public class AuthConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/config/PasswordConfig.java b/src/main/java/edu/tamu/scholars/middleware/auth/config/PasswordConfig.java index db4d563cf..c17851ac3 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/config/PasswordConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/config/PasswordConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware auth configuration to specify password properties. + * + *

See `middleware.auth.password` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.auth.password") public class PasswordConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/config/TokenConfig.java b/src/main/java/edu/tamu/scholars/middleware/auth/config/TokenConfig.java index 167b67025..0e702eed9 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/config/TokenConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/config/TokenConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware auth configuration to specify token properties. + * + *

See `middleware.auth.token` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.auth.token") public class TokenConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/controller/AuthController.java b/src/main/java/edu/tamu/scholars/middleware/auth/controller/AuthController.java index 0b241af2b..e04b30a2a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/controller/AuthController.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/controller/AuthController.java @@ -6,6 +6,9 @@ import edu.tamu.scholars.middleware.auth.model.User; +/** + * Authentication controller returning the authenticated {@link User}. + */ @RestController public class AuthController { diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/controller/RegistrationController.java b/src/main/java/edu/tamu/scholars/middleware/auth/controller/RegistrationController.java index 841e3a286..8f8d58a04 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/controller/RegistrationController.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/controller/RegistrationController.java @@ -2,7 +2,11 @@ import java.io.IOException; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -13,10 +17,6 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; - import edu.tamu.scholars.middleware.auth.controller.exception.RegistrationException; import edu.tamu.scholars.middleware.auth.controller.request.Registration; import edu.tamu.scholars.middleware.auth.model.User; @@ -24,25 +24,46 @@ import edu.tamu.scholars.middleware.auth.validator.group.CompleteRegistration; import edu.tamu.scholars.middleware.auth.validator.group.SubmitRegistration; +/** + * {@link User} registration controller. + * + *

+ * This controller provides ability to register a {@link User} through the following sequence of requests + *

+ * + *
    + *
  1. Submit registration request; create disabled user, send email confirmation with link and token
  2. + *
  3. Confirm email registration; validate token and confirm user email
  4. + *
  5. Complete registration; update and activates user
  6. + *
+ */ @RestController @RequestMapping("/registration") public class RegistrationController { + @Lazy @Autowired private RegistrationService registrationService; @PostMapping - public ResponseEntity submit(@RequestBody @Validated(SubmitRegistration.class) Registration registration) throws JsonProcessingException { + public ResponseEntity submit( + @RequestBody @Validated(SubmitRegistration.class) Registration registration) + throws JsonProcessingException { return ResponseEntity.ok(registrationService.submit(registration)); } @GetMapping - public ResponseEntity confirm(@RequestParam(required = true) String key) throws JsonParseException, JsonMappingException, IOException, RegistrationException { + public ResponseEntity confirm( + @RequestParam(required = true) String key) + throws JsonParseException, JsonMappingException, IOException, RegistrationException { return ResponseEntity.ok(registrationService.confirm(key)); } @PutMapping - public ResponseEntity complete(@RequestParam(required = true) String key, @RequestBody @Validated(CompleteRegistration.class) Registration registration) throws RegistrationException { + public ResponseEntity complete( + @RequestParam(required = true) String key, + @RequestBody @Validated(CompleteRegistration.class) Registration registration) + throws RegistrationException { return ResponseEntity.ok(registrationService.complete(key, registration)); } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/controller/advice/RegistrationAdvice.java b/src/main/java/edu/tamu/scholars/middleware/auth/controller/advice/RegistrationAdvice.java index eb13ab695..40f86c4c1 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/controller/advice/RegistrationAdvice.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/controller/advice/RegistrationAdvice.java @@ -10,15 +10,27 @@ import org.springframework.web.bind.annotation.RestController; import edu.tamu.scholars.middleware.auth.controller.RegistrationController; +import edu.tamu.scholars.middleware.auth.model.User; +/** + * {@link User} registration controller advice to handle bad requests. + */ @RestController @ControllerAdvice(assignableTypes = { RegistrationController.class }) public class RegistrationAdvice { + // TODO: add logging + // TODO: handle registration exception and other exceptions thrown by the RegistrationController + @ResponseStatus(BAD_REQUEST) @ExceptionHandler(MethodArgumentNotValidException.class) - public @ResponseBody String handleMethodArgumentNotValidException(MethodArgumentNotValidException exception) { - return exception.getBindingResult().getAllErrors().get(0).getDefaultMessage(); + public @ResponseBody String handleMethodArgumentNotValidException( + MethodArgumentNotValidException exception + ) { + return exception.getBindingResult() + .getAllErrors() + .get(0) + .getDefaultMessage(); } @ResponseStatus(BAD_REQUEST) diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/controller/exception/RegistrationException.java b/src/main/java/edu/tamu/scholars/middleware/auth/controller/exception/RegistrationException.java index 92889043d..fbe57c4fd 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/controller/exception/RegistrationException.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/controller/exception/RegistrationException.java @@ -1,5 +1,11 @@ package edu.tamu.scholars.middleware.auth.controller.exception; +import edu.tamu.scholars.middleware.auth.model.User; +import edu.tamu.scholars.middleware.auth.service.RegistrationService; + +/** + * {@link User} registration exception used by {@link RegistrationService}. + */ public class RegistrationException extends Exception { private static final long serialVersionUID = 7712767291119883628L; diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/controller/request/Registration.java b/src/main/java/edu/tamu/scholars/middleware/auth/controller/request/Registration.java index 47545d626..a5a707494 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/controller/request/Registration.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/controller/request/Registration.java @@ -11,22 +11,63 @@ import edu.tamu.scholars.middleware.auth.annotation.AvailableEmail; import edu.tamu.scholars.middleware.auth.annotation.ValidPassword; +import edu.tamu.scholars.middleware.auth.model.User; import edu.tamu.scholars.middleware.auth.validator.group.CompleteRegistration; import edu.tamu.scholars.middleware.auth.validator.group.SubmitRegistration; +/** + * {@link User} registration request DTO with validation of two forms; submit and complete requests. + */ @ValidPassword(groups = CompleteRegistration.class, message = "{Registration.passwordInvalid}") public class Registration { - @Size(min = 2, max = 64, groups = { SubmitRegistration.class, CompleteRegistration.class }, message = "{Registration.firstNameSize}") + @Size( + min = 2, + max = 64, + groups = { + SubmitRegistration.class, + CompleteRegistration.class + }, + message = "{Registration.firstNameSize}" + ) private String firstName; - @Size(min = 2, max = 64, groups = { SubmitRegistration.class, CompleteRegistration.class }, message = "{Registration.lastNameSize}") + @Size( + min = 2, + max = 64, + groups = { + SubmitRegistration.class, + CompleteRegistration.class + }, + message = "{Registration.lastNameSize}" + ) private String lastName; - @NotNull(message = "{Registration.emailRequired}", groups = { SubmitRegistration.class, CompleteRegistration.class }) - @NotEmpty(message = "{Registration.emailRequired}", groups = { SubmitRegistration.class, CompleteRegistration.class }) - @AvailableEmail(groups = SubmitRegistration.class, message = "{Registration.emailAlreadyInUse}") - @Email(message = "{Registration.emailInvalid}", groups = { SubmitRegistration.class, CompleteRegistration.class }) + @NotNull( + message = "{Registration.emailRequired}", + groups = { + SubmitRegistration.class, + CompleteRegistration.class + } + ) + @NotEmpty( + message = "{Registration.emailRequired}", + groups = { + SubmitRegistration.class, + CompleteRegistration.class + } + ) + @AvailableEmail( + groups = SubmitRegistration.class, + message = "{Registration.emailAlreadyInUse}" + ) + @Email( + message = "{Registration.emailInvalid}", + groups = { + SubmitRegistration.class, + CompleteRegistration.class + } + ) private String email; @JsonInclude(NON_NULL) diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/details/CustomUserDetails.java b/src/main/java/edu/tamu/scholars/middleware/auth/details/CustomUserDetails.java index fcfdb4898..de875aaaa 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/details/CustomUserDetails.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/details/CustomUserDetails.java @@ -6,14 +6,16 @@ import java.util.Calendar; import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonIgnore; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.UserDetails; -import com.fasterxml.jackson.annotation.JsonIgnore; - import edu.tamu.scholars.middleware.auth.model.User; +/** + * Custom {@link UserDetails} that encapsulates the {@link User}. + */ public class CustomUserDetails extends User implements UserDetails { private static final long serialVersionUID = 6674712962625174202L; @@ -43,7 +45,10 @@ public boolean isAccountNonLocked() { @Override @JsonIgnore public boolean isCredentialsNonExpired() { - return ChronoUnit.DAYS.between(getTimestamp().toInstant(), Calendar.getInstance().toInstant()) < PASSWORD_DURATION_IN_DAYS; + return ChronoUnit.DAYS.between( + getTimestamp().toInstant(), + Calendar.getInstance().toInstant() + ) < PASSWORD_DURATION_IN_DAYS; } @Override diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAccessDeniedExceptionHandler.java b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAccessDeniedExceptionHandler.java index 351dc5624..b8314011b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAccessDeniedExceptionHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAccessDeniedExceptionHandler.java @@ -2,19 +2,27 @@ import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; -import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + import org.springframework.security.access.AccessDeniedException; import org.springframework.security.web.access.AccessDeniedHandler; +/** + * Spring Boot autoconfigured custom {@link AccessDeniedHandler}. Customized to + * return 401 status and write exception message to response. + */ public class CustomAccessDeniedExceptionHandler implements AccessDeniedHandler { @Override - public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException exception) throws IOException, ServletException { + public void handle( + HttpServletRequest request, + HttpServletResponse response, + AccessDeniedException exception + ) throws IOException, ServletException { response.setStatus(SC_UNAUTHORIZED); response.getWriter().write(exception.getMessage()); } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationEntryPoint.java b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationEntryPoint.java index 56a168459..c7056b986 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationEntryPoint.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationEntryPoint.java @@ -2,19 +2,27 @@ import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; -import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; +/** + * Spring Boot autoconfigured custom {@link AuthenticationEntryPoint}. Customized to + * return 401 status and write exception message to response. + */ public class CustomAuthenticationEntryPoint implements AuthenticationEntryPoint { @Override - public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { + public void commence( + HttpServletRequest request, + HttpServletResponse response, + AuthenticationException exception + ) throws IOException, ServletException { response.setStatus(SC_UNAUTHORIZED); response.getWriter().write(exception.getMessage()); } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationFailureHandler.java b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationFailureHandler.java index f0244c8d9..b83008d16 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationFailureHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationFailureHandler.java @@ -2,19 +2,27 @@ import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; -import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.AuthenticationFailureHandler; +/** + * Spring Boot autoconfigured custom {@link AuthenticationFailureHandler}. Customized to + * return 401 status and write exception message to response. + */ public class CustomAuthenticationFailureHandler implements AuthenticationFailureHandler { @Override - public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { + public void onAuthenticationFailure( + HttpServletRequest request, + HttpServletResponse response, + AuthenticationException exception + ) throws IOException, ServletException { response.setStatus(SC_UNAUTHORIZED); response.getWriter().write(exception.getMessage()); } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationSuccessHandler.java b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationSuccessHandler.java index 7023fe654..b63f1ee10 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationSuccessHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomAuthenticationSuccessHandler.java @@ -2,19 +2,22 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; -import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; +import java.io.IOException; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.security.core.Authentication; +import org.springframework.security.web.authentication.AuthenticationSuccessHandler; import edu.tamu.scholars.middleware.auth.model.User; +/** + * Spring Boot autoconfigured custom {@link AuthenticationSuccessHandler}. Customized to + * return authenticated principal as {@link User}. + */ public class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler { private ObjectMapper objectMapper; @@ -24,9 +27,14 @@ public CustomAuthenticationSuccessHandler(ObjectMapper objectMapper) { } @Override - public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { + public void onAuthenticationSuccess( + HttpServletRequest request, + HttpServletResponse response, + Authentication authentication + ) throws IOException, ServletException { response.setContentType(APPLICATION_JSON_VALUE); - response.getOutputStream().write(objectMapper.writeValueAsBytes((User) authentication.getPrincipal())); + response.getOutputStream() + .write(objectMapper.writeValueAsBytes((User) authentication.getPrincipal())); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomLogoutSuccessHandler.java b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomLogoutSuccessHandler.java index 1f95cc196..3be22ebbe 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomLogoutSuccessHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/handler/CustomLogoutSuccessHandler.java @@ -1,16 +1,20 @@ package edu.tamu.scholars.middleware.auth.handler; -import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; +/** + * Spring Boot autoconfigured custom {@link LogoutSuccessHandler}. Customized to + * return 205 status and write i18n message to response. + */ public class CustomLogoutSuccessHandler implements LogoutSuccessHandler { private MessageSource messageSource; @@ -20,9 +24,17 @@ public CustomLogoutSuccessHandler(MessageSource messageSource) { } @Override - public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { + public void onLogoutSuccess( + HttpServletRequest request, + HttpServletResponse response, + Authentication authentication + ) throws IOException, ServletException { response.setStatus(HttpServletResponse.SC_RESET_CONTENT); - response.getWriter().write(messageSource.getMessage("CustomLogoutSuccessHandler.success", new Object[0], LocaleContextHolder.getLocale())); + response.getWriter().write(messageSource.getMessage( + "CustomLogoutSuccessHandler.success", + new Object[0], + LocaleContextHolder.getLocale() + )); response.getWriter().flush(); response.getWriter().close(); } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/model/Role.java b/src/main/java/edu/tamu/scholars/middleware/auth/model/Role.java index 23667680d..7345064f8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/model/Role.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/model/Role.java @@ -3,11 +3,22 @@ import java.util.HashMap; import java.util.Map; +/** + * {@link User} role enumeration used for role-based authentication defined + * primarily in the {@link SecurityFilterChainConfig} or controller + * annotations @PreAuthorize using spring expression `hasRole`. + */ public enum Role { + // NOTE: inconsistent use of enum key + // SecurityFilterChainConfig @PreAuthorize + // `.hasRole("USER")` `@PreAuthorise("hasRole('ROLE_USER')")` + // `.hasRole("ADMIN")` `@PreAuthorise("hasRole('ROLE_ADMIN')")` + // `.hasRole("SUPER_ADMIN")` `@PreAuthorise("hasRole('ROLE_SUPER_ADMIN')")` + ROLE_USER("User"), ROLE_ADMIN("Administrator"), - ROLE_SUPER_ADMIN("Super Administrator"); + ROLE_SUPER_ADMIN("Super Administrator"); private final String value; diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/model/User.java b/src/main/java/edu/tamu/scholars/middleware/auth/model/User.java index b9867ee9a..35f612750 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/model/User.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/model/User.java @@ -7,11 +7,6 @@ import static javax.persistence.TemporalType.TIMESTAMP; import static org.springframework.beans.BeanUtils.copyProperties; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.List; - import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; @@ -24,14 +19,24 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; -import org.hibernate.annotations.CreationTimestamp; -import org.hibernate.annotations.UpdateTimestamp; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; +import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.UpdateTimestamp; + +import edu.tamu.scholars.middleware.auth.details.CustomUserDetails; +/** + * Application `User` to identify, authenticate, and authorize. Encapsulated by + * {@link CustomUserDetails} for Spring security integration. + */ @Entity @Table(name = "users") public class User implements Serializable { diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/UserRepo.java b/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/UserRepo.java index 5471e7993..d653cfdc0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/UserRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/UserRepo.java @@ -7,6 +7,11 @@ import edu.tamu.scholars.middleware.auth.model.User; +/** + * {@link User} JPA repository with Long identifier. Suppress Spring DATA Rest + * controller endpoints to find user by email or that the email exists in + * system. + */ public interface UserRepo extends JpaRepository { @RestResource(exported = false) diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/handler/UserEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/handler/UserEventHandler.java index d9f314e22..6a1caafdb 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/handler/UserEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/model/repo/handler/UserEventHandler.java @@ -10,6 +10,9 @@ import edu.tamu.scholars.middleware.messaging.DeleteEntityMessage; import edu.tamu.scholars.middleware.messaging.UpdateEntityMessage; +/** + * {@link User} persistance event handler dispatching user update and delete events. + */ @RepositoryEventHandler(User.class) public class UserEventHandler { @@ -21,13 +24,24 @@ public class UserEventHandler { @HandleAfterSave public void broadcastUserUpdate(User user) { simpMessageTemplate.convertAndSend(USERS_CHANNEL, new UpdateEntityMessage(user)); - simpMessageTemplate.convertAndSendToUser(user.getEmail(), USERS_CHANNEL, new UpdateEntityMessage(user)); + simpMessageTemplate.convertAndSendToUser( + user.getEmail(), + USERS_CHANNEL, + new UpdateEntityMessage(user) + ); } @HandleAfterDelete public void broadcastUserDelete(User user) { - simpMessageTemplate.convertAndSend(USERS_CHANNEL, new DeleteEntityMessage(user.getEmail())); - simpMessageTemplate.convertAndSendToUser(user.getEmail(), USERS_CHANNEL, new DeleteEntityMessage(user.getEmail())); + simpMessageTemplate.convertAndSend( + USERS_CHANNEL, + new DeleteEntityMessage(user.getEmail()) + ); + simpMessageTemplate.convertAndSendToUser( + user.getEmail(), + USERS_CHANNEL, + new DeleteEntityMessage(user.getEmail()) + ); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/service/CustomUserDetailsService.java b/src/main/java/edu/tamu/scholars/middleware/auth/service/CustomUserDetailsService.java index 22ff4ede8..5be3905ca 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/service/CustomUserDetailsService.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/service/CustomUserDetailsService.java @@ -14,6 +14,11 @@ import edu.tamu.scholars.middleware.auth.model.User; import edu.tamu.scholars.middleware.auth.model.repo.UserRepo; +/** + * Spring Boot autoconfigured custom {@link UserDetailsService}. Customized to + * load a {@link CustomUserDetails} from a persisted {@link User} into the + * Spring security context for an authenticated principle. + */ @Service public class CustomUserDetailsService implements UserDetailsService { @@ -29,7 +34,10 @@ public UserDetails loadUserByUsername(String username) throws UsernameNotFoundEx if (user.isPresent()) { return new CustomUserDetails(user.get()); } - throw new UsernameNotFoundException(messageSource.getMessage("CustomUserDetailsService.emailNotFound", new Object[] { username }, LocaleContextHolder.getLocale())); + throw new UsernameNotFoundException(messageSource.getMessage( + "CustomUserDetailsService.emailNotFound", + new Object[] { username }, + LocaleContextHolder.getLocale())); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/service/RegistrationService.java b/src/main/java/edu/tamu/scholars/middleware/auth/service/RegistrationService.java index 2dffa3a52..3e32a9389 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/service/RegistrationService.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/service/RegistrationService.java @@ -7,6 +7,10 @@ import java.util.Calendar; import java.util.Optional; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.context.i18n.LocaleContextHolder; @@ -16,11 +20,6 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - import edu.tamu.scholars.middleware.auth.config.AuthConfig; import edu.tamu.scholars.middleware.auth.controller.exception.RegistrationException; import edu.tamu.scholars.middleware.auth.controller.request.Registration; @@ -31,6 +30,9 @@ import edu.tamu.scholars.middleware.service.EmailService; import edu.tamu.scholars.middleware.service.TemplateService; +/** + * {@link User} registration service for processing registration requests. + */ @Service public class RegistrationService { @@ -56,7 +58,7 @@ public class RegistrationService { private ObjectMapper objectMapper; @Autowired - protected BCryptPasswordEncoder bCryptPasswordEncoder; + protected BCryptPasswordEncoder passwordEncoder; @Autowired private SimpMessagingTemplate simpMessageTemplate; @@ -64,14 +66,20 @@ public class RegistrationService { public Registration submit(Registration registration) throws JsonProcessingException { String registrationJson = objectMapper.writeValueAsString(registration); Token token = tokenService.allocateToken(registrationJson); - String subject = messageSource.getMessage("RegistrationService.confirmationEmailSubject", new Object[0], LocaleContextHolder.getLocale()); + String subject = messageSource.getMessage( + "RegistrationService.confirmationEmailSubject", + new Object[0], + LocaleContextHolder.getLocale() + ); String message = templateService.templateConfirmRegistrationMessage(registration, token.getKey()); createUser(registration); emailService.send(registration.getEmail(), subject, message); + return registration; } - public Registration confirm(String key) throws JsonParseException, JsonMappingException, IOException, RegistrationException { + public Registration confirm(String key) + throws JsonParseException, JsonMappingException, IOException, RegistrationException { Token token = tokenService.verifyToken(key); String registrationJson = token.getExtendedInformation(); Registration registration = objectMapper.readValue(registrationJson, Registration.class); @@ -83,12 +91,24 @@ public Registration confirm(String key) throws JsonParseException, JsonMappingEx userRepo.save(user.get()); return registration; } - throw new RegistrationException(messageSource.getMessage("RegistrationService.emailAlreadyConfirmed", new Object[] { registration.getEmail() }, LocaleContextHolder.getLocale())); + throw new RegistrationException(messageSource.getMessage( + "RegistrationService.emailAlreadyConfirmed", + new Object[] { registration.getEmail() }, + LocaleContextHolder.getLocale() + )); } userRepo.delete(user.get()); - throw new RegistrationException(messageSource.getMessage("RegistrationService.tokenExpired", new Object[0], LocaleContextHolder.getLocale())); + throw new RegistrationException(messageSource.getMessage( + "RegistrationService.tokenExpired", + new Object[0], + LocaleContextHolder.getLocale() + )); } - throw new RegistrationException(messageSource.getMessage("RegistrationService.unableToConfirmEmailNotFound", new Object[] { registration.getEmail() }, LocaleContextHolder.getLocale())); + throw new RegistrationException(messageSource.getMessage( + "RegistrationService.unableToConfirmEmailNotFound", + new Object[] { registration.getEmail() }, + LocaleContextHolder.getLocale() + )); } public User complete(String key, Registration registration) throws RegistrationException { @@ -98,15 +118,27 @@ public User complete(String key, Registration registration) throws RegistrationE if (!isTokenExpired(token)) { if (user.get().isConfirmed()) { user.get().setEnabled(true); - user.get().setPassword(bCryptPasswordEncoder.encode(registration.getPassword())); + user.get().setPassword(passwordEncoder.encode(registration.getPassword())); return userRepo.save(user.get()); } - throw new RegistrationException(messageSource.getMessage("RegistrationService.emailNotConfirmed", new Object[] { registration.getEmail() }, LocaleContextHolder.getLocale())); + throw new RegistrationException(messageSource.getMessage( + "RegistrationService.emailNotConfirmed", + new Object[] { registration.getEmail() }, + LocaleContextHolder.getLocale() + )); } userRepo.delete(user.get()); - throw new RegistrationException(messageSource.getMessage("RegistrationService.tokenExpired", new Object[0], LocaleContextHolder.getLocale())); + throw new RegistrationException(messageSource.getMessage( + "RegistrationService.tokenExpired", + new Object[0], + LocaleContextHolder.getLocale() + )); } - throw new RegistrationException(messageSource.getMessage("RegistrationService.unableToCompleteEmailNotFound", new Object[] { registration.getEmail() }, LocaleContextHolder.getLocale())); + throw new RegistrationException(messageSource.getMessage( + "RegistrationService.unableToCompleteEmailNotFound", + new Object[] { registration.getEmail() }, + LocaleContextHolder.getLocale() + )); } private synchronized void createUser(Registration registration) { @@ -126,7 +158,11 @@ private boolean isTokenExpired(Token token) { Calendar currentTime = Calendar.getInstance(); Calendar creationTime = Calendar.getInstance(); creationTime.setTimeInMillis(token.getKeyCreationTime()); - return ChronoUnit.DAYS.between(creationTime.toInstant(), currentTime.toInstant()) >= authConfig.getRegistrationTokenDuration(); + + return ChronoUnit.DAYS.between( + creationTime.toInstant(), + currentTime.toInstant() + ) >= authConfig.getRegistrationTokenDuration(); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/validator/EmailConstraintValidator.java b/src/main/java/edu/tamu/scholars/middleware/auth/validator/EmailConstraintValidator.java index 5e7e48558..d7210aff0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/validator/EmailConstraintValidator.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/validator/EmailConstraintValidator.java @@ -6,8 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired; import edu.tamu.scholars.middleware.auth.annotation.AvailableEmail; +import edu.tamu.scholars.middleware.auth.model.User; import edu.tamu.scholars.middleware.auth.model.repo.UserRepo; +/** + * {@link User} email validator. Valid when email does not exist, otherwise invalid. + */ public class EmailConstraintValidator implements ConstraintValidator { @Autowired @@ -15,10 +19,7 @@ public class EmailConstraintValidator implements ConstraintValidator { @Autowired @@ -76,7 +79,11 @@ public boolean isValid(Registration registration, ConstraintValidatorContext con List passwordReferences; if (user.isPresent()) { - passwordReferences = user.get().getOldPasswords().stream().map(pw -> new HistoricalReference(pw)).collect(Collectors.toList()); + passwordReferences = user.get() + .getOldPasswords() + .stream() + .map(pw -> new HistoricalReference(pw)) + .collect(Collectors.toList()); } else { passwordReferences = new ArrayList(); } @@ -89,12 +96,19 @@ public boolean isValid(Registration registration, ConstraintValidatorContext con return true; } context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(String.join(", ", validator.getMessages(result))).addConstraintViolation(); + context.buildConstraintViolationWithTemplate(String.join(", ", validator.getMessages(result))) + .addConstraintViolation(); + return false; } context.disableDefaultConstraintViolation(); - context.buildConstraintViolationWithTemplate(messageSource.getMessage("Registration.passwordsDoNotMatch", new Object[0], LocaleContextHolder.getLocale())).addConstraintViolation(); + context.buildConstraintViolationWithTemplate(messageSource.getMessage( + "Registration.passwordsDoNotMatch", + new Object[0], + LocaleContextHolder.getLocale() + )).addConstraintViolation(); + return false; } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/CompleteRegistration.java b/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/CompleteRegistration.java index 6e51f2b0f..496318c0f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/CompleteRegistration.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/CompleteRegistration.java @@ -1,5 +1,12 @@ package edu.tamu.scholars.middleware.auth.validator.group; +import edu.tamu.scholars.middleware.auth.controller.RegistrationController; + +/** + * Used for validation of {@link Registration} for + * {@link RegistrationController} to allow process to invoke `complete` of + * {@link RegistrationService}. + */ public interface CompleteRegistration { } diff --git a/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/SubmitRegistration.java b/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/SubmitRegistration.java index 06f97342d..43126adb1 100644 --- a/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/SubmitRegistration.java +++ b/src/main/java/edu/tamu/scholars/middleware/auth/validator/group/SubmitRegistration.java @@ -1,5 +1,10 @@ package edu.tamu.scholars.middleware.auth.validator.group; +/** + * Used for validation of {@link Registration} for + * {@link RegistrationController} to allow process to invoke `submit` of + * {@link RegistrationService}. + */ public interface SubmitRegistration { } diff --git a/src/main/java/edu/tamu/scholars/middleware/config/AsyncConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/AsyncConfig.java index 0920fc093..d241740b6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/AsyncConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/AsyncConfig.java @@ -4,11 +4,17 @@ import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; +/** + * Configuration for asynchronous behaviors. + * + *

Enables {@link Async} annotation not in use.

+ */ @EnableAsync @Configuration public class AsyncConfig implements AsyncConfigurer { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/CacheConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/CacheConfig.java index 900163203..aadcaf63d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/CacheConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/CacheConfig.java @@ -1,8 +1,16 @@ package edu.tamu.scholars.middleware.config; +import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.EnableCaching; import org.springframework.context.annotation.Configuration; +import edu.tamu.scholars.middleware.service.ResourceService; + +/** + * Configuration for caching behaviors. + * + *

Enables {@link Cacheable} annotation used in {@link ResourceService}.

+ */ @EnableCaching @Configuration public class CacheConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/HarvesterDependencyConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/HarvesterDependencyConfig.java index ef1309f57..7b1775423 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/HarvesterDependencyConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/HarvesterDependencyConfig.java @@ -11,6 +11,11 @@ import edu.tamu.scholars.middleware.config.model.TriplestoreConfig; import edu.tamu.scholars.middleware.service.Triplestore; +/** + * Externally configured triplestore for harvesting. + * + *

See {@link TriplestoreConfig}.

+ */ @Configuration @Profile("!test") public class HarvesterDependencyConfig { @@ -19,8 +24,14 @@ public class HarvesterDependencyConfig { private MiddlewareConfig middleware; @Bean - public Triplestore triplestore() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - return middleware.getTriplestore().getType().getConstructor(TriplestoreConfig.class).newInstance(middleware.getTriplestore()); + public Triplestore triplestore() + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { + + return middleware.getTriplestore() + .getType() + .getConstructor(TriplestoreConfig.class) + .newInstance(middleware.getTriplestore()); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/config/HarvestingConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/HarvestingConfig.java index 4bf92344f..c44a2a897 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/HarvestingConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/HarvestingConfig.java @@ -14,6 +14,11 @@ import edu.tamu.scholars.middleware.discovery.component.Harvester; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +/** + * Externally configured list of @{link Harvester} beans. + * + *

See {@link MiddlewareConfig}.

+ */ @Configuration public class HarvestingConfig { @@ -24,7 +29,9 @@ public class HarvestingConfig { private AutowireCapableBeanFactory beanFactory; @Bean - public List harvesters() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + public List harvesters() + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { List harvesters = new ArrayList(); for (HarvesterConfig config : middleware.getHarvesters()) { for (Class documentType : config.getDocumentTypes()) { @@ -34,7 +41,9 @@ public List harvesters() throws InstantiationException, IllegalAccess return harvesters; } - public Harvester harvester(Class type, Class documentType) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + public Harvester harvester(Class type, Class documentType) + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { Harvester harvester = type.getConstructor(Class.class).newInstance(documentType); beanFactory.autowireBean(harvester); return harvester; diff --git a/src/main/java/edu/tamu/scholars/middleware/config/IndexingConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/IndexingConfig.java index ebcf4445c..6de543167 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/IndexingConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/IndexingConfig.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.component.Indexer; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +/** + * Externally configured list of @{link Indexer} beans. + */ @Configuration public class IndexingConfig { @@ -24,7 +27,9 @@ public class IndexingConfig { private AutowireCapableBeanFactory beanFactory; @Bean - public List indexers() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + public List indexers() + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { List indexers = new ArrayList(); for (IndexerConfig config : middleware.getIndexers()) { for (Class documentType : config.getDocumentTypes()) { @@ -34,7 +39,9 @@ public List indexers() throws InstantiationException, IllegalAccessExce return indexers; } - public Indexer indexer(Class type, Class documentType) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + public Indexer indexer(Class type, Class documentType) + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { Indexer indexer = type.getConstructor(Class.class).newInstance(documentType); beanFactory.autowireBean(indexer); return indexer; diff --git a/src/main/java/edu/tamu/scholars/middleware/config/InternationalizationConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/InternationalizationConfig.java index 28e73ed7f..155c84db1 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/InternationalizationConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/InternationalizationConfig.java @@ -5,6 +5,9 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.support.ResourceBundleMessageSource; +/** + * i18n configuration beans. Creates {@link MessageSource} bean to provide i18n keys. + */ @Configuration public class InternationalizationConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/RepositoryRestConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/RepositoryRestConfig.java index 18b555791..ea3356deb 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/RepositoryRestConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/RepositoryRestConfig.java @@ -8,6 +8,9 @@ import edu.tamu.scholars.middleware.auth.model.repo.handler.UserEventHandler; import edu.tamu.scholars.middleware.theme.model.repo.handler.ThemeEventHandler; +/** + * + */ @Configuration public class RepositoryRestConfig implements RepositoryRestConfigurer { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/SecurityExpressionConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/SecurityExpressionConfig.java index 43b685376..a9142a0ba 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/SecurityExpressionConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/SecurityExpressionConfig.java @@ -10,6 +10,9 @@ import org.springframework.security.web.FilterInvocation; import org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler; +/** + * + */ @Configuration public class SecurityExpressionConfig { @@ -22,17 +25,19 @@ public RoleHierarchy roleHierarchy() { @Bean public SecurityExpressionHandler securityExpressionHandler() { - DefaultWebSecurityExpressionHandler securityExpressionHandler = new DefaultWebSecurityExpressionHandler(); - securityExpressionHandler.setRoleHierarchy(roleHierarchy()); - return securityExpressionHandler; + DefaultWebSecurityExpressionHandler seh = new DefaultWebSecurityExpressionHandler(); + seh.setRoleHierarchy(roleHierarchy()); + + return seh; } @Bean @SuppressWarnings({ "rawtypes", "unchecked" }) public SecurityExpressionHandler> messageSecurityExpressionHandler() { - DefaultMessageSecurityExpressionHandler securityExpressionHandler = new DefaultMessageSecurityExpressionHandler>(); - securityExpressionHandler.setRoleHierarchy(roleHierarchy()); - return securityExpressionHandler; + DefaultMessageSecurityExpressionHandler seh = new DefaultMessageSecurityExpressionHandler>(); + seh.setRoleHierarchy(roleHierarchy()); + + return seh; } private String buildRoleHierarchy() { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/SolrConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/SolrConfig.java index 3568ba2d1..9c48bf2f8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/SolrConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/SolrConfig.java @@ -7,6 +7,9 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; +/** + * + */ @Configuration @Profile("!test") public class SolrConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/WebMvcConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/WebMvcConfig.java index 62bc30897..761b78ab7 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/WebMvcConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/WebMvcConfig.java @@ -24,6 +24,9 @@ import edu.tamu.scholars.middleware.discovery.resolver.QueryArgumentResolver; import edu.tamu.scholars.middleware.export.resolver.ExportArgumentResolver; +/** + * + */ @Configuration public class WebMvcConfig implements WebMvcConfigurer { @@ -42,7 +45,8 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/file/**") .addResourceLocations(assetDir) .resourceChain(true) - .addResolver(new PathResourceResolver() { + .addResolver( + new PathResourceResolver() { @Override @Nullable @@ -77,8 +81,8 @@ protected Resource getResource(String resourcePath, Resource location) throws IO return location; } - - }); + } + ); } @Override diff --git a/src/main/java/edu/tamu/scholars/middleware/config/WebSecurityConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/WebSecurityConfig.java index c40faede7..5a37ee25e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/WebSecurityConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/WebSecurityConfig.java @@ -10,6 +10,7 @@ import java.security.SecureRandom; import java.util.Arrays; +import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.MessageSource; @@ -36,8 +37,6 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import org.springframework.web.filter.CorsFilter; -import com.fasterxml.jackson.databind.ObjectMapper; - import edu.tamu.scholars.middleware.auth.config.TokenConfig; import edu.tamu.scholars.middleware.auth.handler.CustomAccessDeniedExceptionHandler; import edu.tamu.scholars.middleware.auth.handler.CustomAuthenticationEntryPoint; @@ -46,6 +45,9 @@ import edu.tamu.scholars.middleware.auth.handler.CustomLogoutSuccessHandler; import edu.tamu.scholars.middleware.config.model.MiddlewareConfig; +/** + * + */ @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @@ -95,8 +97,6 @@ public TokenService tokenService() throws NoSuchAlgorithmException { @Bean public CorsFilter corsFilter() { - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - CorsConfiguration embedConfig = new CorsConfiguration(); embedConfig.setAllowCredentials(true); embedConfig.setAllowedOriginPatterns(Arrays.asList("*")); @@ -105,17 +105,28 @@ public CorsFilter corsFilter() { embedConfig.addAllowedMethod("GET"); embedConfig.addAllowedMethod("OPTION"); + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/displayViews/search/findByName", embedConfig); - source.registerCorsConfiguration("/individual/{id}", embedConfig); - source.registerCorsConfiguration("/individual/search/findByIdIn", embedConfig); CorsConfiguration primaryConfig = new CorsConfiguration(); primaryConfig.setAllowCredentials(true); primaryConfig.setAllowedOrigins(config.getAllowedOrigins()); - primaryConfig.setAllowedMethods(Arrays.asList("GET", "DELETE", "PUT", "POST", "PATCH", "OPTIONS")); - primaryConfig.setAllowedHeaders(Arrays.asList("Authorization", "Origin", "Content-Type", "Content-Disposition")); + primaryConfig.setAllowedMethods(Arrays.asList( + "GET", + "DELETE", + "PUT", + "POST", + "PATCH", + "OPTIONS" + )); + primaryConfig.setAllowedHeaders(Arrays.asList( + "Authorization", + "Origin", + "Content-Type", + "Content-Disposition" + )); primaryConfig.setExposedHeaders(Arrays.asList("Content-Disposition")); // NOTE: most general path must be last diff --git a/src/main/java/edu/tamu/scholars/middleware/config/WebSocketConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/WebSocketConfig.java index f39b04e69..bddf06a26 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/WebSocketConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/WebSocketConfig.java @@ -21,6 +21,9 @@ import edu.tamu.scholars.middleware.config.model.MiddlewareConfig; import edu.tamu.scholars.middleware.messaging.handler.CustomStompSubProtocolErrorHandler; +/** + * + */ @Configuration @EnableWebSocketMessageBroker public class WebSocketConfig extends AbstractSessionWebSocketMessageBrokerConfigurer { @@ -38,11 +41,17 @@ protected void configureStompEndpoints(StompEndpointRegistry registry) { .setAllowedOrigins(config.getAllowedOrigins().toArray(new String[config.getAllowedOrigins().size()])) .addInterceptors( new HttpSessionHandshakeInterceptor(), - // TODO: remove when patched in spring-session, https://github.com/spring-projects/spring-session/issues/561 + // TODO: remove when patched in spring-session + // https://github.com/spring-projects/spring-session/issues/561 new HandshakeInterceptor() { @Override - public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map attributes) throws Exception { + public boolean beforeHandshake( + ServerHttpRequest request, + ServerHttpResponse response, + WebSocketHandler wsHandler, + Map attributes + ) throws Exception { if (attributes.containsKey(HTTP_SESSION_ID_ATTR_NAME)) { attributes.put(SPRING_SESSION_ID_ATTR_NAME, attributes.get(HTTP_SESSION_ID_ATTR_NAME)); } @@ -50,7 +59,12 @@ public boolean beforeHandshake(ServerHttpRequest request, ServerHttpResponse res } @Override - public void afterHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, @Nullable Exception exception) { + public void afterHandshake( + ServerHttpRequest request, + ServerHttpResponse response, + WebSocketHandler wsHandler, + @Nullable Exception exception + ) { } diff --git a/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java index 0bd757e1b..15af29877 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java @@ -13,6 +13,9 @@ import org.springframework.security.config.annotation.web.messaging.MessageSecurityMetadataSourceRegistry; import org.springframework.security.config.annotation.web.socket.AbstractSecurityWebSocketMessageBrokerConfigurer; +/** + * + */ @Configuration public class WebSocketSecurityConfig extends AbstractSecurityWebSocketMessageBrokerConfigurer { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/ExportConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/ExportConfig.java index e6b86391c..91f78d688 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/ExportConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/ExportConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware configuration to specify export properties. + * + *

See `middleware.export` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.export") public class ExportConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/HarvesterConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/HarvesterConfig.java index eacb2f8ad..3a809f396 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/HarvesterConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/HarvesterConfig.java @@ -3,6 +3,11 @@ import edu.tamu.scholars.middleware.discovery.component.Harvester; import edu.tamu.scholars.middleware.discovery.component.jena.TriplestoreHarvester; +/** + * {@link MiddlewareConfig} configuration to specify list of harvesters. + * + *

See `middleware.harvesters` in src/main/resources/application.yml.

+ */ public class HarvesterConfig extends IndexDocumentTypesConfig { private Class type = TriplestoreHarvester.class; @@ -10,7 +15,7 @@ public class HarvesterConfig extends IndexDocumentTypesConfig { public HarvesterConfig() { super(); } - + public Class getType() { return type; } diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/HttpConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/HttpConfig.java index 9f02a8117..bc4c020e6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/HttpConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/HttpConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware configuration to specify http properties. + * + *

See `middleware.http` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.http") public class HttpConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/IndexConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/IndexConfig.java index b3758b64e..2d76a6463 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/IndexConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/IndexConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware configuration to specify index properties. + * + *

See `middleware.index` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.index") public class IndexConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/IndexDocumentTypesConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/IndexDocumentTypesConfig.java index c1bf839bd..af1f0d5f6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/IndexDocumentTypesConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/IndexDocumentTypesConfig.java @@ -5,9 +5,12 @@ import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +/** + * Inherited by {@link HarvesterConfig} and {@link IndexerConfig}. + */ public abstract class IndexDocumentTypesConfig { - private List> documentTypes = new ArrayList>(); + private List> documentTypes = new ArrayList<>(); public IndexDocumentTypesConfig() { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/IndexerConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/IndexerConfig.java index 0859a1fda..158f19b75 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/IndexerConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/IndexerConfig.java @@ -3,6 +3,11 @@ import edu.tamu.scholars.middleware.discovery.component.Indexer; import edu.tamu.scholars.middleware.discovery.component.solr.SolrIndexer; +/** + * {@link MiddlewareConfig} configuration to specify list of indexers. + * + *

See `middleware.indexers` in src/main/resources/application.yml.

+ */ public class IndexerConfig extends IndexDocumentTypesConfig { private Class type = SolrIndexer.class; diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/MailConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/MailConfig.java index 4fd04b2d3..5d6b704bf 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/MailConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/MailConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware configuration to specify mail properties. + * + *

See `middleware.mail` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware.mail") public class MailConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfig.java index 8d58ec692..03368a157 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfig.java @@ -8,6 +8,11 @@ import edu.tamu.scholars.middleware.auth.config.AuthConfig; +/** + * Injectable middleware configuration. + * + *

See `middleware` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "middleware") public class MiddlewareConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfig.java index 191904705..98dd10ebe 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfig.java @@ -3,6 +3,11 @@ import edu.tamu.scholars.middleware.service.TDBTriplestore; import edu.tamu.scholars.middleware.service.Triplestore; +/** + * {@link MiddlewareConfig} configuration to specify triplestore. + * + *

See `middleware.triplestore` in src/main/resources/application.yml.

+ */ public class TriplestoreConfig { private Class type = TDBTriplestore.class; @@ -23,9 +28,9 @@ public class TriplestoreConfig { private int jdbcFetchSize = 8; - private boolean streamGraphAPI = true; + private boolean streamGraphApi = true; - private boolean annotateGeneratedSQL = false; + private boolean annotateGeneratedSql = false; public TriplestoreConfig() { @@ -103,20 +108,20 @@ public void setJdbcFetchSize(int jdbcFetchSize) { this.jdbcFetchSize = jdbcFetchSize; } - public boolean isStreamGraphAPI() { - return streamGraphAPI; + public boolean isStreamGraphApi() { + return streamGraphApi; } - public void setStreamGraphAPI(boolean streamGraphAPI) { - this.streamGraphAPI = streamGraphAPI; + public void setStreamGraphApi(boolean streamGraphApi) { + this.streamGraphApi = streamGraphApi; } - public boolean isAnnotateGeneratedSQL() { - return annotateGeneratedSQL; + public boolean isAnnotateGeneratedSql() { + return annotateGeneratedSql; } - public void setAnnotateGeneratedSQL(boolean annotateGeneratedSQL) { - this.annotateGeneratedSQL = annotateGeneratedSQL; + public void setAnnotateGeneratedSql(boolean annotateGeneratedSql) { + this.annotateGeneratedSql = annotateGeneratedSql; } } diff --git a/src/main/java/edu/tamu/scholars/middleware/config/model/VivoConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/model/VivoConfig.java index 2dbf865ca..4607f9fa6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/model/VivoConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/model/VivoConfig.java @@ -3,6 +3,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; +/** + * Injectable middleware configuration to specify vivo properties. + * + *

See `vivo` in src/main/resources/application.yml.

+ */ @Component @ConfigurationProperties(prefix = "vivo") public class VivoConfig { diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/AbstractDefaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/AbstractDefaults.java index 41fb30492..f5cc51da3 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/AbstractDefaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/AbstractDefaults.java @@ -8,6 +8,8 @@ import java.util.Map; import java.util.Optional; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -16,13 +18,13 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.support.ResourcePatternResolver; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; - import edu.tamu.scholars.middleware.config.model.MiddlewareConfig; import edu.tamu.scholars.middleware.model.Named; import edu.tamu.scholars.middleware.model.repo.NamedRepo; +/** + * + */ public abstract class AbstractDefaults> implements Defaults { private static final String CREATED_DEFAULTS = "Created {} {} defaults."; diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/AnalyticViewsDefaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/AnalyticViewsDefaults.java index b9f574712..7dacae62c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/AnalyticViewsDefaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/AnalyticViewsDefaults.java @@ -4,13 +4,15 @@ import java.io.InputStream; import java.util.List; -import org.springframework.stereotype.Service; - import com.fasterxml.jackson.core.type.TypeReference; +import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.view.model.DataAndAnalyticsView; import edu.tamu.scholars.middleware.view.model.repo.DataAndAnalyticsViewRepo; +/** + * + */ @Service public class AnalyticViewsDefaults extends AbstractDefaults { diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/Defaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/Defaults.java index 3c35b643b..8cb7ddde4 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/Defaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/Defaults.java @@ -7,6 +7,9 @@ import edu.tamu.scholars.middleware.model.Named; import edu.tamu.scholars.middleware.model.repo.NamedRepo; +/** + * + */ public interface Defaults> { public String path(); diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/DefaultsService.java b/src/main/java/edu/tamu/scholars/middleware/defaults/DefaultsService.java index 6904cc2af..9fce21518 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/DefaultsService.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/DefaultsService.java @@ -1,16 +1,19 @@ package edu.tamu.scholars.middleware.defaults; +import javax.annotation.PostConstruct; + import java.io.IOException; import java.util.List; -import javax.annotation.PostConstruct; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.config.model.MiddlewareConfig; +/** + * + */ @Service @Profile("!test") public class DefaultsService { diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/DirectoryViewsDefaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/DirectoryViewsDefaults.java index c5cb64f9d..9026e006a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/DirectoryViewsDefaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/DirectoryViewsDefaults.java @@ -4,13 +4,15 @@ import java.io.InputStream; import java.util.List; -import org.springframework.stereotype.Service; - import com.fasterxml.jackson.core.type.TypeReference; +import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.view.model.DirectoryView; import edu.tamu.scholars.middleware.view.model.repo.DirectoryViewRepo; +/** + * + */ @Service public class DirectoryViewsDefaults extends AbstractDefaults { diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/DiscoveryViewsDefaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/DiscoveryViewsDefaults.java index 287f6db6a..e43509007 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/DiscoveryViewsDefaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/DiscoveryViewsDefaults.java @@ -4,13 +4,15 @@ import java.io.InputStream; import java.util.List; -import org.springframework.stereotype.Service; - import com.fasterxml.jackson.core.type.TypeReference; +import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.view.model.DiscoveryView; import edu.tamu.scholars.middleware.view.model.repo.DiscoveryViewRepo; +/** + * + */ @Service public class DiscoveryViewsDefaults extends AbstractDefaults { diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/DisplayViewDefaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/DisplayViewDefaults.java index 7d4e36173..4a615eafe 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/DisplayViewDefaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/DisplayViewDefaults.java @@ -5,19 +5,21 @@ import java.nio.charset.StandardCharsets; import java.util.List; +import com.fasterxml.jackson.core.type.TypeReference; import org.apache.commons.io.IOUtils; import org.springframework.core.io.Resource; import org.springframework.stereotype.Service; -import com.fasterxml.jackson.core.type.TypeReference; - -import edu.tamu.scholars.middleware.view.model.DisplaySubsectionView; import edu.tamu.scholars.middleware.view.model.DisplaySectionView; +import edu.tamu.scholars.middleware.view.model.DisplaySubsectionView; import edu.tamu.scholars.middleware.view.model.DisplayTabView; import edu.tamu.scholars.middleware.view.model.DisplayView; import edu.tamu.scholars.middleware.view.model.ExportView; import edu.tamu.scholars.middleware.view.model.repo.DisplayViewRepo; +/** + * + */ @Service public class DisplayViewDefaults extends AbstractDefaults { diff --git a/src/main/java/edu/tamu/scholars/middleware/defaults/ThemeDefaults.java b/src/main/java/edu/tamu/scholars/middleware/defaults/ThemeDefaults.java index 1010bf74e..961e9a48d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/defaults/ThemeDefaults.java +++ b/src/main/java/edu/tamu/scholars/middleware/defaults/ThemeDefaults.java @@ -4,13 +4,15 @@ import java.io.InputStream; import java.util.List; -import org.springframework.stereotype.Service; - import com.fasterxml.jackson.core.type.TypeReference; +import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.theme.model.Theme; import edu.tamu.scholars.middleware.theme.model.repo.ThemeRepo; +/** + * + */ @Service public class ThemeDefaults extends AbstractDefaults { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java b/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java index 0e7f2ec00..eeb3885ae 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.discovery; +/** + * + */ public class DiscoveryConstants { public static String EXPORT_INDIVIDUAL_KEY; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/advice/DiscoveryControllerAdvice.java b/src/main/java/edu/tamu/scholars/middleware/discovery/advice/DiscoveryControllerAdvice.java index 6067e4e13..dd3fe75bd 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/advice/DiscoveryControllerAdvice.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/advice/DiscoveryControllerAdvice.java @@ -13,6 +13,9 @@ import edu.tamu.scholars.middleware.discovery.exception.InvalidValuePathException; import edu.tamu.scholars.middleware.discovery.exception.SolrRequestException; +/** + * + */ @ControllerAdvice public class DiscoveryControllerAdvice { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/CollectionSource.java b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/CollectionSource.java index 17f1950fd..1ddc22af8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/CollectionSource.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/CollectionSource.java @@ -7,6 +7,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; +/** + * + */ @Documented @Target(TYPE) @Retention(RUNTIME) diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldSource.java b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldSource.java index 8476734f1..2b8cfefed 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldSource.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldSource.java @@ -7,6 +7,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; +/** + * + */ @Documented @Target(FIELD) @Retention(RUNTIME) diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldType.java b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldType.java index bf52b5f88..b96f53054 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldType.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/FieldType.java @@ -6,6 +6,9 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +/** + * + */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE }) diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedMultiValuedProperty.java b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedMultiValuedProperty.java index 5fb0c95f7..08d57024f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedMultiValuedProperty.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedMultiValuedProperty.java @@ -7,6 +7,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.Target; +/** + * + */ @Documented @Target(FIELD) @Retention(RUNTIME) diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedObject.java b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedObject.java index 3d5c26907..bfd0b6a45 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedObject.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/annotation/NestedObject.java @@ -9,6 +9,9 @@ import org.springframework.core.annotation.AliasFor; +/** + * + */ @Documented @Target(FIELD) @Retention(RUNTIME) diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/BoostArg.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/BoostArg.java index 03116ee07..3adff4f16 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/BoostArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/BoostArg.java @@ -2,6 +2,9 @@ import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; +/** + * + */ public class BoostArg { private final String field; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryAcademicAgeDescriptor.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryAcademicAgeDescriptor.java index 3f705fac1..9354d868d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryAcademicAgeDescriptor.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryAcademicAgeDescriptor.java @@ -4,6 +4,9 @@ import java.util.ArrayList; import java.util.List; +/** + * + */ // TODO: refactor to DiscoveryAcademicAgeDescriptorArg and add argument resolver public class DiscoveryAcademicAgeDescriptor { @@ -79,7 +82,8 @@ public List getLabeledRanges() { int bound = getUpperLimitInYears() + getGroupingIntervalInYears(); - int i = 0, o = 0; + int i = 0; + int o = 0; int prevStart = i; int nextStart; while (i <= bound) { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryNetworkDescriptor.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryNetworkDescriptor.java index 37892b5ee..eb5f2938d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryNetworkDescriptor.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryNetworkDescriptor.java @@ -11,6 +11,9 @@ import org.apache.solr.common.params.MapSolrParams; import org.apache.solr.common.params.SolrParams; +/** + * + */ // TODO: refactor to DiscoveryNetworkDescriptorArg and add argument resolver public class DiscoveryNetworkDescriptor { @@ -72,7 +75,12 @@ public SolrParams getSolrParams() { return new MapSolrParams(queryParamMap); } - public static DiscoveryNetworkDescriptor of(String id, String dateField, List dataFields, String typeFilter) { + public static DiscoveryNetworkDescriptor of( + String id, + String dateField, + List dataFields, + String typeFilter + ) { return new DiscoveryNetworkDescriptor(id, dateField, dataFields, typeFilter); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryQuantityDistributionDescriptor.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryQuantityDistributionDescriptor.java index 7d35c0e22..85bc13010 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryQuantityDistributionDescriptor.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/DiscoveryQuantityDistributionDescriptor.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.discovery.argument; +/** + * + */ // TODO: refactor to DiscoveryQuantityDistributionDescriptorArg and add argument resolver public class DiscoveryQuantityDistributionDescriptor { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetArg.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetArg.java index 1a6e9c7f7..ee987c6f3 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetArg.java @@ -7,6 +7,9 @@ import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; import edu.tamu.scholars.middleware.view.model.FacetType; +/** + * + */ public class FacetArg { private final String field; @@ -27,7 +30,17 @@ public class FacetArg { private final String rangeGap; - FacetArg(String field, String sort, int pageSize, int pageNumber, String type, String exclusionTag, String rangeStart, String rangeEnd, String rangeGap) { + FacetArg( + String field, + String sort, + int pageSize, + int pageNumber, + String type, + String exclusionTag, + String rangeStart, + String rangeEnd, + String rangeGap + ) { this.field = DiscoveryUtility.findProperty(field); this.sort = FacetSortArg.of(sort); this.pageSize = pageSize; @@ -79,7 +92,17 @@ public String getCommand() { return StringUtils.isEmpty(exclusionTag) ? field : String.format("{!ex=%s}%s", exclusionTag, field); } - public static FacetArg of(String field, Optional sort, Optional pageSize, Optional pageNumber, Optional type, Optional exclusionTag, Optional rangeStart, Optional rangeEnd, Optional rangeGap) { + public static FacetArg of( + String field, + Optional sort, + Optional pageSize, + Optional pageNumber, + Optional type, + Optional exclusionTag, + Optional rangeStart, + Optional rangeEnd, + Optional rangeGap + ) { String sortParam = sort.isPresent() ? sort.get() : "COUNT,DESC"; int pageSizeParam = pageSize.isPresent() ? Integer.valueOf(pageSize.get()) : 10; int pageNumberParam = pageNumber.isPresent() ? Integer.valueOf(pageNumber.get()) : 1; @@ -88,7 +111,17 @@ public static FacetArg of(String field, Optional sort, Optional String rangeStartParam = rangeStart.isPresent() ? rangeStart.get() : "0"; String rangeEndParam = rangeEnd.isPresent() ? rangeEnd.get() : "100000"; String rangeGapParam = rangeGap.isPresent() ? rangeGap.get() : "100"; - return new FacetArg(field, sortParam, pageSizeParam, pageNumberParam, typeParam, exclusionTagParam, rangeStartParam, rangeEndParam, rangeGapParam); + return new FacetArg( + field, + sortParam, + pageSizeParam, + pageNumberParam, + typeParam, + exclusionTagParam, + rangeStartParam, + rangeEndParam, + rangeGapParam + ); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetSortArg.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetSortArg.java index 5c3378259..43ed8de5f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetSortArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FacetSortArg.java @@ -4,6 +4,9 @@ import edu.tamu.scholars.middleware.view.model.FacetSort; +/** + * + */ public class FacetSortArg { private final FacetSort property; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FilterArg.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FilterArg.java index b6d3f3510..bb56a01c1 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FilterArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/FilterArg.java @@ -7,6 +7,9 @@ import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; import edu.tamu.scholars.middleware.model.OpKey; +/** + * + */ public class FilterArg { private final String field; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/HighlightArg.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/HighlightArg.java index 6933a38bf..f580671d2 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/HighlightArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/HighlightArg.java @@ -6,6 +6,9 @@ import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; +/** + * + */ public class HighlightArg { private final String[] fields; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/QueryArg.java b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/QueryArg.java index 0bcca55de..d599518d2 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/argument/QueryArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/argument/QueryArg.java @@ -7,6 +7,9 @@ import edu.tamu.scholars.middleware.discovery.DiscoveryConstants; import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; +/** + * + */ public class QueryArg { private final String expression; @@ -21,7 +24,14 @@ public class QueryArg { private final String fields; - QueryArg(String expression, String defaultField, String minimumShouldMatch, String queryField, String boostQuery, String fields) { + QueryArg( + String expression, + String defaultField, + String minimumShouldMatch, + String queryField, + String boostQuery, + String fields + ) { this.expression = expression; this.defaultField = DiscoveryUtility.processFields(defaultField); this.minimumShouldMatch = minimumShouldMatch; @@ -54,7 +64,14 @@ public String getFields() { return fields; } - public static QueryArg of(Optional q, Optional df, Optional mm, Optional qf, Optional bq, Optional fl) { + public static QueryArg of( + Optional q, + Optional df, + Optional mm, + Optional qf, + Optional bq, + Optional fl + ) { String expression = q.isPresent() ? q.get() : DiscoveryConstants.DEFAULT_QUERY; String defaultField = df.isPresent() ? df.get() : StringUtils.EMPTY; String minimumShouldMatch = mm.isPresent() ? mm.get() : StringUtils.EMPTY; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/DiscoveryPagedResourcesAssembler.java b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/DiscoveryPagedResourcesAssembler.java index 3a4ce99a5..37d6b1952 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/DiscoveryPagedResourcesAssembler.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/DiscoveryPagedResourcesAssembler.java @@ -16,15 +16,25 @@ import edu.tamu.scholars.middleware.discovery.response.DiscoveryFacetPage; import edu.tamu.scholars.middleware.discovery.response.DiscoveryFacetPage.Facet; +/** + * + */ @Component public class DiscoveryPagedResourcesAssembler extends PagedResourcesAssembler { - public DiscoveryPagedResourcesAssembler(@Nullable HateoasPageableHandlerMethodArgumentResolver resolver, @Nullable UriComponents baseUri) { + public DiscoveryPagedResourcesAssembler( + @Nullable HateoasPageableHandlerMethodArgumentResolver resolver, + @Nullable UriComponents baseUri + ) { super(resolver, baseUri); } @Override - protected , S> PagedModel createPagedModel(List resources, PagedModel.PageMetadata metadata, Page page) { + protected , S> PagedModel createPagedModel( + List resources, + PagedModel.PageMetadata metadata, + Page page + ) { PagedModel pagedResource = super.createPagedModel(resources, metadata, page); if (page instanceof DiscoveryFacetAndHighlightPage) { return new FacetAndHightlightPagedResource(pagedResource, (DiscoveryFacetAndHighlightPage) page); @@ -56,7 +66,10 @@ class FacetAndHightlightPagedResource, S> exten private final List highlights; - FacetAndHightlightPagedResource(PagedModel pagedResources, DiscoveryFacetAndHighlightPage facetAndHighlightPage) { + FacetAndHightlightPagedResource( + PagedModel pagedResources, + DiscoveryFacetAndHighlightPage facetAndHighlightPage + ) { super(pagedResources.getContent(), pagedResources.getMetadata(), pagedResources.getLinks()); this.facets = facetAndHighlightPage.getFacets(); this.highlights = facetAndHighlightPage.getHighlights(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/IndividualResourceAssembler.java b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/IndividualResourceAssembler.java index 149b7df83..697014711 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/IndividualResourceAssembler.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/IndividualResourceAssembler.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.controller.IndividualSearchController; import edu.tamu.scholars.middleware.discovery.model.Individual; +/** + * + */ @Component public class IndividualResourceAssembler extends RepresentationModelAssemblerSupport { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualCollectionModel.java b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualCollectionModel.java index e4c79662b..e19cc8eca 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualCollectionModel.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualCollectionModel.java @@ -5,9 +5,16 @@ import org.springframework.hateoas.Link; import org.springframework.lang.Nullable; +/** + * + */ public class IndividualCollectionModel extends CollectionModel { - public IndividualCollectionModel(Iterable content, Iterable links, @Nullable ResolvableType fallbackType) { + public IndividualCollectionModel( + Iterable content, + Iterable links, + @Nullable ResolvableType fallbackType + ) { super(content, links, fallbackType); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualModel.java b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualModel.java index f3e977ce7..c15ddf8c9 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualModel.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/assembler/model/IndividualModel.java @@ -5,6 +5,9 @@ import edu.tamu.scholars.middleware.discovery.model.Individual; +/** + * + */ public class IndividualModel extends EntityModel { public IndividualModel(Individual individual, Iterable links) { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java index 1302adc30..2a7f5eec7 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java @@ -1,9 +1,13 @@ package edu.tamu.scholars.middleware.discovery.component; +import reactor.core.publisher.Flux; + import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; import edu.tamu.scholars.middleware.discovery.model.Individual; -import reactor.core.publisher.Flux; +/** + * + */ public interface Harvester { public Flux harvest(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java index 81556bfe2..e0b786dfd 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java @@ -5,6 +5,9 @@ import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; import edu.tamu.scholars.middleware.discovery.model.Individual; +/** + * + */ public interface Indexer { public void init(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java index 95642cd9f..1e901d8f0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java @@ -25,6 +25,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import reactor.core.publisher.Flux; import edu.tamu.scholars.middleware.discovery.annotation.CollectionSource; import edu.tamu.scholars.middleware.discovery.annotation.FieldSource; @@ -34,8 +35,10 @@ import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.service.TemplateService; import edu.tamu.scholars.middleware.service.Triplestore; -import reactor.core.publisher.Flux; +/** + * + */ public class TriplestoreHarvester implements Harvester { private static final Logger logger = LoggerFactory.getLogger(TriplestoreHarvester.class); @@ -99,7 +102,9 @@ public Class type() { return type; } - private Individual createIndividual(String subject) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + private Individual createIndividual(String subject) + throws InstantiationException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException, NoSuchMethodException, SecurityException { Individual individual = new Individual(); individual.setId(parse(subject)); lookupProperties(individual, subject); @@ -121,7 +126,12 @@ private void lookupProperties(Individual individual, String subject) { logger.debug("Could not find values for {}", typeOp.getField().getName()); } } catch (Exception e) { - logger.error("Unable to populate individual {} {}: {}", type.getSimpleName(), parse(subject), e.getMessage()); + logger.error( + "Unable to populate individual {} {}: {}", + type.getSimpleName(), + parse(subject), + e.getMessage() + ); logger.debug("Error populating individual", e); } }); @@ -184,7 +194,11 @@ private List queryForProperty(TypeOp typeOp, FieldSource source, Model m return values; } - private void populate(Individual document, Field field, List values) throws IllegalArgumentException, IllegalAccessException { + private void populate( + Individual document, + Field field, + List values + ) throws IllegalArgumentException, IllegalAccessException { if (values.isEmpty()) { logger.debug("Could not find values for {}", field.getName()); } else { @@ -216,9 +230,9 @@ private void lookupSyncIds(Individual individual) { } private void addSyncId(Set syncIds, String value) { - String[] vParts = value.split(NESTED_DELIMITER); - for (int i = 1; i < vParts.length; i++) { - syncIds.add(vParts[i]); + String[] valueParts = value.split(NESTED_DELIMITER); + for (int i = 1; i < valueParts.length; i++) { + syncIds.add(valueParts[i]); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java index e46624f53..6a371518e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java @@ -22,6 +22,9 @@ import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; import edu.tamu.scholars.middleware.discovery.model.Individual; +/** + * + */ public class SolrIndexer implements Indexer { private static final Logger logger = LoggerFactory.getLogger(SolrIndexer.class); @@ -72,7 +75,10 @@ public void init() { if (fieldType.copyTo().length > 0) { try { - SchemaRequest.AddCopyField addCopyFieldRequest = new SchemaRequest.AddCopyField(name, Arrays.asList(fieldType.copyTo())); + SchemaRequest.AddCopyField addCopyFieldRequest = new SchemaRequest.AddCopyField( + name, + Arrays.asList(fieldType.copyTo()) + ); addCopyFieldRequest.process(solrClient, collectionName); } catch (Exception e) { logger.error("Failed to add copy field", e); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndexingController.java b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndexingController.java index b98d95ab7..2c1ab0e81 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndexingController.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndexingController.java @@ -1,6 +1,7 @@ package edu.tamu.scholars.middleware.discovery.controller; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -9,10 +10,14 @@ import edu.tamu.scholars.middleware.discovery.service.IndexService; +/** + * + */ @RestController @RequestMapping("/index") public class IndexingController { + @Lazy @Autowired private IndexService indexService; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualAnalyticsController.java b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualAnalyticsController.java index e718967ae..4fd0bc68a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualAnalyticsController.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualAnalyticsController.java @@ -3,6 +3,7 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; @@ -18,10 +19,14 @@ import edu.tamu.scholars.middleware.discovery.response.DiscoveryAcademicAge; import edu.tamu.scholars.middleware.discovery.response.DiscoveryQuantityDistribution; +/** + * + */ @RestController @RequestMapping("/individual/analytics") public class IndividualAnalyticsController { + @Lazy @Autowired private IndividualRepo repo; @@ -38,7 +43,20 @@ public ResponseEntity academicAge( @RequestParam(name = "upperLimitInYears", defaultValue = "40") Integer upperLimitInYears, @RequestParam(name = "groupingIntervalInYears", defaultValue = "5") Integer groupingIntervalInYears) { - return ResponseEntity.ok(repo.academicAge(DiscoveryAcademicAgeDescriptor.of(label, dateField, accumulateMultivaluedDate, averageOverInterval, upperLimitInYears, groupingIntervalInYears), query, filters)); + return ResponseEntity.ok( + repo.academicAge( + DiscoveryAcademicAgeDescriptor.of( + label, + dateField, + accumulateMultivaluedDate, + averageOverInterval, + upperLimitInYears, + groupingIntervalInYears + ), + query, + filters + ) + ); } @GetMapping("/quantityDistribution") @@ -49,7 +67,13 @@ public ResponseEntity quantityDistribution( @RequestParam(name = "label", defaultValue = "UN SDG") String label, @RequestParam(name = "field", defaultValue = "tags") String field) { - return ResponseEntity.ok(repo.quantityDistribution(DiscoveryQuantityDistributionDescriptor.of(label, field), query, filters)); + return ResponseEntity.ok( + repo.quantityDistribution( + DiscoveryQuantityDistributionDescriptor.of(label, field), + query, + filters + ) + ); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualController.java b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualController.java index 52074268f..f8a7bfc78 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualController.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualController.java @@ -5,13 +5,14 @@ import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; +import javax.persistence.EntityNotFoundException; + import java.util.Arrays; import java.util.List; import java.util.Optional; -import javax.persistence.EntityNotFoundException; - import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.Pageable; import org.springframework.data.web.PageableDefault; import org.springframework.hateoas.PagedModel; @@ -35,15 +36,21 @@ import edu.tamu.scholars.middleware.discovery.model.repo.IndividualRepo; import edu.tamu.scholars.middleware.discovery.response.DiscoveryNetwork; +/** + * + */ @RestController public class IndividualController implements RepresentationModelProcessor { + @Lazy @Autowired private IndividualRepo repo; + @Lazy @Autowired private IndividualResourceAssembler assembler; + @Lazy @Autowired private DiscoveryPagedResourcesAssembler pagedAssembler; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchController.java b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchController.java index 47c771a99..62d4328ff 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchController.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchController.java @@ -11,6 +11,7 @@ import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.rest.webmvc.RepositorySearchesResource; @@ -35,21 +36,29 @@ import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.discovery.model.repo.IndividualRepo; +/** + * + */ @RestController @RequestMapping("/individual") public class IndividualSearchController implements RepresentationModelProcessor { + @Lazy @Autowired private IndividualRepo repo; + @Lazy @Autowired private IndividualResourceAssembler assembler; + @Lazy @Autowired private DiscoveryPagedResourcesAssembler pagedAssembler; @GetMapping("/search/findByIdIn") - public ResponseEntity> findByIdIn(@RequestParam(required = true) List ids) { + public ResponseEntity> findByIdIn( + @RequestParam(required = true) List ids + ) { return ResponseEntity.ok(assembler.toCollectionModel(repo.findByIdIn(ids))); } @@ -75,7 +84,12 @@ public ResponseEntity> search( HighlightArg highlight, @PageableDefault(page = 0, size = 10, sort = ID, direction = ASC) Pageable page ) { - return ResponseEntity.ok(pagedAssembler.toModel(repo.search(query, facets, filters, boosts, highlight, page), assembler)); + return ResponseEntity.ok( + pagedAssembler.toModel( + repo.search(query, facets, filters, boosts, highlight, page), + assembler + ) + ); } @Override diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchCountController.java b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchCountController.java index cd8aab531..8bb40bd4d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchCountController.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/controller/IndividualSearchCountController.java @@ -5,6 +5,7 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -14,14 +15,21 @@ import edu.tamu.scholars.middleware.discovery.argument.FilterArg; import edu.tamu.scholars.middleware.discovery.model.repo.IndividualRepo; +/** + * + */ @RestController public class IndividualSearchCountController { + @Lazy @Autowired private IndividualRepo repo; @GetMapping(value = "/individual/search/count", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity count(@RequestParam(value = "query", required = false, defaultValue = DEFAULT_QUERY) String query, List filters) { + public ResponseEntity count( + @RequestParam(value = "query", required = false, defaultValue = DEFAULT_QUERY) String query, + List filters + ) { return ResponseEntity.ok(new Count(repo.count(query, filters))); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/exception/InvalidValuePathException.java b/src/main/java/edu/tamu/scholars/middleware/discovery/exception/InvalidValuePathException.java index ce5ddc1a3..cc0b7015f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/exception/InvalidValuePathException.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/exception/InvalidValuePathException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.discovery.exception; +/** + * + */ public class InvalidValuePathException extends Exception { private static final long serialVersionUID = 743005968579994619L; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/exception/SolrRequestException.java b/src/main/java/edu/tamu/scholars/middleware/discovery/exception/SolrRequestException.java index 8732ffde8..d07928a4f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/exception/SolrRequestException.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/exception/SolrRequestException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.discovery.exception; +/** + * + */ public class SolrRequestException extends RuntimeException { private static final long serialVersionUID = 385092384750932845L; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java b/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java index ce21c9d6f..ea3d76e6d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java @@ -20,6 +20,9 @@ import edu.tamu.scholars.middleware.config.model.IndexConfig; import edu.tamu.scholars.middleware.discovery.model.repo.IndividualRepo; +/** + * + */ @Component("index") @Profile("!test") public class IndexHealthIndicator implements HealthIndicator { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java index d7e22af1b..f17d5ed91 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java @@ -10,6 +10,9 @@ import edu.tamu.scholars.middleware.discovery.annotation.FieldSource; import edu.tamu.scholars.middleware.discovery.annotation.FieldType; +/** + * + */ public abstract class AbstractIndexDocument { @JsonProperty(CLASS) @@ -19,7 +22,11 @@ public abstract class AbstractIndexDocument { private String id; @FieldType(type = "whole_strings") - @FieldSource(template = "common/type", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "common/type", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List type; @FieldType(type = "strings") diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java index 15c34dc38..646e379e6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java @@ -14,109 +14,180 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "collections", predicate = "http://purl.org/ontology/bibo/Collection") public class Collection extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) - @FieldSource(template = "collection/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/name", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String name; @JsonProperty(ABSTRACT) @FieldType(type = "tokenized_string", value = ABSTRACT, copyTo = "_text_") - @FieldSource(template = "collection/abstract", predicate = "http://purl.org/ontology/bibo/abstract") + @FieldSource( + template = "collection/abstract", + predicate = "http://purl.org/ontology/bibo/abstract" + ) private String abstractText; @FieldType(type = "whole_string") - @FieldSource(template = "collection/abbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "collection/abbreviation", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private String abbreviation; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/publicationVenueFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/publicationVenueFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List publicationVenueFor; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/editor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/editor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List editors; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/translator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/translator", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List translators; @FieldType(type = "pdate", searchable = false) - @FieldSource(template = "collection/publicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "collection/publicationDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String publicationDate; @FieldType(type = "nested_whole_string") @NestedObject(properties = { @Reference(value = "publisherType", key = "type") }) - @FieldSource(template = "collection/publisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "collection/publisher", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private String publisher; @FieldType(type = "nested_whole_string") - @FieldSource(template = "collection/publisherType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "collection/publisherType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private String publisherType; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/hasSubjectArea", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subjectAreas; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/feature", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/feature", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List features; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/outputOfProcessOrEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/outputOfProcessOrEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outputOfProcessOrEvent; @FieldType(type = "whole_strings", copyTo = "_text_") - @FieldSource(template = "collection/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") + @FieldSource( + template = "collection/keyword", + predicate = "http://vivoweb.org/ontology/core#freetextKeyword" + ) private List keywords; @FieldType(type = "whole_string") - @FieldSource(template = "collection/issn", predicate = "http://purl.org/ontology/bibo/issn") + @FieldSource( + template = "collection/issn", + predicate = "http://purl.org/ontology/bibo/issn" + ) private String issn; @FieldType(type = "whole_string") - @FieldSource(template = "collection/eissn", predicate = "http://purl.org/ontology/bibo/eissn") + @FieldSource( + template = "collection/eissn", + predicate = "http://purl.org/ontology/bibo/eissn" + ) private String eissn; @FieldType(type = "whole_string") - @FieldSource(template = "collection/doi", predicate = "http://purl.org/ontology/bibo/doi") + @FieldSource( + template = "collection/doi", + predicate = "http://purl.org/ontology/bibo/doi" + ) private String doi; @FieldType(type = "whole_string") - @FieldSource(template = "collection/oclcnum", predicate = "http://purl.org/ontology/bibo/oclcnum") + @FieldSource( + template = "collection/oclcnum", + predicate = "http://purl.org/ontology/bibo/oclcnum" + ) private String oclcnum; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/isAbout", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/isAbout", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List isAbout; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/specifiedOutputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/specifiedOutputOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List specifiedOutputOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/mention", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/mention", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List mentions; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/participatesIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/participatesIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List participatesIn; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "collection/supportedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "collection/supportedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List supportedBy; public Collection() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java index 1b842a33c..36358958d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java @@ -7,37 +7,61 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ public class Common extends AbstractIndexDocument { @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "common/image", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl") + @FieldSource( + template = "common/image", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl" + ) private String image; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "common/thumbnail", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl") + @FieldSource( + template = "common/thumbnail", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl" + ) private String thumbnail; @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "websiteUrl", key = "url") }) - @FieldSource(template = "common/website", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "common/website", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List websites; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "common/websiteUrl", predicate = "http://www.w3.org/2006/vcard/ns#url") + @FieldSource( + template = "common/websiteUrl", + predicate = "http://www.w3.org/2006/vcard/ns#url" + ) private List websiteUrl; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "common/geographicFocus", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "common/geographicFocus", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List geographicFocus; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "common/sameAs", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "common/sameAs", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List sameAs; @FieldType(type = "pdate") - @FieldSource(template = "common/modTime", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime") + @FieldSource( + template = "common/modTime", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime" + ) private String modTime; public String getImage() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java index c013b93a7..c674f8b8e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java @@ -13,103 +13,181 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "concepts", predicate = "http://www.w3.org/2004/02/skos/core#Concept") public class Concept extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) - @FieldSource(template = "concept/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/name", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String name; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "concept/associatedDepartment", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/associatedDepartment", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List associatedDepartments; @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "concept/researchAreaOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/researchAreaOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List researchAreaOf; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @NestedObject(properties = { @Reference(value = "awardOrHonorForType", key = "type") }) - @FieldSource(template = "concept/awardOrHonorFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "awardOrHonorForType", key = "type") + }) + @FieldSource( + template = "concept/awardOrHonorFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardOrHonorFor; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "concept/awardOrHonorForType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "concept/awardOrHonorForType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List awardOrHonorForType; @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "awardConferredBy_nested_facets" }) - @NestedObject(properties = { @Reference(value = "awardConferredByType", key = "type") }) - @FieldSource(template = "concept/awardConferredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "awardConferredByType", key = "type") + }) + @FieldSource( + template = "concept/awardConferredBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardConferredBy; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "concept/awardConferredByType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "concept/awardConferredByType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List awardConferredByType; @FieldType(type = "whole_strings", copyTo = "_text_") - @FieldSource(template = "concept/awardConferredByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardConferredBy_label") + @FieldSource( + template = "concept/awardConferredByPreferredLabel", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardConferredBy_label" + ) private List awardConferredByPreferredLabel; @FieldType(type = "pdate") - @FieldSource(template = "concept/yearAwarded", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "concept/yearAwarded", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String yearAwarded; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "receiptRecipientName", key = "recipientName") }) - @FieldSource(template = "concept/receipts", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "receiptRecipientName", key = "recipientName") + }) + @FieldSource( + template = "concept/receipts", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List receipts; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "concept/receiptRecipientName", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/receiptRecipientName", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List receiptRecipientName; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "concept/broaderConcept", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/broaderConcept", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List broaderConcepts; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "concept/narrowerConcept", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/narrowerConcept", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List narrowerConcepts; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "concept/relatedConcept", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/relatedConcept", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List relatedConcepts; @FieldType(type = "nested_tokenized_string", copyTo = { "_text_", "futureResearchIdeaOf_nested_facets" }) - @NestedObject(properties = { @Reference(value = "futureResearchIdeaOfEmail", key = "email"), @Reference(value = "futureResearchIdeaOfTitle", key = "title"), @Reference(value = "futureResearchIdeaOfOrganization", key = "organizations") }) - @FieldSource(template = "concept/futureResearchIdeaOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "futureResearchIdeaOfEmail", key = "email"), + @Reference(value = "futureResearchIdeaOfTitle", key = "title"), + @Reference(value = "futureResearchIdeaOfOrganization", key = "organizations") + }) + @FieldSource( + template = "concept/futureResearchIdeaOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String futureResearchIdeaOf; @FieldType(type = "nested_whole_string") - @FieldSource(template = "concept/futureResearchIdeaOfEmail", predicate = "http://www.w3.org/2006/vcard/ns#email") + @FieldSource( + template = "concept/futureResearchIdeaOfEmail", + predicate = "http://www.w3.org/2006/vcard/ns#email" + ) private String futureResearchIdeaOfEmail; @FieldType(type = "nested_whole_string") - @FieldSource(template = "concept/futureResearchIdeaOfTitle", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/futureResearchIdeaOfTitle", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String futureResearchIdeaOfTitle; @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") - @FieldSource(template = "concept/futureResearchIdeaOfOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "concept/futureResearchIdeaOfOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List futureResearchIdeaOfOrganization; @FieldType(type = "whole_strings", copyTo = "_text_") - @FieldSource(template = "concept/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") + @FieldSource( + template = "concept/keyword", + predicate = "http://vivoweb.org/ontology/core#freetextKeyword" + ) private List keywords; @FieldType(type = "tokenized_string", copyTo = "_text_") - @FieldSource(template = "concept/description", predicate = "http://vivoweb.org/ontology/core#description") + @FieldSource( + template = "concept/description", + predicate = "http://vivoweb.org/ontology/core#description" + ) private String description; @FieldType(type = "pdate") - @FieldSource(template = "concept/createdDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "concept/createdDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String createdDate; public Concept() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java index 857fbef75..58bad8ac0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java @@ -15,352 +15,600 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "documents", predicate = "http://purl.org/ontology/bibo/Document") public class Document extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "title_sort" }) - @FieldSource(template = "document/title", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/title", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String title; @JsonProperty(ABSTRACT) @FieldType(type = "tokenized_string", value = ABSTRACT, copyTo = "_text_") - @FieldSource(template = "document/abstract", predicate = "http://purl.org/ontology/bibo/abstract") + @FieldSource( + template = "document/abstract", + predicate = "http://purl.org/ontology/bibo/abstract" + ) private String abstractText; @FieldType(type = "whole_string", copyTo = "_text_") - @FieldSource(template = "document/abbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "document/abbreviation", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private String abbreviation; @NestedObject @FieldType(type = "nested_whole_string", copyTo = "_text_") - @FieldSource(template = "document/publicationVenue", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "document/publicationVenue", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private String publicationVenue; @NestedObject @FieldType(type = "nested_whole_string", searchable = false) - @FieldSource(template = "document/hasPublicationVenueFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "document/hasPublicationVenueFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private String hasPublicationVenueFor; @FieldType(type = "whole_string", copyTo = "_text_") - @FieldSource(template = "document/publicationOutlet", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#publishedProceedings", unique = true) + @FieldSource( + template = "document/publicationOutlet", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#publishedProceedings", + unique = true + ) private String publicationOutlet; @FieldType(type = "whole_string", copyTo = "_text_") - @FieldSource(template = "document/nameOfConference", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#nameOfConference", unique = true) + @FieldSource( + template = "document/nameOfConference", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#nameOfConference", + unique = true + ) private String nameOfConference; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @NestedObject(properties = { @Reference(value = "authorOrganization", key = "organizations") }) - @FieldSource(template = "document/author", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "authorOrganization", key = "organizations") + }) + @FieldSource( + template = "document/author", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List authors; @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") - @FieldSource(template = "document/authorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/authorOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List authorOrganization; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/editor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/editor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List editors; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/translator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/translator", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List translators; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/status", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/status", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String status; @FieldType(type = "pdate") - @FieldSource(template = "document/publicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "document/publicationDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String publicationDate; @FieldType(type = "nested_whole_string") - @NestedObject(properties = { @Reference(value = "publisherType", key = "type") }) - @FieldSource(template = "document/publisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @NestedObject(properties = { + @Reference(value = "publisherType", key = "type") + }) + @FieldSource( + template = "document/publisher", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private String publisher; @FieldType(type = "nested_whole_string") - @FieldSource(template = "document/publisherType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "document/publisherType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private String publisherType; @FieldType(type = "pdate", searchable = false) - @FieldSource(template = "document/dateFiled", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "document/dateFiled", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String dateFiled; @FieldType(type = "pdate", searchable = false) - @FieldSource(template = "document/dateIssued", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "document/dateIssued", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String dateIssued; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "document/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/hasSubjectArea", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subjectAreas; @FieldType(type = "whole_strings", searchable = false) - @FieldSource(template = "document/hasRestriction", predicate = "http://purl.obolibrary.org/obo/ERO_0000045") + @FieldSource( + template = "document/hasRestriction", + predicate = "http://purl.obolibrary.org/obo/ERO_0000045" + ) private List restrictions; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/documentPart", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/documentPart", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List documentParts; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/chapter", predicate = "http://purl.org/ontology/bibo/chapter") + @FieldSource( + template = "document/chapter", + predicate = "http://purl.org/ontology/bibo/chapter" + ) private String chapter; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/feature", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/feature", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List features; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/edition", predicate = "http://purl.org/ontology/bibo/edition") + @FieldSource( + template = "document/edition", + predicate = "http://purl.org/ontology/bibo/edition" + ) private String edition; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/documentationForProjectOrResource", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/documentationForProjectOrResource", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List documentationForProjectOrResource; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/outputOfProcessOrEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/outputOfProcessOrEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outputOfProcessOrEvent; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/presentedAt", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/presentedAt", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List presentedAt; @FieldType(type = "whole_strings", copyTo = "_text_") - @FieldSource(template = "document/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") + @FieldSource( + template = "document/keyword", + predicate = "http://vivoweb.org/ontology/core#freetextKeyword" + ) private List keywords; @FieldType(type = "whole_string") - @FieldSource(template = "document/eanucc13", predicate = "http://purl.org/ontology/bibo/eanucc13") + @FieldSource( + template = "document/eanucc13", + predicate = "http://purl.org/ontology/bibo/eanucc13" + ) private String eanucc13; @FieldType(type = "whole_string") - @FieldSource(template = "document/nihmsid", predicate = "http://vivoweb.org/ontology/core#nihmsid") + @FieldSource( + template = "document/nihmsid", + predicate = "http://vivoweb.org/ontology/core#nihmsid" + ) private String nihmsid; @FieldType(type = "whole_string") - @FieldSource(template = "document/pmcid", predicate = "http://vivoweb.org/ontology/core#pmcid") + @FieldSource( + template = "document/pmcid", + predicate = "http://vivoweb.org/ontology/core#pmcid" + ) private String pmcid; @FieldType(type = "whole_string") - @FieldSource(template = "document/identifier", predicate = "http://purl.org/ontology/bibo/identifier") + @FieldSource( + template = "document/identifier", + predicate = "http://purl.org/ontology/bibo/identifier" + ) private String identifier; @FieldType(type = "whole_string") - @FieldSource(template = "document/patentNumber", predicate = "http://vivoweb.org/ontology/core#patentNumber") + @FieldSource( + template = "document/patentNumber", + predicate = "http://vivoweb.org/ontology/core#patentNumber" + ) private String patentNumber; @FieldType(type = "whole_string") - @FieldSource(template = "document/doi", predicate = "http://purl.org/ontology/bibo/doi") + @FieldSource( + template = "document/doi", + predicate = "http://purl.org/ontology/bibo/doi" + ) private String doi; @FieldType(type = "whole_string") - @FieldSource(template = "document/oclcnum", predicate = "http://purl.org/ontology/bibo/oclcnum") + @FieldSource( + template = "document/oclcnum", + predicate = "http://purl.org/ontology/bibo/oclcnum" + ) private String oclcnum; @FieldType(type = "whole_string") - @FieldSource(template = "document/isbn10", predicate = "http://purl.org/ontology/bibo/isbn10") + @FieldSource( + template = "document/isbn10", + predicate = "http://purl.org/ontology/bibo/isbn10" + ) private String isbn10; @FieldType(type = "whole_string") - @FieldSource(template = "document/isbn13", predicate = "http://purl.org/ontology/bibo/isbn13") + @FieldSource( + template = "document/isbn13", + predicate = "http://purl.org/ontology/bibo/isbn13" + ) private String isbn13; @FieldType(type = "whole_string") - @FieldSource(template = "document/pmid", predicate = "http://purl.org/ontology/bibo/pmid") + @FieldSource( + template = "document/pmid", + predicate = "http://purl.org/ontology/bibo/pmid" + ) private String pmid; @FieldType(type = "whole_string") - @FieldSource(template = "document/lccn", predicate = "http://purl.org/ontology/bibo/lccn") + @FieldSource( + template = "document/lccn", + predicate = "http://purl.org/ontology/bibo/lccn" + ) private String lccn; @FieldType(type = "whole_string") - @FieldSource(template = "document/issn", predicate = "http://purl.org/ontology/bibo/issn") + @FieldSource( + template = "document/issn", + predicate = "http://purl.org/ontology/bibo/issn" + ) private String issn; @FieldType(type = "whole_string") - @FieldSource(template = "document/eissn", predicate = "http://purl.org/ontology/bibo/eissn") + @FieldSource( + template = "document/eissn", + predicate = "http://purl.org/ontology/bibo/eissn" + ) private String eissn; @FieldType(type = "whole_string") - @FieldSource(template = "document/uri", predicate = "http://purl.org/ontology/bibo/uri") + @FieldSource( + template = "document/uri", + predicate = "http://purl.org/ontology/bibo/uri" + ) private String uri; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/citedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/citedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List citedBy; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/cites", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/cites", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List cites; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/citesAsDataSource", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/citesAsDataSource", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List citesAsDataSource; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/hasTranslation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/hasTranslation", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List translations; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/translationOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/translationOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List translationOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/globalCitationFrequency", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/globalCitationFrequency", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List globalCitationFrequency; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/iclCode", predicate = "http://vivoweb.org/ontology/core#iclCode") + @FieldSource( + template = "document/iclCode", + predicate = "http://vivoweb.org/ontology/core#iclCode" + ) private String iclCode; @FieldType(type = "pint") - @FieldSource(template = "document/numberOfPages", predicate = "http://purl.org/ontology/bibo/numPages") + @FieldSource( + template = "document/numberOfPages", + predicate = "http://purl.org/ontology/bibo/numPages" + ) private Integer numberOfPages; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/pageStart", predicate = "http://purl.org/ontology/bibo/pageStart") + @FieldSource( + template = "document/pageStart", + predicate = "http://purl.org/ontology/bibo/pageStart" + ) private String pageStart; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/pageEnd", predicate = "http://purl.org/ontology/bibo/pageEnd") + @FieldSource( + template = "document/pageEnd", + predicate = "http://purl.org/ontology/bibo/pageEnd" + ) private String pageEnd; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/number", predicate = "http://purl.org/ontology/bibo/number") + @FieldSource( + template = "document/number", + predicate = "http://purl.org/ontology/bibo/number" + ) private String number; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/volume", predicate = "http://purl.org/ontology/bibo/volume") + @FieldSource( + template = "document/volume", + predicate = "http://purl.org/ontology/bibo/volume" + ) private String volume; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/issue", predicate = "http://purl.org/ontology/bibo/issue") + @FieldSource( + template = "document/issue", + predicate = "http://purl.org/ontology/bibo/issue" + ) private String issue; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/placeOfPublication", predicate = "http://vivoweb.org/ontology/core#placeOfPublication") + @FieldSource( + template = "document/placeOfPublication", + predicate = "http://vivoweb.org/ontology/core#placeOfPublication" + ) private String placeOfPublication; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/assignee", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/assignee", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List assignees; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/reproducedIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/reproducedIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List reproducedIn; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/reproduces", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/reproduces", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List reproduces; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/isAbout", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/isAbout", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List isAbout; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/specifiedOutputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/specifiedOutputOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List specifiedOutputOf; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "document/isTemplate", predicate = "http://purl.obolibrary.org/obo/ARG_0000001") + @FieldSource( + template = "document/isTemplate", + predicate = "http://purl.obolibrary.org/obo/ARG_0000001" + ) private String isTemplate; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/mention", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/mention", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List mentions; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/participatesIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/participatesIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List participatesIn; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/supportedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/supportedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List supportedBy; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/receipt", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/receipt", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List receipts; @FieldType(type = "pfloat") - @FieldSource(template = "document/altmetricScore", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#AltmetricScore") + @FieldSource( + template = "document/altmetricScore", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#AltmetricScore" + ) private Float altmetricScore; @FieldType(type = "pint") - @FieldSource(template = "document/citationCount", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#CitationCount") + @FieldSource( + template = "document/citationCount", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#CitationCount" + ) private Integer citationCount; @FieldType(type = "whole_strings") - @FieldSource(template = "document/tag", predicate = "http://purl.obolibrary.org/obo/ARG_0000015") + @FieldSource( + template = "document/tag", + predicate = "http://purl.obolibrary.org/obo/ARG_0000015" + ) private List tags; @FieldType(type = "whole_string") - @FieldSource(template = "document/note", predicate = "http://www.w3.org/2006/vcard/ns#note") + @FieldSource( + template = "document/note", + predicate = "http://www.w3.org/2006/vcard/ns#note" + ) private String note; @FieldType(type = "whole_string") - @FieldSource(template = "document/key", predicate = "http://www.w3.org/2006/vcard/ns#key") + @FieldSource( + template = "document/key", + predicate = "http://www.w3.org/2006/vcard/ns#key" + ) private String key; @FieldType(type = "whole_string") - @FieldSource(template = "document/url", predicate = "http://www.w3.org/2006/vcard/ns#url") + @FieldSource( + template = "document/url", + predicate = "http://www.w3.org/2006/vcard/ns#url" + ) private String url; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "document/etdChairedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/etdChairedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List etdChairedBy; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "document/advisedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "document/advisedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List advisedBy; @FieldType(type = "whole_strings") - @FieldSource(template = "document/completeAuthorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#completeAuthorList", split = true) + @FieldSource( + template = "document/completeAuthorList", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#completeAuthorList", + split = true + ) private List completeAuthorList; @FieldType(type = "whole_strings") - @FieldSource(template = "document/authorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullAuthorList") + @FieldSource( + template = "document/authorList", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullAuthorList" + ) private List authorList; @FieldType(type = "whole_strings", searchable = false) - @FieldSource(template = "document/editorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullEditorList") + @FieldSource( + template = "document/editorList", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullEditorList" + ) private List editorList; @FieldType(type = "tokenized_string", copyTo = "_text_") - @FieldSource(template = "document/bookTitle", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#bookTitleForChapter") + @FieldSource( + template = "document/bookTitle", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#bookTitleForChapter" + ) private String bookTitle; @FieldType(type = "whole_string") - @FieldSource(template = "document/newsOutlet", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#NewsOutlet") + @FieldSource( + template = "document/newsOutlet", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#NewsOutlet" + ) private String newsOutlet; public Document() { @@ -956,7 +1204,7 @@ public List getCompleteAuthorList() { } public void setCompleteAuthorList(List completeAuthorList) { - this.completeAuthorList =completeAuthorList; + this.completeAuthorList = completeAuthorList; } public List getAuthorList() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java index 52f6169f5..650e6cd56 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java @@ -12,15 +12,17 @@ import java.util.Map; import java.util.stream.Collectors; +import com.fasterxml.jackson.annotation.JsonInclude; import org.apache.lucene.document.StoredField; import org.apache.solr.client.solrj.beans.Field; import org.apache.solr.common.SolrDocument; import org.springframework.hateoas.server.core.Relation; -import com.fasterxml.jackson.annotation.JsonInclude; - import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; +/** + * + */ @JsonInclude(NON_EMPTY) @Relation(collectionRelation = "individual", itemRelation = "individual") public class Individual extends AbstractIndexDocument { @@ -80,6 +82,13 @@ public void setSyncIds(List syncIds) { this.content.put(SYNC_IDS, syncIds); } + public static Object normalize(Object value) { + if (StoredField.class.isAssignableFrom(value.getClass())) { + return ((StoredField) value).stringValue(); + } + return value; + } + public static Individual from(SolrDocument document) { Map content = new HashMap<>(); @@ -105,13 +114,6 @@ public static Individual from(SolrDocument document) { return Individual.from(content); } - public static Object normalize(Object value) { - if (StoredField.class.isAssignableFrom(value.getClass())) { - return ((StoredField) value).stringValue(); - } - return value; - } - public static Individual from(Map content) { return new Individual(content); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java index aa88567cb..155dabe19 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java @@ -12,279 +12,473 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "organizations", predicate = "http://xmlns.com/foaf/0.1/Organization") public class Organization extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) - @FieldSource(template = "organization/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/name", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String name; @FieldType(type = "tokenized_string", copyTo = "_text_") - @FieldSource(template = "organization/overview", predicate = "http://vivoweb.org/ontology/core#overview") + @FieldSource( + template = "organization/overview", + predicate = "http://vivoweb.org/ontology/core#overview" + ) private String overview; @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "organization/offersDegree", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/offersDegree", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List degrees; @FieldType(type = "whole_string", copyTo = "_text_") - @FieldSource(template = "organization/abbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "organization/abbreviation", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private String abbreviation; @FieldType(type = "pdate", searchable = false) - @FieldSource(template = "organization/date", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "organization/date", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String date; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/sponsorsAwardOrHonor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/sponsorsAwardOrHonor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List sponsorsAwardOrHonor; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/awardOrHonorGiven", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/awardOrHonorGiven", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardOrHonorGiven; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/awardOrHonorReceived", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/awardOrHonorReceived", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardOrHonorReceived; @FieldType(type = "whole_strings", copyTo = "_text_") - @FieldSource(template = "organization/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") + @FieldSource( + template = "organization/keyword", + predicate = "http://vivoweb.org/ontology/core#freetextKeyword" + ) private List keywords; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "organizationForTrainingTrainee", key = "trainee"), @Reference(value = "organizationForTrainingDegree", key = "degree"), @Reference(value = "organizationForTrainingStartDate", key = "startDate"), @Reference(value = "organizationForTrainingEndDate", key = "endDate") }) - @FieldSource(template = "organization/organizationForTraining", predicate = "http://vivoweb.org/ontology/core#majorField") + @NestedObject(properties = { + @Reference(value = "organizationForTrainingTrainee", key = "trainee"), + @Reference(value = "organizationForTrainingDegree", key = "degree"), + @Reference(value = "organizationForTrainingStartDate", key = "startDate"), + @Reference(value = "organizationForTrainingEndDate", key = "endDate") + }) + @FieldSource( + template = "organization/organizationForTraining", + predicate = "http://vivoweb.org/ontology/core#majorField" + ) private List organizationForTraining; @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/organizationForTrainingTrainee", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/organizationForTrainingTrainee", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List organizationForTrainingTrainee; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/organizationForTrainingDegree", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "organization/organizationForTrainingDegree", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private List organizationForTrainingDegree; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "organization/organizationForTrainingStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "organization/organizationForTrainingStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List organizationForTrainingStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "organization/organizationForTrainingEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "organization/organizationForTrainingEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List organizationForTrainingEndDate; @FieldType(type = "nested_whole_strings") - @NestedObject(properties = { @Reference(value = "peopleType", key = "type"), @Reference(value = "peopleTitle", key = "title") }) - @FieldSource(template = "organization/people", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "peopleType", key = "type"), + @Reference(value = "peopleTitle", key = "title") + }) + @FieldSource( + template = "organization/people", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List people; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/peopleType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "organization/peopleType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List peopleType; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "organization/peopleTitle", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/peopleTitle", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List peopleTitle; - @NestedObject(properties = { @Reference(value = "hasSubOrganizationType", key = "type") }) + @NestedObject(properties = { + @Reference(value = "hasSubOrganizationType", key = "type") + }) @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/hasSubOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/hasSubOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasSubOrganizations; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/hasSubOrganizationType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "organization/hasSubOrganizationType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List hasSubOrganizationType; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "organization/organizationWithin", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/organizationWithin", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List organizationWithin; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/leadOrganizationOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/leadOrganizationOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List leadOrganizationOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/hasCollaboratingOrganizationOrGroup", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/hasCollaboratingOrganizationOrGroup", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasCollaboratingOrganizationOrGroup; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/hasAffiliatedOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/hasAffiliatedOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasAffiliatedOrganizations; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/memberOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/memberOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List memberOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/clinicalActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/clinicalActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List clinicalActivities; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/convenerOfEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/convenerOfEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List convenerOfEvents; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/attendedEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/attendedEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List attendedEvents; @NestedObject @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") - @FieldSource(template = "organization/publication", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/publication", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List publications; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "organization/publisherOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "organization/publisherOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private List publisherOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/presentation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/presentation", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List presentations; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/featuredIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/featuredIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List featuredIn; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/assigneeForPatent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/assigneeForPatent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List assigneeForPatent; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/translatorOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/translatorOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List translatorOf; @FieldType(type = "nested_whole_strings") @NestedObject(properties = { @Reference(value = "awardsGrantDate", key = "date") }) - @FieldSource(template = "organization/awardsGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/awardsGrant", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardsGrant; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "organization/awardsGrantDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "organization/awardsGrantDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List awardsGrantDate; @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "administersGrantDate", key = "date") }) - @FieldSource(template = "organization/administersGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/administersGrant", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List administersGrant; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "organization/administersGrantDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "organization/administersGrantDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List administersGrantDate; @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "subcontractsGrantDate", key = "date") }) - @FieldSource(template = "organization/subcontractsGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/subcontractsGrant", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subcontractsGrant; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "organization/subcontractsGrantDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "organization/subcontractsGrantDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List subcontractsGrantDate; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/performsHumanStudy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/performsHumanStudy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List performsHumanStudy; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/contractOrProviderForService", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/contractOrProviderForService", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List contractOrProviderForService; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/outreachAndCommunityServiceActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/outreachAndCommunityServiceActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outreachAndCommunityServiceActivities; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/hasEquipment", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/hasEquipment", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasEquipment; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "organization/offersCourse", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/offersCourse", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List courses; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/phone", predicate = "http://www.w3.org/2006/vcard/ns#telephone") + @FieldSource( + template = "organization/phone", + predicate = "http://www.w3.org/2006/vcard/ns#telephone" + ) private String phone; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/fax", predicate = "http://www.w3.org/2006/vcard/ns#fax") + @FieldSource( + template = "organization/fax", + predicate = "http://www.w3.org/2006/vcard/ns#fax" + ) private String fax; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/emailAddress", predicate = "http://www.w3.org/2006/vcard/ns#email") + @FieldSource( + template = "organization/emailAddress", + predicate = "http://www.w3.org/2006/vcard/ns#email" + ) private String emailAddress; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/streetAddress", predicate = "organization.streetAddress") + @FieldSource( + template = "organization/streetAddress", + predicate = "organization.streetAddress" + ) private String streetAddress; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/locality", predicate = "organization.locality") + @FieldSource( + template = "organization/locality", + predicate = "organization.locality" + ) private String locality; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/region", predicate = "organization.region") + @FieldSource( + template = "organization/region", + predicate = "organization.region" + ) private String region; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/postalCode", predicate = "organization.postalCode") + @FieldSource( + template = "organization/postalCode", + predicate = "organization.postalCode" + ) private String postalCode; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/country", predicate = "organization.country") + @FieldSource( + template = "organization/country", + predicate = "organization.country" + ) private String country; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/geographicLocation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/geographicLocation", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String geographicLocation; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/locatedAtFacility", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/locatedAtFacility", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List locatedAtFacilities; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/predecessorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/predecessorOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List predecessorOrganizations; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/successorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/successorOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List successorOrganizations; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "organization/governingAuthorityFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "organization/governingAuthorityFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List governingAuthorityFor; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "organization/affiliatedResearchArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "organization/affiliatedResearchArea", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private List affiliatedResearchAreas; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "organization/orgId", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#OrgID") + @FieldSource( + template = "organization/orgId", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#OrgID" + ) private String orgId; public Organization() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java index 32069db84..21b906ace 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java @@ -13,704 +13,1335 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "persons", predicate = "http://xmlns.com/foaf/0.1/Person") public class Person extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) - @FieldSource(template = "person/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/name", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String name; @FieldType(type = "whole_string") - @FieldSource(template = "person/primaryEmail", predicate = "http://www.w3.org/2006/vcard/ns#email") + @FieldSource( + template = "person/primaryEmail", + predicate = "http://www.w3.org/2006/vcard/ns#email" + ) private String primaryEmail; @FieldType(type = "whole_strings", searchable = false) - @FieldSource(template = "person/additionalEmail", predicate = "http://www.w3.org/2006/vcard/ns#email") + @FieldSource( + template = "person/additionalEmail", + predicate = "http://www.w3.org/2006/vcard/ns#email" + ) private List additionalEmails; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/phone", predicate = "http://www.w3.org/2006/vcard/ns#telephone") + @FieldSource( + template = "person/phone", + predicate = "http://www.w3.org/2006/vcard/ns#telephone" + ) private String phone; @FieldType(type = "whole_string") - @FieldSource(template = "person/orcidId", predicate = "http://vivoweb.org/ontology/core#orcidId", parse = true) + @FieldSource( + template = "person/orcidId", + predicate = "http://vivoweb.org/ontology/core#orcidId", + parse = true + ) private String orcidId; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/preferredTitle", predicate = "http://www.w3.org/2006/vcard/ns#title") + @FieldSource( + template = "person/preferredTitle", + predicate = "http://www.w3.org/2006/vcard/ns#title" + ) private String preferredTitle; @FieldType(type = "nested_whole_strings") - @NestedObject(properties = { @Reference(value = "positionType", key = "type"), @Reference(value = "positionOrganization", key = "organizations") }) - @FieldSource(template = "person/position", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "positionType", key = "type"), + @Reference(value = "positionOrganization", key = "organizations") + }) + @FieldSource( + template = "person/position", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List positions; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/positionType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/positionType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List positionType; @NestedMultiValuedProperty @FieldType(type = "nested_whole_strings") - @NestedObject(root = false, properties = { @Reference(value = "positionOrganizationParent", key = "parent") }) - @FieldSource(template = "person/positionOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @NestedObject( + root = false, + properties = { + @Reference(value = "positionOrganizationParent", key = "parent") + } + ) + @FieldSource( + template = "person/positionOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private List positionOrganization; @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/positionOrganizationParent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/positionOrganizationParent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List positionOrganizationParent; @FieldType(type = "tokenized_string", copyTo = "_text_") - @FieldSource(template = "person/overview", predicate = "http://vivoweb.org/ontology/core#overview") + @FieldSource( + template = "person/overview", + predicate = "http://vivoweb.org/ontology/core#overview" + ) private String overview; @NestedObject @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "researchAreas_nested_facets" }) - @FieldSource(template = "person/researchArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/researchArea", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List researchAreas; @FieldType(type = "whole_string") - @FieldSource(template = "person/hrJobTitle", predicate = "http://vivoweb.org/ontology/core#hrJobTitle") + @FieldSource( + template = "person/hrJobTitle", + predicate = "http://vivoweb.org/ontology/core#hrJobTitle" + ) private String hrJobTitle; @FieldType(type = "whole_strings") - @FieldSource(template = "person/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") + @FieldSource( + template = "person/keyword", + predicate = "http://vivoweb.org/ontology/core#freetextKeyword" + ) private List keywords; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "headOfType", key = "type"), @Reference(value = "headOfOrganization", key = "organization"), @Reference(value = "headOfStartDate", key = "startDate"), @Reference(value = "headOfEndDate", key = "endDate") }) - @FieldSource(template = "person/headOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "headOfType", key = "type"), + @Reference(value = "headOfOrganization", key = "organization"), + @Reference(value = "headOfStartDate", key = "startDate"), + @Reference(value = "headOfEndDate", key = "endDate") + }) + @FieldSource( + template = "person/headOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List headOf; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/headOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/headOfType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List headOfType; @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/headOfOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/headOfOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List headOfOrganization; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/headOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/headOfStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List headOfStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/headOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/headOfEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List headOfEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "memberOfType", key = "type"), @Reference(value = "memberOfOrganization", key = "organization"), @Reference(value = "memberOfStartDate", key = "startDate"), @Reference(value = "memberOfEndDate", key = "endDate") }) - @FieldSource(template = "person/memberOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "memberOfType", key = "type"), + @Reference(value = "memberOfOrganization", key = "organization"), + @Reference(value = "memberOfStartDate", key = "startDate"), + @Reference(value = "memberOfEndDate", key = "endDate") + }) + @FieldSource( + template = "person/memberOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List memberOf; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/memberOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/memberOfType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List memberOfType; @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/memberOfOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/memberOfOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List memberOfOrganization; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/memberOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/memberOfStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List memberOfStartDate; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/memberOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/memberOfEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List memberOfEndDate; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/hasCollaborator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/hasCollaborator", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasCollaborator; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "clinicalActivityType", key = "type"), @Reference(value = "clinicalActivityRole", key = "role"), @Reference(value = "clinicalActivityStartDate", key = "startDate"), @Reference(value = "clinicalActivityEndDate", key = "endDate") }) - @FieldSource(template = "person/clinicalActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "clinicalActivityType", key = "type"), + @Reference(value = "clinicalActivityRole", key = "role"), + @Reference(value = "clinicalActivityStartDate", key = "startDate"), + @Reference(value = "clinicalActivityEndDate", key = "endDate") + }) + @FieldSource( + template = "person/clinicalActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List clinicalActivities; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/clinicalActivityType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/clinicalActivityType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List clinicalActivityType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/clinicalActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/clinicalActivityRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List clinicalActivityRole; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/clinicalActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/clinicalActivityStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List clinicalActivityStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/clinicalActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/clinicalActivityEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List clinicalActivityEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "attendedEventType", key = "type"), @Reference(value = "attendedEventStartDate", key = "startDate"), @Reference(value = "attendedEventEndDate", key = "endDate") }) - @FieldSource(template = "person/attendedEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "attendedEventType", key = "type"), + @Reference(value = "attendedEventStartDate", key = "startDate"), + @Reference(value = "attendedEventEndDate", key = "endDate") + }) + @FieldSource( + template = "person/attendedEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List attendedEvents; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/attendedEventType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/attendedEventType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List attendedEventType; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/attendedEventStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/attendedEventStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List attendedEventStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/attendedEventEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/attendedEventEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List attendedEventEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "educationAndTrainingName", key = "name"), @Reference(value = "educationAndTrainingInfo", key = "info"), @Reference(value = "educationAndTrainingOrganization", key = "organization"), @Reference(value = "educationAndTrainingMajorField", key = "field"), @Reference(value = "educationAndTrainingDegreeAbbreviation", key = "abbreviation"), @Reference(value = "educationAndTrainingStartDate", key = "startDate"), @Reference(value = "educationAndTrainingEndDate", key = "endDate"), @Reference(value = "educationAndTrainingIsDateSuppressed", key = "isDateSuppressed") }) - @FieldSource(template = "person/educationAndTraining", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @NestedObject(properties = { + @Reference(value = "educationAndTrainingName", key = "name"), + @Reference(value = "educationAndTrainingInfo", key = "info"), + @Reference(value = "educationAndTrainingOrganization", key = "organization"), + @Reference(value = "educationAndTrainingMajorField", key = "field"), + @Reference(value = "educationAndTrainingDegreeAbbreviation", key = "abbreviation"), + @Reference(value = "educationAndTrainingStartDate", key = "startDate"), + @Reference(value = "educationAndTrainingEndDate", key = "endDate"), + @Reference(value = "educationAndTrainingIsDateSuppressed", key = "isDateSuppressed") + }) + @FieldSource( + template = "person/educationAndTraining", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List educationAndTraining; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/educationAndTrainingName", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/educationAndTrainingName", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List educationAndTrainingName; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/educationAndTrainingInfo", predicate = "http://vivoweb.org/ontology/core#supplementalInformation") + @FieldSource( + template = "person/educationAndTrainingInfo", + predicate = "http://vivoweb.org/ontology/core#supplementalInformation" + ) private List educationAndTrainingInfo; @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/educationAndTrainingOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/educationAndTrainingOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List educationAndTrainingOrganization; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/educationAndTrainingMajorField", predicate = "http://vivoweb.org/ontology/core#majorField") + @FieldSource( + template = "person/educationAndTrainingMajorField", + predicate = "http://vivoweb.org/ontology/core#majorField" + ) private List educationAndTrainingMajorField; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/educationAndTrainingDegreeAbbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "person/educationAndTrainingDegreeAbbreviation", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private List educationAndTrainingDegreeAbbreviation; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/educationAndTrainingStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/educationAndTrainingStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List educationAndTrainingStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/educationAndTrainingEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/educationAndTrainingEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List educationAndTrainingEndDate; - @FieldType(type="nested_whole_string", searchable = false) - @FieldSource(template= "person/educationAndTrainingIsDateSuppressed", predicate = "http://vivoweb.org/ontology/core#supplementalInformation") + @FieldType(type = "nested_whole_string", searchable = false) + @FieldSource( + template = "person/educationAndTrainingIsDateSuppressed", + predicate = "http://vivoweb.org/ontology/core#supplementalInformation" + ) private List educationAndTrainingIsDateSuppressed; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/credentials", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/credentials", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List credentials; @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "credentialEligibilityAttainedType", key = "type") }) - @FieldSource(template = "person/credentialEligibilityAttained", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/credentialEligibilityAttained", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List credentialEligibilityAttained; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/credentialEligibilityAttainedType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/credentialEligibilityAttainedType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List credentialEligibilityAttainedType; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/awardAndHonor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/awardAndHonor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardsAndHonors; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "adviseeOfType", key = "type"), @Reference(value = "adviseeOfCandidacy", key = "candidacy"), @Reference(value = "adviseeOfStartDate", key = "startDate"), @Reference(value = "adviseeOfEndDate", key = "endDate") }) - @FieldSource(template = "person/adviseeOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "adviseeOfType", key = "type"), + @Reference(value = "adviseeOfCandidacy", key = "candidacy"), + @Reference(value = "adviseeOfStartDate", key = "startDate"), + @Reference(value = "adviseeOfEndDate", key = "endDate") + }) + @FieldSource( + template = "person/adviseeOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List adviseeOf; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/adviseeOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/adviseeOfType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List adviseeOfType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/adviseeOfCandidacy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/adviseeOfCandidacy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List adviseeOfCandidacy; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/adviseeOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/adviseeOfStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List adviseeOfStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/adviseeOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/adviseeOfEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List adviseeOfEndDate; @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") - @NestedObject(properties = { @Reference(value = "selectedPublicationType", key = "type"), @Reference(value = "selectedPublicationDate", key = "publicationDate"), @Reference(value = "selectedPublicationPublisher", key = "publisher"), @Reference(value = "selectedPublicationVenue", key = "venue"), @Reference(value = "selectedPublicationTag", key = "tags") }) - @FieldSource(template = "person/selectedPublications", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "selectedPublicationType", key = "type"), + @Reference(value = "selectedPublicationDate", key = "publicationDate"), + @Reference(value = "selectedPublicationPublisher", key = "publisher"), + @Reference(value = "selectedPublicationVenue", key = "venue"), + @Reference(value = "selectedPublicationTag", key = "tags") + }) + @FieldSource( + template = "person/selectedPublications", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List publications; @FieldType(type = "pdates") - @FieldSource(template = "person/publicationDates", predicate = "http://vivoweb.org/ontology/core#dateTime") - private List publicationDates; // duplicate of selectedPublicationDate without encoded reference to publication + @FieldSource( + template = "person/publicationDates", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) + // duplicate of selectedPublicationDate without encoded reference to publication + private List publicationDates; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/selectedPublicationType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/selectedPublicationType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List selectedPublicationType; @FieldType(type = "nested_dates") - @FieldSource(template = "person/selectedPublicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/selectedPublicationDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List selectedPublicationDate; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/selectedPublicationPublisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "person/selectedPublicationPublisher", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private List selectedPublicationPublisher; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/selectedPublicationVenue", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "person/selectedPublicationVenue", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private List selectedPublicationVenue; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/selectedPublicationTag", predicate = "http://purl.obolibrary.org/obo/ARG_0000015") + @FieldSource( + template = "person/selectedPublicationTag", + predicate = "http://purl.obolibrary.org/obo/ARG_0000015" + ) private List selectedPublicationTag; @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "creativeWorkType", key = "type") }) - @FieldSource(template = "person/creativeWorks", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/creativeWorks", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List creativeWorks; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/creativeWorkType", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#subtype") + @FieldSource( + template = "person/creativeWorkType", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#subtype" + ) private List creativeWorkType; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "collectionOrSeriesEditorForType", key = "type"), @Reference(value = "collectionOrSeriesEditorForRole", key = "role"), @Reference(value = "collectionOrSeriesEditorForStartDate", key = "startDate"), @Reference(value = "collectionOrSeriesEditorForEndDate", key = "endDate") }) - @FieldSource(template = "person/collectionOrSeriesEditorFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "collectionOrSeriesEditorForType", key = "type"), + @Reference(value = "collectionOrSeriesEditorForRole", key = "role"), + @Reference(value = "collectionOrSeriesEditorForStartDate", key = "startDate"), + @Reference(value = "collectionOrSeriesEditorForEndDate", key = "endDate") + }) + @FieldSource( + template = "person/collectionOrSeriesEditorFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List collectionOrSeriesEditorFor; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/collectionOrSeriesEditorForType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/collectionOrSeriesEditorForType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List collectionOrSeriesEditorForType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/collectionOrSeriesEditorForRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/collectionOrSeriesEditorForRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List collectionOrSeriesEditorForRole; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/collectionOrSeriesEditorForStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/collectionOrSeriesEditorForStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List collectionOrSeriesEditorForStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/collectionOrSeriesEditorForEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/collectionOrSeriesEditorForEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List collectionOrSeriesEditorForEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "editorOfType", key = "type"), @Reference(value = "editorOfPublisher", key = "publisher"), @Reference(value = "editorOfPageStart", key = "pageStart"), @Reference(value = "editorOfPageEnd", key = "pageEnd"), @Reference(value = "editorOfDate", key = "date") }) - @FieldSource(template = "person/editorOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "editorOfType", key = "type"), + @Reference(value = "editorOfPublisher", key = "publisher"), + @Reference(value = "editorOfPageStart", key = "pageStart"), + @Reference(value = "editorOfPageEnd", key = "pageEnd"), + @Reference(value = "editorOfDate", key = "date") + }) + @FieldSource( + template = "person/editorOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List editorOf; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/editorOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/editorOfType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List editorOfType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/editorOfPublisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) + @FieldSource( + template = "person/editorOfPublisher", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + unique = true + ) private List editorOfPublisher; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/editorOfPageStart", predicate = "http://purl.org/ontology/bibo/pageStart") + @FieldSource( + template = "person/editorOfPageStart", + predicate = "http://purl.org/ontology/bibo/pageStart" + ) private List editorOfPageStart; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/editorOfPageEnd", predicate = "http://purl.org/ontology/bibo/pageEnd") + @FieldSource( + template = "person/editorOfPageEnd", + predicate = "http://purl.org/ontology/bibo/pageEnd" + ) private List editorOfPageEnd; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/editorOfDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/editorOfDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List editorOfDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "presentationType", key = "type"), @Reference(value = "presentationRole", key = "role"), @Reference(value = "presentationEvent", key = "event"), @Reference(value = "presentationStartDate", key = "startDate"), @Reference(value = "presentationEndDate", key = "endDate") }) - @FieldSource(template = "person/presentation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "presentationType", key = "type"), + @Reference(value = "presentationRole", key = "role"), + @Reference(value = "presentationEvent", key = "event"), + @Reference(value = "presentationStartDate", key = "startDate"), + @Reference(value = "presentationEndDate", key = "endDate") + }) + @FieldSource( + template = "person/presentation", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List presentations; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/presentationType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/presentationType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List presentationType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/presentationRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/presentationRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List presentationRole; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/presentationEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label", parse = true) + @FieldSource( + template = "person/presentationEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label", + parse = true + ) private List presentationEvent; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/presentationStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/presentationStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List presentationStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/presentationEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/presentationEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List presentationEndDate; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/featuredIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/featuredIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List featuredIn; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/assigneeForPatent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/assigneeForPatent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List assigneeForPatent; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/translatorOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/translatorOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List translatorOf; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/researchOverview", predicate = "http://vivoweb.org/ontology/core#researchOverview") + @FieldSource( + template = "person/researchOverview", + predicate = "http://vivoweb.org/ontology/core#researchOverview" + ) private String researchOverview; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/principalInvestigatorOn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/principalInvestigatorOn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List principalInvestigatorOn; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/coPrincipalInvestigatorOn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/coPrincipalInvestigatorOn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List coPrincipalInvestigatorOn; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "researcherOnAwardedBy", key = "awardedBy"), @Reference(value = "researcherOnRole", key = "role"), @Reference(value = "researcherOnStartDate", key = "startDate"), @Reference(value = "researcherOnEndDate", key = "endDate") }) - @FieldSource(template = "person/researcherOn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "researcherOnAwardedBy", key = "awardedBy"), + @Reference(value = "researcherOnRole", key = "role"), + @Reference(value = "researcherOnStartDate", key = "startDate"), + @Reference(value = "researcherOnEndDate", key = "endDate") + }) + @FieldSource( + template = "person/researcherOn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List researcherOn; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(root = false, properties = { @Reference(value = "researcherOnAwardedByPreferredLabel", key = "preferredLabel") }) - @FieldSource(template = "person/researcherOnAwardedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject( + root = false, + properties = { + @Reference(value = "researcherOnAwardedByPreferredLabel", key = "preferredLabel") + } + ) + @FieldSource( + template = "person/researcherOnAwardedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List researcherOnAwardedBy; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/researcherOnAwardedByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardedBy_label") + @FieldSource( + template = "person/researcherOnAwardedByPreferredLabel", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardedBy_label" + ) private List researcherOnAwardedByPreferredLabel; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/researcherOnRole", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/researcherOnRole", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List researcherOnRole; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/researcherOnStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/researcherOnStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List researcherOnStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/researcherOnEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/researcherOnEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List researcherOnEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "otherResearchActivityRole", key = "role"), @Reference(value = "otherResearchActivityStartDate", key = "startDate"), @Reference(value = "otherResearchActivityEndDate", key = "endDate") }) - @FieldSource(template = "person/otherResearchActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "otherResearchActivityRole", key = "role"), + @Reference(value = "otherResearchActivityStartDate", key = "startDate"), + @Reference(value = "otherResearchActivityEndDate", key = "endDate") + }) + @FieldSource( + template = "person/otherResearchActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List otherResearchActivities; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/otherResearchActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/otherResearchActivityRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List otherResearchActivityRole; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/otherResearchActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/otherResearchActivityStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List otherResearchActivityStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/otherResearchActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/otherResearchActivityEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List otherResearchActivityEndDate; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/teachingOverview", predicate = "http://vivoweb.org/ontology/core#teachingOverview") + @FieldSource( + template = "person/teachingOverview", + predicate = "http://vivoweb.org/ontology/core#teachingOverview" + ) private String teachingOverview; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "teachingActivityRole", key = "role") }) - @FieldSource(template = "person/teachingActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "teachingActivityRole", key = "role") + }) + @FieldSource( + template = "person/teachingActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List teachingActivities; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/teachingActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/teachingActivityRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List teachingActivityRole; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/teachingMaterials", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/teachingMaterials", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List teachingMaterials; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "adviseeType", key = "type"), @Reference(value = "adviseeCandidacy", key = "candidacy"), @Reference(value = "adviseeStartDate", key = "startDate"), @Reference(value = "adviseeEndDate", key = "endDate") }) - @FieldSource(template = "person/advisee", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "adviseeType", key = "type"), + @Reference(value = "adviseeCandidacy", key = "candidacy"), + @Reference(value = "adviseeStartDate", key = "startDate"), + @Reference(value = "adviseeEndDate", key = "endDate") + }) + @FieldSource( + template = "person/advisee", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List advisee; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/adviseeType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/adviseeType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List adviseeType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/adviseeCandidacy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/adviseeCandidacy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List adviseeCandidacy; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/adviseeStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/adviseeStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List adviseeStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/adviseeEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/adviseeEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List adviseeEndDate; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/outreachOverview", predicate = "http://vivoweb.org/ontology/core#outreachOverview") + @FieldSource( + template = "person/outreachOverview", + predicate = "http://vivoweb.org/ontology/core#outreachOverview" + ) private String outreachOverview; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "reviewerOfType", key = "type"), @Reference(value = "reviewerOfStartDate", key = "startDate"), @Reference(value = "reviewerOfEndDate", key = "endDate") }) - @FieldSource(template = "person/reviewerOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "reviewerOfType", key = "type"), + @Reference(value = "reviewerOfStartDate", key = "startDate"), + @Reference(value = "reviewerOfEndDate", key = "endDate") + }) + @FieldSource( + template = "person/reviewerOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List reviewerOf; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/reviewerOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/reviewerOfType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List reviewerOfType; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/reviewerOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/reviewerOfStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List reviewerOfStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/reviewerOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/reviewerOfEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List reviewerOfEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "contactOrProvidorForServiceType", key = "type") }) - @FieldSource(template = "person/contactOrProvidorForService", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "contactOrProvidorForServiceType", key = "type") + }) + @FieldSource( + template = "person/contactOrProvidorForService", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List contactOrProvidorForService; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/contactOrProvidorForServiceType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/contactOrProvidorForServiceType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List contactOrProvidorForServiceType; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "organizerOfEventType", key = "type"), @Reference(value = "organizerOfEventStartDate", key = "startDate"), @Reference(value = "organizerOfEventEndDate", key = "endDate") }) - @FieldSource(template = "person/organizerOfEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "organizerOfEventType", key = "type"), + @Reference(value = "organizerOfEventStartDate", key = "startDate"), + @Reference(value = "organizerOfEventEndDate", key = "endDate") + }) + @FieldSource( + template = "person/organizerOfEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List organizerOfEvent; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/organizerOfEventType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/organizerOfEventType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List organizerOfEventType; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/organizerOfEventStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/organizerOfEventStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List organizerOfEventStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/organizerOfEventEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/organizerOfEventEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List organizerOfEventEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "professionalServiceActivityType", key = "type"), @Reference(value = "professionalServiceActivityRole", key = "role"), @Reference(value = "professionalServiceActivityStartDate", key = "startDate"), @Reference(value = "professionalServiceActivityEndDate", key = "endDate") }) - @FieldSource(template = "person/professionalServiceActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "professionalServiceActivityType", key = "type"), + @Reference(value = "professionalServiceActivityRole", key = "role"), + @Reference(value = "professionalServiceActivityStartDate", key = "startDate"), + @Reference(value = "professionalServiceActivityEndDate", key = "endDate") + }) + @FieldSource( + template = "person/professionalServiceActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List professionalServiceActivities; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/professionalServiceActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/professionalServiceActivityRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List professionalServiceActivityRole; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/professionalServiceActivityType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/professionalServiceActivityType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List professionalServiceActivityType; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/professionalServiceActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/professionalServiceActivityStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List professionalServiceActivityStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/professionalServiceActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/professionalServiceActivityEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List professionalServiceActivityEndDate; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "outreachAndCommunityServiceActivityType", key = "type"), @Reference(value = "outreachAndCommunityServiceActivityRole", key = "role"), @Reference(value = "outreachAndCommunityServiceActivityStartDate", key = "startDate"), @Reference(value = "outreachAndCommunityServiceActivityEndDate", key = "endDate") }) - @FieldSource(template = "person/outreachAndCommunityServiceActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "outreachAndCommunityServiceActivityType", key = "type"), + @Reference(value = "outreachAndCommunityServiceActivityRole", key = "role"), + @Reference(value = "outreachAndCommunityServiceActivityStartDate", key = "startDate"), + @Reference(value = "outreachAndCommunityServiceActivityEndDate", key = "endDate") + }) + @FieldSource( + template = "person/outreachAndCommunityServiceActivity", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outreachAndCommunityServiceActivities; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/professionalServiceActivityType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/professionalServiceActivityType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List outreachAndCommunityServiceActivityType; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/professionalServiceActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/professionalServiceActivityRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outreachAndCommunityServiceActivityRole; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/professionalServiceActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/professionalServiceActivityStartDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List outreachAndCommunityServiceActivityStartDate; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/professionalServiceActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/professionalServiceActivityEndDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List outreachAndCommunityServiceActivityEndDate; @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "performsTechniqueType", key = "type") }) - @FieldSource(template = "person/performsTechnique", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/performsTechnique", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List performsTechnique; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/performsTechniqueType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/performsTechniqueType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List performsTechniqueType; @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "hasExpertiseInTechniqueType", key = "type") }) - @FieldSource(template = "person/hasExpertiseInTechnique", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/hasExpertiseInTechnique", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasExpertiseInTechnique; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/hasExpertiseInTechniqueType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "person/hasExpertiseInTechniqueType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List hasExpertiseInTechniqueType; @FieldType(type = "whole_string") - @FieldSource(template = "person/eraCommonsId", predicate = "http://vivoweb.org/ontology/core#eRACommonsId") + @FieldSource( + template = "person/eraCommonsId", + predicate = "http://vivoweb.org/ontology/core#eRACommonsId" + ) private String eraCommonsId; @FieldType(type = "whole_string") - @FieldSource(template = "person/isiResearcherId", predicate = "http://vivoweb.org/ontology/core#researcherId") + @FieldSource( + template = "person/isiResearcherId", + predicate = "http://vivoweb.org/ontology/core#researcherId" + ) private String isiResearcherId; @FieldType(type = "whole_string") - @FieldSource(template = "person/scopusId", predicate = "http://vivoweb.org/ontology/core#scopusId") + @FieldSource( + template = "person/scopusId", + predicate = "http://vivoweb.org/ontology/core#scopusId" + ) private String scopusId; @FieldType(type = "whole_string") - @FieldSource(template = "person/healthCareProviderId", predicate = "http://purl.obolibrary.org/obo/ARG_0000197") + @FieldSource( + template = "person/healthCareProviderId", + predicate = "http://purl.obolibrary.org/obo/ARG_0000197" + ) private String healthCareProviderId; @FieldType(type = "whole_string") - @FieldSource(template = "person/email", predicate = "http://www.w3.org/2006/vcard/ns#email") + @FieldSource( + template = "person/email", + predicate = "http://www.w3.org/2006/vcard/ns#email" + ) private String email; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/firstName", predicate = "http://www.w3.org/2006/vcard/ns#givenName") + @FieldSource( + template = "person/firstName", + predicate = "http://www.w3.org/2006/vcard/ns#givenName" + ) private String firstName; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/middleName", predicate = "http://www.w3.org/2006/vcard/ns#middleName") + @FieldSource( + template = "person/middleName", + predicate = "http://www.w3.org/2006/vcard/ns#middleName" + ) private String middleName; @FieldType(type = "tokenized_string") - @FieldSource(template = "person/lastName", predicate = "http://www.w3.org/2006/vcard/ns#familyName") + @FieldSource( + template = "person/lastName", + predicate = "http://www.w3.org/2006/vcard/ns#familyName" + ) private String lastName; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/streetAddress", predicate = "http://www.w3.org/2006/vcard/ns#streetAddress") + @FieldSource( + template = "person/streetAddress", + predicate = "http://www.w3.org/2006/vcard/ns#streetAddress" + ) private String streetAddress; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/locality", predicate = "http://www.w3.org/2006/vcard/ns#locality") + @FieldSource( + template = "person/locality", + predicate = "http://www.w3.org/2006/vcard/ns#locality" + ) private String locality; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/region", predicate = "http://www.w3.org/2006/vcard/ns#region") + @FieldSource( + template = "person/region", + predicate = "http://www.w3.org/2006/vcard/ns#region" + ) private String region; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/postalCode", predicate = "http://www.w3.org/2006/vcard/ns#postalCode") + @FieldSource( + template = "person/postalCode", + predicate = "http://www.w3.org/2006/vcard/ns#postalCode" + ) private String postalCode; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/country", predicate = "http://www.w3.org/2006/vcard/ns#country") + @FieldSource( + template = "person/country", + predicate = "http://www.w3.org/2006/vcard/ns#country" + ) private String country; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/geographicLocation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/geographicLocation", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String geographicLocation; @FieldType(type = "whole_strings", searchable = false) - @FieldSource(template = "person/locatedInFacility", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/locatedInFacility", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List locatedInFacility; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/fax", predicate = "http://www.w3.org/2006/vcard/ns#fax") + @FieldSource( + template = "person/fax", + predicate = "http://www.w3.org/2006/vcard/ns#fax" + ) private String fax; @FieldType(type = "whole_strings") - @FieldSource(template = "person/organization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/organization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List organizations; @FieldType(type = "whole_strings") - @FieldSource(template = "person/school", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/school", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List schools; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/isni", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#ISNI") + @FieldSource( + template = "person/isni", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#ISNI" + ) private String isni; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/netid", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#NETID") + @FieldSource( + template = "person/netid", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#NETID" + ) private String netid; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/researcherId", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#ResearcherId") + @FieldSource( + template = "person/researcherId", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#ResearcherId" + ) private String researcherId; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/twitter", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#twitterID") + @FieldSource( + template = "person/twitter", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#twitterID" + ) private String twitter; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/uid", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#UID") + @FieldSource( + template = "person/uid", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#UID" + ) private String uid; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/uin", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#UIN") + @FieldSource( + template = "person/uin", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#UIN" + ) private String uin; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "person/youtube", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#youtube") + @FieldSource( + template = "person/youtube", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#youtube" + ) private String youtube; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/inTheNews", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/inTheNews", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List inTheNews; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/futureResearchIdeas", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/futureResearchIdeas", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List futureResearchIdeas; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "etdChairOfURL", key = "url"), @Reference(value = "etdChairOfPublicationDate", key = "publicationDate") }) - @FieldSource(template = "person/etdChairOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "etdChairOfUrl", key = "url"), + @Reference(value = "etdChairOfPublicationDate", key = "publicationDate") + }) + @FieldSource( + template = "person/etdChairOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List etdChairOf; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "person/etdChairOfURL", predicate = "http://www.w3.org/2006/vcard/ns#url") - private List etdChairOfURL; + @FieldSource( + template = "person/etdChairOfUrl", + predicate = "http://www.w3.org/2006/vcard/ns#url" + ) + private List etdChairOfUrl; @FieldType(type = "nested_dates", searchable = false) - @FieldSource(template = "person/etdChairOfPublicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/etdChairOfPublicationDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List etdChairOfPublicationDate; - @NestedObject(properties = { @Reference(value = "capstoneAdvisedOfURL", key = "url"), @Reference(value = "capstoneAdvisedOfPublicationDate", key = "publicationDate") }) + @NestedObject(properties = { + @Reference(value = "capstoneAdvisedOfUrl", key = "url"), + @Reference(value = "capstoneAdvisedOfPublicationDate", key = "publicationDate") + }) @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/capstoneAdvisedOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "person/capstoneAdvisedOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List capstoneAdvisedOf; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "person/capstoneAdvisedOfURL", predicate = "http://www.w3.org/2006/vcard/ns#url") - private List capstoneAdvisedOfURL; + @FieldSource( + template = "person/capstoneAdvisedOfUrl", + predicate = "http://www.w3.org/2006/vcard/ns#url" + ) + private List capstoneAdvisedOfUrl; @FieldType(type = "nested_dates") - @FieldSource(template = "person/capstoneAdvisedOfPublicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "person/capstoneAdvisedOfPublicationDate", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List capstoneAdvisedOfPublicationDate; @FieldType(type = "whole_string") - @FieldSource(template = "person/featuredProfileDisplay", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#FeaturedProfileDisplay") + @FieldSource( + template = "person/featuredProfileDisplay", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#FeaturedProfileDisplay" + ) private String featuredProfileDisplay; @FieldType(type = "whole_string") - @FieldSource(template = "person/publicationToInterfolio", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#PublicationToInterfolio") + @FieldSource( + template = "person/publicationToInterfolio", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#PublicationToInterfolio" + ) private String publicationToInterfolio; public Person() { @@ -1697,7 +2328,9 @@ public List getOutreachAndCommunityServiceActivityStartDate() { return outreachAndCommunityServiceActivityStartDate; } - public void setOutreachAndCommunityServiceActivityStartDate(List outreachAndCommunityServiceActivityStartDate) { + public void setOutreachAndCommunityServiceActivityStartDate( + List outreachAndCommunityServiceActivityStartDate + ) { this.outreachAndCommunityServiceActivityStartDate = outreachAndCommunityServiceActivityStartDate; } @@ -1705,7 +2338,9 @@ public List getOutreachAndCommunityServiceActivityEndDate() { return outreachAndCommunityServiceActivityEndDate; } - public void setOutreachAndCommunityServiceActivityEndDate(List outreachAndCommunityServiceActivityEndDate) { + public void setOutreachAndCommunityServiceActivityEndDate( + List outreachAndCommunityServiceActivityEndDate + ) { this.outreachAndCommunityServiceActivityEndDate = outreachAndCommunityServiceActivityEndDate; } @@ -1965,12 +2600,12 @@ public void setEtdChairOf(List etdChairOf) { this.etdChairOf = etdChairOf; } - public List getEtdChairOfURL() { - return etdChairOfURL; + public List getEtdChairOfUrl() { + return etdChairOfUrl; } - public void setEtdChairOfURL(List etdChairOfURL) { - this.etdChairOfURL = etdChairOfURL; + public void setEtdChairOfUrl(List etdChairOfUrl) { + this.etdChairOfUrl = etdChairOfUrl; } public List getEtdChairOfPublicationDate() { @@ -1989,12 +2624,12 @@ public void setCapstoneAdvisedOf(List capstoneAdvisedOf) { this.capstoneAdvisedOf = capstoneAdvisedOf; } - public List getCapstoneAdvisedOfURL() { - return capstoneAdvisedOfURL; + public List getCapstoneAdvisedOfUrl() { + return capstoneAdvisedOfUrl; } - public void setCapstoneAdvisedOfURL(List capstoneAdvisedOfURL) { - this.capstoneAdvisedOfURL = capstoneAdvisedOfURL; + public void setCapstoneAdvisedOfUrl(List capstoneAdvisedOfUrl) { + this.capstoneAdvisedOfUrl = capstoneAdvisedOfUrl; } public List getCapstoneAdvisedOfPublicationDate() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java index 82b4fa1b8..b9789655c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java @@ -15,173 +15,307 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "processes", predicate = "http://purl.obolibrary.org/obo/BFO_0000015") public class Process extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "title_sort" }) - @FieldSource(template = "process/title", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/title", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String title; @JsonProperty(ABSTRACT) @FieldType(type = "tokenized_string", value = ABSTRACT, copyTo = "_text_") - @FieldSource(template = "process/abstract", predicate = "http://purl.org/ontology/bibo/abstract") + @FieldSource( + template = "process/abstract", + predicate = "http://purl.org/ontology/bibo/abstract" + ) private String abstractText; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @NestedObject(properties = { @Reference(value = "authorOrganization", key = "organizations") }) - @FieldSource(template = "process/author", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "authorOrganization", key = "organizations") + }) + @FieldSource( + template = "process/author", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List authors; @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") - @FieldSource(template = "process/authorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/authorOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List authorOrganization; @FieldType(type = "whole_strings") - @FieldSource(template = "process/authorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullAuthorList") + @FieldSource( + template = "process/authorList", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullAuthorList" + ) private List authorList; @FieldType(type = "tokenized_string", copyTo = "_text_") - @FieldSource(template = "process/description", predicate = "http://vivoweb.org/ontology/core#description") + @FieldSource( + template = "process/description", + predicate = "http://vivoweb.org/ontology/core#description" + ) private String description; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "process/offeredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/offeredBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List offeredBy; @FieldType(type = "nested_whole_string") - @NestedObject(properties = { @Reference(value = "dateTimeIntervalStart", key = "start"), @Reference(value = "dateTimeIntervalEnd", key = "end") }) - @FieldSource(template = "process/dateTimeInterval", predicate = "http://vivoweb.org/ontology/core#dateTimeInterval") + @NestedObject(properties = { + @Reference(value = "dateTimeIntervalStart", key = "start"), + @Reference(value = "dateTimeIntervalEnd", key = "end") + }) + @FieldSource( + template = "process/dateTimeInterval", + predicate = "http://vivoweb.org/ontology/core#dateTimeInterval" + ) private String dateTimeInterval; @FieldType(type = "nested_date") - @NestedObject(properties = { @Reference(value = "dateTimePrecisionStart", key = "precision") }, root = false) - @FieldSource(template = "process/dateTimeIntervalStart", predicate = "http://vivoweb.org/ontology/core#dateTime") + @NestedObject( + root = false, + properties = { + @Reference(value = "dateTimePrecisionStart", key = "precision") + } + ) + @FieldSource( + template = "process/dateTimeIntervalStart", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String dateTimeIntervalStart; @FieldType(type = "nested_date") - @NestedObject(properties = { @Reference(value = "dateTimePrecisionEnd", key = "precision") }, root = false) - @FieldSource(template = "process/dateTimeIntervalEnd", predicate = "http://vivoweb.org/ontology/core#dateTime") + @NestedObject( + root = false, + properties = { + @Reference(value = "dateTimePrecisionEnd", key = "precision") + } + ) + @FieldSource( + template = "process/dateTimeIntervalEnd", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String dateTimeIntervalEnd; @FieldType(type = "nested_whole_string") - @FieldSource(template = "process/dateTimePrecisionStart", predicate = "http://vivoweb.org/ontology/core#dateTimePrecision", parse = true) + @FieldSource( + template = "process/dateTimePrecisionStart", + predicate = "http://vivoweb.org/ontology/core#dateTimePrecision", + parse = true + ) private String dateTimePrecisionStart; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "process/dateTimePrecisionEnd", predicate = "http://vivoweb.org/ontology/core#dateTimePrecision", parse = true) + @FieldSource( + template = "process/dateTimePrecisionEnd", + predicate = "http://vivoweb.org/ontology/core#dateTimePrecision", + parse = true + ) private String dateTimePrecisionEnd; @FieldType(type = "whole_string") - @FieldSource(template = "process/subtype", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#subtype") + @FieldSource( + template = "process/subtype", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#subtype" + ) private String subtype; @FieldType(type = "whole_string") - @FieldSource(template = "process/venue", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#venue") + @FieldSource( + template = "process/venue", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#venue" + ) private String venue; @FieldType(type = "whole_string") - @FieldSource(template = "process/location", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#location") + @FieldSource( + template = "process/location", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#location" + ) private String location; @FieldType(type = "whole_string") - @FieldSource(template = "process/url", predicate = "http://www.w3.org/2006/vcard/ns#url") + @FieldSource( + template = "process/url", + predicate = "http://www.w3.org/2006/vcard/ns#url" + ) private String url; @FieldType(type = "whole_string") - @FieldSource(template = "process/note", predicate = "http://www.w3.org/2006/vcard/ns#note") + @FieldSource( + template = "process/note", + predicate = "http://www.w3.org/2006/vcard/ns#note" + ) private String note; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/occursWithinEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/occursWithinEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List occursWithinEvent; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/includesEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/includesEvent", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List includesEvent; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/inEventSeries", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/inEventSeries", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List inEventSeries; @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "participants_nested_facets" }) - @NestedObject(properties = { @Reference(value = "participantId", key = "personId"), @Reference(value = "participantRole", key = "role"), @Reference(value = "participantDateTimeIntervalStart", key = "startDate"), @Reference(value = "participantDateTimeIntervalEnd", key = "endDate") }) - @FieldSource(template = "process/participant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "participantId", key = "personId"), + @Reference(value = "participantRole", key = "role"), + @Reference(value = "participantDateTimeIntervalStart", key = "startDate"), + @Reference(value = "participantDateTimeIntervalEnd", key = "endDate") + }) + @FieldSource( + template = "process/participant", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List participants; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/participantId", predicate = "http://purl.obolibrary.org/obo/RO_0000052", parse = true) + @FieldSource( + template = "process/participantId", + predicate = "http://purl.obolibrary.org/obo/RO_0000052", + parse = true + ) private List participantId; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/participantRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/participantRole", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List participantRole; @FieldType(type = "nested_dates") - @FieldSource(template = "process/participantDateTimeIntervalStart", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "process/participantDateTimeIntervalStart", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List participantDateTimeIntervalStart; @FieldType(type = "nested_dates") - @FieldSource(template = "process/participantDateTimeIntervalEnd", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "process/participantDateTimeIntervalEnd", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private List participantDateTimeIntervalEnd; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "process/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/hasSubjectArea", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subjectAreas; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/hasPrerequisite", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/hasPrerequisite", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasPrerequisite; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/prerequisiteFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/prerequisiteFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List prerequisiteFor; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "process/credits", predicate = "http://vivoweb.org/ontology/core#courseCredits") + @FieldSource( + template = "process/credits", + predicate = "http://vivoweb.org/ontology/core#courseCredits" + ) private String credits; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/outputPublicationOrOtherWork", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/outputPublicationOrOtherWork", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outputPublicationOrOtherWork; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/relatedDocument", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/relatedDocument", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List relatedDocuments; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "process/contactInformation", predicate = "http://vivoweb.org/ontology/core#contactInformation") + @FieldSource( + template = "process/contactInformation", + predicate = "http://vivoweb.org/ontology/core#contactInformation" + ) private String contactInformation; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/heldInFacility", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/heldInFacility", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List heldInFacility; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/heldInGeographicLocation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/heldInGeographicLocation", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List heldInGeographicLocation; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/hasOutput", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/hasOutput", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasOutput; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "process/hasParticipant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "process/hasParticipant", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List hasParticipant; public Process() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java index 31578dc2a..ea78ee3f0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java @@ -14,184 +14,324 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ @JsonInclude(NON_EMPTY) @CollectionSource(name = "relationships", predicate = "http://vivoweb.org/ontology/core#Relationship") public class Relationship extends Common { @FieldType(type = "tokenized_string", copyTo = { "_text_", "title_sort" }) - @FieldSource(template = "relationship/title", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/title", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private String title; @JsonProperty(ABSTRACT) @FieldType(type = "whole_string", value = ABSTRACT, copyTo = "_text_") - @FieldSource(template = "relationship/abstract", predicate = "http://purl.org/ontology/bibo/abstract") + @FieldSource( + template = "relationship/abstract", + predicate = "http://purl.org/ontology/bibo/abstract" + ) private String abstractText; @FieldType(type = "whole_string") - @FieldSource(template = "relationship/description", predicate = "http://vivoweb.org/ontology/core#description") + @FieldSource( + template = "relationship/description", + predicate = "http://vivoweb.org/ontology/core#description" + ) private String description; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/organization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/organization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List organization; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/receiptOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/receiptOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List receiptOf; @FieldType(type = "nested_whole_strings") - @NestedObject(properties = { @Reference(value = "awardOrHonorForType", key = "type") }) - @FieldSource(template = "relationship/awardOrHonorFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "awardOrHonorForType", key = "type") + }) + @FieldSource( + template = "relationship/awardOrHonorFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardOrHonorFor; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/awardOrHonorForType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "relationship/awardOrHonorForType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List awardOrHonorForType; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @NestedObject(properties = { @Reference(value = "awardConferredByType", key = "type"), @Reference(value = "awardConferredByAbbreviation", key = "abbreviation"), @Reference(value = "awardConferredByPreferredLabel", key = "preferredLabel") }) - @FieldSource(template = "relationship/awardConferredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "awardConferredByType", key = "type"), + @Reference(value = "awardConferredByAbbreviation", key = "abbreviation"), + @Reference(value = "awardConferredByPreferredLabel", key = "preferredLabel") + }) + @FieldSource( + template = "relationship/awardConferredBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardConferredBy; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/awardConferredByType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "relationship/awardConferredByType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List awardConferredByType; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "relationship/awardConferredByAbbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "relationship/awardConferredByAbbreviation", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private List awardConferredByAbbreviation; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "relationship/awardConferredByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardConferredBy_label") + @FieldSource( + template = "relationship/awardConferredByPreferredLabel", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardConferredBy_label" + ) private List awardConferredByPreferredLabel; @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "awardedBy_nested_facets" }) - @NestedObject(properties = { @Reference(value = "awardedByType", key = "type"), @Reference(value = "awardedByAbbreviation", key = "abbreviation"), @Reference(value = "awardedByPreferredLabel", key = "preferredLabel") }) - @FieldSource(template = "relationship/awardedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "awardedByType", key = "type"), + @Reference(value = "awardedByAbbreviation", key = "abbreviation"), + @Reference(value = "awardedByPreferredLabel", key = "preferredLabel") + }) + @FieldSource( + template = "relationship/awardedBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List awardedBy; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/awardedByType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "relationship/awardedByType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List awardedByType; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "relationship/awardedByAbbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") + @FieldSource( + template = "relationship/awardedByAbbreviation", + predicate = "http://vivoweb.org/ontology/core#abbreviation" + ) private List awardedByAbbreviation; @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "relationship/awardedByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardedBy_label") + @FieldSource( + template = "relationship/awardedByPreferredLabel", + predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardedBy_label" + ) private List awardedByPreferredLabel; @FieldType(type = "nested_whole_strings", searchable = false) - @NestedObject(properties = { @Reference(value = "grantSubcontractedThroughType", key = "type") }) - @FieldSource(template = "relationship/grantSubcontractedThrough", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "grantSubcontractedThroughType", key = "type") + }) + @FieldSource( + template = "relationship/grantSubcontractedThrough", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List grantSubcontractedThrough; @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/grantSubcontractedThroughType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "relationship/grantSubcontractedThroughType", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List grantSubcontractedThroughType; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "relationship/administeredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/administeredBy", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List administeredBy; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/subGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/subGrant", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subGrant; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/subGrantOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/subGrantOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subGrantOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/providesFundingFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/providesFundingFor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List providesFundingFor; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "relationship/totalAwardAmount", predicate = "http://vivoweb.org/ontology/core#totalAwardAmount") + @FieldSource( + template = "relationship/totalAwardAmount", + predicate = "http://vivoweb.org/ontology/core#totalAwardAmount" + ) private String totalAwardAmount; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "relationship/directCosts", predicate = "http://vivoweb.org/ontology/core#directCosts") + @FieldSource( + template = "relationship/directCosts", + predicate = "http://vivoweb.org/ontology/core#directCosts" + ) private String directCosts; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "relationship/sponsorAwardId", predicate = "http://vivoweb.org/ontology/core#sponsorAwardId") + @FieldSource( + template = "relationship/sponsorAwardId", + predicate = "http://vivoweb.org/ontology/core#sponsorAwardId" + ) private String sponsorAwardId; @FieldType(type = "whole_string", searchable = false) - @FieldSource(template = "relationship/localAwardId", predicate = "http://vivoweb.org/ontology/core#localAwardId") + @FieldSource( + template = "relationship/localAwardId", + predicate = "http://vivoweb.org/ontology/core#localAwardId" + ) private String localAwardId; @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") - @NestedObject(properties = { @Reference(value = "contributorRole", key = "role"), @Reference(value = "contributorOrganization", key = "organizations") }) - @FieldSource(template = "relationship/contributor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @NestedObject(properties = { + @Reference(value = "contributorRole", key = "role"), + @Reference(value = "contributorOrganization", key = "organizations") + }) + @FieldSource( + template = "relationship/contributor", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List contributors; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "relationship/contributorRole", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) + @FieldSource( + template = "relationship/contributorRole", + predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", + parse = true + ) private List contributorRole; @FieldType(type = "nested_whole_strings") - @FieldSource(template = "relationship/contributorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/contributorOrganization", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List contributorOrganization; @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "relationship/principalInvestigator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/principalInvestigator", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List principalInvestigators; @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") - @FieldSource(template = "relationship/coPrincipalInvestigator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/coPrincipalInvestigator", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List coPrincipalInvestigators; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/supportedPublicationOrOtherWork", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/supportedPublicationOrOtherWork", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List supportedPublicationOrOtherWork; @FieldType(type = "pdate") - @FieldSource(template = "relationship/startDateTime", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "relationship/startDateTime", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String startDateTime; @FieldType(type = "pdate") - @FieldSource(template = "relationship/endDateTime", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "relationship/endDateTime", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String endDateTime; @NestedObject @FieldType(type = "nested_whole_strings") - @FieldSource(template = "relationship/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/hasSubjectArea", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List subjectAreas; @FieldType(type = "pdate") - @FieldSource(template = "relationship/yearAwarded", predicate = "http://vivoweb.org/ontology/core#dateTime") + @FieldSource( + template = "relationship/yearAwarded", + predicate = "http://vivoweb.org/ontology/core#dateTime" + ) private String yearAwarded; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/inheresIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/inheresIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List inheresIn; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/isSpecifiedOutputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/isSpecifiedOutputOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List specifiedOutputOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/outputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/outputOf", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List outputOf; @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) - @FieldSource(template = "relationship/participatesIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") + @FieldSource( + template = "relationship/participatesIn", + predicate = "http://www.w3.org/2000/01/rdf-schema#label" + ) private List participatesIn; public Relationship() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndexDocumentRepo.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndexDocumentRepo.java index 18cabf3fd..0f1765fb0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndexDocumentRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndexDocumentRepo.java @@ -6,22 +6,25 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; +import reactor.core.publisher.Flux; import edu.tamu.scholars.middleware.discovery.argument.BoostArg; +import edu.tamu.scholars.middleware.discovery.argument.DiscoveryAcademicAgeDescriptor; import edu.tamu.scholars.middleware.discovery.argument.DiscoveryNetworkDescriptor; import edu.tamu.scholars.middleware.discovery.argument.DiscoveryQuantityDistributionDescriptor; -import edu.tamu.scholars.middleware.discovery.argument.DiscoveryAcademicAgeDescriptor; import edu.tamu.scholars.middleware.discovery.argument.FacetArg; import edu.tamu.scholars.middleware.discovery.argument.FilterArg; import edu.tamu.scholars.middleware.discovery.argument.HighlightArg; import edu.tamu.scholars.middleware.discovery.argument.QueryArg; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +import edu.tamu.scholars.middleware.discovery.response.DiscoveryAcademicAge; import edu.tamu.scholars.middleware.discovery.response.DiscoveryFacetAndHighlightPage; import edu.tamu.scholars.middleware.discovery.response.DiscoveryNetwork; import edu.tamu.scholars.middleware.discovery.response.DiscoveryQuantityDistribution; -import edu.tamu.scholars.middleware.discovery.response.DiscoveryAcademicAge; -import reactor.core.publisher.Flux; +/** + * + */ public interface IndexDocumentRepo { public long count(QueryArg query, List filters); @@ -40,14 +43,29 @@ public interface IndexDocumentRepo { public List findMostRecentlyUpdate(Integer limit, List filters); - public DiscoveryFacetAndHighlightPage search(QueryArg query, List facets, List filters, List boosts, HighlightArg highlight, Pageable page); + public DiscoveryFacetAndHighlightPage search( + QueryArg query, + List facets, + List filters, + List boosts, + HighlightArg highlight, + Pageable page + ); public Flux export(QueryArg query, List filters, List boosts, Sort sort); public DiscoveryNetwork network(DiscoveryNetworkDescriptor dataNetworkDescriptor); - public DiscoveryAcademicAge academicAge(DiscoveryAcademicAgeDescriptor academicAgeDescriptor, QueryArg query, List filters); - - public DiscoveryQuantityDistribution quantityDistribution(DiscoveryQuantityDistributionDescriptor quantityDistributionDescriptor, QueryArg query, List filters); + public DiscoveryAcademicAge academicAge( + DiscoveryAcademicAgeDescriptor academicAgeDescriptor, + QueryArg query, + List filters + ); + + public DiscoveryQuantityDistribution quantityDistribution( + DiscoveryQuantityDistributionDescriptor quantityDistributionDescriptor, + QueryArg query, + List filters + ); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java index 5d1af93a6..f6ab6f1a4 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java @@ -43,6 +43,7 @@ import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.stereotype.Service; +import reactor.core.publisher.Flux; import edu.tamu.scholars.middleware.discovery.argument.BoostArg; import edu.tamu.scholars.middleware.discovery.argument.DiscoveryAcademicAgeDescriptor; @@ -59,8 +60,10 @@ import edu.tamu.scholars.middleware.discovery.response.DiscoveryNetwork; import edu.tamu.scholars.middleware.discovery.response.DiscoveryQuantityDistribution; import edu.tamu.scholars.middleware.utility.DateFormatUtility; -import reactor.core.publisher.Flux; +/** + * + */ @Service public class IndividualRepo implements IndexDocumentRepo { @@ -87,7 +90,7 @@ public long count(QueryArg query, List filters) { .withQuery(query) .withFilters(filters); - return count(builder.query()); + return countQuery(builder.query()); } @Override @@ -95,7 +98,7 @@ public long count(String query, List filters) { SolrQueryBuilder builder = new SolrQueryBuilder(query) .withFilters(filters); - return count(builder.query()); + return countQuery(builder.query()); } @Override @@ -108,7 +111,7 @@ public Page findAll(Pageable pageable) { SolrQueryBuilder builder = new SolrQueryBuilder() .withPage(pageable); - return findAll(builder.query(), pageable); + return findAllQuery(builder.query(), pageable); } @Override @@ -118,7 +121,7 @@ public List findByType(String type) { .withFilters(Arrays.asList(filter)) .withRows(Integer.MAX_VALUE); - return findAll(builder.query()); + return findAllQuery(builder.query()); } @Override @@ -154,7 +157,7 @@ public List findMostRecentlyUpdate(Integer limit, List fi .withSort(Sort.by(Direction.DESC, MOD_TIME)) .withRows(limit); - return findAll(builder.query()); + return findAllQuery(builder.query()); } @Override @@ -182,7 +185,14 @@ public DiscoveryFacetAndHighlightPage search( .map(Individual::from) .collect(Collectors.toList()); - return DiscoveryFacetAndHighlightPage.from(individuals, response, page, facets, highlight, Individual.class); + return DiscoveryFacetAndHighlightPage.from( + individuals, + response, + page, + facets, + highlight, + Individual.class + ); } catch (IOException | SolrServerException e) { throw new SolrRequestException("Failed to search documents", e); } @@ -275,8 +285,13 @@ public DiscoveryNetwork network(DiscoveryNetworkDescriptor dataNetworkDescriptor } @Override - public DiscoveryAcademicAge academicAge(DiscoveryAcademicAgeDescriptor academicAgeDescriptor, QueryArg query, List filters) { - DiscoveryAcademicAge academicAge = new DiscoveryAcademicAge(academicAgeDescriptor.getLabel(), academicAgeDescriptor.getDateField()); + public DiscoveryAcademicAge academicAge( + DiscoveryAcademicAgeDescriptor academicAgeDescriptor, + QueryArg query, + List filters + ) { + DiscoveryAcademicAge academicAge = + new DiscoveryAcademicAge(academicAgeDescriptor.getLabel(), academicAgeDescriptor.getDateField()); String dateField = academicAgeDescriptor.getDateField(); String ageField = academicAgeDescriptor.getAgeField(); @@ -308,24 +323,31 @@ public DiscoveryAcademicAge academicAge(DiscoveryAcademicAgeDescriptor academicA } @Override - public DiscoveryQuantityDistribution quantityDistribution(DiscoveryQuantityDistributionDescriptor quantityDistributionDescriptor, QueryArg query, List filters) { - DiscoveryQuantityDistribution quantityDistribution = DiscoveryQuantityDistribution.from(quantityDistributionDescriptor); + public DiscoveryQuantityDistribution quantityDistribution( + DiscoveryQuantityDistributionDescriptor quantityDistributionDescriptor, + QueryArg query, + List filters + ) { + DiscoveryQuantityDistribution quantityDistribution = + DiscoveryQuantityDistribution.from(quantityDistributionDescriptor); String field = quantityDistributionDescriptor.getField(); - List facets = new ArrayList() {{ - add(FacetArg.of( - field, - Optional.of("COUNT,DESC"), - Optional.of(String.valueOf(Integer.MAX_VALUE)), - Optional.empty(), - Optional.of("STRING"), - Optional.empty(), - Optional.empty(), - Optional.empty(), - Optional.empty() - )); - }}; + List facets = new ArrayList() { + { + add(FacetArg.of( + field, + Optional.of("COUNT,DESC"), + Optional.of(String.valueOf(Integer.MAX_VALUE)), + Optional.empty(), + Optional.of("STRING"), + Optional.empty(), + Optional.empty(), + Optional.empty(), + Optional.empty() + )); + } + }; SolrQueryBuilder builder = new SolrQueryBuilder() .withQuery(query) @@ -371,7 +393,7 @@ private boolean validateAndCountDateField(DiscoveryNetwork dataNetwork, Object d return success; } - private long count(SolrQuery query) { + private long countQuery(SolrQuery query) { try { return solrClient.query(collectionName, query) .getResults() @@ -391,7 +413,7 @@ private Individual getById(String id) { } } - private List findAll(SolrQuery query) { + private List findAllQuery(SolrQuery query) { try { return solrClient.query(collectionName, query).getResults() .stream() @@ -402,7 +424,7 @@ private List findAll(SolrQuery query) { } } - private Page findAll(SolrQuery query, Pageable pageable) { + private Page findAllQuery(SolrQuery query, Pageable pageable) { try { SolrDocumentList documents = solrClient.query(collectionName, query) .getResults(); @@ -464,7 +486,10 @@ public SolrQueryBuilder withQuery(QueryArg query) { if (StringUtils.isNotEmpty(query.getFields())) { String fields = String.join(REQUEST_PARAM_DELIMETER, ID, CLASS, query.getFields()); - String fl = String.join(REQUEST_PARAM_DELIMETER, Arrays.stream(fields.split(REQUEST_PARAM_DELIMETER)).collect(Collectors.toSet())); + String fl = String.join( + REQUEST_PARAM_DELIMETER, + Arrays.stream(fields.split(REQUEST_PARAM_DELIMETER)).collect(Collectors.toSet()) + ); this.query.setParam("fl", fl); } @@ -493,7 +518,7 @@ public SolrQueryBuilder withRows(int rows) { public SolrQueryBuilder withSort(Sort sort) { sort.iterator().forEachRemaining(order -> { - this.query.addSort(order.getProperty(), order.getDirection().isAscending() ? ORDER.asc: ORDER.desc); + this.query.addSort(order.getProperty(), order.getDirection().isAscending() ? ORDER.asc : ORDER.desc); }); return this; @@ -723,6 +748,7 @@ public String build() { case RAW: filterQuery .append(value); + break; default: break; } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/BoostArgumentResolver.java b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/BoostArgumentResolver.java index 6c03a1aa8..7558bf54d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/BoostArgumentResolver.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/BoostArgumentResolver.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.argument.BoostArg; +/** + * + */ public class BoostArgumentResolver implements HandlerMethodArgumentResolver { @Override @@ -23,7 +26,12 @@ public boolean supportsParameter(MethodParameter parameter) { } @Override - public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument( + MethodParameter parameter, + @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + @Nullable WebDataBinderFactory binderFactory + ) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); return getBoostArguments(request); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FacetArgumentResolver.java b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FacetArgumentResolver.java index ebb860047..42dd5ae63 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FacetArgumentResolver.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FacetArgumentResolver.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.argument.FacetArg; +/** + * + */ public class FacetArgumentResolver implements HandlerMethodArgumentResolver { @Override @@ -23,7 +26,12 @@ public boolean supportsParameter(MethodParameter parameter) { } @Override - public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument( + MethodParameter parameter, + @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + @Nullable WebDataBinderFactory binderFactory + ) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); return getFacetArguments(request); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FilterArgumentResolver.java b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FilterArgumentResolver.java index 4619e5e57..f2c5b780f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FilterArgumentResolver.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/FilterArgumentResolver.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.argument.FilterArg; +/** + * + */ public class FilterArgumentResolver implements HandlerMethodArgumentResolver { @Override @@ -23,7 +26,12 @@ public boolean supportsParameter(MethodParameter parameter) { } @Override - public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument( + MethodParameter parameter, + @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + @Nullable WebDataBinderFactory binderFactory + ) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); return getFilterArguments(request); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/HighlightArgumentResolver.java b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/HighlightArgumentResolver.java index d44f3d4bb..1982ed80b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/HighlightArgumentResolver.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/HighlightArgumentResolver.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.argument.HighlightArg; +/** + * + */ public class HighlightArgumentResolver implements HandlerMethodArgumentResolver { @Override @@ -23,7 +26,12 @@ public boolean supportsParameter(MethodParameter parameter) { } @Override - public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument( + MethodParameter parameter, + @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + @Nullable WebDataBinderFactory binderFactory + ) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); return getHightlightArgument(request); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/QueryArgumentResolver.java b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/QueryArgumentResolver.java index da46b55dc..33ec7b73b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/QueryArgumentResolver.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/resolver/QueryArgumentResolver.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.discovery.argument.QueryArg; +/** + * + */ public class QueryArgumentResolver implements HandlerMethodArgumentResolver { @Override @@ -23,7 +26,12 @@ public boolean supportsParameter(MethodParameter parameter) { } @Override - public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument( + MethodParameter parameter, + @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + @Nullable WebDataBinderFactory binderFactory + ) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); return getQueryArgument(request); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryAcademicAge.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryAcademicAge.java index af52644d6..2ecf3d32e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryAcademicAge.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryAcademicAge.java @@ -16,6 +16,9 @@ import edu.tamu.scholars.middleware.discovery.argument.DiscoveryAcademicAgeDescriptor.LabeledRange; import edu.tamu.scholars.middleware.discovery.utility.DateUtility; +/** + * + */ public class DiscoveryAcademicAge { private final String label; @@ -100,7 +103,9 @@ public void from(DiscoveryAcademicAgeDescriptor academicAgeDescriptor, SolrDocum Collections.sort(groups, new AgeGroupComparator()); this.mean = results.size() > 0 ? sum.get() / results.size() : 0; - this.median = results.size() > 0 ? DateUtility.ageInYearsFromEpochSecond((long) results.get(results.size() / 2).getFieldValue(ageField)) : 0; + this.median = results.size() > 0 + ? DateUtility.ageInYearsFromEpochSecond((long) results.get(results.size() / 2).getFieldValue(ageField)) + : 0; } public String getLabel() { @@ -135,17 +140,21 @@ public class AgeGroup { private final Integer index; private final String label; private final Integer value; + private AgeGroup(Integer index, String label, Integer value) { this.index = index; this.label = label; this.value = value; } + public Integer getIndex() { return index; } + public String getLabel() { return label; } + public Integer getValue() { return value; } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java index 742742915..6e89a4746 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java @@ -6,8 +6,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Map.Entry; +import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -20,20 +20,36 @@ import edu.tamu.scholars.middleware.discovery.argument.FacetArg; import edu.tamu.scholars.middleware.discovery.argument.HighlightArg; +/** + * + */ public class DiscoveryFacetAndHighlightPage extends DiscoveryFacetPage { private static final long serialVersionUID = 1932430579005159735L; - private final static Pattern REFERENCE_PATTERN = Pattern.compile("^(.*?)::([\\w\\-\\:]*)(.*)$"); + private static final Pattern REFERENCE_PATTERN = Pattern.compile("^(.*?)::([\\w\\-\\:]*)(.*)$"); private final List highlights; - public DiscoveryFacetAndHighlightPage(List content, Pageable pageable, long total, List facets, List highlights) { + public DiscoveryFacetAndHighlightPage( + List content, + Pageable pageable, + long total, + List facets, + List highlights + ) { super(content, pageable, total, facets); this.highlights = highlights; } - public static DiscoveryFacetAndHighlightPage from(List documents, QueryResponse response, Pageable pageable, List facetArguments, HighlightArg highlightArg, Class type) { + public static DiscoveryFacetAndHighlightPage from( + List documents, + QueryResponse response, + Pageable pageable, + List facetArguments, + HighlightArg highlightArg, + Class type + ) { List facets = buildFacets(response, facetArguments); List highlights = buildHighlights(response, highlightArg); SolrDocumentList results = response.getResults(); @@ -45,29 +61,40 @@ public static List buildHighlights(QueryResponse response, Highli List highlights = new ArrayList<>(); Map>> highlighting = response.getHighlighting(); if (Objects.nonNull(highlighting)) { - highlighting.entrySet().stream().filter(DiscoveryFacetAndHighlightPage::hasHighlights).forEach(hEntry -> { - String id = hEntry.getKey(); - Map> snippets = new HashMap<>(); - hEntry.getValue().entrySet().stream().filter(DiscoveryFacetAndHighlightPage::hasSnippets).forEach(sEntry -> { - snippets.put(findPath(sEntry.getKey()), sEntry.getValue().stream().map(s -> { - Matcher matcher = REFERENCE_PATTERN.matcher(s); - if (matcher.find()) { - Map value = new HashMap<>(); - value.put(DiscoveryConstants.ID, matcher.group(2)); - value.put(DiscoveryConstants.SNIPPET, matcher.group(1) + matcher.group(3)); - return value; - } - return s; - }).collect(Collectors.toList())); - }); - highlights.add(new Highlight(id, snippets)); - }); + highlighting.entrySet() + .stream() + .filter(DiscoveryFacetAndHighlightPage::hasHighlights) + .forEach(highlightEntry -> { + + String id = highlightEntry.getKey(); + Map> snippets = new HashMap<>(); + + highlightEntry.getValue().entrySet() + .stream() + .filter(DiscoveryFacetAndHighlightPage::hasSnippets) + .forEach(se -> { + + snippets.put(findPath(se.getKey()), se.getValue().stream().map(s -> { + Matcher matcher = REFERENCE_PATTERN.matcher(s); + if (matcher.find()) { + Map value = new HashMap<>(); + value.put(DiscoveryConstants.ID, matcher.group(2)); + value.put(DiscoveryConstants.SNIPPET, matcher.group(1) + matcher.group(3)); + return value; + } + + return s; + }).collect(Collectors.toList())); + }); + + highlights.add(new Highlight(id, snippets)); + }); } return highlights; } - public static boolean hasHighlights(Entry>> entry ) { + public static boolean hasHighlights(Entry>> entry) { return !entry.getValue().isEmpty(); } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java index 0076a559d..617a846a1 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java @@ -24,6 +24,9 @@ import edu.tamu.scholars.middleware.utility.DateFormatUtility; import edu.tamu.scholars.middleware.view.model.FacetSort; +/** + * + */ public class DiscoveryFacetPage extends DiscoveryPage { private static final long serialVersionUID = 8673698977219588493L; @@ -35,7 +38,13 @@ public DiscoveryFacetPage(List content, Pageable pageable, long total, List DiscoveryFacetPage from(List documents, QueryResponse response, Pageable pageable, List facetArguments, Class type) { + public static DiscoveryFacetPage from( + List documents, + QueryResponse response, + Pageable pageable, + List facetArguments, + Class type + ) { List facets = buildFacets(response, facetArguments); SolrDocumentList results = response.getResults(); @@ -54,7 +63,9 @@ public static List buildFacets(QueryResponse response, List List entries = facetField.getValues().parallelStream() .map(entry -> new FacetEntry(entry.getName(), entry.getCount())) - .collect(Collectors.toMap(FacetEntry::getValueKey, fe -> fe, FacetEntry::merge)).values().parallelStream() + .collect(Collectors.toMap(FacetEntry::getValueKey, fe -> fe, FacetEntry::merge)) + .values() + .parallelStream() .sorted(FacetEntryComparator.of(facetArgument.getSort())) .collect(Collectors.toList()); @@ -69,11 +80,17 @@ public static List buildFacets(QueryResponse response, List int end = offset + (pageSize > totalElements ? totalElements : offset + pageSize); - Sort sort = Sort.by(facetArgument.getSort().getDirection(), facetArgument.getSort().getProperty().toString()); + Sort sort = Sort.by( + facetArgument.getSort().getDirection(), + facetArgument.getSort().getProperty().toString() + ); Pageable pageable = PageRequest.of(pageNumber, pageSize, sort); - facets.add(new Facet(findPath(name), DiscoveryPage.from(entries.subList(start, end), pageable, totalElements))); + facets.add( + new Facet(findPath(name), + DiscoveryPage.from(entries.subList(start, end), pageable, totalElements)) + ); } }); return facets; @@ -90,7 +107,9 @@ private FacetEntryComparator(FacetSortArg facetSort) { @Override public int compare(FacetEntry e1, FacetEntry e2) { if (facetSort.getProperty().equals(FacetSort.COUNT)) { - return facetSort.getDirection().equals(Direction.ASC) ? Long.compare(e1.count, e2.count) : Long.compare(e2.count, e1.count); + return facetSort.getDirection().equals(Direction.ASC) + ? Long.compare(e1.count, e2.count) + : Long.compare(e2.count, e1.count); } try { ZonedDateTime ld1 = DateFormatUtility.parseZonedDateTime(e1.value); @@ -102,7 +121,9 @@ public int compare(FacetEntry e1, FacetEntry e2) { Double d2 = Double.parseDouble(e2.value); return facetSort.getDirection().equals(Direction.ASC) ? d1.compareTo(d2) : d2.compareTo(d1); } else { - return facetSort.getDirection().equals(Direction.ASC) ? e1.value.compareTo(e2.value) : e2.value.compareTo(e1.value); + return facetSort.getDirection().equals(Direction.ASC) + ? e1.value.compareTo(e2.value) + : e2.value.compareTo(e1.value); } } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryNetwork.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryNetwork.java index 2873ff054..ca4782a10 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryNetwork.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryNetwork.java @@ -12,6 +12,9 @@ import java.util.Set; import java.util.stream.Collectors; +/** + * + */ public class DiscoveryNetwork { private final String id; @@ -83,26 +86,26 @@ public synchronized void map(String id, String source, String target) { return; } - String[] sParts = source.split(NESTED_DELIMITER); - String[] tParts = target.split(NESTED_DELIMITER); + String[] sourceParts = source.split(NESTED_DELIMITER); + String[] targetParts = target.split(NESTED_DELIMITER); - if (sParts.length <= 1 || tParts.length <= 1) { + if (sourceParts.length <= 1 || targetParts.length <= 1) { return; } - String sId = sParts[1]; - String tId = tParts[1]; + String sourceId = sourceParts[1]; + String targetId = targetParts[1]; for (DirectedData dd : this.data) { // count either direction - if ((dd.getSource().equals(sId) && dd.getTarget().equals(tId)) || - (dd.getSource().equals(tId) && dd.getTarget().equals(sId))) { + if (dd.getSource().equals(sourceId) && dd.getTarget().equals(targetId) + || dd.getSource().equals(targetId) && dd.getTarget().equals(sourceId)) { dd.add(id); return; } } // add new connection - this.data.add(new DirectedData(id, sId, tId)); + this.data.add(new DirectedData(id, sourceId, targetId)); } public static DiscoveryNetwork to(String id) { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryPage.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryPage.java index de31d6b17..fbb5456ff 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryPage.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryPage.java @@ -2,11 +2,13 @@ import java.util.List; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - +/** + * + */ @JsonIgnoreProperties({ "number", "size", diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryQuantityDistribution.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryQuantityDistribution.java index 3b6843d7b..ef557fd53 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryQuantityDistribution.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryQuantityDistribution.java @@ -9,6 +9,9 @@ import edu.tamu.scholars.middleware.discovery.argument.DiscoveryQuantityDistributionDescriptor; +/** + * + */ public class DiscoveryQuantityDistribution { private final String label; @@ -60,8 +63,13 @@ public int compare(Count o1, Count o2) { }); } - public static DiscoveryQuantityDistribution from(DiscoveryQuantityDistributionDescriptor quantityDistributionDescriptor) { - return new DiscoveryQuantityDistribution(quantityDistributionDescriptor.getLabel(), quantityDistributionDescriptor.getField()); + public static DiscoveryQuantityDistribution from( + DiscoveryQuantityDistributionDescriptor quantityDistributionDescriptor + ) { + return new DiscoveryQuantityDistribution( + quantityDistributionDescriptor.getLabel(), + quantityDistributionDescriptor.getField() + ); } public class Slice { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/IndividualSerializer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/IndividualSerializer.java index 23909c120..c981c6690 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/IndividualSerializer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/IndividualSerializer.java @@ -2,17 +2,19 @@ import java.io.IOException; -import org.springframework.boot.jackson.JsonComponent; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import com.fasterxml.jackson.databind.util.NameTransformer; +import org.springframework.boot.jackson.JsonComponent; import edu.tamu.scholars.middleware.discovery.model.Individual; +/** + * + */ @JsonComponent public class IndividualSerializer extends StdSerializer { @@ -25,7 +27,11 @@ public IndividualSerializer() { } @Override - public void serialize(Individual document, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { + public void serialize( + Individual document, + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider + ) throws IOException, JsonProcessingException { jsonGenerator.writeStartObject(); delegate.serialize(document, jsonGenerator, serializerProvider); jsonGenerator.writeEndObject(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java index 8451d9c5e..6f00b2646 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java @@ -17,8 +17,6 @@ import java.util.function.Supplier; import java.util.stream.Collector; -import org.apache.commons.lang3.reflect.FieldUtils; - import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonProcessingException; @@ -30,6 +28,7 @@ import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.databind.util.NameTransformer; +import org.apache.commons.lang3.reflect.FieldUtils; import edu.tamu.scholars.middleware.discovery.annotation.FieldSource; import edu.tamu.scholars.middleware.discovery.annotation.NestedMultiValuedProperty; @@ -37,6 +36,9 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; import edu.tamu.scholars.middleware.discovery.model.Individual; +/** + * + */ public class UnwrappingIndividualSerializer extends JsonSerializer { private static final ObjectMapper mapper = new ObjectMapper(); @@ -53,7 +55,11 @@ public boolean isUnwrappingSerializer() { } @Override - public void serialize(Individual individual, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { + public void serialize( + Individual individual, + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider + ) throws IOException, JsonProcessingException { Class type = getDiscoveryDocumentType(individual.getProxy()); Map content = individual.getContent(); jsonGenerator.writeObjectField(nameTransformer.transform(ID), individual.getId()); @@ -73,17 +79,17 @@ public void serialize(Individual individual, JsonGenerator jsonGenerator, Serial ArrayNode array = values.parallelStream() .map(v -> v.split(NESTED_DELIMITER)) - .filter(vParts -> vParts.length > 1) - .map(vParts -> processValue(content, type, field, vParts, 1)) + .filter(vparts -> vparts.length > 1) + .map(vparts -> processValue(content, type, field, vparts, 1)) .collect(new JsonNodeArrayNodeCollector()); if (array.size() > 0) { jsonGenerator.writeObjectField(name, array); } } else { - String[] vParts = strip(value.toString()).split(NESTED_DELIMITER); - if (vParts.length > 1) { - jsonGenerator.writeObjectField(name, processValue(content, type, field, vParts, 1)); + String[] vparts = strip(value.toString()).split(NESTED_DELIMITER); + if (vparts.length > 1) { + jsonGenerator.writeObjectField(name, processValue(content, type, field, vparts, 1)); } } } @@ -103,18 +109,31 @@ public void serialize(Individual individual, JsonGenerator jsonGenerator, Serial } } - private ObjectNode processValue(Map content, Class type, Field field, String[] vParts, int index) { + private ObjectNode processValue( + Map content, + Class type, + Field field, + String[] valueParts, + int index + ) { ObjectNode node = JsonNodeFactory.instance.objectNode(); NestedObject nestedObject = field.getAnnotation(NestedObject.class); if (nestedObject != null) { - node.put(ID, vParts[index]); - node.put(nestedObject.label(), vParts[0]); - processNestedObject(content, type, nestedObject, node, vParts, index + 1); + node.put(ID, valueParts[index]); + node.put(nestedObject.label(), valueParts[0]); + processNestedObject(content, type, nestedObject, node, valueParts, index + 1); } return node; } - private void processNestedObject(Map content, Class type, NestedObject nestedObject, ObjectNode node, String[] vParts, int depth) { + private void processNestedObject( + Map content, + Class type, + NestedObject nestedObject, + ObjectNode node, + String[] valueParts, + int depth + ) { for (Reference reference : nestedObject.properties()) { String ref = reference.value(); Field nestedField = FieldUtils.getField(type, ref, true); @@ -134,12 +153,13 @@ private void processNestedObject(Map content, Class type, Nes if (strip(nestedValues.get(0)).split(NESTED_DELIMITER).length > depth) { array = nestedValues.parallelStream() - .filter(nv -> isProperty(vParts, nv)) - .map(nv -> processValue(content, type, nestedField, strip(nv).split(NESTED_DELIMITER), depth)) + .filter(nv -> isProperty(valueParts, nv)) + .map(nv -> processValue(content, type, nestedField, strip(nv) + .split(NESTED_DELIMITER), depth)) .collect(new JsonNodeArrayNodeCollector()); } else { array = nestedValues.parallelStream() - .filter(nv -> isProperty(vParts, nv)) + .filter(nv -> isProperty(valueParts, nv)) .map(nv -> strip(nv).split(NESTED_DELIMITER)[0]) .collect(new StringArrayNodeCollector()); } @@ -153,12 +173,12 @@ private void processNestedObject(Map content, Class type, Nes } } } else { - String[] nvParts = strip(nestedValue.toString()).split(NESTED_DELIMITER); - if (nvParts.length > depth) { - node.set(name, processValue(content, type, nestedField, nvParts, depth)); + String[] nestedValueParts = strip(nestedValue.toString()).split(NESTED_DELIMITER); + if (nestedValueParts.length > depth) { + node.set(name, processValue(content, type, nestedField, nestedValueParts, depth)); } else { - if (nvParts[0] != null) { - node.put(name, nvParts[0]); + if (nestedValueParts[0] != null) { + node.put(name, nestedValueParts[0]); } } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java b/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java index 2198a615e..8c8581b37 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java @@ -1,5 +1,7 @@ package edu.tamu.scholars.middleware.discovery.service; +import javax.annotation.PostConstruct; + import java.time.Duration; import java.time.Instant; import java.util.Date; @@ -7,8 +9,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicBoolean; -import javax.annotation.PostConstruct; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -21,12 +21,15 @@ import edu.tamu.scholars.middleware.discovery.component.Indexer; import edu.tamu.scholars.middleware.service.Triplestore; +/** + * + */ @Service public class IndexService { - private final static Logger logger = LoggerFactory.getLogger(IndexService.class); + private static final Logger logger = LoggerFactory.getLogger(IndexService.class); - private final static AtomicBoolean indexing = new AtomicBoolean(false); + private static final AtomicBoolean indexing = new AtomicBoolean(false); public static final List CREATED_FIELDS = new CopyOnWriteArrayList(); @@ -74,15 +77,17 @@ public void run() { public void index() { if (indexing.compareAndSet(false, true)) { triplestore.init(); - Instant start = Instant.now(); + final Instant start = Instant.now(); logger.info("Indexing..."); harvesters.parallelStream().forEach(harvester -> { logger.info("Indexing {} documents.", harvester.type().getSimpleName()); if (indexers.stream().anyMatch(indexer -> indexer.type().equals(harvester.type()))) { harvester.harvest().buffer(index.getBatchSize()).subscribe(batch -> { - indexers.parallelStream().filter(indexer -> indexer.type().equals(harvester.type())).forEach(indexer -> { - indexer.index(batch); - }); + indexers.parallelStream() + .filter(indexer -> indexer.type().equals(harvester.type())) + .forEach(indexer -> { + indexer.index(batch); + }); }); } else { logger.warn("No indexer found for {} documents!", harvester.type().getSimpleName()); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/ArgumentUtility.java b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/ArgumentUtility.java index 49144d1f9..383ee738f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/ArgumentUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/ArgumentUtility.java @@ -1,5 +1,7 @@ package edu.tamu.scholars.middleware.discovery.utility; +import javax.servlet.http.HttpServletRequest; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -8,8 +10,6 @@ import java.util.Optional; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; - import org.apache.commons.lang3.StringUtils; import edu.tamu.scholars.middleware.discovery.argument.BoostArg; @@ -18,36 +18,43 @@ import edu.tamu.scholars.middleware.discovery.argument.HighlightArg; import edu.tamu.scholars.middleware.discovery.argument.QueryArg; +/** + * + */ public class ArgumentUtility { - private final static String FACET_QUERY_PARAM_KEY = "facets"; - private final static String FILTER_QUERY_PARAM_KEY = "filters"; - private final static String BOOST_QUERY_PARAM_KEY = "boost"; - - private final static String QUERY_EXPRESSION_QUERY_PARAM_KEY = "q"; - private final static String DEFAULT_FIELD_QUERY_PARAM_KEY = "df"; - private final static String MINIMUM_SHOULD_MATCH_QUERY_PARAM_KEY = "mm"; - private final static String QUERY_FIELD_QUERY_PARAM_KEY = "qf"; - private final static String BOOST_QUERY_QUERY_PARAM_KEY = "bq"; - private final static String FIELDS_QUERY_PARAM_KEY = "fl"; - - private final static String HIGHLIGHT_FIELDS_QUERY_PARAM_KEY = "hl"; - private final static String HIGHLIGHT_PRE_QUERY_PARAM_KEY = "hl.prefix"; - private final static String HIGHLIGHT_POST_QUERY_PARAM_KEY = "hl.postfix"; - - private final static String FACET_SORT_FORMAT = "%s.sort"; - private final static String FACET_PAGE_SIZE_FORMAT = "%s.pageSize"; - private final static String FACET_PAGE_NUMBER_FORMAT = "%s.pageNumber"; - private final static String FACET_TYPE_FORMAT = "%s.type"; - private final static String FACET_EXCLUDE_TAG_FORMAT = "%s.exclusionTag"; - private final static String FACET_RANGE_START_TAG_FORMAT = "%s.rangeStart"; - private final static String FACET_RANGE_END_TAG_FORMAT = "%s.rangeEnd"; - private final static String FACET_RANGE_GAP_TAG_FORMAT = "%s.rangeGap"; - - private final static String FILTER_VALUE_DELIMITER = ";;"; - private final static String FILTER_VALUE_FORMAT = "%s.filter"; - private final static String FILTER_OPKEY_FORMAT = "%s.opKey"; - private final static String FILTER_TAG_FORMAT = "%s.tag"; + private static final String FACET_QUERY_PARAM_KEY = "facets"; + private static final String FILTER_QUERY_PARAM_KEY = "filters"; + private static final String BOOST_QUERY_PARAM_KEY = "boost"; + + private static final String QUERY_EXPRESSION_QUERY_PARAM_KEY = "q"; + private static final String DEFAULT_FIELD_QUERY_PARAM_KEY = "df"; + private static final String MINIMUM_SHOULD_MATCH_QUERY_PARAM_KEY = "mm"; + private static final String QUERY_FIELD_QUERY_PARAM_KEY = "qf"; + private static final String BOOST_QUERY_QUERY_PARAM_KEY = "bq"; + private static final String FIELDS_QUERY_PARAM_KEY = "fl"; + + private static final String HIGHLIGHT_FIELDS_QUERY_PARAM_KEY = "hl"; + private static final String HIGHLIGHT_PRE_QUERY_PARAM_KEY = "hl.prefix"; + private static final String HIGHLIGHT_POST_QUERY_PARAM_KEY = "hl.postfix"; + + private static final String FACET_SORT_FORMAT = "%s.sort"; + private static final String FACET_PAGE_SIZE_FORMAT = "%s.pageSize"; + private static final String FACET_PAGE_NUMBER_FORMAT = "%s.pageNumber"; + private static final String FACET_TYPE_FORMAT = "%s.type"; + private static final String FACET_EXCLUDE_TAG_FORMAT = "%s.exclusionTag"; + private static final String FACET_RANGE_START_TAG_FORMAT = "%s.rangeStart"; + private static final String FACET_RANGE_END_TAG_FORMAT = "%s.rangeEnd"; + private static final String FACET_RANGE_GAP_TAG_FORMAT = "%s.rangeGap"; + + private static final String FILTER_VALUE_DELIMITER = ";;"; + private static final String FILTER_VALUE_FORMAT = "%s.filter"; + private static final String FILTER_OPKEY_FORMAT = "%s.opKey"; + private static final String FILTER_TAG_FORMAT = "%s.tag"; + + private ArgumentUtility() { + + } public static List getFacetArguments(HttpServletRequest request) { List parameterNames = Collections.list(request.getParameterNames()); @@ -69,14 +76,14 @@ public static List getFacetArguments(HttpServletRequest request) { final String rangeStartTagFacet = String.format(FACET_RANGE_START_TAG_FORMAT, field); final String rangeEndTagFacet = String.format(FACET_RANGE_END_TAG_FORMAT, field); final String rangeGapTagFacet = String.format(FACET_RANGE_GAP_TAG_FORMAT, field); - Optional sort = Optional.empty(), - pageSize = Optional.empty(), - pageNumber = Optional.empty(), - type = Optional.empty(), - exclusionTag = Optional.empty(), - rangeStart = Optional.empty(), - rangeEnd = Optional.empty(), - rangeGap = Optional.empty(); + Optional sort = Optional.empty(); + Optional pageSize = Optional.empty(); + Optional pageNumber = Optional.empty(); + Optional type = Optional.empty(); + Optional exclusionTag = Optional.empty(); + Optional rangeStart = Optional.empty(); + Optional rangeEnd = Optional.empty(); + Optional rangeGap = Optional.empty(); for (String paramName : parameterNames) { String[] parameterValues = request.getParameterValues(paramName); if (Objects.nonNull(parameterValues)) { @@ -121,8 +128,8 @@ public static List getFilterArguments(HttpServletRequest request) { final String opKeyFilter = String.format(FILTER_OPKEY_FORMAT, field); final String tagFilter = String.format(FILTER_TAG_FORMAT, field); String values = StringUtils.EMPTY; - Optional opKey = Optional.empty(), - tag = Optional.empty(); + Optional opKey = Optional.empty(); + Optional tag = Optional.empty(); for (String paramName : parameterNames) { String[] parameterValues = request.getParameterValues(paramName); if (Objects.nonNull(parameterValues)) { @@ -162,7 +169,9 @@ public static HighlightArg getHightlightArgument(HttpServletRequest request) { public static QueryArg getQueryArgument(HttpServletRequest request) { Optional expression = Optional.ofNullable(request.getParameter(QUERY_EXPRESSION_QUERY_PARAM_KEY)); Optional defaultField = Optional.ofNullable(request.getParameter(DEFAULT_FIELD_QUERY_PARAM_KEY)); - Optional minimumShouldMatch = Optional.ofNullable(request.getParameter(MINIMUM_SHOULD_MATCH_QUERY_PARAM_KEY)); + Optional minimumShouldMatch = Optional.ofNullable( + request.getParameter(MINIMUM_SHOULD_MATCH_QUERY_PARAM_KEY) + ); Optional queryField = Optional.ofNullable(request.getParameter(QUERY_FIELD_QUERY_PARAM_KEY)); Optional boostQuery = Optional.ofNullable(request.getParameter(BOOST_QUERY_QUERY_PARAM_KEY)); Optional fields = Optional.ofNullable(request.getParameter(FIELDS_QUERY_PARAM_KEY)); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DateUtility.java b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DateUtility.java index 401c08d99..09bbbbd8e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DateUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DateUtility.java @@ -4,6 +4,9 @@ import java.time.Period; import java.time.ZoneId; +/** + * + */ public class DateUtility { private DateUtility() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java index 095841864..308ba434a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java @@ -28,13 +28,16 @@ import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; +/** + * + */ public class DiscoveryUtility { - private final static Map> TYPES = new HashMap<>(); + private static final Map> TYPES = new HashMap<>(); - private final static Map>> TYPE_FIELDS = new HashMap<>(); + private static final Map>> TYPE_FIELDS = new HashMap<>(); - private final static BidiMap MAPPING = new DualHashBidiMap(); + private static final BidiMap MAPPING = new DualHashBidiMap(); static { ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); @@ -63,6 +66,10 @@ public class DiscoveryUtility { } } + private DiscoveryUtility() { + + } + public static Class getDiscoveryDocumentType(String name) { Optional> documentType = Optional.ofNullable(TYPES.get(name)); if (documentType.isPresent()) { diff --git a/src/main/java/edu/tamu/scholars/middleware/export/advice/ExportControllerAdvice.java b/src/main/java/edu/tamu/scholars/middleware/export/advice/ExportControllerAdvice.java index aa762c020..eb2fc3da6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/advice/ExportControllerAdvice.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/advice/ExportControllerAdvice.java @@ -16,10 +16,13 @@ import edu.tamu.scholars.middleware.export.exception.UnknownExporterTypeException; import edu.tamu.scholars.middleware.export.exception.UnsupportedExporterTypeException; +/** + * + */ @ControllerAdvice public class ExportControllerAdvice { - private final static Logger logger = LoggerFactory.getLogger(ExportControllerAdvice.class); + private static final Logger logger = LoggerFactory.getLogger(ExportControllerAdvice.class); @ResponseStatus(value = HttpStatus.NOT_FOUND) @ExceptionHandler(value = UnknownExporterTypeException.class) @@ -41,7 +44,9 @@ public class ExportControllerAdvice { @ResponseStatus(value = HttpStatus.BAD_REQUEST) @ExceptionHandler(value = ExportQueryParameterRequiredException.class) - public @ResponseBody String handleExportQueryParameterRequiredException(ExportQueryParameterRequiredException exception) { + public @ResponseBody String handleExportQueryParameterRequiredException( + ExportQueryParameterRequiredException exception + ) { return exception.getMessage(); } diff --git a/src/main/java/edu/tamu/scholars/middleware/export/argument/ExportArg.java b/src/main/java/edu/tamu/scholars/middleware/export/argument/ExportArg.java index 22e515df4..d99ebae29 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/argument/ExportArg.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/argument/ExportArg.java @@ -4,6 +4,9 @@ import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; +/** + * + */ public class ExportArg { private final String field; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualExportController.java b/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualExportController.java index e9480cc15..c393afabb 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualExportController.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualExportController.java @@ -1,16 +1,19 @@ package edu.tamu.scholars.middleware.export.controller; +import static edu.tamu.scholars.middleware.export.utility.FilenameUtility.normalizeExportFilename; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; +import static org.springframework.http.HttpHeaders.CONTENT_DISPOSITION; +import static org.springframework.http.HttpHeaders.CONTENT_TYPE; + +import javax.persistence.EntityNotFoundException; import java.util.Objects; import java.util.Optional; -import javax.persistence.EntityNotFoundException; - import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.hateoas.server.RepresentationModelProcessor; -import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; @@ -29,14 +32,19 @@ import edu.tamu.scholars.middleware.export.exception.UnknownExporterTypeException; import edu.tamu.scholars.middleware.export.service.Exporter; import edu.tamu.scholars.middleware.export.service.ExporterRegistry; -import edu.tamu.scholars.middleware.export.utility.FilenameUtility; + +/** + * REST controller for exporting + */ @RestController public class IndividualExportController implements RepresentationModelProcessor { + @Lazy @Autowired private IndividualRepo repo; + @Lazy @Autowired private ExporterRegistry exporterRegistry; @@ -59,8 +67,8 @@ public ResponseEntity export( Individual document = individual.get(); Exporter exporter = exporterRegistry.getExporter(type); return ResponseEntity.ok() - .header(HttpHeaders.CONTENT_DISPOSITION, exporter.contentDisposition(FilenameUtility.normalizeExportFilename(document))) - .header(HttpHeaders.CONTENT_TYPE, exporter.contentType()) + .header(CONTENT_DISPOSITION, exporter.contentDisposition(normalizeExportFilename(document))) + .header(CONTENT_TYPE, exporter.contentType()) .body(exporter.streamIndividual(document, name)); } throw new EntityNotFoundException(String.format("Individual with id %s not found", id)); @@ -71,13 +79,37 @@ public IndividualModel process(IndividualModel resource) { Individual individual = resource.getContent(); if (individual != null) { if (individual.getProxy().equals(Person.class.getSimpleName())) { - addResource(resource, new ResourceLink(individual, "docx", "Single Page Bio", "Individual single page bio export")); - addResource(resource, new ResourceLink(individual, "docx", "Profile Summary", "Individual profile summary export")); - addResource(resource, new ResourceLink(individual, "zip", "Last 5 Years", "Individual 5 year publications export")); - addResource(resource, new ResourceLink(individual, "zip", "Last 8 Years", "Individual 8 year publications export")); + addResource(resource, new ResourceLink( + individual, + "docx", + "Single Page Bio", + "Individual single page bio export")); + addResource(resource, new ResourceLink( + individual, + "docx", + "Profile Summary", + "Individual profile summary export")); + addResource(resource, new ResourceLink( + individual, + "zip", + "Last 5 Years", + "Individual 5 year publications export")); + addResource(resource, new ResourceLink( + individual, + "zip", + "Last 8 Years", + "Individual 8 year publications export")); } else if (individual.getProxy().equals(Organization.class.getSimpleName())) { - addResource(resource, new ResourceLink(individual, "zip", "Last 5 Years", "Organization 5 year publications export")); - addResource(resource, new ResourceLink(individual, "zip", "Last 8 Years", "Organization 8 year publications export")); + addResource(resource, new ResourceLink( + individual, + "zip", + "Last 5 Years", + "Organization 5 year publications export")); + addResource(resource, new ResourceLink( + individual, + "zip", + "Last 8 Years", + "Organization 8 year publications export")); } } @@ -86,7 +118,9 @@ public IndividualModel process(IndividualModel resource) { private boolean isAdmin(Authentication authentication) { return authentication.getAuthorities().stream() - .anyMatch(a -> a.getAuthority().equals("ROLE_ADMIN") || a.getAuthority().equals("ROLE_SUPER_ADMIN")); + .anyMatch(a -> + a.getAuthority().equals("ROLE_ADMIN") || a.getAuthority().equals("ROLE_SUPER_ADMIN") + ); } private void addResource(IndividualModel resource, ResourceLink link) { @@ -95,8 +129,13 @@ private void addResource(IndividualModel resource, ResourceLink link) { link.getIndividual().getId(), link.getType(), link.getName() - )).withRel(link.getName().toLowerCase().replace(" ", "_")).withTitle(link.getTitle())); - } catch (NullPointerException | UnknownExporterTypeException | IllegalArgumentException | IllegalAccessException e) { + )).withRel(link.getName().toLowerCase().replace(" ", "_")) + .withTitle(link.getTitle())); + } catch (NullPointerException + | UnknownExporterTypeException + | IllegalArgumentException + | IllegalAccessException e + ) { e.printStackTrace(); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualSearchExportController.java b/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualSearchExportController.java index 6abd474d3..2e618ce01 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualSearchExportController.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/controller/IndividualSearchExportController.java @@ -3,6 +3,8 @@ import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.DEFAULT_QUERY; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.linkTo; import static org.springframework.hateoas.server.mvc.WebMvcLinkBuilder.methodOn; +import static org.springframework.http.HttpHeaders.CONTENT_DISPOSITION; +import static org.springframework.http.HttpHeaders.CONTENT_TYPE; import java.util.ArrayList; import java.util.List; @@ -10,11 +12,11 @@ import java.util.concurrent.ExecutionException; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.domain.Sort; import org.springframework.data.rest.webmvc.RepositorySearchesResource; import org.springframework.data.web.SortDefault; import org.springframework.hateoas.server.RepresentationModelProcessor; -import org.springframework.http.HttpHeaders; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -32,12 +34,17 @@ import edu.tamu.scholars.middleware.export.service.ExporterRegistry; import edu.tamu.scholars.middleware.export.utility.FilenameUtility; +/** + * + */ @RestController public class IndividualSearchExportController implements RepresentationModelProcessor { + @Lazy @Autowired private IndividualRepo repo; + @Lazy @Autowired private ExporterRegistry exporterRegistry; @@ -53,8 +60,8 @@ public ResponseEntity export( ) throws UnknownExporterTypeException, InterruptedException, ExecutionException { Exporter exporter = exporterRegistry.getExporter(type); return ResponseEntity.ok() - .header(HttpHeaders.CONTENT_DISPOSITION, exporter.contentDisposition(FilenameUtility.normalizeExportFilename(view))) - .header(HttpHeaders.CONTENT_TYPE, exporter.contentType()) + .header(CONTENT_DISPOSITION, exporter.contentDisposition(FilenameUtility.normalizeExportFilename(view))) + .header(CONTENT_TYPE, exporter.contentType()) .body(exporter.streamIndividuals(repo.export(query, filters, boosts, sort), export)); } diff --git a/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportException.java b/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportException.java index 6b1dcb771..12b277402 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportException.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.export.exception; +/** + * + */ public class ExportException extends RuntimeException { private static final long serialVersionUID = 3058530112449800844L; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportQueryParameterRequiredException.java b/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportQueryParameterRequiredException.java index bd28cd59c..521f7c589 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportQueryParameterRequiredException.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/exception/ExportQueryParameterRequiredException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.export.exception; +/** + * + */ public class ExportQueryParameterRequiredException extends Exception { private static final long serialVersionUID = 3058530112449800844L; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/exception/UnauthorizedExportException.java b/src/main/java/edu/tamu/scholars/middleware/export/exception/UnauthorizedExportException.java index 1c390d515..fbe253ca0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/exception/UnauthorizedExportException.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/exception/UnauthorizedExportException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.export.exception; +/** + * + */ public class UnauthorizedExportException extends RuntimeException { private static final long serialVersionUID = -928374692174698721L; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/exception/UnknownExporterTypeException.java b/src/main/java/edu/tamu/scholars/middleware/export/exception/UnknownExporterTypeException.java index 9cbfb2d89..b98be08eb 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/exception/UnknownExporterTypeException.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/exception/UnknownExporterTypeException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.export.exception; +/** + * + */ public class UnknownExporterTypeException extends Exception { private static final long serialVersionUID = -7645099779549895590L; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/exception/UnsupportedExporterTypeException.java b/src/main/java/edu/tamu/scholars/middleware/export/exception/UnsupportedExporterTypeException.java index 2c4975101..68e19553c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/exception/UnsupportedExporterTypeException.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/exception/UnsupportedExporterTypeException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.export.exception; +/** + * + */ public class UnsupportedExporterTypeException extends RuntimeException { private static final long serialVersionUID = -1343712418180719211L; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/resolver/ExportArgumentResolver.java b/src/main/java/edu/tamu/scholars/middleware/export/resolver/ExportArgumentResolver.java index 5061338d7..423f306f5 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/resolver/ExportArgumentResolver.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/resolver/ExportArgumentResolver.java @@ -14,6 +14,9 @@ import edu.tamu.scholars.middleware.export.argument.ExportArg; +/** + * + */ public final class ExportArgumentResolver implements HandlerMethodArgumentResolver { @Override @@ -23,7 +26,12 @@ public boolean supportsParameter(MethodParameter parameter) { } @Override - public Object resolveArgument(MethodParameter parameter, @Nullable ModelAndViewContainer mavContainer, NativeWebRequest webRequest, @Nullable WebDataBinderFactory binderFactory) throws Exception { + public Object resolveArgument( + MethodParameter parameter, + @Nullable ModelAndViewContainer mavContainer, + NativeWebRequest webRequest, + @Nullable WebDataBinderFactory binderFactory + ) throws Exception { HttpServletRequest request = (HttpServletRequest) webRequest.getNativeRequest(); return getExportArguments(request); } diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/AbstractDocxExporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/AbstractDocxExporter.java index 3d52f2a59..0d7ba8a3d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/AbstractDocxExporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/AbstractDocxExporter.java @@ -1,7 +1,10 @@ package edu.tamu.scholars.middleware.export.service; -import static org.springframework.web.servlet.support.ServletUriComponentsBuilder.fromCurrentRequest; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ID; +import static org.springframework.web.servlet.support.ServletUriComponentsBuilder.fromCurrentRequest; + +import javax.servlet.ServletContext; +import javax.xml.bind.JAXBException; import java.io.IOException; import java.io.UnsupportedEncodingException; @@ -13,9 +16,10 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; -import javax.servlet.ServletContext; -import javax.xml.bind.JAXBException; - +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.docx4j.jaxb.Context; import org.docx4j.model.structure.SectionWrapper; import org.docx4j.openpackaging.contenttype.ContentType; @@ -43,11 +47,6 @@ import org.springframework.data.domain.Sort.Order; import org.springframework.web.util.UriComponents; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ArrayNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - import edu.tamu.scholars.middleware.discovery.argument.FilterArg; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; import edu.tamu.scholars.middleware.discovery.model.Individual; @@ -57,6 +56,9 @@ import edu.tamu.scholars.middleware.view.model.ExportView; import edu.tamu.scholars.middleware.view.model.repo.DisplayViewRepo; +/** + * + */ public abstract class AbstractDocxExporter implements Exporter { private static final ContentType HTML_CONTENT_TYPE = new ContentType("text/html"); @@ -84,7 +86,10 @@ public abstract class AbstractDocxExporter implements Exporter { @Value("${ui.url:http://localhost:4200}") protected String uiUrl; - protected WordprocessingMLPackage createDocx(ObjectNode node, ExportView exportView) throws IOException, JAXBException, Docx4JException { + protected WordprocessingMLPackage createDocx( + ObjectNode node, + ExportView exportView + ) throws IOException, JAXBException, Docx4JException { final WordprocessingMLPackage pkg = WordprocessingMLPackage.createPackage(); final MainDocumentPart mdp = pkg.getMainDocumentPart(); @@ -150,7 +155,12 @@ protected List extractIds(JsonNode reference) { protected List fetchLazyReference(ExportFieldView lazyReference, List ids) { List filters = lazyReference.getFilters().stream().map(f -> { - return FilterArg.of(f.getField(), Optional.of(f.getValue()), Optional.of(f.getOpKey().getKey()), Optional.empty()); + return FilterArg.of( + f.getField(), + Optional.of(f.getValue()), + Optional.of(f.getOpKey().getKey()), + Optional.empty() + ); }).collect(Collectors.toList()); Sort sort = Sort.by( @@ -179,7 +189,10 @@ protected void addContent(final MainDocumentPart mainDocumentPart, String html) mainDocumentPart.addAltChunk(AltChunkType.Xhtml, html.getBytes(Charset.defaultCharset())); } - protected void createAndAddHeader(final WordprocessingMLPackage pkg, final String html) throws InvalidFormatException { + protected void createAndAddHeader( + final WordprocessingMLPackage pkg, + final String html + ) throws InvalidFormatException { final HeaderPart headerPart = new HeaderPart(new PartName("/word/content-header.xml")); pkg.getParts().put(headerPart); final Relationship headerRel = pkg.getMainDocumentPart().addTargetPart(headerPart); @@ -192,11 +205,17 @@ protected void createAndAddHeader(final WordprocessingMLPackage pkg, final Strin lastSectPr.getEGHdrFtrReferences().add(headerRef); } - protected void createAndAddHtmlHeader(final HeaderPart headerPart, final String html) throws InvalidFormatException { + protected void createAndAddHtmlHeader( + final HeaderPart headerPart, + final String html + ) throws InvalidFormatException { final Hdr hdr = WML_OBJECT_FACTORY.createHdr(); headerPart.setJaxbElement(hdr); try { - final AlternativeFormatInputPart targetpart = createHeaderHtml(new PartName("/word/htmlheader.html"), html); + final AlternativeFormatInputPart targetpart = createHeaderHtml( + new PartName("/word/htmlheader.html"), + html + ); final Relationship rel = headerPart.addTargetPart(targetpart); final CTAltChunk ac = WML_OBJECT_FACTORY.createCTAltChunk(); ac.setId(rel.getId()); @@ -206,7 +225,10 @@ protected void createAndAddHtmlHeader(final HeaderPart headerPart, final String } } - protected AlternativeFormatInputPart createHeaderHtml(final PartName partName, final String html) throws InvalidFormatException, UnsupportedEncodingException { + protected AlternativeFormatInputPart createHeaderHtml( + final PartName partName, + final String html + ) throws InvalidFormatException, UnsupportedEncodingException { final AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(partName); afiPart.setBinaryData(html.getBytes(Charset.defaultCharset())); afiPart.setContentType(HTML_CONTENT_TYPE); diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java index eb53cf9ba..ead350926 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java @@ -15,13 +15,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; +import reactor.core.publisher.Flux; import edu.tamu.scholars.middleware.config.model.ExportConfig; import edu.tamu.scholars.middleware.discovery.exception.InvalidValuePathException; import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.export.argument.ExportArg; -import reactor.core.publisher.Flux; +/** + * + */ @Service public class CsvExporter implements Exporter { @@ -69,7 +72,11 @@ public StreamingResponseBody streamIndividuals(Flux individuals, Lis try { List row = getRow(individual, properties); printer.printRecord(row.toArray(new Object[row.size()])); - } catch (IllegalArgumentException | IllegalAccessException | InvalidValuePathException | IOException e) { + } catch (IllegalArgumentException + | IllegalAccessException + | InvalidValuePathException + | IOException e + ) { e.printStackTrace(); } }, error -> { @@ -99,7 +106,10 @@ private String[] getColumnHeaders(List export) { return columnHeaders.toArray(new String[columnHeaders.size()]); } - private List getRow(Individual individual, List properties) throws InvalidValuePathException, IllegalArgumentException, IllegalAccessException { + private List getRow( + Individual individual, + List properties + ) throws InvalidValuePathException, IllegalArgumentException, IllegalAccessException { Map content = individual.getContent(); List row = new ArrayList(); for (String property : properties) { diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java index 05c7466b9..b0431e647 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java @@ -1,29 +1,32 @@ package edu.tamu.scholars.middleware.export.service; +import javax.xml.bind.JAXBException; + import java.io.IOException; import java.util.List; import java.util.Optional; -import javax.xml.bind.JAXBException; - +import com.fasterxml.jackson.databind.node.ObjectNode; import org.docx4j.openpackaging.exceptions.Docx4JException; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.springframework.stereotype.Service; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; -import com.fasterxml.jackson.databind.node.ObjectNode; - import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.export.exception.ExportException; import edu.tamu.scholars.middleware.view.model.DisplayView; import edu.tamu.scholars.middleware.view.model.ExportView; +/** + * + */ @Service public class DocxExporter extends AbstractDocxExporter { private static final String TYPE = "docx"; - private static final String CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; + private static final String CONTENT_TYPE = + "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; private static final String CONTENT_DISPOSITION_TEMPLATE = "attachment; filename=%s.docx"; @@ -49,7 +52,8 @@ public StreamingResponseBody streamIndividual(Individual individual, String name Optional displayView = displayViewRepo.findByTypesIn(type); if (!displayView.isPresent()) { - throw new ExportException(String.format("Could not find a display view for types: %s", String.join(", ", type))); + throw new ExportException(String.format( + "Could not find a display view for types: %s", String.join(", ", type))); } Optional exportView = displayView.get() @@ -59,7 +63,11 @@ public StreamingResponseBody streamIndividual(Individual individual, String name .findAny(); if (!exportView.isPresent()) { - throw new ExportException(String.format("%s display view does not have an export view named %s", displayView.get().getName(), name)); + throw new ExportException(String.format( + "%s display view does not have an export view named %s", + displayView.get().getName(), + name + )); } return outputStream -> { diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/Exporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/Exporter.java index 94de6ae02..928260cd6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/Exporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/Exporter.java @@ -3,12 +3,15 @@ import java.util.List; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; +import reactor.core.publisher.Flux; import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.export.argument.ExportArg; import edu.tamu.scholars.middleware.export.exception.UnsupportedExporterTypeException; -import reactor.core.publisher.Flux; +/** + * + */ public interface Exporter { public String type(); @@ -17,12 +20,18 @@ public interface Exporter { public String contentType(); - default public StreamingResponseBody streamIndividuals(Flux cursor, List export) { - throw new UnsupportedExporterTypeException(String.format("%s exporter does not support export field exports", type())); + public default StreamingResponseBody streamIndividuals(Flux cursor, List export) { + throw new UnsupportedExporterTypeException(String.format( + "%s exporter does not support export field exports", + type() + )); } - default public StreamingResponseBody streamIndividual(Individual individual, String name) { - throw new UnsupportedExporterTypeException(String.format("%s exporter does not support individual templated exports", type())); + public default StreamingResponseBody streamIndividual(Individual individual, String name) { + throw new UnsupportedExporterTypeException(String.format( + "%s exporter does not support individual templated exports", + type() + )); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/ExporterRegistry.java b/src/main/java/edu/tamu/scholars/middleware/export/service/ExporterRegistry.java index 2fcbf805f..0c491211d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/ExporterRegistry.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/ExporterRegistry.java @@ -8,6 +8,9 @@ import edu.tamu.scholars.middleware.export.exception.UnknownExporterTypeException; +/** + * + */ @Service public class ExporterRegistry { diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/ZipDocxExporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/ZipDocxExporter.java index a789033db..5787738ee 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/ZipDocxExporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/ZipDocxExporter.java @@ -1,5 +1,7 @@ package edu.tamu.scholars.middleware.export.service; +import javax.xml.bind.JAXBException; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -8,17 +10,14 @@ import java.util.Optional; import java.util.zip.ZipOutputStream; -import javax.xml.bind.JAXBException; - +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.docx4j.Docx4J; import org.docx4j.openpackaging.exceptions.Docx4JException; import org.docx4j.openpackaging.packages.WordprocessingMLPackage; import org.springframework.stereotype.Service; import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; - import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.export.exception.ExportException; @@ -28,6 +27,9 @@ import edu.tamu.scholars.middleware.view.model.ExportFieldView; import edu.tamu.scholars.middleware.view.model.ExportView; +/** + * + */ @Service public class ZipDocxExporter extends AbstractDocxExporter { @@ -59,7 +61,9 @@ public StreamingResponseBody streamIndividual(Individual individual, String name Optional displayView = displayViewRepo.findByTypesIn(type); if (!displayView.isPresent()) { - throw new ExportException(String.format("Could not find a display view for types: %s", String.join(", ", type))); + throw new ExportException(String.format( + "Could not find a display view for types: %s", String.join(", ", type)) + ); } Optional exportView = displayView.get() @@ -69,7 +73,9 @@ public StreamingResponseBody streamIndividual(Individual individual, String name .findAny(); if (!exportView.isPresent()) { - throw new ExportException(String.format("%s display view does not have an export view named %s", displayView.get().getName(), name)); + throw new ExportException(String.format( + "%s display view does not have an export view named %s", displayView.get().getName(), name) + ); } return outputStream -> { diff --git a/src/main/java/edu/tamu/scholars/middleware/export/utility/ArgumentUtility.java b/src/main/java/edu/tamu/scholars/middleware/export/utility/ArgumentUtility.java index 03c6f4d2a..a65ab3397 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/utility/ArgumentUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/utility/ArgumentUtility.java @@ -1,17 +1,20 @@ package edu.tamu.scholars.middleware.export.utility; +import javax.servlet.http.HttpServletRequest; + import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; - import edu.tamu.scholars.middleware.export.argument.ExportArg; +/** + * + */ public class ArgumentUtility { - private final static String EXPORT_QUERY_PARAM_KEY = "export"; + private static final String EXPORT_QUERY_PARAM_KEY = "export"; public static List getExportArguments(HttpServletRequest request) { return Collections.list(request.getParameterNames()).stream() diff --git a/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java b/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java index 72933818f..f8c1d6f04 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java @@ -12,12 +12,15 @@ import edu.tamu.scholars.middleware.discovery.model.Organization; import edu.tamu.scholars.middleware.discovery.model.Person; +/** + * + */ public class FilenameUtility { - private final static String UNDERSCORE = "_"; - private final static String NAME = "name"; - private final static String LAST_NAME = "lastName"; - private final static String FIRST_NAME = "firstName"; + private static final String UNDERSCORE = "_"; + private static final String NAME = "name"; + private static final String LAST_NAME = "lastName"; + private static final String FIRST_NAME = "firstName"; private FilenameUtility() { @@ -41,7 +44,7 @@ public static String normalizeExportFilename(Individual individual) { label.append((String) content.get(NAME)) .append(UNDERSCORE); } else if (proxy.equals(Person.class.getSimpleName()) && content.containsKey(LAST_NAME)) { - label.append((String) content.get(LAST_NAME)) + label.append((String) content.get(LAST_NAME)) .append(UNDERSCORE); if (content.containsKey(FIRST_NAME)) { diff --git a/src/main/java/edu/tamu/scholars/middleware/export/utility/ZipUtility.java b/src/main/java/edu/tamu/scholars/middleware/export/utility/ZipUtility.java index 1ce891cf4..66e3d8220 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/utility/ZipUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/utility/ZipUtility.java @@ -8,6 +8,9 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; +/** + * + */ public class ZipUtility { private ZipUtility() { diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/CreateEntityMessage.java b/src/main/java/edu/tamu/scholars/middleware/messaging/CreateEntityMessage.java index 20174d83b..8ad54fd77 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/CreateEntityMessage.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/CreateEntityMessage.java @@ -2,6 +2,9 @@ import static edu.tamu.scholars.middleware.messaging.EntityAction.CREATE; +/** + * + */ public class CreateEntityMessage extends SaveEntityMessage { public CreateEntityMessage(E entity) { diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/DeleteEntityMessage.java b/src/main/java/edu/tamu/scholars/middleware/messaging/DeleteEntityMessage.java index 9eca659f0..40120d14a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/DeleteEntityMessage.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/DeleteEntityMessage.java @@ -2,6 +2,9 @@ import static edu.tamu.scholars.middleware.messaging.EntityAction.DELETE; +/** + * + */ public class DeleteEntityMessage { private final I id; diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/EntityAction.java b/src/main/java/edu/tamu/scholars/middleware/messaging/EntityAction.java index 728718cbb..f7b7f6d20 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/EntityAction.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/EntityAction.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.messaging; +/** + * + */ public enum EntityAction { CREATE, UPDATE, DELETE } diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/EntityMessage.java b/src/main/java/edu/tamu/scholars/middleware/messaging/EntityMessage.java index 32b553398..b6d594452 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/EntityMessage.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/EntityMessage.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.messaging; +/** + * + */ public interface EntityMessage { public EntityAction getAction(); diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/SaveEntityMessage.java b/src/main/java/edu/tamu/scholars/middleware/messaging/SaveEntityMessage.java index 8372797c1..c098e488d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/SaveEntityMessage.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/SaveEntityMessage.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.messaging; +/** + * + */ public abstract class SaveEntityMessage implements EntityMessage { private final E entity; diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/UpdateEntityMessage.java b/src/main/java/edu/tamu/scholars/middleware/messaging/UpdateEntityMessage.java index b7eaa7b3e..10d62b5e4 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/UpdateEntityMessage.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/UpdateEntityMessage.java @@ -2,6 +2,9 @@ import static edu.tamu.scholars.middleware.messaging.EntityAction.UPDATE; +/** + * + */ public class UpdateEntityMessage extends SaveEntityMessage { public UpdateEntityMessage(E entity) { diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/handler/CustomStompSubProtocolErrorHandler.java b/src/main/java/edu/tamu/scholars/middleware/messaging/handler/CustomStompSubProtocolErrorHandler.java index 302ef250d..70fa046f8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/handler/CustomStompSubProtocolErrorHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/handler/CustomStompSubProtocolErrorHandler.java @@ -8,10 +8,18 @@ import org.springframework.messaging.support.MessageBuilder; import org.springframework.web.socket.messaging.StompSubProtocolErrorHandler; +/** + * + */ public class CustomStompSubProtocolErrorHandler extends StompSubProtocolErrorHandler { @Override - protected Message handleInternal(StompHeaderAccessor errorHeaderAccessor, byte[] errorPayload, @Nullable Throwable cause, @Nullable StompHeaderAccessor clientHeaderAccessor) { + protected Message handleInternal( + StompHeaderAccessor errorHeaderAccessor, + byte[] errorPayload, + @Nullable Throwable cause, + @Nullable StompHeaderAccessor clientHeaderAccessor + ) { if (Objects.nonNull(clientHeaderAccessor)) { errorHeaderAccessor.setDestination(clientHeaderAccessor.getDestination()); } diff --git a/src/main/java/edu/tamu/scholars/middleware/messaging/listener/SubscriptionListener.java b/src/main/java/edu/tamu/scholars/middleware/messaging/listener/SubscriptionListener.java index 73e3dac98..b6265a6ad 100644 --- a/src/main/java/edu/tamu/scholars/middleware/messaging/listener/SubscriptionListener.java +++ b/src/main/java/edu/tamu/scholars/middleware/messaging/listener/SubscriptionListener.java @@ -11,10 +11,13 @@ import org.springframework.stereotype.Component; import org.springframework.web.socket.messaging.SessionSubscribeEvent; +/** + * + */ @Component public class SubscriptionListener implements ApplicationListener { - private final static byte[] EMPTY_PAYLOAD = new byte[0]; + private static final byte[] EMPTY_PAYLOAD = new byte[0]; @Autowired private AbstractSubscribableChannel clientOutboundChannel; diff --git a/src/main/java/edu/tamu/scholars/middleware/model/Named.java b/src/main/java/edu/tamu/scholars/middleware/model/Named.java index 5c38e77d8..95a7b68c9 100644 --- a/src/main/java/edu/tamu/scholars/middleware/model/Named.java +++ b/src/main/java/edu/tamu/scholars/middleware/model/Named.java @@ -2,8 +2,6 @@ import static javax.persistence.GenerationType.IDENTITY; -import java.io.Serializable; - import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Id; @@ -11,9 +9,14 @@ import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import java.io.Serializable; + import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +/** + * + */ @MappedSuperclass public abstract class Named implements Serializable { diff --git a/src/main/java/edu/tamu/scholars/middleware/model/OpKey.java b/src/main/java/edu/tamu/scholars/middleware/model/OpKey.java index 0f8cb7620..56cd3a581 100644 --- a/src/main/java/edu/tamu/scholars/middleware/model/OpKey.java +++ b/src/main/java/edu/tamu/scholars/middleware/model/OpKey.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.model; +/** + * + */ public enum OpKey { BETWEEN("BETWEEN"), diff --git a/src/main/java/edu/tamu/scholars/middleware/model/repo/NamedRepo.java b/src/main/java/edu/tamu/scholars/middleware/model/repo/NamedRepo.java index 0630389d4..58c116e83 100644 --- a/src/main/java/edu/tamu/scholars/middleware/model/repo/NamedRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/model/repo/NamedRepo.java @@ -6,6 +6,11 @@ import org.springframework.data.repository.NoRepositoryBean; import org.springframework.data.rest.core.annotation.RestResource; +/** + * {@link Named} {@link JpaRepository} interface. + * + * @param entity + */ @NoRepositoryBean public interface NamedRepo extends JpaRepository { diff --git a/src/main/java/edu/tamu/scholars/middleware/service/EmailService.java b/src/main/java/edu/tamu/scholars/middleware/service/EmailService.java index 1d60d999d..865952953 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/EmailService.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/EmailService.java @@ -8,6 +8,9 @@ import edu.tamu.scholars.middleware.config.model.MailConfig; +/** + * + */ @Service public class EmailService { @@ -25,7 +28,13 @@ private void send(String to, String subject, String message, String from, String emailSender.send(createMimeMessagePreparator(to, subject, message, from, replyTo)); } - MimeMessagePreparator createMimeMessagePreparator(String to, String subject, String message, String from, String replyTo) { + MimeMessagePreparator createMimeMessagePreparator( + String to, + String subject, + String message, + String from, + String replyTo + ) { return mimeMessage -> { MimeMessageHelper messageHelper = new MimeMessageHelper(mimeMessage); messageHelper.setFrom(from); diff --git a/src/main/java/edu/tamu/scholars/middleware/service/HttpService.java b/src/main/java/edu/tamu/scholars/middleware/service/HttpService.java index ced3e2b06..7a59f0182 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/HttpService.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/HttpService.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.service; +import javax.annotation.PostConstruct; +import javax.annotation.PreDestroy; + import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -8,9 +11,6 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; - import org.apache.http.Header; import org.apache.http.HttpStatus; import org.apache.http.StatusLine; @@ -31,10 +31,13 @@ import edu.tamu.scholars.middleware.config.model.HttpConfig; import edu.tamu.scholars.middleware.service.request.HttpRequest; +/** + * + */ @Service public class HttpService { - private final static Logger logger = LoggerFactory.getLogger(HttpService.class); + private static final Logger logger = LoggerFactory.getLogger(HttpService.class); @Autowired private HttpConfig httpConfig; diff --git a/src/main/java/edu/tamu/scholars/middleware/service/HttpTriplestore.java b/src/main/java/edu/tamu/scholars/middleware/service/HttpTriplestore.java index fd6dfd8c7..2fa74bbe8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/HttpTriplestore.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/HttpTriplestore.java @@ -9,9 +9,12 @@ import edu.tamu.scholars.middleware.config.model.TriplestoreConfig; +/** + * + */ public class HttpTriplestore implements Triplestore { - private final static Logger logger = LoggerFactory.getLogger(HttpTriplestore.class); + private static final Logger logger = LoggerFactory.getLogger(HttpTriplestore.class); private final TriplestoreConfig config; @@ -28,7 +31,11 @@ public QueryExecution createQueryExecution(String query) { public void init() { Instant start = Instant.now(); logger.info("Initializing {}", config.getType().getSimpleName()); - logger.info("{} ready. {} seconds", config.getType().getSimpleName(), Duration.between(start, Instant.now()).toMillis() / 1000.0); + logger.info( + "{} ready. {} seconds", + config.getType().getSimpleName(), + Duration.between(start, Instant.now()).toMillis() / 1000.0 + ); } @Override diff --git a/src/main/java/edu/tamu/scholars/middleware/service/ResourceService.java b/src/main/java/edu/tamu/scholars/middleware/service/ResourceService.java index 22b0f280d..70f893b5d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/ResourceService.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/ResourceService.java @@ -10,6 +10,9 @@ import org.springframework.core.io.Resource; import org.springframework.stereotype.Service; +/** + * + */ @Service public class ResourceService { diff --git a/src/main/java/edu/tamu/scholars/middleware/service/TDBTriplestore.java b/src/main/java/edu/tamu/scholars/middleware/service/TDBTriplestore.java index ea2742f79..2816decfb 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/TDBTriplestore.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/TDBTriplestore.java @@ -13,9 +13,14 @@ import edu.tamu.scholars.middleware.config.model.TriplestoreConfig; +/** + * + */ +//CHECKSTYLE.OFF: AbbreviationAsWordInName - TDBFactory public class TDBTriplestore implements Triplestore { + //CHECKSTYLE.ON: AbbreviationAsWordInName - private final static Logger logger = LoggerFactory.getLogger(TDBTriplestore.class); + private static final Logger logger = LoggerFactory.getLogger(TDBTriplestore.class); private final TriplestoreConfig config; @@ -32,12 +37,16 @@ public QueryExecution createQueryExecution(String query) { @Override public void init() { - Instant start = Instant.now(); - logger.info(String.format("Intializing %s", config.getType().getSimpleName())); + final Instant start = Instant.now(); + logger.info("Intializing {}", config.getType().getSimpleName()); // TODO: handle missing configurations TDB.getContext().setTrue(TDB.symUnionDefaultGraph); dataset = TDBFactory.createDataset(config.getDirectory()); - logger.info(String.format("%s ready. %s seconds", config.getType().getSimpleName(), Duration.between(start, Instant.now()).toMillis() / 1000.0)); + logger.info( + "{} ready. {} seconds", + config.getType().getSimpleName(), + Duration.between(start, Instant.now()).toMillis() / 1000.0 + ); } @Override diff --git a/src/main/java/edu/tamu/scholars/middleware/service/TemplateService.java b/src/main/java/edu/tamu/scholars/middleware/service/TemplateService.java index 340aac391..32fa498bd 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/TemplateService.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/TemplateService.java @@ -1,12 +1,12 @@ package edu.tamu.scholars.middleware.service; +import javax.annotation.PostConstruct; + import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; -import javax.annotation.PostConstruct; - import com.github.jknack.handlebars.Context; import com.github.jknack.handlebars.Handlebars; import com.github.jknack.handlebars.Jackson2Helper; @@ -16,13 +16,15 @@ import com.github.jknack.handlebars.context.JavaBeanValueResolver; import com.github.jknack.handlebars.context.MapValueResolver; import com.github.jknack.handlebars.context.MethodValueResolver; - import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.auth.controller.request.Registration; +/** + * + */ @Service public class TemplateService { diff --git a/src/main/java/edu/tamu/scholars/middleware/service/Triplestore.java b/src/main/java/edu/tamu/scholars/middleware/service/Triplestore.java index a51703ac0..9e5335840 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/Triplestore.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/Triplestore.java @@ -2,6 +2,9 @@ import org.apache.jena.query.QueryExecution; +/** + * + */ public interface Triplestore { public QueryExecution createQueryExecution(String query); diff --git a/src/main/java/edu/tamu/scholars/middleware/service/VivoService.java b/src/main/java/edu/tamu/scholars/middleware/service/VivoService.java index 2587b6f45..16b5b6098 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/VivoService.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/VivoService.java @@ -21,10 +21,13 @@ import edu.tamu.scholars.middleware.config.model.VivoConfig; import edu.tamu.scholars.middleware.service.request.HttpRequest; +/** + * + */ @Service public class VivoService { - private final static Logger logger = LoggerFactory.getLogger(VivoService.class); + private static final Logger logger = LoggerFactory.getLogger(VivoService.class); @Autowired private VivoConfig vivoConfig; @@ -63,11 +66,11 @@ public String individual(String id, String accept) { logger.debug("id: " + id); logger.debug("accept: " + accept); } - HttpRequest request = new HttpRequest(); List
headers = new ArrayList
(); headers.add(new BasicHeader("Accept", accept)); + HttpRequest request = new HttpRequest(); request.setUrl(vivoConfig.getLinkedOpenDataEndpointUrl() + "/" + id); request.setHeaders(headers); @@ -75,6 +78,7 @@ public String individual(String id, String accept) { if (logger.isDebugEnabled()) { logger.debug("response:\n" + response); } + return response; } @@ -84,7 +88,6 @@ public String sparql(String query, String accept) { logger.debug("query: " + query); logger.debug("accept: " + accept); } - HttpRequest request = new HttpRequest(); List
headers = new ArrayList
(); headers.add(new BasicHeader("Accept", accept)); @@ -94,6 +97,7 @@ public String sparql(String query, String accept) { parameters.add(new BasicNameValuePair("password", vivoConfig.getPassword())); parameters.add(new BasicNameValuePair("query", query)); + HttpRequest request = new HttpRequest(); request.setUrl(vivoConfig.getSparqlQueryEndpointUrl()); request.setHeaders(headers); request.setParameters(parameters); @@ -102,6 +106,7 @@ public String sparql(String query, String accept) { if (logger.isDebugEnabled()) { logger.debug("response:\n" + response); } + return response; } diff --git a/src/main/java/edu/tamu/scholars/middleware/service/request/HttpRequest.java b/src/main/java/edu/tamu/scholars/middleware/service/request/HttpRequest.java index 3d11c0287..221c3c5f6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/service/request/HttpRequest.java +++ b/src/main/java/edu/tamu/scholars/middleware/service/request/HttpRequest.java @@ -6,6 +6,9 @@ import org.apache.http.Header; import org.apache.http.NameValuePair; +/** + * + */ public class HttpRequest { private String url; diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/advice/ThemeAdvice.java b/src/main/java/edu/tamu/scholars/middleware/theme/advice/ThemeAdvice.java index 767371082..d9dae7453 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/advice/ThemeAdvice.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/advice/ThemeAdvice.java @@ -11,20 +11,23 @@ import edu.tamu.scholars.middleware.theme.exception.CreateActiveThemeException; import edu.tamu.scholars.middleware.theme.exception.DeleteActiveThemeException; +/** + * + */ @RestController @ControllerAdvice public class ThemeAdvice { - @ResponseStatus(BAD_REQUEST) - @ExceptionHandler(CreateActiveThemeException.class) - public @ResponseBody String handleCreateActiveThemeException(CreateActiveThemeException exception) { - return exception.getMessage(); - } + @ResponseStatus(BAD_REQUEST) + @ExceptionHandler(CreateActiveThemeException.class) + public @ResponseBody String handleCreateActiveThemeException(CreateActiveThemeException exception) { + return exception.getMessage(); + } - @ResponseStatus(BAD_REQUEST) - @ExceptionHandler(DeleteActiveThemeException.class) - public @ResponseBody String handleDeleteActiveThemeException(DeleteActiveThemeException exception) { - return exception.getMessage(); - } + @ResponseStatus(BAD_REQUEST) + @ExceptionHandler(DeleteActiveThemeException.class) + public @ResponseBody String handleDeleteActiveThemeException(DeleteActiveThemeException exception) { + return exception.getMessage(); + } } diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/exception/CreateActiveThemeException.java b/src/main/java/edu/tamu/scholars/middleware/theme/exception/CreateActiveThemeException.java index eeae4f312..4b4ebad93 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/exception/CreateActiveThemeException.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/exception/CreateActiveThemeException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.theme.exception; +/** + * + */ public class CreateActiveThemeException extends Exception { private static final long serialVersionUID = -2259663188976444000L; diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/exception/DeleteActiveThemeException.java b/src/main/java/edu/tamu/scholars/middleware/theme/exception/DeleteActiveThemeException.java index 71c7a8d7d..5af455a82 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/exception/DeleteActiveThemeException.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/exception/DeleteActiveThemeException.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.theme.exception; +/** + * + */ public class DeleteActiveThemeException extends Exception { private static final long serialVersionUID = -1346268539838679573L; diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Banner.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Banner.java index 58c113559..f1d44c338 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Banner.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Banner.java @@ -1,13 +1,16 @@ package edu.tamu.scholars.middleware.theme.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ @Embeddable public class Banner { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Footer.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Footer.java index de9e94951..7bbc2ae5a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Footer.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Footer.java @@ -1,13 +1,16 @@ package edu.tamu.scholars.middleware.theme.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ @Embeddable public class Footer { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Header.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Header.java index b26d9790d..781d01cc9 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Header.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Header.java @@ -1,13 +1,16 @@ package edu.tamu.scholars.middleware.theme.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.CollectionTable; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; import javax.persistence.Embedded; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ @Embeddable public class Header { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Hero.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Hero.java index 7d403edac..da249a504 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Hero.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Hero.java @@ -3,6 +3,9 @@ import javax.persistence.Column; import javax.persistence.Embeddable; +/** + * + */ @Embeddable public class Hero { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Home.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Home.java index ca2675d94..5243c0040 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Home.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Home.java @@ -1,13 +1,16 @@ package edu.tamu.scholars.middleware.theme.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ @Embeddable public class Home { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Link.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Link.java index 5e5153431..ce78f4a59 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Link.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Link.java @@ -3,6 +3,9 @@ import javax.persistence.Column; import javax.persistence.Embeddable; +/** + * + */ @Embeddable public class Link { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Navbar.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Navbar.java index eedbfd0cd..b2b02c75c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Navbar.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Navbar.java @@ -1,13 +1,16 @@ package edu.tamu.scholars.middleware.theme.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.CollectionTable; import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; +import java.util.ArrayList; +import java.util.List; + +/** + * + */ @Embeddable public class Navbar { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Style.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Style.java index ae84de20c..55df4b0a9 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Style.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Style.java @@ -3,6 +3,9 @@ import javax.persistence.Column; import javax.persistence.Embeddable; +/** + * + */ @Embeddable public class Style { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/Theme.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/Theme.java index 0dedad470..c0be1679f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/Theme.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/Theme.java @@ -1,16 +1,19 @@ package edu.tamu.scholars.middleware.theme.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.Table; +import java.util.ArrayList; +import java.util.List; + import edu.tamu.scholars.middleware.model.Named; +/** + * + */ @Entity @Table(name = "themes") public class Theme extends Named { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/ThemeRepo.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/ThemeRepo.java index 272459fdb..de030cea9 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/ThemeRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/ThemeRepo.java @@ -8,6 +8,9 @@ import edu.tamu.scholars.middleware.model.repo.NamedRepo; import edu.tamu.scholars.middleware.theme.model.Theme; +/** + * + */ @RepositoryRestResource public interface ThemeRepo extends NamedRepo { diff --git a/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/handler/ThemeEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/handler/ThemeEventHandler.java index 35b7a9f73..ddc63be2c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/handler/ThemeEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/theme/model/repo/handler/ThemeEventHandler.java @@ -19,6 +19,9 @@ import edu.tamu.scholars.middleware.theme.model.Theme; import edu.tamu.scholars.middleware.theme.model.repo.ThemeRepo; +/** + * + */ @RepositoryEventHandler(Theme.class) public class ThemeEventHandler { diff --git a/src/main/java/edu/tamu/scholars/middleware/utility/DateFormatUtility.java b/src/main/java/edu/tamu/scholars/middleware/utility/DateFormatUtility.java index c76ef1739..961e53599 100644 --- a/src/main/java/edu/tamu/scholars/middleware/utility/DateFormatUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/utility/DateFormatUtility.java @@ -10,6 +10,9 @@ import org.apache.commons.lang3.time.DateUtils; import org.springframework.context.i18n.LocaleContextHolder; +/** + * + */ public class DateFormatUtility { private static final String[] datePatterns = { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Boost.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Boost.java index 66909cdf6..0e2ddd9fc 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Boost.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Boost.java @@ -3,6 +3,9 @@ import javax.persistence.Column; import javax.persistence.Embeddable; +/** + * Embeddable domain model for {@link CollectionView} result set term relevancy boosting. + */ @Embeddable public class Boost { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/CollectionView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/CollectionView.java index 257abf39b..aee7491b5 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/CollectionView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/CollectionView.java @@ -1,10 +1,5 @@ package edu.tamu.scholars.middleware.view.model; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.EnumType; @@ -12,6 +7,14 @@ import javax.persistence.MapKeyColumn; import javax.persistence.MappedSuperclass; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * A persistent representation of how a UI should render a collection view and its result set. + */ @MappedSuperclass // @ValidCollectionFacets(message = "{CollectionView.validCollectionFacets}") // @ValidCollectionFilters(message = "{CollectionView.validCollectionFilters}") diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/ContainerType.java b/src/main/java/edu/tamu/scholars/middleware/view/model/ContainerType.java index 06b1be7c6..6eb49cc1f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/ContainerType.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/ContainerType.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.view.model; +/** + * An initial enumeration for describing to the client which type of container a view is to be within. + */ public enum ContainerType { ACADEMIC_AGE_GROUP, QUANTITY_DISTRIBUTION, PROFILE_SUMMARIES_EXPORT } diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DataAndAnalyticsView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DataAndAnalyticsView.java index 3b492cb52..724b79dc2 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DataAndAnalyticsView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DataAndAnalyticsView.java @@ -6,6 +6,11 @@ import javax.persistence.Enumerated; import javax.persistence.Table; +/** + * A persistent representation of how a UI should render a data and analytics view. + * + *

See `src/main/resources/defaults/dataAndAnalyticViews.yml`

+ */ @Entity @Table(name = "data_and_analytics_views") public class DataAndAnalyticsView extends CollectionView { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DirectoryView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DirectoryView.java index 73d478799..8f6504da2 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DirectoryView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DirectoryView.java @@ -4,6 +4,11 @@ import javax.persistence.Entity; import javax.persistence.Table; +/** + * A persistent representation of how a UI should render a directory view and its result set. + * + *

See `src/main/resources/defaults/directoryView.yml`

+ */ @Entity @Table(name = "directory_views") //@ValidIndexField(message = "{DirectoryView.validIndexField}") diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DiscoveryView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DiscoveryView.java index 26e93e1e6..c9e1fa66e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DiscoveryView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DiscoveryView.java @@ -2,16 +2,21 @@ import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.Table; +import java.util.ArrayList; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonInclude; +/** + * A persistent representation of how a UI should render a discovery view and its result set. + * + *

See `src/main/resources/defaults/discoveryViews.yml`

+ */ @Entity @JsonInclude(NON_EMPTY) @Table(name = "discovery_views") diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySectionView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySectionView.java index 236d9dcd9..40fe3f03a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySectionView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySectionView.java @@ -1,8 +1,5 @@ package edu.tamu.scholars.middleware.view.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.AttributeOverride; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -13,9 +10,15 @@ import javax.persistence.OrderBy; import javax.persistence.Table; +import java.util.ArrayList; +import java.util.List; + import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; +/** + * + */ @Entity @Table(name = "display_sections") @AttributeOverride(name = "name", column = @Column(nullable = false)) diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySubsectionView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySubsectionView.java index 5560df231..522639776 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySubsectionView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplaySubsectionView.java @@ -5,6 +5,10 @@ import javax.persistence.Entity; import javax.persistence.Table; +/** + * Represents a view for display subsections. + * Extends the {@link FieldView} class. + */ @Entity @Table(name = "display_subsections") @AttributeOverride(name = "name", column = @Column(nullable = false)) @@ -18,25 +22,49 @@ public class DisplaySubsectionView extends FieldView { @Column(nullable = false, columnDefinition = "TEXT") private String template; + /** + * Default constructor. + * Initializes the page size to 5. + */ public DisplaySubsectionView() { super(); pageSize = 5; } + /** + * Gets the page size. + * + * @return The page size. + */ public int getPageSize() { return pageSize; } + /** + * Sets the page size. + * + * @param pageSize The new page size. + */ public void setPageSize(int pageSize) { this.pageSize = pageSize; } + /** + * Gets the template. + * + * @return The template. + */ public String getTemplate() { return template; } + /** + * Sets the template. + * + * @param template The new template. + */ public void setTemplate(String template) { this.template = template; } - } + diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayTabView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayTabView.java index 404f932a6..73ca0873a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayTabView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayTabView.java @@ -1,8 +1,5 @@ package edu.tamu.scholars.middleware.view.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.AttributeOverride; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -12,14 +9,19 @@ import javax.persistence.OrderBy; import javax.persistence.Table; +import java.util.ArrayList; +import java.util.List; + import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; +/** + * Represents a display tab view in the application. + */ @Entity @Table(name = "display_tabs") @AttributeOverride(name = "name", column = @Column(nullable = false)) public class DisplayTabView extends View { - private static final long serialVersionUID = -6232439954200363571L; @Column(nullable = false) @@ -31,30 +33,57 @@ public class DisplayTabView extends View { @LazyCollection(LazyCollectionOption.FALSE) public List sections; + /** + * Default constructor for DisplayTabView. + */ public DisplayTabView() { super(); hidden = false; - sections = new ArrayList(); + sections = new ArrayList<>(); } + /** + * Get the name of the display tab. + * + * @return The name of the display tab. + */ public String getName() { return name; } + /** + * Check if the display tab is hidden. + * + * @return True if hidden, false otherwise. + */ public boolean isHidden() { return hidden; } + /** + * Set the display tab's hidden status. + * + * @param hidden True to hide the display tab, false otherwise. + */ public void setHidden(boolean hidden) { this.hidden = hidden; } + /** + * Get the list of display sections associated with this tab. + * + * @return List of display sections. + */ public List getSections() { return sections; } + /** + * Set the list of display sections for this tab. + * + * @param sections List of display sections. + */ public void setSections(List sections) { this.sections = sections; } - } diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayView.java index fd9c236fe..740b5cf5c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/DisplayView.java @@ -2,11 +2,6 @@ import static javax.persistence.EnumType.STRING; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.ElementCollection; @@ -17,9 +12,19 @@ import javax.persistence.OneToMany; import javax.persistence.Table; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; +/** + * A persistent representation of how a UI should render a display view. + * + *

See `src/main/resources/defaults/displayViews.yml`

+ */ @Entity @Table(name = "display_views") public class DisplayView extends View { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/ExportField.java b/src/main/java/edu/tamu/scholars/middleware/view/model/ExportField.java index 7aa936953..69355e897 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/ExportField.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/ExportField.java @@ -3,6 +3,9 @@ import javax.persistence.Column; import javax.persistence.Embeddable; +/** + * + */ @Embeddable public class ExportField { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/ExportFieldView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/ExportFieldView.java index 4474d3852..6b83af205 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/ExportFieldView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/ExportFieldView.java @@ -5,6 +5,9 @@ import javax.persistence.Entity; import javax.persistence.Table; +/** + * + */ @Entity @Table(name = "export_fields") @AttributeOverride(name = "name", column = @Column(nullable = false)) diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/ExportView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/ExportView.java index 22deb80a8..ddd1a3c42 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/ExportView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/ExportView.java @@ -1,8 +1,5 @@ package edu.tamu.scholars.middleware.view.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.AttributeOverride; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -13,9 +10,15 @@ import javax.persistence.OrderBy; import javax.persistence.Table; +import java.util.ArrayList; +import java.util.List; + import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; +/** + * + */ @Entity @Table(name = "display_export_views") @AttributeOverride(name = "name", column = @Column(nullable = false)) diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Facet.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Facet.java index c5fbf32e3..4ca8e9437 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Facet.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Facet.java @@ -1,20 +1,19 @@ package edu.tamu.scholars.middleware.view.model; -import static edu.tamu.scholars.middleware.view.model.FacetType.STRING; -import static org.springframework.data.domain.Sort.Direction.DESC; - import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import org.springframework.data.domain.Sort.Direction; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import org.springframework.data.domain.Sort.Direction; import edu.tamu.scholars.middleware.model.OpKey; +/** + * Embeddable domain model for {@link CollectionView} result set faceting. + */ @Embeddable @JsonInclude(Include.NON_NULL) public class Facet { @@ -71,11 +70,28 @@ public class Facet { @Column(nullable = true) private String rangeGap; + /** + * Default `Facet` constructor. + * + * + * + * + * + * + * + * + * + * + * + * + * + *
opKey{@link OpKey}.EQUALS
type{@link FacetType}.STRING
sort{@link FacetSort}.COUNT
direction{@link Direction}.DESC
pageSize10
pageNumber1
expandabletrue
collapsibletrue
collapsedtrue
useDialogfalse
hiddenfalse
+ */ public Facet() { opKey = OpKey.EQUALS; - type = STRING; + type = FacetType.STRING; sort = FacetSort.COUNT; - direction = DESC; + direction = Direction.DESC; pageSize = 10; pageNumber = 1; expandable = true; diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/FacetSort.java b/src/main/java/edu/tamu/scholars/middleware/view/model/FacetSort.java index 0309e2b11..c30e68b09 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/FacetSort.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/FacetSort.java @@ -1,5 +1,10 @@ package edu.tamu.scholars.middleware.view.model; +import edu.tamu.scholars.middleware.discovery.argument.FacetSortArg; + +/** + * Sort enumeration for {@link CollectionView} {@link Facet} and {@link FacetSortArg}. + */ public enum FacetSort { COUNT, INDEX } diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/FacetType.java b/src/main/java/edu/tamu/scholars/middleware/view/model/FacetType.java index da60a8c4f..2936f1aa4 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/FacetType.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/FacetType.java @@ -1,5 +1,10 @@ package edu.tamu.scholars.middleware.view.model; +import edu.tamu.scholars.middleware.discovery.argument.FacetArg; + +/** + * Type enumeration for {@link CollectionView} {@link Facet} and {@link FacetArg}. + */ public enum FacetType { // TODO: add date range STRING, DATE_YEAR, NUMBER_RANGE diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/FieldView.java b/src/main/java/edu/tamu/scholars/middleware/view/model/FieldView.java index 2bbfb90f9..3a98af803 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/FieldView.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/FieldView.java @@ -1,13 +1,17 @@ package edu.tamu.scholars.middleware.view.model; -import java.util.ArrayList; -import java.util.List; - import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.MappedSuperclass; import javax.validation.constraints.Min; +import java.util.ArrayList; +import java.util.List; + +/** + * Abstract mapped superclass `FieldView` to order itself and + * filter and sort its result sets for a given field. + */ @MappedSuperclass public abstract class FieldView extends View { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Filter.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Filter.java index 693d7d9a1..7eb698e40 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Filter.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Filter.java @@ -7,6 +7,9 @@ import edu.tamu.scholars.middleware.model.OpKey; +/** + * Embeddable class `Filter` to describe filtering of {@link View} result sets. + */ @Embeddable public class Filter { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Index.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Index.java index 3aa8921e6..0bd5559c3 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Index.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Index.java @@ -1,15 +1,19 @@ package edu.tamu.scholars.middleware.view.model; -import java.util.List; - import javax.persistence.Column; import javax.persistence.ElementCollection; import javax.persistence.Embeddable; import javax.persistence.EnumType; import javax.persistence.Enumerated; +import java.util.List; + import edu.tamu.scholars.middleware.model.OpKey; +/** + * {@link DirectoryView} embedded class `Index` to describe collection result + * navigation. + */ @Embeddable public class Index { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Layout.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Layout.java index cf30324e9..b31ab4853 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Layout.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Layout.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.view.model; +/** + * {@link CollectionView} enumeration for which `Layout` the collection view is to be contained in. + */ public enum Layout { CONTAINER, GRID, LIST } diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Side.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Side.java index 5347fe882..fcb6e9085 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Side.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Side.java @@ -1,5 +1,8 @@ package edu.tamu.scholars.middleware.view.model; +/** + * {@link DisplayView} enumeration for which `Side` an aside should be displayed on. + */ public enum Side { LEFT, RIGHT } diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/Sort.java b/src/main/java/edu/tamu/scholars/middleware/view/model/Sort.java index 5f7168d7f..605ad5e62 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/Sort.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/Sort.java @@ -7,6 +7,9 @@ import org.springframework.data.domain.Sort.Direction; +/** + * Embeddable class `Sort` to describe ordering of {@link View} result sets. + */ @Embeddable public class Sort { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/View.java b/src/main/java/edu/tamu/scholars/middleware/view/model/View.java index 18a1bc13b..ea98e295a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/View.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/View.java @@ -4,6 +4,9 @@ import edu.tamu.scholars.middleware.model.Named; +/** + * Abstract mapped superclass `View` to differentiate between persistent views. + */ @MappedSuperclass public abstract class View extends Named { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DataAndAnalyticsViewRepo.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DataAndAnalyticsViewRepo.java index 0f9030f89..1a7318c97 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DataAndAnalyticsViewRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DataAndAnalyticsViewRepo.java @@ -4,6 +4,9 @@ import edu.tamu.scholars.middleware.view.model.DataAndAnalyticsView; +/** + * {@link DataAndAnalyticsView} Sprint Data REST repository resource. + */ @RepositoryRestResource public interface DataAndAnalyticsViewRepo extends ViewRepo { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DirectoryViewRepo.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DirectoryViewRepo.java index 2df8f5361..64ae9c756 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DirectoryViewRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DirectoryViewRepo.java @@ -4,6 +4,9 @@ import edu.tamu.scholars.middleware.view.model.DirectoryView; +/** + * {@link DirectoryView} Sprint Data REST repository resource. + */ @RepositoryRestResource public interface DirectoryViewRepo extends ViewRepo { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DiscoveryViewRepo.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DiscoveryViewRepo.java index f9567bb97..5da662b41 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DiscoveryViewRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DiscoveryViewRepo.java @@ -4,6 +4,9 @@ import edu.tamu.scholars.middleware.view.model.DiscoveryView; +/** + * {@link DiscoveryView} Sprint Data REST repository resource. + */ @RepositoryRestResource public interface DiscoveryViewRepo extends ViewRepo { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DisplayViewRepo.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DisplayViewRepo.java index c0fabcdec..6aa5c79df 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DisplayViewRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/DisplayViewRepo.java @@ -8,6 +8,9 @@ import edu.tamu.scholars.middleware.view.model.DisplayView; +/** + * {@link DisplayView} Sprint Data REST repository resource. + */ @RepositoryRestResource public interface DisplayViewRepo extends ViewRepo { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/ViewRepo.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/ViewRepo.java index 3cb26c5fd..34265a6e0 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/ViewRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/ViewRepo.java @@ -5,6 +5,11 @@ import edu.tamu.scholars.middleware.model.repo.NamedRepo; import edu.tamu.scholars.middleware.view.model.View; +/** + * {@link View} repository interface to provide generic representation of a {@link NamedRepo}. + * + * @param {@link View} + */ @NoRepositoryBean public interface ViewRepo extends NamedRepo { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DataAndAnalyticViewEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DataAndAnalyticViewEventHandler.java index 8113d340e..23c424df8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DataAndAnalyticViewEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DataAndAnalyticViewEventHandler.java @@ -3,10 +3,13 @@ import org.springframework.data.rest.core.annotation.RepositoryEventHandler; import edu.tamu.scholars.middleware.view.model.DataAndAnalyticsView; -import edu.tamu.scholars.middleware.view.model.DirectoryView; +/** + * {@link DataAndAnalyticsView} {@link ViewEventHandler} with const channel + * defined for handling events. + */ @RepositoryEventHandler(DataAndAnalyticsView.class) -public class DataAndAnalyticViewEventHandler extends ViewEventHandler { +public class DataAndAnalyticViewEventHandler extends ViewEventHandler { public static final String DATA_AND_ANALYTICS_VIEWS_CHANNEL = "/queue/data-and-analytics-views"; diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DirectoryViewEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DirectoryViewEventHandler.java index 433e3ef9a..845816d7e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DirectoryViewEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DirectoryViewEventHandler.java @@ -4,6 +4,10 @@ import edu.tamu.scholars.middleware.view.model.DirectoryView; +/** + * {@link DirectoryView} {@link ViewEventHandler} with const channel + * defined for handling events. + */ @RepositoryEventHandler(DirectoryView.class) public class DirectoryViewEventHandler extends ViewEventHandler { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DiscoveryViewEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DiscoveryViewEventHandler.java index 72b6d96b9..4e871224c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DiscoveryViewEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DiscoveryViewEventHandler.java @@ -4,6 +4,10 @@ import edu.tamu.scholars.middleware.view.model.DiscoveryView; +/** + * {@link DiscoveryView} {@link ViewEventHandler} with const channel + * defined for handling events. + */ @RepositoryEventHandler(DiscoveryView.class) public class DiscoveryViewEventHandler extends ViewEventHandler { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DisplayViewEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DisplayViewEventHandler.java index 28dec298c..17d06c258 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DisplayViewEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/DisplayViewEventHandler.java @@ -4,6 +4,10 @@ import edu.tamu.scholars.middleware.view.model.DisplayView; +/** + * {@link DisplayView} {@link ViewEventHandler} with const channel + * defined for handling events. + */ @RepositoryEventHandler(DisplayView.class) public class DisplayViewEventHandler extends ViewEventHandler { diff --git a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/ViewEventHandler.java b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/ViewEventHandler.java index 165894a3e..678408c03 100644 --- a/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/ViewEventHandler.java +++ b/src/main/java/edu/tamu/scholars/middleware/view/model/repo/handler/ViewEventHandler.java @@ -10,24 +10,31 @@ import edu.tamu.scholars.middleware.messaging.DeleteEntityMessage; import edu.tamu.scholars.middleware.messaging.UpdateEntityMessage; import edu.tamu.scholars.middleware.view.model.View; - +import edu.tamu.scholars.middleware.view.model.repo.ViewRepo; + +/** + * Abstract {@link View} event handler to dispatch {@link ViewRepo} events. + * Provides events for clients to be notified when a view changes. + * + * @param {@link View} + */ public abstract class ViewEventHandler { @Autowired private SimpMessagingTemplate simpMessageTemplate; @HandleAfterCreate - public void broadcastThemeCreate(V view) { + public void broadcastCreate(V view) { simpMessageTemplate.convertAndSend(getChannel(), new CreateEntityMessage(view)); } @HandleAfterSave - public void broadcastThemeUpdate(V view) { + public void broadcastUpdate(V view) { simpMessageTemplate.convertAndSend(getChannel(), new UpdateEntityMessage(view)); } @HandleAfterDelete - public void broadcastThemeDelete(V view) { + public void broadcastDelete(V view) { simpMessageTemplate.convertAndSend(getChannel(), new DeleteEntityMessage(view.getName())); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 596a2cbbd..645988b04 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -5,7 +5,7 @@ middleware: ## copy a~n to src/main/resources/assets/a~n assets-location: classpath:/assets ## works in Windows and expected to work on Linux - # assets-location: file:/Users/wwelling/Development/scholars/scholars-discovery/assets + # assets-location: file:/Development/scholars/scholars-discovery/assets load-defaults: true update-defaults: true allowed-origins: diff --git a/src/main/resources/docx4j.properties b/src/main/resources/docx4j.properties index 65bfaca99..3ce3d3b8c 100644 --- a/src/main/resources/docx4j.properties +++ b/src/main/resources/docx4j.properties @@ -346,9 +346,9 @@ com.plutext.merge.pptx.SectionAware=false # @since 3.3.0 # The property XAdESLevel supports the following values: -# 0 - XAdES Off (Create XML-DSig signatures) -# 1 - Create XAdES-EPES signatures -# 2 - Create XAdES-T signatures +# 0 - XAdES Off (Create XML-DSig signatures) +# 1 - Create XAdES-EPES signatures +# 2 - Create XAdES-T signatures com.plutext.dsig.XAdES.Level=1 diff --git a/src/test/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfigTest.java b/src/test/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfigTest.java index 51e70fd85..86f1e2ad5 100644 --- a/src/test/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfigTest.java +++ b/src/test/java/edu/tamu/scholars/middleware/config/model/MiddlewareConfigTest.java @@ -164,8 +164,8 @@ public void testTriplestoreGetterSetter() { newTriplestoreConfig.setPassword("password"); newTriplestoreConfig.setJdbcStream(false); newTriplestoreConfig.setJdbcFetchSize(16); - newTriplestoreConfig.setStreamGraphAPI(false); - newTriplestoreConfig.setAnnotateGeneratedSQL(true); + newTriplestoreConfig.setStreamGraphApi(false); + newTriplestoreConfig.setAnnotateGeneratedSql(true); middlewareConfig.setTriplestore(newTriplestoreConfig); TriplestoreConfig triplestoreConfig = middlewareConfig.getTriplestore(); triplestoreConfig.setType(TDBTriplestore.class); @@ -186,10 +186,10 @@ public void testTriplestoreGetterSetter() { assertFalse(triplestoreConfig.isJdbcStream()); triplestoreConfig.setJdbcFetchSize(16); assertEquals(16, triplestoreConfig.getJdbcFetchSize()); - triplestoreConfig.setStreamGraphAPI(false); - assertFalse(triplestoreConfig.isStreamGraphAPI()); - triplestoreConfig.setAnnotateGeneratedSQL(true); - assertTrue(triplestoreConfig.isAnnotateGeneratedSQL()); + triplestoreConfig.setStreamGraphApi(false); + assertFalse(triplestoreConfig.isStreamGraphApi()); + triplestoreConfig.setAnnotateGeneratedSql(true); + assertTrue(triplestoreConfig.isAnnotateGeneratedSql()); } @Test diff --git a/src/test/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfigTest.java b/src/test/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfigTest.java index 02f042bcf..711bcea0b 100644 --- a/src/test/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfigTest.java +++ b/src/test/java/edu/tamu/scholars/middleware/config/model/TriplestoreConfigTest.java @@ -28,8 +28,8 @@ public void testDefaultConstructor() { assertNull(triplestoreConfig.getPassword()); assertTrue(triplestoreConfig.isJdbcStream()); assertEquals(8, triplestoreConfig.getJdbcFetchSize()); - assertTrue(triplestoreConfig.isStreamGraphAPI()); - assertFalse(triplestoreConfig.isAnnotateGeneratedSQL()); + assertTrue(triplestoreConfig.isStreamGraphApi()); + assertFalse(triplestoreConfig.isAnnotateGeneratedSql()); } @Test @@ -53,10 +53,10 @@ public void testGettersAndSetters() { assertFalse(triplestoreConfig.isJdbcStream()); triplestoreConfig.setJdbcFetchSize(16); assertEquals(16, triplestoreConfig.getJdbcFetchSize()); - triplestoreConfig.setStreamGraphAPI(false); - assertFalse(triplestoreConfig.isStreamGraphAPI()); - triplestoreConfig.setAnnotateGeneratedSQL(true); - assertTrue(triplestoreConfig.isAnnotateGeneratedSQL()); + triplestoreConfig.setStreamGraphApi(false); + assertFalse(triplestoreConfig.isStreamGraphApi()); + triplestoreConfig.setAnnotateGeneratedSql(true); + assertTrue(triplestoreConfig.isAnnotateGeneratedSql()); } } diff --git a/src/test/resources/mock/discovery/persons/n163f68fe.json b/src/test/resources/mock/discovery/persons/n163f68fe.json index 29f4ab8f2..ce1661998 100644 --- a/src/test/resources/mock/discovery/persons/n163f68fe.json +++ b/src/test/resources/mock/discovery/persons/n163f68fe.json @@ -1483,7 +1483,7 @@ "Mathaudhu, Suveen Nigel (2006-08). Fabrication of amorphous metal matrix composites by severe plastic deformation. Doctoral Dissertation.::nb43a88ca", "Kao, Yi-Tang (2014-12). Effect of Severe Plastic Deformation and Subsequent Heat Treatment on Hardness and Electrical Conductivity of Oxygen-Free High Conductivity (OFHC) Copper, Commercial Pure Copper, and Copper Chromium Alloy. Master's Thesis.::ncd21c0c8" ], - "etdChairOfURL": [ + "etdChairOfUrl": [ "http://hdl.handle.net/1969.1/ETD-TAMU-2009-08-7140::n6cca7c7a", "http://hdl.handle.net/1969.1/153503::n558af149", "http://hdl.handle.net/1969.1/4880::n6d71c2ca", diff --git a/src/test/resources/mock/discovery/persons/n3e016f20.json b/src/test/resources/mock/discovery/persons/n3e016f20.json index 9f1300eef..cf97fefd7 100644 --- a/src/test/resources/mock/discovery/persons/n3e016f20.json +++ b/src/test/resources/mock/discovery/persons/n3e016f20.json @@ -919,7 +919,7 @@ "Chou, Wen-Ko (2013-12). Basic and Applied Aspects of Chicken Macrophage Biology. Doctoral Dissertation.::n8cbcb10f", "Oubre, Cherie Morgan (2003-05). Common messenger molecules and cell types demonstrating neuroendocrine-immune interactions in the chicken. Doctoral Dissertation.::n1a966d07" ], - "etdChairOfURL": [ + "etdChairOfUrl": [ "http://hdl.handle.net/1969.1/3165::n463041ca", "http://hdl.handle.net/1969.1/ETD-TAMU-1847::n807eaf17", "http://hdl.handle.net/1969.1/ETD-TAMU-1186::nd1d6a528",