PAN-57 Refacted superfluous code

This commit is contained in:
2019-03-17 14:48:43 -06:00
parent a85bf67d08
commit a13ab97154
25 changed files with 331 additions and 371 deletions
@@ -1,6 +1,6 @@
package edu.msudenver.tsp.persistence.controller;
import edu.msudenver.tsp.persistence.dto.AccountDto;
import edu.msudenver.tsp.persistence.dto.Account;
import edu.msudenver.tsp.persistence.repository.AccountsRepository;
import edu.msudenver.tsp.utilities.PersistenceUtilities;
import lombok.AllArgsConstructor;
@@ -28,7 +28,7 @@ public class AccountController {
@GetMapping({"","/"})
public @ResponseBody
ResponseEntity<Iterable<AccountDto>> getListOfAccounts() {
ResponseEntity<Iterable<Account>> getListOfAccounts() {
LOG.info("Received request to list all accounts");
LOG.debug("Querying for list of accounts");
@@ -36,7 +36,7 @@ public class AccountController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<AccountDto> listOfAccounts = (List<AccountDto>) accountsRepository.findAll();
final List<Account> listOfAccounts = (List<Account>) accountsRepository.findAll();
stopWatch.stop();
@@ -48,7 +48,7 @@ public class AccountController {
@GetMapping("/id")
public @ResponseBody
ResponseEntity<AccountDto> getAccountById(@RequestParam("id") final Integer id) {
ResponseEntity<Account> getAccountById(@RequestParam("id") final Integer id) {
LOG.info("Received request to query for account with id {}", id);
if (id == null) {
LOG.error("ERROR: ID was null");
@@ -59,7 +59,7 @@ public class AccountController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<AccountDto> account = accountsRepository.findById(id);
final Optional<Account> account = accountsRepository.findById(id);
stopWatch.stop();
@@ -77,7 +77,7 @@ public class AccountController {
@GetMapping("/username")
public @ResponseBody
ResponseEntity<AccountDto> getAccountByUsername(@RequestParam("username") final String username) {
ResponseEntity<Account> getAccountByUsername(@RequestParam("username") final String username) {
LOG.info("Received request to query for account with username {}", username);
if (username == null) {
LOG.error("ERROR: username was null");
@@ -88,7 +88,7 @@ public class AccountController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<AccountDto> account = accountsRepository.findByUsername(username);
final Optional<Account> account = accountsRepository.findByUsername(username);
stopWatch.stop();
@@ -105,9 +105,9 @@ public class AccountController {
}
@PostMapping({"","/"})
@Validated({AccountDto.Insert.class, Default.class})
public @ResponseBody ResponseEntity<AccountDto> insertAccount(
@Valid @RequestBody final AccountDto accountDto, final BindingResult bindingResult) {
@Validated({Account.Insert.class, Default.class})
public @ResponseBody ResponseEntity<Account> insertAccount(
@Valid @RequestBody final Account account, final BindingResult bindingResult) {
LOG.info("Received request to insert a new account");
if (bindingResult.hasErrors()) {
@@ -115,23 +115,23 @@ public class AccountController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (accountDto == null) {
if (account == null) {
LOG.error("Passed account is unprocessable");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
LOG.info("Checking for any existing users with username {}", accountDto.getUsername());
LOG.info("Checking for any existing users with username {}", account.getUsername());
final Instant start = Instant.now();
LOG.debug("Querying for existing accounts");
final Optional<AccountDto> existingAccount = accountsRepository.findByUsername(accountDto.getUsername());
final Optional<Account> existingAccount = accountsRepository.findByUsername(account.getUsername());
LOG.debug("Received response from the server: query took {} ms", Duration.between(start, Instant.now()).toMillis());
if (existingAccount.isPresent()) {
LOG.warn("An account already exists with username {}", accountDto.getUsername());
LOG.warn("An account already exists with username {}", account.getUsername());
return new ResponseEntity<>(HttpStatus.CONFLICT);
}
@@ -140,7 +140,7 @@ public class AccountController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final AccountDto savedAccount = accountsRepository.save(accountDto);
final Account savedAccount = accountsRepository.save(account);
stopWatch.stop();
@@ -150,9 +150,9 @@ public class AccountController {
}
@PatchMapping("/{id}")
public @ResponseBody ResponseEntity<AccountDto> updateAccount(
public @ResponseBody ResponseEntity<Account> updateAccount(
@PathVariable("id") final Integer id,
@RequestBody final AccountDto accountDto, final BindingResult bindingResult) {
@RequestBody final Account account, final BindingResult bindingResult) {
LOG.info("Received request to update an account");
if (bindingResult.hasErrors()) {
@@ -160,7 +160,7 @@ public class AccountController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (accountDto == null) {
if (account == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -175,7 +175,7 @@ public class AccountController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<AccountDto> existingAccount = accountsRepository.findById(id);
final Optional<Account> existingAccount = accountsRepository.findById(id);
stopWatch.stop();
@@ -186,7 +186,7 @@ public class AccountController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
PersistenceUtilities.copyNonNullProperties(accountDto, existingAccount.get());
PersistenceUtilities.copyNonNullProperties(account, existingAccount.get());
existingAccount.get().setVersion(existingAccount.get().getVersion()+ 1);
LOG.info("Updating account with id {}", id);
@@ -194,7 +194,7 @@ public class AccountController {
stopWatch.start();
final AccountDto updatedAccount = accountsRepository.save(existingAccount.get());
final Account updatedAccount = accountsRepository.save(existingAccount.get());
stopWatch.stop();
@@ -1,6 +1,6 @@
package edu.msudenver.tsp.persistence.controller;
import edu.msudenver.tsp.persistence.dto.DefinitionDto;
import edu.msudenver.tsp.persistence.dto.Definition;
import edu.msudenver.tsp.persistence.repository.DefinitionRepository;
import edu.msudenver.tsp.utilities.PersistenceUtilities;
import lombok.AllArgsConstructor;
@@ -26,14 +26,14 @@ public class DefinitionController {
@GetMapping({"","/"})
public @ResponseBody
ResponseEntity<Iterable<DefinitionDto>> getAllDefinitions() {
ResponseEntity<Iterable<Definition>> getAllDefinitions() {
LOG.info("Received request to list all definitions");
LOG.debug("Querying for list of all definitions");
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<DefinitionDto> listOfDefinitions = definitionRepository.findAll();
final List<Definition> listOfDefinitions = definitionRepository.findAll();
stopWatch.stop();
@@ -45,7 +45,7 @@ public class DefinitionController {
@GetMapping("/{id}")
public @ResponseBody
ResponseEntity<DefinitionDto> getDefinitionById(@PathVariable("id") final Integer id) {
ResponseEntity<Definition> getDefinitionById(@PathVariable("id") final Integer id) {
LOG.info("Received request to query for definition with id {}", id);
if (id == null) {
LOG.error("ERROR: ID was null");
@@ -57,7 +57,7 @@ public class DefinitionController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<DefinitionDto> definition = definitionRepository.findById(id);
final Optional<Definition> definition = definitionRepository.findById(id);
stopWatch.stop();
@@ -74,9 +74,9 @@ public class DefinitionController {
}
@PostMapping({"","/"})
@Validated({DefinitionDto.Insert.class, Default.class})
public @ResponseBody ResponseEntity<DefinitionDto> insertDefinition(
@Valid @RequestBody final DefinitionDto definitionDto,
@Validated({Definition.Insert.class, Default.class})
public @ResponseBody ResponseEntity<Definition> insertDefinition(
@Valid @RequestBody final Definition definition,
final BindingResult bindingResult) {
LOG.info("Received request to insert a new definition");
if (bindingResult.hasErrors()) {
@@ -84,7 +84,7 @@ public class DefinitionController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (definitionDto == null) {
if (definition == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -94,7 +94,7 @@ public class DefinitionController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final DefinitionDto savedDefinition = definitionRepository.save(definitionDto);
final Definition savedDefinition = definitionRepository.save(definition);
stopWatch.stop();
LOG.debug("Received response from server: query took {}ms to complete", stopWatch.getTotalTimeMillis());
@@ -104,9 +104,9 @@ public class DefinitionController {
}
@PatchMapping("/{id}")
public @ResponseBody ResponseEntity<DefinitionDto> updateDefinition(
public @ResponseBody ResponseEntity<Definition> updateDefinition(
@PathVariable("id") final Integer id,
@RequestBody final DefinitionDto definitionDto, final BindingResult bindingResult) {
@RequestBody final Definition definition, final BindingResult bindingResult) {
LOG.info("Received request to update an account");
if (bindingResult.hasErrors()) {
@@ -114,7 +114,7 @@ public class DefinitionController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (definitionDto == null) {
if (definition == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -129,7 +129,7 @@ public class DefinitionController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<DefinitionDto> existingDefinition = definitionRepository.findById(id);
final Optional<Definition> existingDefinition = definitionRepository.findById(id);
stopWatch.stop();
@@ -140,7 +140,7 @@ public class DefinitionController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
PersistenceUtilities.copyNonNullProperties(definitionDto, existingDefinition.get());
PersistenceUtilities.copyNonNullProperties(definition, existingDefinition.get());
existingDefinition.get().setVersion(existingDefinition.get().getVersion()+ 1);
LOG.info("Updating definition with id {}", id);
@@ -148,7 +148,7 @@ public class DefinitionController {
stopWatch.start();
final DefinitionDto updatedDefinition = definitionRepository.save(existingDefinition.get());
final Definition updatedDefinition = definitionRepository.save(existingDefinition.get());
stopWatch.stop();
@@ -1,11 +0,0 @@
package edu.msudenver.tsp.persistence.controller;
import edu.msudenver.tsp.persistence.repository.NotationRepository;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
@Component
@AllArgsConstructor
public class NotationController {
private final NotationRepository notationRepository;
}
@@ -1,6 +1,6 @@
package edu.msudenver.tsp.persistence.controller;
import edu.msudenver.tsp.persistence.dto.ProofDto;
import edu.msudenver.tsp.persistence.dto.Proof;
import edu.msudenver.tsp.persistence.repository.ProofRepository;
import edu.msudenver.tsp.utilities.PersistenceUtilities;
import lombok.AllArgsConstructor;
@@ -26,14 +26,14 @@ public class ProofController {
@GetMapping({"","/"})
public @ResponseBody
ResponseEntity<Iterable<ProofDto>> getAllProofs() {
ResponseEntity<Iterable<Proof>> getAllProofs() {
LOG.info("Received request to list all theorems");
LOG.debug("Querying for list of all theorems");
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<ProofDto> listOfProofs = proofRepository.findAll();
final List<Proof> listOfProofs = proofRepository.findAll();
stopWatch.stop();
@@ -45,7 +45,7 @@ public class ProofController {
@GetMapping("/id")
public @ResponseBody
ResponseEntity<ProofDto> getProofById(@RequestParam("id") final Integer id) {
ResponseEntity<Proof> getProofById(@RequestParam("id") final Integer id) {
LOG.info("Received request to query for proof with id {}", id);
if (id == null) {
LOG.error("ERROR: ID was null");
@@ -57,7 +57,7 @@ public class ProofController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<ProofDto> proof = proofRepository.findById(id);
final Optional<Proof> proof = proofRepository.findById(id);
stopWatch.stop();
@@ -75,7 +75,7 @@ public class ProofController {
@GetMapping("/branch")
public @ResponseBody
ResponseEntity<List<ProofDto>> getAllProofsByBranch(@RequestParam("branch") final String branch) {
ResponseEntity<List<Proof>> getAllProofsByBranch(@RequestParam("branch") final String branch) {
LOG.info("Received request to query for proofs related to the {} branch of mathematics", branch);
if (branch == null) {
LOG.error("ERROR: branch was null");
@@ -87,7 +87,7 @@ public class ProofController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<ProofDto> listOfProofs = proofRepository.findByBranch(branch);
final List<Proof> listOfProofs = proofRepository.findByBranch(branch);
stopWatch.stop();
@@ -105,7 +105,7 @@ public class ProofController {
@GetMapping("/theorem_name")
public @ResponseBody
ResponseEntity<List<ProofDto>> getAllProofsByTheoremName(@PathVariable("theorem_name") final String theoremName) {
ResponseEntity<List<Proof>> getAllProofsByTheoremName(@PathVariable("theorem_name") final String theoremName) {
LOG.info("Received request to query for proofs of the theorem {}", theoremName);
if (theoremName == null) {
LOG.error("ERROR: theorem name was null");
@@ -117,7 +117,7 @@ public class ProofController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<ProofDto> listOfProofs = proofRepository.findByTheoremName(theoremName);
final List<Proof> listOfProofs = proofRepository.findByTheoremName(theoremName);
stopWatch.stop();
@@ -134,9 +134,9 @@ public class ProofController {
}
@PostMapping({"","/"})
@Validated({ProofDto.Insert.class, Default.class})
public @ResponseBody ResponseEntity<ProofDto> insertProof(
@Valid @RequestBody final ProofDto proofDto,
@Validated({Proof.Insert.class, Default.class})
public @ResponseBody ResponseEntity<Proof> insertProof(
@Valid @RequestBody final Proof proof,
final BindingResult bindingResult) {
LOG.info("Received request to insert a new proof");
if (bindingResult.hasErrors()) {
@@ -144,7 +144,7 @@ public class ProofController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (proofDto == null) {
if (proof == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -154,7 +154,7 @@ public class ProofController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final ProofDto savedProof = proofRepository.save(proofDto);
final Proof savedProof = proofRepository.save(proof);
stopWatch.stop();
LOG.debug("Received response from server: query took {}ms to complete", stopWatch.getTotalTimeMillis());
@@ -164,9 +164,9 @@ public class ProofController {
}
@PatchMapping("/{id}")
public @ResponseBody ResponseEntity<ProofDto> updateProof(
public @ResponseBody ResponseEntity<Proof> updateProof(
@PathVariable("id") final Integer id,
@RequestBody final ProofDto proofDto, final BindingResult bindingResult) {
@RequestBody final Proof proof, final BindingResult bindingResult) {
LOG.info("Received request to update a proof");
if (bindingResult.hasErrors()) {
@@ -174,7 +174,7 @@ public class ProofController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (proofDto == null) {
if (proof == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -189,7 +189,7 @@ public class ProofController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<ProofDto> existingProof = proofRepository.findById(id);
final Optional<Proof> existingProof = proofRepository.findById(id);
stopWatch.stop();
@@ -200,7 +200,7 @@ public class ProofController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
PersistenceUtilities.copyNonNullProperties(proofDto, existingProof.get());
PersistenceUtilities.copyNonNullProperties(proof, existingProof.get());
existingProof.get().setVersion(existingProof.get().getVersion()+ 1);
LOG.info("Updating proof with id {}", id);
@@ -208,7 +208,7 @@ public class ProofController {
stopWatch.start();
final ProofDto updatedProof = proofRepository.save(existingProof.get());
final Proof updatedProof = proofRepository.save(existingProof.get());
stopWatch.stop();
@@ -1,6 +1,6 @@
package edu.msudenver.tsp.persistence.controller;
import edu.msudenver.tsp.persistence.dto.TheoremDto;
import edu.msudenver.tsp.persistence.dto.Theorem;
import edu.msudenver.tsp.persistence.repository.TheoremRepository;
import edu.msudenver.tsp.utilities.PersistenceUtilities;
import lombok.AllArgsConstructor;
@@ -26,14 +26,14 @@ public class TheoremController {
@GetMapping({"","/"})
public @ResponseBody
ResponseEntity<Iterable<TheoremDto>> getAllTheorems() {
ResponseEntity<Iterable<Theorem>> getAllTheorems() {
LOG.info("Received request to list all theorems");
LOG.debug("Querying for list of all theorems");
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<TheoremDto> listOfTheorems = theoremRepository.findAll();
final List<Theorem> listOfTheorems = theoremRepository.findAll();
stopWatch.stop();
@@ -45,7 +45,7 @@ public class TheoremController {
@GetMapping("/branch")
public @ResponseBody
ResponseEntity<List<TheoremDto>> getAllTheoremsByBranch(@RequestParam("branch") final String branch) {
ResponseEntity<List<Theorem>> getAllTheoremsByBranch(@RequestParam("branch") final String branch) {
LOG.info("Received request to query for theorems related to the {} branch of mathematics", branch);
if (branch == null) {
LOG.error("ERROR: branch was null");
@@ -57,7 +57,7 @@ public class TheoremController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<TheoremDto> listOfTheorems = theoremRepository.findByBranch(branch);
final List<Theorem> listOfTheorems = theoremRepository.findByBranch(branch);
stopWatch.stop();
@@ -75,7 +75,7 @@ public class TheoremController {
@GetMapping("/proven_status")
public @ResponseBody
ResponseEntity<List<TheoremDto>> getAllTheoremsByProvenStatus(@PathVariable("proven_status") final Boolean provenStatus) {
ResponseEntity<List<Theorem>> getAllTheoremsByProvenStatus(@PathVariable("proven_status") final Boolean provenStatus) {
LOG.info("Received request to query for theorems whose proven status is {}", provenStatus);
if (provenStatus == null) {
LOG.error("ERROR: status was null");
@@ -87,7 +87,7 @@ public class TheoremController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<TheoremDto> listOfTheorems = theoremRepository.findByProvenStatus(provenStatus);
final List<Theorem> listOfTheorems = theoremRepository.findByProvenStatus(provenStatus);
stopWatch.stop();
@@ -105,7 +105,7 @@ public class TheoremController {
@GetMapping("/name")
public @ResponseBody
ResponseEntity<List<TheoremDto>> getAllTheoremsByName(@PathVariable("name") final String name) {
ResponseEntity<List<Theorem>> getAllTheoremsByName(@PathVariable("name") final String name) {
LOG.info("Received request to query for theorems whose name is {}", name);
if (name == null) {
LOG.error("ERROR: name was null");
@@ -117,7 +117,7 @@ public class TheoremController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final List<TheoremDto> listOfTheorems = theoremRepository.findByName(name);
final List<Theorem> listOfTheorems = theoremRepository.findByName(name);
stopWatch.stop();
@@ -135,7 +135,7 @@ public class TheoremController {
@GetMapping("/id")
public @ResponseBody
ResponseEntity<TheoremDto> getTheoremById(@PathVariable("id") final Integer id) {
ResponseEntity<Theorem> getTheoremById(@PathVariable("id") final Integer id) {
LOG.info("Received request to query for theorem with id {}", id);
if (id == null) {
LOG.error("ERROR: ID was null");
@@ -147,7 +147,7 @@ public class TheoremController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<TheoremDto> theorem = theoremRepository.findById(id);
final Optional<Theorem> theorem = theoremRepository.findById(id);
stopWatch.stop();
@@ -164,9 +164,9 @@ public class TheoremController {
}
@PostMapping({"","/"})
@Validated({TheoremDto.Insert.class, Default.class})
public @ResponseBody ResponseEntity<TheoremDto> insertTheorem(
@Valid @RequestBody final TheoremDto theoremDto,
@Validated({Theorem.Insert.class, Default.class})
public @ResponseBody ResponseEntity<Theorem> insertTheorem(
@Valid @RequestBody final Theorem theorem,
final BindingResult bindingResult) {
LOG.info("Received request to insert a new theorem");
if (bindingResult.hasErrors()) {
@@ -174,7 +174,7 @@ public class TheoremController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (theoremDto == null) {
if (theorem == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -184,7 +184,7 @@ public class TheoremController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final TheoremDto savedTheorem = theoremRepository.save(theoremDto);
final Theorem savedTheorem = theoremRepository.save(theorem);
stopWatch.stop();
LOG.debug("Received response from server: query took {}ms to complete", stopWatch.getTotalTimeMillis());
@@ -194,9 +194,9 @@ public class TheoremController {
}
@PatchMapping("/{id}")
public @ResponseBody ResponseEntity<TheoremDto> updateTheorem(
public @ResponseBody ResponseEntity<Theorem> updateTheorem(
@PathVariable("id") final Integer id,
@RequestBody final TheoremDto theoremDto, final BindingResult bindingResult) {
@RequestBody final Theorem theorem, final BindingResult bindingResult) {
LOG.info("Received request to update a theorem");
if (bindingResult.hasErrors()) {
@@ -204,7 +204,7 @@ public class TheoremController {
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
if (theoremDto == null) {
if (theorem == null) {
LOG.error("Passed entity is null");
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
@@ -219,7 +219,7 @@ public class TheoremController {
final StopWatch stopWatch = new StopWatch();
stopWatch.start();
final Optional<TheoremDto> existingTheorem = theoremRepository.findById(id);
final Optional<Theorem> existingTheorem = theoremRepository.findById(id);
stopWatch.stop();
@@ -230,7 +230,7 @@ public class TheoremController {
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
}
PersistenceUtilities.copyNonNullProperties(theoremDto, existingTheorem.get());
PersistenceUtilities.copyNonNullProperties(theorem, existingTheorem.get());
existingTheorem.get().setVersion(existingTheorem.get().getVersion()+ 1);
LOG.info("Updating theorem with id {}", id);
@@ -238,7 +238,7 @@ public class TheoremController {
stopWatch.start();
final TheoremDto updatedTheorem = theoremRepository.save(existingTheorem.get());
final Theorem updatedTheorem = theoremRepository.save(existingTheorem.get());
stopWatch.stop();
@@ -16,7 +16,7 @@ import java.util.Date;
@EntityListeners(AuditingEntityListener.class)
@Data
@EqualsAndHashCode(callSuper = true)
public class AccountDto extends BaseDto implements Serializable {
public class Account extends BaseDto implements Serializable {
@NotBlank(groups = Insert.class, message = "A username must be specified") @Size(max = 50) private String username;
@NotBlank(groups = Insert.class, message = "A password must be specified") @Size(max = 256) private String password;
@NotNull @Column(name = "administrator_status") private boolean administratorStatus;
@@ -19,7 +19,7 @@ import java.util.List;
@EntityListeners(AuditingEntityListener.class)
@Data
@EqualsAndHashCode(callSuper = true)
public class DefinitionDto extends BaseDto implements Serializable {
public class Definition extends BaseDto implements Serializable {
@NotBlank(groups = Insert.class, message = "A name must be specified")
@Size(min = 1, max = 200, message = "Must be between 1 and 200 characters")
private String name;
@@ -17,7 +17,7 @@ import java.util.List;
@EntityListeners(AuditingEntityListener.class)
@Data
@EqualsAndHashCode(callSuper = true)
public class ProofDto extends BaseDto implements Serializable {
public class Proof extends BaseDto implements Serializable {
@NotBlank(groups = Insert.class)
@Size(min = 1, max = 512, message = "The name must be at least 1 character and at most 512 characters")
@Column(name = "theorem_name")
@@ -19,7 +19,7 @@ import java.util.List;
@EntityListeners(AuditingEntityListener.class)
@Data
@EqualsAndHashCode(callSuper = true)
public class TheoremDto extends BaseDto implements Serializable {
public class Theorem extends BaseDto implements Serializable {
@NotBlank(groups = Insert.class) @Size(min = 1, max = 512, message = "theorem name must be between 1 and 512 characters") private String name;
@NotNull(groups = Insert.class) @Column(name = "theorem_type") private TheoremType theoremType;
@NotNull(groups = Insert.class, message = "a branch of mathematics that this theorem is associated with must be specified") private String branch;
@@ -1,12 +1,12 @@
package edu.msudenver.tsp.persistence.repository;
import edu.msudenver.tsp.persistence.dto.AccountDto;
import edu.msudenver.tsp.persistence.dto.Account;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface AccountsRepository extends CrudRepository<AccountDto, Integer> {
Optional<AccountDto> findByUsername(String username);
public interface AccountsRepository extends CrudRepository<Account, Integer> {
Optional<Account> findByUsername(String username);
}
@@ -1,11 +1,11 @@
package edu.msudenver.tsp.persistence.repository;
import edu.msudenver.tsp.persistence.dto.DefinitionDto;
import edu.msudenver.tsp.persistence.dto.Definition;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface DefinitionRepository extends JpaRepository<DefinitionDto, Integer> {
public interface DefinitionRepository extends JpaRepository<Definition, Integer> {
}
@@ -1,7 +0,0 @@
package edu.msudenver.tsp.persistence.repository;
import edu.msudenver.tsp.persistence.dto.BaseDto;
import org.springframework.data.repository.CrudRepository;
public interface NotationRepository extends CrudRepository<BaseDto, Long> {
}
@@ -1,13 +1,13 @@
package edu.msudenver.tsp.persistence.repository;
import edu.msudenver.tsp.persistence.dto.ProofDto;
import edu.msudenver.tsp.persistence.dto.Proof;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface ProofRepository extends JpaRepository<ProofDto, Integer> {
public interface ProofRepository extends JpaRepository<Proof, Integer> {
List<ProofDto> findByBranch(String branch);
List<Proof> findByBranch(String branch);
List<ProofDto> findByTheoremName(String name);
List<Proof> findByTheoremName(String name);
}
@@ -1,17 +1,17 @@
package edu.msudenver.tsp.persistence.repository;
import edu.msudenver.tsp.persistence.dto.TheoremDto;
import edu.msudenver.tsp.persistence.dto.Theorem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TheoremRepository extends JpaRepository<TheoremDto, Integer> {
public interface TheoremRepository extends JpaRepository<Theorem, Integer> {
List<TheoremDto> findByBranch(String branch);
List<Theorem> findByBranch(String branch);
List<TheoremDto> findByProvenStatus(Boolean provenStatus);
List<Theorem> findByProvenStatus(Boolean provenStatus);
List<TheoremDto> findByName(String name);
List<Theorem> findByName(String name);
}