Skip to content

Commit

Permalink
Story/vspc 72 (#119)
Browse files Browse the repository at this point in the history
* [VSPC-72] Adding status to Space

* [VSPC-72] Adding status to Space

* [VSPC-72] Loading only published spaces in the exhibition.

* [VSPC-72] Resolving CodeFactor issues

* [VSPC-72] Trying to fix issues caught by CodeFactor

* [VSPC-72] Fixing indentation for VSpaceElement

* [VSPC-72]Status check on request to load Space

* [VSPC-72] Resolution to the review comments

* [VSPC-72] Code style fix

* [VSPC-72] Fixes for review comments

* [VSPC-72]Resolving conflicts

* [VSPC-72] Fixing indentation and resolving conflicts

* [VSPC-72] Adding comments for null space status check

* [VSPC-72] Updating the URL for status update

* [VSPC 72] JUnit Test cases for space status

* [VSPC-72] JUnit Test Cases for Space status as null, pub and unpublished

* [VSPC-72] Adding published spaces to space layout

* [VSPC-72] UI fixes and JUnit Test Case for Space not found
  • Loading branch information
prjadhav14 authored Jun 1, 2020
1 parent 64cd9fc commit 0c7b2e5
Show file tree
Hide file tree
Showing 14 changed files with 360 additions and 150 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package edu.asu.diging.vspace.core.aspects;

import java.util.List;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
Expand All @@ -9,6 +11,8 @@
import org.springframework.ui.Model;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import edu.asu.diging.vspace.core.model.ISpace;
import edu.asu.diging.vspace.core.model.impl.SpaceStatus;
import edu.asu.diging.vspace.core.services.IExhibitionManager;
import edu.asu.diging.vspace.core.services.ISpaceManager;

Expand All @@ -35,8 +39,13 @@ public void setExhibition(JoinPoint jp) {
if (!((Model) obj).containsAttribute("exhibition")) {
((Model) obj).addAttribute("exhibition", exhibitionManager.getStartExhibition());
}
if (!((Model) obj).containsAttribute("allSpaces")) {
((Model) obj).addAttribute("allSpaces", spaceManager.getAllSpaces());
if (!((Model) obj).containsAttribute("publishedSpaces")) {
List<ISpace> publishedSpaces=spaceManager.getSpacesWithStatus(SpaceStatus.PUBLISHED);
/* (non-Javadoc)
* Added to show spaces with null status and accommodate existing spaces with null space status
*/
publishedSpaces.addAll(spaceManager.getSpacesWithStatus(null));
((Model) obj).addAttribute("publishedSpaces", publishedSpaces);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.impl.Space;
import edu.asu.diging.vspace.core.model.impl.SpaceStatus;

@Repository
@JaversSpringDataAuditable
public interface SpaceRepository extends PagingAndSortingRepository<Space, String> {

List<Space> findTop5ByOrderByCreationDateDesc();

List<Space> findAllBySpaceStatus(SpaceStatus spaceStatus);

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,39 @@

import java.time.OffsetDateTime;

import edu.asu.diging.vspace.core.model.impl.SpaceStatus;

public interface IVSpaceElement {

String getId();
String getId();

void setId(String id);

String getName();

void setId(String id);
void setName(String name);

String getName();
String getDescription();

void setName(String name);
void setDescription(String description);

String getDescription();
String getCreatedBy();

void setDescription(String description);
void setCreatedBy(String createdBy);

String getCreatedBy();
OffsetDateTime getCreationDate();

void setCreatedBy(String createdBy);
void setCreationDate(OffsetDateTime creationDate);

OffsetDateTime getCreationDate();
String getModifiedBy();

void setCreationDate(OffsetDateTime creationDate);
void setModifiedBy(String modifiedBy);

String getModifiedBy();
OffsetDateTime getModificationDate();

void setModifiedBy(String modifiedBy);
void setModificationDate(OffsetDateTime modificationDate);

OffsetDateTime getModificationDate();
SpaceStatus getSpaceStatus();

void setModificationDate(OffsetDateTime modificationDate);
void setSpaceStatus(SpaceStatus status);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package edu.asu.diging.vspace.core.model.impl;

public enum SpaceStatus {
PUBLISHED,
UNPUBLISHED
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,96 +9,110 @@

@MappedSuperclass
public abstract class VSpaceElement implements IVSpaceElement {
private String name;
@Lob private String description;
private String createdBy;
private OffsetDateTime creationDate;
private String modifiedBy;
private OffsetDateTime modificationDate;
private SpaceStatus spaceStatus;

private String name;
@Lob private String description;
private String createdBy;
private OffsetDateTime creationDate;
private String modifiedBy;
private OffsetDateTime modificationDate;

/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getName()
*/
@Override
public String getName() {
return name;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setName(java.lang.String)
*/
@Override
public void setName(String name) {
this.name = name;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getDescription()
*/
@Override
public String getDescription() {
return description;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setDescription(java.lang.String)
*/
@Override
public void setDescription(String description) {
this.description = description;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreatedBy()
*/
@Override
public String getCreatedBy() {
return createdBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreatedBy(java.lang.String)
*/
@Override
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreationDate()
*/
@Override
public OffsetDateTime getCreationDate() {
return creationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreationDate(java.time.OffsetDateTime)
*/
@Override
public void setCreationDate(OffsetDateTime creationDate) {
this.creationDate = creationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModifiedBy()
*/
@Override
public String getModifiedBy() {
return modifiedBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModifiedBy(java.lang.String)
*/
@Override
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModificationDate()
*/
@Override
public OffsetDateTime getModificationDate() {
return modificationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModificationDate(java.time.OffsetDateTime)
*/
@Override
public void setModificationDate(OffsetDateTime modificationDate) {
this.modificationDate = modificationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getName()
*/
@Override
public String getName() {
return name;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setName(java.lang.String)
*/
@Override
public void setName(String name) {
this.name = name;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getDescription()
*/
@Override
public String getDescription() {
return description;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setDescription(java.lang.String)
*/
@Override
public void setDescription(String description) {
this.description = description;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreatedBy()
*/
@Override
public String getCreatedBy() {
return createdBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreatedBy(java.lang.String)
*/
@Override
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getCreationDate()
*/
@Override
public OffsetDateTime getCreationDate() {
return creationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setCreationDate(java.time.OffsetDateTime)
*/
@Override
public void setCreationDate(OffsetDateTime creationDate) {
this.creationDate = creationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModifiedBy()
*/
@Override
public String getModifiedBy() {
return modifiedBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModifiedBy(java.lang.String)
*/
@Override
public void setModifiedBy(String modifiedBy) {
this.modifiedBy = modifiedBy;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getModificationDate()
*/
@Override
public OffsetDateTime getModificationDate() {
return modificationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setModificationDate(java.time.OffsetDateTime)
*/
@Override
public void setModificationDate(OffsetDateTime modificationDate) {
this.modificationDate = modificationDate;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#getSpaceStatus()
*/
@Override
public SpaceStatus getSpaceStatus() {
return spaceStatus;
}
/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.model.impl.IVSpaceElement#setSpaceStatus(edu.asu.diging.vspace.core.model.impl.SpaceStatus)
*/
@Override
public void setSpaceStatus(SpaceStatus spaceStatus) {
this.spaceStatus = spaceStatus;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException;
import edu.asu.diging.vspace.core.model.ISpace;
import edu.asu.diging.vspace.core.model.IVSImage;
import edu.asu.diging.vspace.core.model.impl.SpaceStatus;
import edu.asu.diging.vspace.core.services.impl.CreationReturnValue;

public interface ISpaceManager {
Expand All @@ -19,5 +20,7 @@ public interface ISpaceManager {

List<ISpace> getAllSpaces();

List<ISpace> getSpacesWithStatus(SpaceStatus status);

void deleteSpaceById(String id) throws SpaceDoesNotExistException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import edu.asu.diging.vspace.core.model.display.ISpaceDisplay;
import edu.asu.diging.vspace.core.model.display.impl.SpaceDisplay;
import edu.asu.diging.vspace.core.model.impl.Space;
import edu.asu.diging.vspace.core.model.impl.SpaceStatus;
import edu.asu.diging.vspace.core.model.impl.VSImage;
import edu.asu.diging.vspace.core.services.IImageService;
import edu.asu.diging.vspace.core.services.ISpaceManager;
Expand Down Expand Up @@ -179,6 +180,13 @@ public List<ISpace> getAllSpaces() {
return spaces;
}

@Override
public List<ISpace> getSpacesWithStatus(SpaceStatus status) {
List<ISpace> spaces = new ArrayList<>();
spaceRepo.findAllBySpaceStatus(status).forEach(s -> spaces.add(s));
return spaces;
}

/**
* Method to delete space based on id
*
Expand Down
Loading

0 comments on commit 0c7b2e5

Please sign in to comment.