-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from diging/develop
prepare release
- Loading branch information
Showing
21 changed files
with
559 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
vspace/src/main/java/edu/asu/diging/vspace/core/model/SortByField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package edu.asu.diging.vspace.core.model; | ||
|
||
public enum SortByField { | ||
CREATION_DATE("creationDate"); | ||
|
||
private final String value; | ||
|
||
private SortByField(String value) { | ||
this.value = value; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
vspace/src/main/java/edu/asu/diging/vspace/core/services/IImageService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
package edu.asu.diging.vspace.core.services; | ||
|
||
|
||
import edu.asu.diging.vspace.core.model.IVSImage; | ||
import edu.asu.diging.vspace.core.model.impl.VSImage; | ||
import edu.asu.diging.vspace.core.services.impl.model.ImageData; | ||
import java.util.List; | ||
|
||
public interface IImageService { | ||
|
||
ImageData getImageData(byte[] image); | ||
|
||
ImageData getImageDimensions(IVSImage image, int width, int height); | ||
|
||
long getTotalPages(); | ||
|
||
List<VSImage> getImages(int pageNo); | ||
|
||
long getTotalImageCount(); | ||
|
||
int validatePageNumber(int pageNo); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
vspace/src/main/java/edu/asu/diging/vspace/web/staff/DeleteSpaceController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package edu.asu.diging.vspace.web.staff; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestMethod; | ||
|
||
import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException; | ||
import edu.asu.diging.vspace.core.services.ISpaceManager; | ||
|
||
@Controller | ||
public class DeleteSpaceController { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(getClass()); | ||
|
||
@Autowired | ||
private ISpaceManager spaceManager; | ||
|
||
@RequestMapping(value = "/staff/space/{id}", method = RequestMethod.DELETE) | ||
public ResponseEntity<?> deleteSpace(@PathVariable String id) { | ||
try { | ||
spaceManager.deleteSpaceById(id); | ||
} catch (SpaceDoesNotExistException spaceDoesNotExistException) { | ||
logger.error("Could not delete space.", spaceDoesNotExistException); | ||
return new ResponseEntity<>("Invalid input. Please try again", HttpStatus.BAD_REQUEST); | ||
} | ||
return new ResponseEntity<>(HttpStatus.OK); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
vspace/src/main/java/edu/asu/diging/vspace/web/staff/ListImagesController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package edu.asu.diging.vspace.web.staff; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.ui.Model; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import edu.asu.diging.vspace.core.services.IImageService; | ||
|
||
@Controller | ||
public class ListImagesController { | ||
|
||
@Autowired | ||
private IImageService imageService; | ||
|
||
@RequestMapping("/staff/images/list/{page}") | ||
public String listSpaces(@PathVariable String page, Model model) { | ||
int pageNo; | ||
try { | ||
pageNo = imageService.validatePageNumber(Integer.parseInt(page)); | ||
} catch (NumberFormatException numberFormatException) { | ||
pageNo = 1; | ||
} | ||
model.addAttribute("totalPages", imageService.getTotalPages()); | ||
model.addAttribute("currentPageNumber", pageNo); | ||
model.addAttribute("totalImageCount", imageService.getTotalImageCount()); | ||
model.addAttribute("images", imageService.getImages(pageNo)); | ||
return "staff/images/list"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.