Skip to content

Commit

Permalink
Merge pull request #276 from diging/develop
Browse files Browse the repository at this point in the history
prepare release
  • Loading branch information
jdamerow authored Jan 21, 2022
2 parents 06f8277 + a906d4f commit 5f1b8e2
Show file tree
Hide file tree
Showing 56 changed files with 2,266 additions and 267 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

![Docker Image Version (latest by date)](https://img.shields.io/docker/v/digingasu/virtual-spaces?color=yellow&label=Docker%20Hub&sort=date)

Virtual Spaces 2.0 let's you build virtual exhibitions through a web application. Upload images of your (virtual or real) spaces and link them by placing links on them. Create modules that provide more details about the topics you present.
Virtual Spaces 2.0 lets you build virtual exhibitions through a web application. Upload images of your (virtual or real) spaces and link them by placing links on them. Create modules that provide more details about the topics you present.

You can find Virtual Spaces documentation [here](https://diging.atlassian.net/wiki/spaces/VS2D).
2 changes: 1 addition & 1 deletion vspace/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
</classpath>
1 change: 1 addition & 0 deletions vspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<tomcat.server.id>TomcatServer</tomcat.server.id>

<hibernate.show_sql></hibernate.show_sql>
<buildNumber>v0.16.1</buildNumber>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package edu.asu.diging.simpleusers.web.admin;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

import org.springframework.security.core.authority.SimpleGrantedAuthority;

/**
* Utility class that contains methods for ListUsersController
* @author Glen Dsouza
*/
public class UsersUtility {

/**
* This method checks if the User has a specific Role assigned to them.
* It takes as parameter a set of User Roles of the type SimpleGrantedAuthority
* and it validates if the User Role exists with the second parameter which is
* a String of the type of Role we need to validate.
* @param userRoles a set of SimpleGrantedAuthority containing details of the roles assigned to a User
* @param role the role that needs to be checked against userRoles
* @return Boolean: True if User is assigned the role, else False.
*/
public static Boolean checkUserRoleExists(Set<SimpleGrantedAuthority> userRoles, String role) {
return userRoles.stream().anyMatch(roleKey -> (roleKey.toString().equals(role)));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,22 @@
import java.util.List;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.impl.Module;

@Repository
@JaversSpringDataAuditable
public interface ModuleRepository extends PagingAndSortingRepository<Module, String> {

List<Module> findTop5ByOrderByCreationDateDesc();

List<Module> findAllByOrderByCreationDateDesc();

Page<IModule> findDistinctByNameContainingOrDescriptionContaining(Pageable requestedPage, String name,
String description);

List<Module> findAllByOrderByCreationDateDesc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import java.util.List;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.impl.Sequence;
import edu.asu.diging.vspace.core.model.impl.Slide;

Expand All @@ -16,8 +19,11 @@ public interface SlideRepository extends PagingAndSortingRepository<Slide, Strin

@Query("SELECT d FROM Slide d WHERE d.module.id = ?1")
public List<Slide> findSlidesForModule(String moduleId);

@Query("SELECT d.sequence FROM Slide d WHERE d.id = ?1")
public List<Sequence> getSequencesForSlide(String slideId);

Page<ISlide> findDistinctByNameContainingOrDescriptionContaining(Pageable requestedPage, String name,
String description);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import java.util.List;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

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

Expand All @@ -19,4 +22,6 @@ public interface SpaceRepository extends PagingAndSortingRepository<Space, Strin

List<Space> findAllByImageId(String imageId);

Page<ISpace> findDistinctByNameContainingOrDescriptionContaining(Pageable requestedPage, String name,
String description);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
package edu.asu.diging.vspace.core.data;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.impl.TextBlock;

@Repository
@JaversSpringDataAuditable
public interface TextContentBlockRepository extends PagingAndSortingRepository<TextBlock, String> {

@Query("SELECT DISTINCT c.slide FROM ContentBlock c, TextBlock t WHERE c.id = t.id AND t.text LIKE %?1%")
public Page<ISlide> findWithNameOrDescription(Pageable requestedPage, String searchText);

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ public interface ISlide extends IVSpaceElement {
void setContents(List<IContentBlock> contents);

List<IContentBlock> getContents();


IImageBlock getFirstImageBlock();

ITextBlock getFirstMatchedTextBlock(String searchTerm);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ public interface ITextBlock extends IContentBlock {
void setId(String id);

String getId();

String htmlRenderedText();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
Expand All @@ -18,28 +19,28 @@
import com.fasterxml.jackson.annotation.JsonIgnore;

import edu.asu.diging.vspace.core.model.IContentBlock;
import edu.asu.diging.vspace.core.model.IImageBlock;
import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.ISequence;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.ITextBlock;

@Entity
public class Slide extends VSpaceElement implements ISlide {

@Id
@GeneratedValue(generator = "slide_id_generator")
@GenericGenerator(name = "slide_id_generator",
parameters = @Parameter(name = "prefix", value = "SLI"),
strategy = "edu.asu.diging.vspace.core.data.IdGenerator")
@GenericGenerator(name = "slide_id_generator", parameters = @Parameter(name = "prefix", value = "SLI"), strategy = "edu.asu.diging.vspace.core.data.IdGenerator")
private String id;

@ManyToOne(targetEntity = Module.class)
private IModule module;

//-------- @JsonIgnore used as this entity will be returned in a controller
@JsonIgnore
// -------- @JsonIgnore used as this entity will be returned in a controller
@JsonIgnore
@OneToMany(targetEntity = ContentBlock.class, mappedBy = "slide", cascade = CascadeType.ALL)
private List<IContentBlock> contents;

@JsonIgnore
@ManyToMany(mappedBy = "slides", targetEntity = Sequence.class)
private List<ISequence> sequence;
Expand Down Expand Up @@ -77,8 +78,7 @@ public IModule getModule() {
/*
* (non-Javadoc)
*
* @see
* edu.asu.diging.vspace.core.model.impl.ISlide#setImage(edu.asu.diging.
* @see edu.asu.diging.vspace.core.model.impl.ISlide#setImage(edu.asu.diging.
* vspace. core.model.IModule)
*/
@Override
Expand Down Expand Up @@ -106,15 +106,14 @@ public int compare(IContentBlock o1, IContentBlock o2) {
/*
* (non-Javadoc)
*
* @see
* edu.asu.diging.vspace.core.model.impl.ISlide#setContents(edu.asu.diging.
* @see edu.asu.diging.vspace.core.model.impl.ISlide#setContents(edu.asu.diging.
* vspace. core.model.IContentBlock)
*/
@Override
public void setContents(List<IContentBlock> contents) {
this.contents = contents;
}

/*
* (non-Javadoc)
*
Expand All @@ -127,12 +126,51 @@ public List<ISequence> getSequence() {
/*
* (non-Javadoc)
*
* @see
* edu.asu.diging.vspace.core.model.impl.ISlide#setSequence(java.util.List)
* @see edu.asu.diging.vspace.core.model.impl.ISlide#setSequence(java.util.List)
*/
public void setSequence(List<ISequence> sequence) {
this.sequence = sequence;
}

/**
* This Method will retrieve the first ImageBlock of a slide if the ImageBlock
* is present
*
* @return IImageBlock
*/
@Override
@JsonIgnore
public IImageBlock getFirstImageBlock() {
List<IContentBlock> allBlocks = getContents();
if (allBlocks != null) {
Optional<IContentBlock> firstImageBlock = allBlocks.stream()
.filter(contentBlock -> contentBlock instanceof ImageBlock).findFirst();
if (firstImageBlock.isPresent()) {
return (ImageBlock) firstImageBlock.get();
}
}
return null;
}

/**
* This Method will return the first Text block whose content has searchTerm in
* it.
*
* @param searchTerm the search string which is being searched.
* @return TextBlock
*/
@Override
@JsonIgnore
public ITextBlock getFirstMatchedTextBlock(String searchTerm) {
List<IContentBlock> allBlocks = getContents();
if (allBlocks != null) {
Optional<IContentBlock> firstMatchedTextBlock = allBlocks.stream()
.filter(contentBlock -> contentBlock instanceof TextBlock)
.filter(contentBlock -> ((TextBlock) contentBlock).getText().contains(searchTerm)).findFirst();
if (firstMatchedTextBlock.isPresent()) {
return (TextBlock) firstMatchedTextBlock.get();
}
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ public void setText(String text) {
this.text = text;
}

/*
* (non-Javadoc)
*
* @see
* edu.asu.diging.vspace.core.model.impl.ITextBlock#htmlRenderedText()
*/
@Override
@Transient
public String htmlRenderedText() {
Parser parser = Parser.builder().build();
Node document = parser.parse(text);
HtmlRenderer renderer = HtmlRenderer.builder().build();
return renderer.render(document);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.ISequence;
import edu.asu.diging.vspace.core.model.ISlide;
Expand All @@ -19,5 +22,6 @@ public interface IModuleManager {
List<ISequence> getModuleSequences(String moduleId);

ISequence checkIfSequenceExists(String moduleId, String sequenceId);


Page<IModule> findByNameOrDescription(Pageable requestedPage,String searchText);
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package edu.asu.diging.vspace.core.services;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import edu.asu.diging.vspace.core.model.IBranchingPoint;
import edu.asu.diging.vspace.core.model.IChoice;
import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.display.SlideType;
import java.util.List;

import edu.asu.diging.vspace.core.model.impl.Sequence;
import edu.asu.diging.vspace.core.model.impl.Slide;
import edu.asu.diging.vspace.core.model.IChoice;
import edu.asu.diging.vspace.web.staff.forms.SlideForm;

public interface ISlideManager {
Expand All @@ -28,5 +31,6 @@ public interface ISlideManager {
void deleteSlideById(String slideId, String moduleId);

List<Sequence> getSlideSequences(String slideId, String moduleId);


Page<ISlide> findByNameOrDescription(Pageable requestedPage,String searchText);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException;
import edu.asu.diging.vspace.core.model.ISpace;
import edu.asu.diging.vspace.core.model.IVSImage;
Expand Down Expand Up @@ -33,5 +36,6 @@ public interface ISpaceManager {
List<SpaceLink> getIncomingLinks(String id);

Iterable<Space> addIncomingLinkInfoToSpaces(Iterable<Space> spaces);


Page<ISpace> findByNameOrDescription(Pageable requestedPage,String searchText);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package edu.asu.diging.vspace.core.services;

import org.springframework.data.domain.Page;

import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.ISpace;

public interface IStaffSearchManager {

Page<ISpace> searchInSpaces(String searchTerm, int page);

Page<IModule> searchInModules(String searchTerm, int page);

Page<ISlide> searchInSlides(String searchTerm, int page);

Page<ISlide> searchInSlideTexts(String searchTerm, int page);
}
Loading

0 comments on commit 5f1b8e2

Please sign in to comment.