Skip to content
Open
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
0783f6d
[story/VSPC-204] added download section in staff page
May 26, 2022
d1b15cc
[story/VSPC-204] download api
Jun 8, 2022
e1cda05
[story/VSPC-204] added jsoup dependency
Jun 30, 2022
d68de99
[story/VSPC-204] modified download api response
Jul 1, 2022
9e509e2
[story/VSPC-204] copy images to new folder structure
Jul 5, 2022
70907bb
[story/VSPC-204] store images under eaach space
Jul 6, 2022
0d2e771
[story/VSPC-204] downlaod template modified to pick up images
Jul 7, 2022
78c5003
[story-VSPC-204] copied resources for css
Jul 8, 2022
1a6da12
[story/VSPC-204] converted to zip folder. added template for slides
Jul 11, 2022
7a71f63
[story/VSPC-204] added code to consider branching points
Jul 12, 2022
737dad5
[story/VSPC-204] zip folder download working as expected
Jul 13, 2022
0a24c03
[story/VSPC-204] list of downlods
Jul 22, 2022
ef2ee5a
[story/VSPC-204] refactored downloads manager
Jul 25, 2022
0c3e206
[story/VSPC-204] refactor
Jul 25, 2022
3caf863
[story/VSPC-204] test cases
Jul 26, 2022
b7d9442
[story/VSPC-204] test cases
Jul 27, 2022
34496eb
[story/VSPC-204] removed controller call to download html template
Jul 28, 2022
e74fe71
[story/VSPC-204] refactor
Jul 29, 2022
e280828
[story/VSPC-204]
Jul 29, 2022
dff8c3d
[story/VSPC-204] removed unwanted methods
Aug 1, 2022
e1bf075
[story/VSPC-204] code factor
Aug 1, 2022
3adad85
[story/VSPC-204] code factor
Aug 1, 2022
3a86887
[story/VSPC-204]
Aug 1, 2022
d2a9a14
Merge branch 'develop' into story/VSPC-204
Aug 2, 2022
3926ce1
[story/VSPC-204] review comments
pkharge Nov 1, 2022
7d8fb37
[story/VSPC-204] added async
pkharge Nov 2, 2022
9f521c3
[story/VSPC-204] async - polling
pkharge Nov 3, 2022
88c9b87
[story/VSPC-204] modifed backend
pkharge Nov 8, 2022
c7c6df4
[story/VSPC-204]
pkharge Nov 9, 2022
0847669
[story/VSPC-204] future task
pkharge Nov 10, 2022
4896d85
[story/VSPC-204] sequencehistory
pkharge Nov 15, 2022
1f2c46d
[story/VSPC-204] polling in javascript
pkharge Nov 16, 2022
4702909
[story/VSPC-204] thymeleaf context npe pending
pkharge Nov 30, 2022
3cc5781
[story/VSPC-204] async config
pkharge Dec 1, 2022
60bc618
[story/VSPC-204] testing branching point
pkharge Dec 2, 2022
1f4b4fd
[story/VSPC-204] review comment
pkharge Dec 6, 2022
da355c1
[story/VSPC-204] added new context to process template in async method
pkharge Dec 12, 2022
2a6ce84
[story/VSPC-204] modified space download template for async method
pkharge Dec 13, 2022
1c52717
[story/VSPC-204] async exhibition folder
pkharge Dec 14, 2022
0bdf246
[story/VSPC-204]
pkharge Dec 15, 2022
9fe3a25
[story/VSPC-204] 2 rest apis for polling
pkharge Dec 16, 2022
342f195
[story/VSPC-204] fixed ajax calls
pkharge Dec 19, 2022
0b8538e
[story/VSPC-204]progress spinner
pkharge Dec 20, 2022
f8cce1c
[story/VSPC-204] added different api for polling
pkharge Dec 21, 2022
b6f9027
[story/VSPC-204] read polling response in ui
pkharge Dec 22, 2022
fbfca18
[VSPC-204] async flow working fine
pkharge Jan 3, 2023
510692d
[story/VSPC-204] pagination added
pkharge Jan 4, 2023
9f390e4
[story/VSPC-204]test cases
pkharge Jan 5, 2023
8152349
[story/VSPC-204] added snapshot task entity
pkharge Jan 6, 2023
7ae7346
[story/VSPC-204 ]ui changes
pkharge Jan 10, 2023
d84796c
[story/VSPC-204] one to oen bidirectional
pkharge Jan 12, 2023
40a83b6
[story/VSPC-204] snapshot task fixed
pkharge Jan 14, 2023
4e716bf
[story/VSPC-204] ui alert, test cases
pkharge Jan 17, 2023
ccb6a35
[story/vspc-204] REFACTOR
pkharge Jan 19, 2023
cec7445
[story/vspc-204] refactor
pkharge Jan 19, 2023
effb3a5
[story/VSPC-204] refactor, test case
pkharge Jan 20, 2023
b7ab2e7
[story/VSPC-204] pom xml
pkharge Jan 20, 2023
8c64978
[story/VSPC-204 ] refactor
pkharge Jan 20, 2023
24fbc07
[story/VSPC-204] code factor
pkharge Jan 24, 2023
72abc69
[story/VSPC-204] code factor
pkharge Jan 24, 2023
1f05362
Merge branch 'develop' into story/VSPC-204
pkharge Jan 24, 2023
eeacaea
[story/VSPC-204] refactor
pkharge Mar 16, 2023
bcde954
[story/VSPC-204]
pkharge Mar 30, 2023
d00e77b
[story/VSPC-204] added folder type
pkharge Apr 18, 2023
bd85667
[story/VSPC-204] added relative paths
pkharge Apr 20, 2023
38ee8a9
[story/VSPC-204] testing
pkharge Apr 21, 2023
3d23f6d
[story/VSPC-204] relative path working zip folder downlaoding
pkharge Apr 25, 2023
e391b62
[story/VSPC-204] test case
pkharge Apr 27, 2023
c3e29aa
[story/VSPC-204]
pkharge Apr 27, 2023
0a1add5
[story/VSPC-204] storage engine added
pkharge May 4, 2023
9c1b8ed
[story/VSPC-204] bean storage engine
pkharge May 5, 2023
4c2fa90
[story/VSPC-204] code factor
pkharge May 5, 2023
eb029f3
[story/VSPC-204] code factor
pkharge May 5, 2023
7c9b5ba
[story/VSPC-204] code factor
pkharge May 5, 2023
aad9e14
[story/VSPC-204] merge conflict
pkharge May 9, 2023
ab92dad
[story/VSPC-204] review comments
pkharge May 18, 2023
80d3796
[story/VSPC-204] review comments
pkharge May 19, 2023
b19a2b6
[story/VSPC-204] Review comments
swetalina-prusty25 Jun 19, 2023
8ba400d
[story/VSPC-214] Resolved errors
swetalina-prusty25 Jun 20, 2023
52a24b3
[story/VSPC-204] create snapshot method
swetalina-prusty25 Jun 21, 2023
92b0062
[story/VSPC-204] Async Configuration
swetalina-prusty25 Jun 22, 2023
b0a44ad
[story/VSPC-204]Number format Exception
swetalina-prusty25 Jul 13, 2023
f777e53
[story/VSPC-204]Getting string value
swetalina-prusty25 Jul 14, 2023
d61e650
Code cleanup - removed spaces, fixed few errors
pooja-thalur Apr 22, 2024
7f3ce57
fixed the config issue and removed unused imports
pooja-thalur Apr 24, 2024
b35db5b
Addressed review comments
pooja-thalur Apr 26, 2024
7b232cc
removed debug statement
pooja-thalur Apr 26, 2024
35a495c
fixed the issue with creating a snapshot
pooja-thalur Apr 26, 2024
d9b3deb
fixed exceptions occured during testing
pooja-thalur May 2, 2024
44bbd99
Removing servlet context dependency as per review comments
pooja-thalur May 2, 2024
298e3d9
Changes to download resources folder
pooja-thalur May 3, 2024
6dc1fc0
Merge branch 'develop' into story/VSPC-204
pooja-thalur May 3, 2024
2357602
Code cleanup and addressing pr comments
pooja-thalur May 6, 2024
0134549
Codefactor issue
pooja-thalur May 6, 2024
4cf5d37
Code cleanup - removed unused imports
pooja-thalur May 6, 2024
70d45f3
removed sysout and console logs (VSPC-204)
pooja-thalur May 13, 2024
966c169
VSPC-204 removed spaces
pooja-thalur May 13, 2024
38794fa
logging the error
pooja-thalur May 13, 2024
d3b7e10
[VSPC-204] addressed pr comments
pooja-thalur May 30, 2024
1091f71
[VSPC-204] addressed pr comments
pooja-thalur May 31, 2024
d270fc0
[VSPC-204] addressed pr comments - renamed download to snapshots
pooja-thalur Jun 3, 2024
57bac32
[VSPC-204] addressed pr comments - added java doc
pooja-thalur Jun 4, 2024
be69f61
[VSPC-204] code cleanup
pooja-thalur Jun 5, 2024
b5ce14d
[VSPC-204] code cleanup
pooja-thalur Jun 6, 2024
502cbb9
[VSPC-204] delete folder after creating a zip
pooja-thalur Jun 7, 2024
e12f6f0
[VSPC-204] Fixed code factor issue
pooja-thalur Jun 10, 2024
e7857e9
[VSPC-204] Code cleanup
pooja-thalur Jun 10, 2024
7d6b9f0
[VSPC-204] addressed pr comments
pooja-thalur Jun 14, 2024
246caf4
[VSPC-204] addressed pr comments
pooja-thalur Jun 17, 2024
2635356
[VSPC-204] Addressed pr comments
pooja-thalur Jun 18, 2024
9da2084
[VSPC-204] code cleanup
pooja-thalur Jun 18, 2024
26e30c8
[VSPC-204] codefactor issue fixed
pooja-thalur Jun 18, 2024
fa22d8c
[VSPC-204] addressed pr comments
pooja-thalur Jun 20, 2024
a3afc68
[VSPC-204] addressed pr comments - to store branching point slide
pooja-thalur Jun 21, 2024
6b93127
[VSPC-204] addressed pr comments
pooja-thalur Jun 24, 2024
2d28775
[VSPC-204] addressed pr comments
pooja-thalur Jun 25, 2024
2a4149b
[VSPC-204] Addressed pr comments
pooja-thalur Jun 26, 2024
de3303d
[VSPC-204] Branching point rendering changes
pooja-thalur Jun 28, 2024
fd94f74
[VSPC-204] code cleanup
pooja-thalur Jul 2, 2024
74b3372
[VSPC-204] code cleanup
pooja-thalur Jul 3, 2024
9ebe4ce
[VSPC-204] addressed review comments
pooja-thalur Jul 23, 2024
e42f6fe
[VSPC-204]changed unit tests
pooja-thalur Jul 23, 2024
229ba5f
[VSPC-204] code cleanup and fixed testcases
pooja-thalur Jul 24, 2024
8ba9281
[VSPC-204] code refactored
pooja-thalur Jul 25, 2024
e42eac9
[VSPC-204] addressed pr comment
pooja-thalur Jul 26, 2024
e269bb1
[VSPC-204] addressing review comments
pooja-thalur Sep 3, 2024
504ff0b
[VSPC-204] addressed pr comments
pooja-thalur Sep 4, 2024
27c94a7
[VSPC-204] removed console logs
pooja-thalur Nov 6, 2024
334ff22
[VSPC-204] fixing issue on creating snapshot
pooja-thalur Nov 8, 2024
27bcf6b
Merge branch 'develop' into story/VSPC-204
pooja-thalur Jan 6, 2025
3d19a1e
[VSPC-204] Async changes
pooja-thalur Mar 26, 2025
79210a4
[VSPC-204] failing testcase fixed
pooja-thalur Apr 1, 2025
93b1aa9
[VSPC-204] review comments addressed
pooja-thalur Apr 9, 2025
d665d9e
[VSPC-204] async changes
pooja-thalur Apr 11, 2025
a205132
[VSPC-204] fixed unit tests
pooja-thalur Apr 15, 2025
5f1b1cc
[VSPC-204] code cleanup
pooja-thalur Apr 15, 2025
41d73db
Merge branch 'develop' into story/VSPC-204
pooja-thalur Apr 15, 2025
4256d9e
[VSPC-204] upload storage engine change
pooja-thalur Apr 17, 2025
2fa6b8c
[VSPC-204] Fixed ui issues, proper nav for exhibitions exports, worki…
Girik1105 Oct 3, 2025
937227c
[VSPC-204] Added AsyncSnapshotCreator interface
Girik1105 Oct 6, 2025
d7c3f76
[VSPC-204] Pom update
Girik1105 Oct 6, 2025
f1407a2
Merge branch 'develop' into story/VSPC-204
Girik1105 Oct 6, 2025
c66eac7
[VSPC-204] Fixed var cannot be resolved to type issue
Girik1105 Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion vspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<db.user>vspace</db.user>
<db.password>vspace</db.password>
<uploaded.files.path></uploaded.files.path>

<downloaded.files.path></downloaded.files.path>
<email.user></email.user>
<email.password></email.password>
<email.host></email.host>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.asu.diging.vspace.core.data;

import java.util.List;

import org.springframework.data.repository.PagingAndSortingRepository;

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

public interface ExhibitionDownloadRepository extends PagingAndSortingRepository<ExhibitionDownload, String> {

List<ExhibitionDownload> findAllByOrderByCreationDateDesc();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package edu.asu.diging.vspace.core.exception;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;

@ResponseStatus(value = HttpStatus.NOT_FOUND, reason = "Exhibition Download folder Not Found")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrect capitalization, should be "Exhibition download folder not found". Also, is the Exhibition download not found or the folder?

And also, let's loose the empty line after the annotation (line 7)


public class ExhibitionDownloadNotFoundException extends Exception{
private static final long serialVersionUID = 1L;

public ExhibitionDownloadNotFoundException(String id) {
super("Exhibition download folder with id " + id + " not found");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

public interface IStorageEngine {

String storeFile(byte[] fileContent, String filename, String directory) throws FileStorageException;
String storeFile(byte[] fileContent, String filename, String directory, String path) throws FileStorageException;

byte[] getImageContent(String directory, String filename) throws IOException;
byte[] getImageContent(String directory, String filename) throws IOException;

boolean renameImage(IVSImage image, String newFileName);
boolean renameImage(IVSImage image, String newFileName);

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Stream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
Expand All @@ -20,20 +29,23 @@
@Component
@PropertySource({"classpath:config.properties", "${appConfigFile:classpath:}/app.properties"})
public class StorageEngine implements IStorageEngine {
private final Logger logger = LoggerFactory.getLogger(getClass());

@Value("${uploads_path}")
private String path;

/* (non-Javadoc)
* @see edu.asu.diging.vspace.core.file.impl.IStorageEngine#storeFile(byte[], java.lang.String, java.lang.String)
*/
@Override
public String storeFile(byte[] fileContent, String filename, String directory) throws FileStorageException {
File parent = new File(path + File.separator + directory);
if (!parent.exists()) {
parent.mkdir();
}
File file = new File(parent.getAbsolutePath() + File.separator + filename);
* @see edu.asu.diging.vspace.core.file.impl.IStorageEngine#storeFile(byte[], java.lang.String, java.lang.String)
*/
@Override
public String storeFile(byte[] fileContent, String filename, String directory, String path) throws FileStorageException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, no this shouldn't be changed. The point of the storage engine is to take the guess work out of where files are stored. Why did you add this? Is this because of multiple places that files need to be stored, or because there are a defined number of places files should be stored (e.g. images and exhibition exports)? I suspect it's the latter? In that case, there should be simply two instances of storage engine, setup with different base paths. The instances can be created in a config class and then injected with qualifiers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdamerow , There is one scenario where files need to be stored at multiple paths. when we create spaces -> modules -> slides, the path varies and it reuses the same createfolder method by giving path as a parameter. if we want to remove path , I will have to create different methods for each type of folder that needs to be created.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not created multiple storage engines with different base paths?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can create 2 storage engines, one for uploads , one for downloads.
Now in the downloads storage engine, the paths are dynamic. so the createFolder and storeFile methods will still need a path parameter. Or there will be methods such as createSpace, createModule, createSlide, etc

File parent = new File(path + (directory!= null ? File.separator + directory : "" ));
if (!parent.exists()) {
parent.mkdir();
}
File file = new File(parent.getAbsolutePath() + File.separator + filename);


BufferedOutputStream stream;
try {
stream = new BufferedOutputStream(new FileOutputStream(file));
Expand All @@ -48,7 +60,8 @@ public String storeFile(byte[] fileContent, String filename, String directory) t
}

return directory;
}
}


@Override
public byte[] getImageContent(String directory, String filename) throws IOException {
Expand Down Expand Up @@ -89,4 +102,77 @@ public boolean renameImage(IVSImage image, String newFileName) {
File renamedFile = new File(path + File.separator + image.getId() + File.separator + newFileName);
return currentFile.renameTo(renamedFile);
}




public String createFolder(String folderName, String path ) {
File folder = new File(path + File.separator + folderName);
if (!folder.exists()) {
folder.mkdir();
}

return folder.getAbsolutePath();

}


/**
* Converts the given folder into a zip folder and returna byte array.
*
* @param folderPath
* @return
* @throws IOException
*/
public byte[] generateZipFolder(String folderPath) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just zip?

Path zipFile = Paths.get(folderPath);

try (
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(byteArrayOutputStream);
ZipOutputStream responseZipStream = new ZipOutputStream(bufferedOutputStream);

Stream<Path> paths = Files.walk(zipFile)) {
paths
.filter(path -> !Files.isDirectory(path))
.forEach(path -> {
ZipEntry zipEntry = new ZipEntry(zipFile.relativize(path).toString());
try {
responseZipStream.putNextEntry(zipEntry);
Files.copy(path, responseZipStream);
responseZipStream.closeEntry();

} catch (IOException e) {
System.err.println(e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

}
});
IOUtils.close(responseZipStream);
IOUtils.close(bufferedOutputStream);
IOUtils.close(byteArrayOutputStream);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can probably be tightened up by using try-with statements

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these needed since you're using the try-with statement?


return byteArrayOutputStream.toByteArray();

} catch (IOException e) {
throw new IOException(e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no point in wrapping an IOException in another IOException

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no point in wrapping an exception in the same type of exception. also it should be either logged and handled, or thrown, but not both.

}

}



/**
* Copies given image to imagesFolderPath
*
* @param image
* @param imagesFolderPath
*/
public void copyImageToFolder(IVSImage image, String imagesFolderPath) {
try {
byte[] byteArray = getImageContent(image.getId(), image.getFilename());
storeFile(byteArray, image.getFilename(),image.getId(), imagesFolderPath );

} catch (IOException | FileStorageException e) {
logger.error("Could not copy images" , e);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package edu.asu.diging.vspace.core.model;

public interface IExhibitionDownload {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package edu.asu.diging.vspace.core.model.impl;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import edu.asu.diging.vspace.core.model.IExhibitionDownload;

@Entity
public class ExhibitionDownload extends VSpaceElement implements IExhibitionDownload{

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

private String folderPath;

private String folderName;


public ExhibitionDownload() {
super();
}

public ExhibitionDownload(String folderPath, String folderName) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the path? absolute (which it shouldn't be), relative? Is it needed? can't the path be calculated automatically given the id?

super();
this.folderPath = folderPath;
this.folderName = folderName;
}

@Override
public String getId() {
return this.id; }

@Override
public void setId(String id) {
this.id = id;

}

public String getFolderPath() {
return folderPath;
}

public void setFolderPath(String folderPath) {
this.folderPath = folderPath;
}


public String getFolderName() {
return folderName;
}

public void setFolderName(String folderName) {
this.folderName = folderName;
}


}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package edu.asu.diging.vspace.core.services.impl;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.tika.Tika;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
Expand Down Expand Up @@ -73,6 +75,9 @@ public class ContentBlockManager implements IContentBlockManager {

@Autowired
private ContentBlockRepository contentBlockRepository;

@Value("${uploads_path}")
private String uploadsPath;

/*
* (non-Javadoc)
Expand Down Expand Up @@ -118,7 +123,7 @@ private void storeImageFile(byte[] image, IVSImage slideContentImage, String fil
if (slideContentImage != null) {
String relativePath = null;
try {
relativePath = storage.storeFile(image, filename, slideContentImage.getId());
relativePath = storage.storeFile(image, filename, slideContentImage.getId(), uploadsPath);
} catch (FileStorageException e) {
throw new ImageCouldNotBeStoredException(e);
}
Expand Down
Loading