Skip to content
Open
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
8001301
[VSPC-172] Description pop up for spacelink, modulelink and externallink
pradeep-017 Aug 20, 2021
0172279
[VSPC-172] Fixing the unit tests for latest changes of description as…
pradeep-017 Aug 23, 2021
c0274f7
[VSPC-172] Changes completed for descrition in modulelinks, space lin…
pradeep-017 Oct 8, 2021
f69a469
Merge branch 'develop' into story/VSPC-172
pradeep-017 Oct 8, 2021
46d8c98
[VSPC-172] Description for space and module links on public site
pradeep-017 Oct 11, 2021
e028619
Code indentation fixes for space.html
pradeep-017 Oct 11, 2021
bc51fc4
[VSPC-171] Added new SpaceBlock
glend17 Oct 27, 2021
7be602f
[VSPC-171] Added SpaceBlock type functionality
glend17 Oct 27, 2021
5efc1a9
[VSPC-171] Adding SpaceBlock functionality
glend17 Oct 28, 2021
11aa526
[VSPC-171] Front-end changes
glend17 Oct 29, 2021
f50002c
[VSPC-194] Changes for module links addition and Ui changes for modul…
pradeep-017 Oct 29, 2021
1bb50c2
[VSPC-171] Added drop down for staff to pick space to link to from sp…
glend17 Nov 1, 2021
afb962c
[VSPC-171] Bug checks
glend17 Nov 3, 2021
b6892fa
[VSPC-194] Image Module link create and edit function completed
pradeep-017 Nov 3, 2021
6ec14dd
[VSPC-171] Form fix
glend17 Nov 4, 2021
4d5a7a7
[VSPC-171] Space content block changes on slide.html
glend17 Nov 5, 2021
83b4e4d
[VSPC-171] Delete and edit related changes for space block
glend17 Nov 8, 2021
8c42767
[VSPC-194] Completed Unit tests
pradeep-017 Nov 8, 2021
56ec4db
[VSPC-194] COde cleanup
pradeep-017 Nov 8, 2021
733d50f
[VSPC-171] Unit test
glend17 Nov 10, 2021
dca101f
[VSPC-171] dropdown will keep track of selected space block
glend17 Nov 12, 2021
5eb2f6e
[VSPC-171] Code factor changes
glend17 Nov 15, 2021
1fda47d
[VSPC-171] PR code review change
glend17 Nov 15, 2021
12aaaec
[VSPC-171] Removing loggers
glend17 Nov 15, 2021
c5aef6c
[VSPC-196] Changes for selecting existing image in SpaceLink
pradeep-017 Nov 15, 2021
23c3726
[VSPC-196] Completed changes for selecting existing images for Spacel…
pradeep-017 Nov 29, 2021
6107df5
[VSPC-196] Completed create and delete part for external links. wip f…
pradeep-017 Dec 7, 2021
8112992
[VSPC-196] Wip for unit tests for SpaceLink, ModuleLink and ExternalLink
pradeep-017 Dec 10, 2021
60a2038
[VSPC-196] Unit tests for spaceLink, ExternalLinks completed
pradeep-017 Dec 13, 2021
4edcda8
[VSPC-196] Changes for unit tests and image preview fixes
pradeep-017 Dec 17, 2021
2d12110
[VSPC-172] Fix for label validation and separation between label and …
pradeep-017 Jan 10, 2022
cbdfedb
[VSPC-172] Changes for showing no tooltip for null lables or description
pradeep-017 Jan 11, 2022
358366e
[VSPC-196] CHanges for resetting the image selection fields on links
pradeep-017 Jan 25, 2022
52555a2
Merge remote-tracking branch 'origin/develop' into story/VSPC-196
pradeep-017 Jan 25, 2022
4bfd19b
[VSPC-196] fixes for merge related issues
pradeep-017 Jan 25, 2022
f7c9665
[VSPC-196] Changes for handling existing image Id and reset error on …
pradeep-017 Jan 26, 2022
766f0bb
[VSPC-172] Fix for external link label issue and code clean up
pradeep-017 Feb 1, 2022
89a3721
Merge remote-tracking branch 'origin/develop' into story/VSPC-172
pradeep-017 Feb 2, 2022
7581dff
Merge branch 'story/VSPC-196' into story/VSPC-172
pradeep-017 Feb 3, 2022
7d931ea
[VSPC-172] fixed issue with image hover
pradeep-017 Feb 3, 2022
4a39139
[VSPC-172] Fixed issues with position of images and code indentations
pradeep-017 Feb 9, 2022
e22d7b2
[VSPC-172] Chnages for fixing image coming again n again while editin…
pradeep-017 Feb 15, 2022
017bc82
[VSPC-171] PR Review comments
glend17 Feb 17, 2022
8801229
[VSPC-171] Review comments
glend17 Feb 17, 2022
67e4d0b
[VSPC-172] Changes for disabling image selection option for other lin…
pradeep-017 Feb 21, 2022
82fc9c0
[VSPC-171] PR Review comments
glend17 Feb 21, 2022
60d3fa1
[VSPC-171] PR review comments
glend17 Feb 21, 2022
b944cd7
[VSPC-171] Whitespace removal
glend17 Feb 21, 2022
e09cab5
[VSPC-172] Unit test changes and ui changes and code cleanup
pradeep-017 Feb 22, 2022
fb785dc
[VSPC-171] Exhibition side link
glend17 Feb 23, 2022
4132c9d
[VSPC-171] PR Review comments addressed
glend17 Feb 23, 2022
95178b1
[VSPC-171] PR review comments
glend17 Feb 23, 2022
eb24c98
[VSPC-171] merging with develop
glend17 Feb 23, 2022
c6ddad3
[VSPC 172] Worked on the review comments given to Pradeep
bnayak4 Mar 10, 2022
36209f9
[VSPC-171] PR comment on log
glend17 Mar 23, 2022
1ad4008
[VSPC-171] indentation
glend17 Mar 24, 2022
1fa0679
[VSPC-171] Indentation changes
glend17 Mar 28, 2022
b949658
[VSPC-171] Removing log
glend17 Mar 28, 2022
1bdae06
Merge branch 'story/vspc-171' of https://github.com/diging/virtual-sp…
glend17 Mar 28, 2022
e5964fc
[VSPC-171] implemented ajax call to get list of spaces
glend17 Mar 28, 2022
e5c50b7
[VSPC-171] Current selected space in edit space content block
glend17 Mar 29, 2022
0f644ac
[VSPC-171] Indentation fix
glend17 Mar 29, 2022
464560f
[VSPC-171] Space search
glend17 Mar 30, 2022
92c85b1
[VSPC-171] pagination and editspaceblock drop down
glend17 Mar 31, 2022
0f55c08
added changes to remove the merge conflicts for VSPC-172,196
bnayak4 Apr 1, 2022
f206c62
Merge branch 'develop' into story/VSPC-172
bnayak4 Apr 4, 2022
7cd76cd
[VSPC-171] current selected space for spaceblock
glend17 Apr 4, 2022
6702d39
[VSPC-171] adding headers to csrf
glend17 Apr 4, 2022
2b062e1
[VSPC-171] unit test
glend17 Apr 5, 2022
04ab7b6
[VSPC-171] overloaded space
glend17 Apr 5, 2022
5de472b
[VSPC-171] pr comments
glend17 Apr 6, 2022
5cf6e73
[VSPC-171] Organize imports
glend17 Apr 11, 2022
af9d3c9
[VSPC-171] Organized imports
glend17 Apr 11, 2022
dca6f80
[VSPC-171] merge with develop
glend17 Apr 11, 2022
e29fa72
[VSPC-171] page size call to db fix
glend17 Apr 18, 2022
fcca809
[VSPC-171] fix indentation issues
glend17 Apr 18, 2022
8fd80be
[VSPC-171] test cases fix
glend17 Apr 18, 2022
80cacd3
reverted back to 5ebdc4f5c54879534870c8643b229299ef74ef17 i.e. undoin…
bnayak4 May 6, 2022
ccd289a
reverted back to 5ebdc4f5c54879534870c8643b229299ef74ef17 i.e. undoin…
bnayak4 May 6, 2022
a0cce24
Story/vspc 180 (#257)
glend17 Apr 11, 2022
ae15b58
[VSPC-205] chaged the values of dropdown menu for a sequence (#281)
swetalina-prusty25 Apr 11, 2022
cff7158
[VSPC-193] Fixed space link, module link and external link placement …
tusanand Apr 11, 2022
b8546d3
Story/vspc 181 Deletion of modules (#268)
glend17 May 5, 2022
f1918e7
Bug/vspc 206 (#290)
swetalina-prusty25 May 5, 2022
78e0412
[VSPC-172] merged pradeeps's changes with develop
bnayak4 May 6, 2022
52630f4
[VSPC-172] Resolved merge conflict
bnayak4 May 6, 2022
cdb1717
[VSPC-171] Addressed review comments
glend17 May 12, 2022
54b7514
[VSPC-171] changing token input parameter
glend17 May 13, 2022
0bc365c
[VSPC-171] merge with develop
glend17 May 14, 2022
37f4b2a
[VSPC-171] worked on PR comment'
bnayak4 May 24, 2022
f72b91c
Merge remote-tracking branch 'origin/develop' into story/vspc-171
bnayak4 May 24, 2022
9b86698
[VSPC-171] added changes to merge the PR
bnayak4 Jun 9, 2022
580f127
[VSPC-171] added testcase for id which is not found
bnayak4 Jun 14, 2022
ea57318
[VSPC-171] added changes for testcase failure
bnayak4 Jun 21, 2022
61fc9ff
[VSPC-171] added test cases as mentioned in PR
bnayak4 Jun 29, 2022
85b7e40
[VSPC-171] added test cases
bnayak4 Jun 30, 2022
3a31b0e
[VSPC-171] added test cases to increase coverage
bnayak4 Jul 6, 2022
ba16291
[VSPC-171] added test case to increase the code coverage
bnayak4 Jul 6, 2022
025a3fb
[VSPC-171] addressed review comments
bnayak4 Jul 6, 2022
1cc4872
[VSPC-171] added changes to resolve codefactor.io problems
bnayak4 Jul 6, 2022
509407a
[VSPC-171] Addressed review comments
bnayak4 Jul 11, 2022
c208d60
[VSPC-171] changed method name
bnayak4 Jul 12, 2022
c91a409
[VSPC-171] removed merge conflicts
bnayak4 Mar 10, 2023
ff24e71
[VSPC-171] testing junits
bnayak4 Mar 10, 2023
6e25188
[VSPC-171] JUNITS
bnayak4 Mar 14, 2023
93de906
[VSPC-171] addressed review comments
bnayak4 Mar 14, 2023
45b7fcf
[VSPC-171] addressed review comments
bnayak4 Apr 18, 2023
086d464
[VSPC-171] addressed review comments
bnayak4 Apr 20, 2023
e5df44c
[vspc-172] CODE FACTOR
pkharge Sep 22, 2023
0eb0c40
[VSPC-172] code factor
pkharge Sep 26, 2023
0c7c70d
[VSPC-172] code factor
pkharge Sep 26, 2023
2e96970
[VSPC-172] merge conflict
pkharge Sep 26, 2023
eb4e190
[story/VSPC-171] review comments
pkharge Sep 28, 2023
dc62901
[story/VSPC-171] review comments
pkharge Sep 28, 2023
ca0e877
[VSPC-171] merge conflict
pkharge Sep 28, 2023
816412d
[VSPC-171] tooltip
pkharge Sep 29, 2023
7ce8c45
[VSPC-171] fixed close buttons
pkharge Oct 3, 2023
43b7f7b
[vspc-171] compile error tests
pkharge Oct 6, 2023
05eb7d1
[story/VSPC-171] review comments
pkharge Oct 17, 2023
ba0292e
story/VSPC-172 review comments
pkharge Nov 28, 2023
224d631
[VSPC-172] test case fix
pkharge Nov 30, 2023
14a8916
[VSPC-172]: Fixing save issues
diya17 Feb 14, 2024
fa2ebfe
[VSPC-196] Resetting required params if already uploaded image is sel…
diya17 Feb 16, 2024
e0bf726
[VSPC-172] Fixing jquery and adding validations
diya17 Feb 20, 2024
0207db5
[VSPC-172] Changing space.html
diya17 Feb 21, 2024
55efa32
[VSPC-172] Changing space.html
diya17 Feb 23, 2024
54b7726
[VSPV-172] Changes to UI
diya17 Feb 27, 2024
f9b2a90
[VSPC-172] Fixing UI
diya17 Feb 28, 2024
3528a34
VSPC-171 fixed null selection
ajay3568yadav Mar 15, 2024
fc52972
VSPC-171 block refreshing error
ajay3568yadav Mar 18, 2024
4ad80fd
VSPC-171 fixed space block deletion
ajay3568yadav Mar 20, 2024
94225ae
VSPC-171 removed console prints
ajay3568yadav Mar 22, 2024
38b05cd
VSPC-171 review comments
ajay3568yadav Mar 25, 2024
accfa4a
VSPC-171 review comments and image block
ajay3568yadav Mar 29, 2024
f6e0615
VSPC-171 fixed the image block creation
ajay3568yadav Apr 1, 2024
48cfd00
VSPC-171 review comments
ajay3568yadav Apr 13, 2024
88f6509
Merge branch 'develop' into story/vspc-171
ajay3568yadav May 3, 2024
d5bc0b2
VSPC-171 review comments
ajay3568yadav May 8, 2024
abbaba5
VSPC-171 attempt to fix reordering of content blocks
ajay3568yadav May 8, 2024
3128f1f
VSPC-171 build fail fix
ajay3568yadav May 8, 2024
fdf6de9
VSPC-172 added choose from existing option to the Spaces
ajay3568yadav May 10, 2024
78ecadf
Merge branch 'story/VSPC-172' of https://github.com/diging/virtual-sp…
ajay3568yadav May 10, 2024
e858c3d
VSPC-172 fixed the issue with opening link
pooja-thalur May 13, 2024
7a92d94
VSPC-196 added choose image option to modules and spaces
ajay3568yadav May 13, 2024
bc6c762
VSPC-196 merge conflicts
ajay3568yadav May 13, 2024
29d2ecd
Changes to display description
pooja-thalur May 14, 2024
668976f
Merge branch 'story/VSPC-172' of https://github.com/diging/virtual-sp…
pooja-thalur May 14, 2024
f7e30cb
[VSPC-172] UI changes to show description
pooja-thalur May 15, 2024
05d90c2
[VSPC-196] fixed choose from existing images
ajay3568yadav May 16, 2024
aa4defb
VPSC-196 merge conflicts
ajay3568yadav May 16, 2024
c7a778d
VSPC-196 added choose from existing images to space, module and exter…
ajay3568yadav May 17, 2024
8afaa88
VSPC-196 fixed space link
ajay3568yadav May 20, 2024
10b3652
[VSPC-172] Fixed indendations
Girik1105 Sep 26, 2025
92225f6
[VSPC-172] Fixed merge conflicts after merging develop
Girik1105 Sep 29, 2025
44b4d60
[VSPC-172] Fixed java exceptions
Girik1105 Oct 1, 2025
906b142
[VSPC-172] Fixed syntax errors
Girik1105 Oct 1, 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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.asu.diging.vspace.core.services;

import edu.asu.diging.vspace.core.exception.ImageCouldNotBeStoredException;
import edu.asu.diging.vspace.core.exception.ImageDoesNotExistException;
import edu.asu.diging.vspace.core.exception.LinkDoesNotExistsException;
import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException;
import edu.asu.diging.vspace.core.model.IExternalLink;
Expand All @@ -12,11 +13,11 @@
public interface IExternalLinkManager extends ILinkManager<IExternalLink, ExternalLinkValue, IExternalLinkDisplay>{

IExternalLinkDisplay createLink(String title, String id, float positionX, float positionY, int rotation, String linkedId,
String linkLabel, DisplayType displayType, byte[] linkImage, String imageFilename,ExternalLinkDisplayMode howToOpen)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException;
String linkLabel, String desc, DisplayType displayType, byte[] linkImage, String imageFilename,ExternalLinkDisplayMode howToOpen, String imageId)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException, ImageDoesNotExistException;

IExternalLinkDisplay updateLink(String title, String id, float positionX, float positionY, int rotation, String linkedId,
String linkLabel, String linkId, String linkDisplayId, DisplayType displayType, byte[] linkImage,
String imageFilename,ExternalLinkDisplayMode howToOpen)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException;
String linkLabel, String desc, String linkId, String linkDisplayId, DisplayType displayType, byte[] linkImage,
String imageFilename, String existingImageId, ExternalLinkDisplayMode howToOpen)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException, ImageDoesNotExistException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@
import java.util.List;

import edu.asu.diging.vspace.core.exception.ImageCouldNotBeStoredException;
import edu.asu.diging.vspace.core.exception.ImageDoesNotExistException;
import edu.asu.diging.vspace.core.exception.LinkDoesNotExistsException;
import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException;
import edu.asu.diging.vspace.core.model.ILink;
import edu.asu.diging.vspace.core.model.IVSpaceElement;
import edu.asu.diging.vspace.core.model.display.DisplayType;
import edu.asu.diging.vspace.core.model.display.ExternalLinkDisplayMode;
import edu.asu.diging.vspace.core.model.display.ILinkDisplay;

public interface ILinkManager<L extends ILink<T>, T extends IVSpaceElement, U extends ILinkDisplay> {

U createLink(String title, String id, float positionX, float positionY, int rotation, String linkedId,
String linkLabel, DisplayType displayType, byte[] linkImage, String imageFilename)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException;
String linkLabel, String linkDesc, DisplayType displayType, byte[] linkImage, String imageFilename, String existingImageId)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException, ImageDoesNotExistException;

U updateLink(String title, String id, float positionX, float positionY, int rotation, String linkedId,
String linkLabel, String linkId, String linkDisplayId, DisplayType displayType, byte[] linkImage,
String imageFilename)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException;
String linkLabel, String linkDesc, String linkId, String linkDisplayId, DisplayType displayType, byte[] linkImage,
String imageFilename, String existingImageId)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException, ImageDoesNotExistException;

List<U> getLinkDisplays(String spaceId);

void deleteLink(String linkId);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import edu.asu.diging.vspace.core.model.impl.ExternalLinkValue;
import edu.asu.diging.vspace.core.services.IExternalLinkManager;
import edu.asu.diging.vspace.core.services.ISpaceManager;

import edu.asu.diging.vspace.core.exception.ImageDoesNotExistException;
@Transactional
@Service
public class ExternalLinkManager extends LinkManager<IExternalLink, ExternalLinkValue, IExternalLinkDisplay>
Expand All @@ -49,15 +49,6 @@ public class ExternalLinkManager extends LinkManager<IExternalLink, ExternalLink
@Autowired
private IExternalLinkDisplayFactory externalLinkDisplayFactory;

@Autowired
private IImageFactory imageFactory;

@Autowired
private ImageRepository imageRepo;

@Autowired
private IStorageEngine storage;

@Override
public List<IExternalLinkDisplay> getLinkDisplays(String spaceId) {
return externalLinkDisplayRepo.findExternalLinkDisplaysForSpace(spaceId);
Expand Down Expand Up @@ -121,9 +112,10 @@ protected void deleteLinkRepo(IExternalLink link) {

@Override
public IExternalLinkDisplay createLink(String title, String id, float positionX, float positionY, int rotation,
String linkedId, String linkLabel, DisplayType displayType, byte[] linkImage, String imageFilename,
ExternalLinkDisplayMode howToOpen)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException {
String linkedId, String linkLabel, String desc, DisplayType displayType, byte[] linkImage, String imageFilename,
ExternalLinkDisplayMode howToOpen, String imageId )
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException, ImageDoesNotExistException {


/*
* When createLink is called then inside updateLinkAndDisplay(link, displayLink)
Expand All @@ -133,17 +125,17 @@ public IExternalLinkDisplay createLink(String title, String id, float positionX,
* automatically persist howToOpen in database.
*/
IExternalLinkDisplay externalLinkDisplay = createLink(title, id, positionX, positionY, rotation, linkedId,
linkLabel, displayType, linkImage, imageFilename);
linkLabel, desc, displayType, linkImage, imageFilename, imageId);
externalLinkDisplay.setHowToOpen(howToOpen);
return externalLinkDisplay;

}

@Override
public IExternalLinkDisplay updateLink(String title, String id, float positionX, float positionY, int rotation,
String linkedId, String linkLabel, String linkId, String linkDisplayId, DisplayType displayType,
byte[] linkImage, String imageFilename, ExternalLinkDisplayMode howToOpen)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException {
String linkedId, String linkLabel, String desc, String linkId, String linkDisplayId, DisplayType displayType,
byte[] linkImage, String imageFilename, String existingImageId, ExternalLinkDisplayMode howToOpen)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException, ImageDoesNotExistException {

/*
* When updateLink is called then inside updateLinkAndDisplay(link, displayLink)
Expand All @@ -153,9 +145,9 @@ public IExternalLinkDisplay updateLink(String title, String id, float positionX,
* automatically persist howToOpen in database.
*/
IExternalLinkDisplay externalLinkDisplay = updateLink(title, id, positionX, positionY, rotation, linkedId,
linkLabel, linkId, linkDisplayId, displayType, linkImage, imageFilename);
linkLabel, desc, linkId, linkDisplayId, displayType, linkImage, imageFilename, existingImageId);
externalLinkDisplay.setHowToOpen(howToOpen);
return externalLinkDisplay;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
import edu.asu.diging.vspace.core.model.IVSImage;
import edu.asu.diging.vspace.core.model.IVSpaceElement;
import edu.asu.diging.vspace.core.model.display.DisplayType;
import edu.asu.diging.vspace.core.model.display.ExternalLinkDisplayMode;
import edu.asu.diging.vspace.core.model.display.ILinkDisplay;
import edu.asu.diging.vspace.core.model.impl.VSImage;
import edu.asu.diging.vspace.core.services.IImageService;
import edu.asu.diging.vspace.core.services.ILinkManager;
import edu.asu.diging.vspace.core.services.ISpaceManager;

import edu.asu.diging.vspace.core.exception.ImageDoesNotExistException;
@Transactional
public abstract class LinkManager<L extends ILink<T>, T extends IVSpaceElement, U extends ILinkDisplay>
implements ILinkManager<L, T, U> {
Expand All @@ -36,37 +38,66 @@ public abstract class LinkManager<L extends ILink<T>, T extends IVSpaceElement,

@Autowired
private IStorageEngine storage;

@Autowired
private IImageService imageService;

protected abstract void deleteLinkRepo(L link);

protected abstract void deleteLinkDisplayRepo(L link);

protected abstract void removeFromLinkList(ISpace space, L link);

protected abstract U updateLinkAndDisplay(L link, U displayLink);

protected abstract U getDisplayLink(String linkDisplayId) throws LinkDoesNotExistsException;

protected abstract L getLink(String linkId);

protected abstract L createLinkObject(String title, String id);

protected abstract T getTarget(String linkedId);

protected abstract U createDisplayLink(L link);

@Override
public U createLink(String title, String id, float positionX, float positionY, int rotation, String linkedId,
String linkLabel, DisplayType displayType, byte[] linkImage, String imageFilename)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException {
String linkLabel, String linkDesc, DisplayType displayType, byte[] linkImage, String imageFilename, String existingImageId)
throws SpaceDoesNotExistException, ImageCouldNotBeStoredException, SpaceDoesNotExistException, ImageDoesNotExistException {

L link = createLinkObject(title, id);
T target = getTarget(linkedId);
link.setName(linkLabel);
link.setDescription(linkDesc);
link.setTarget(target);
U displayLink = createDisplayLink(link);
setDisplayProperties(displayLink, id, positionX, positionY, rotation, displayType, linkImage, imageFilename);
if(existingImageId!=null && !existingImageId.trim().isEmpty()) {
setDisplayProperties(displayLink, positionX, positionY, rotation, displayType, existingImageId);
} else {
setDisplayProperties(displayLink, id, positionX, positionY, rotation, displayType, linkImage, imageFilename);
}
return updateLinkAndDisplay(link, displayLink);

}

@Override
public U updateLink(String title, String id, float positionX, float positionY, int rotation, String linkedId,
String linkLabel, String linkId, String linkDisplayId, DisplayType displayType, byte[] linkImage,
String imageFilename)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException {

String linkLabel, String linkDesc, String linkId, String linkDisplayId, DisplayType displayType, byte[] linkImage,
String imageFilename, String existingImageId)
throws SpaceDoesNotExistException, LinkDoesNotExistsException, ImageCouldNotBeStoredException, ImageDoesNotExistException {
validateSpace(id);

L link = getLink(linkId);
T target = getTarget(linkedId);
link.setName(title);
link.setDescription(linkDesc);
link.setTarget(target);
U displayLink = getDisplayLink(linkDisplayId);
setDisplayProperties(displayLink, id, positionX, positionY, rotation, displayType, linkImage, imageFilename);
return updateLinkAndDisplay(link, displayLink);
if(existingImageId!=null && !existingImageId.trim().isEmpty()) {
setDisplayProperties(displayLink, positionX, positionY, rotation, displayType, existingImageId);
} else {
setDisplayProperties(displayLink, id, positionX, positionY, rotation, displayType, linkImage, imageFilename);
}
return updateLinkAndDisplay(link,displayLink);
}

@Override
Expand All @@ -77,38 +108,26 @@ public void deleteLink(String linkId) {
deleteLinkRepo(link);
}

protected abstract void deleteLinkRepo(L link);

protected abstract void deleteLinkDisplayRepo(L link);

protected abstract void removeFromLinkList(ISpace space, L link);

protected abstract U updateLinkAndDisplay(L link, U displayLink);

protected abstract U getDisplayLink(String linkDisplayId) throws LinkDoesNotExistsException;

protected abstract L getLink(String linkId);

protected abstract L createLinkObject(String title, String id);

protected abstract T getTarget(String linkedId);

protected abstract U createDisplayLink(L link);

protected void validateSpace(String id) throws SpaceDoesNotExistException {
ISpace source = spaceManager.getSpace(id);
if (source == null) {
throw new SpaceDoesNotExistException();
}
}

protected void setLinkDisplay(ILinkDisplay linkDisplay, float positionX, float positionY, int rotation, DisplayType displayType) {
linkDisplay.setPositionX(positionX);
linkDisplay.setPositionY(positionY);
linkDisplay.setRotation(rotation);
linkDisplay.setType(displayType != null ? displayType : DisplayType.ARROW);
}

protected void setDisplayProperties(ILinkDisplay linkDisplay, String id, float positionX, float positionY,
int rotation, DisplayType displayType, byte[] linkImage, String imageFilename)
throws ImageCouldNotBeStoredException {
linkDisplay.setPositionX(positionX);
linkDisplay.setPositionY(positionY);
linkDisplay.setRotation(rotation);
linkDisplay.setType(displayType != null ? displayType : DisplayType.ARROW);

setLinkDisplay(linkDisplay, positionX, positionY, rotation, displayType);

if (linkImage != null && linkImage.length > 0) {
Tika tika = new Tika();
String contentType = tika.detect(linkImage);
Expand All @@ -126,5 +145,15 @@ protected void setDisplayProperties(ILinkDisplay linkDisplay, String id, float p
}

}

protected void setDisplayProperties(ILinkDisplay linkDisplay, float positionX, float positionY, int rotation,
DisplayType displayType, String existingImageId) throws ImageCouldNotBeStoredException, ImageDoesNotExistException {
setLinkDisplay(linkDisplay, positionX, positionY, rotation, displayType);
if(existingImageId!=null && !existingImageId.trim().isEmpty()) {
IVSImage image = imageService.getImageById(existingImageId);
linkDisplay.setImage(image);
}

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.fasterxml.jackson.databind.node.ObjectNode;

import edu.asu.diging.vspace.core.exception.ImageCouldNotBeStoredException;
import edu.asu.diging.vspace.core.exception.ImageDoesNotExistException;
import edu.asu.diging.vspace.core.exception.SpaceDoesNotExistException;
import edu.asu.diging.vspace.core.model.ISpace;
import edu.asu.diging.vspace.core.model.display.DisplayType;
Expand All @@ -37,9 +38,11 @@ public class AddExternalLinkController {
@RequestMapping(value = "/staff/space/{id}/externallink", method = RequestMethod.POST)
public ResponseEntity<String> createExternalLink(@PathVariable("id") String id, @RequestParam("x") String x,
@RequestParam("y") String y, @RequestParam("externalLinkLabel") String title,
@RequestParam("externalLinkDesc") String desc,
@RequestParam("url") String externalLink, @RequestParam("tabOpen") String howToOpen,
@RequestParam("type") String displayType, @RequestParam("externalLinkImage") MultipartFile file)
throws NumberFormatException, SpaceDoesNotExistException, IOException, ImageCouldNotBeStoredException {
@RequestParam("type") String displayType, @RequestParam("externalLinkImage") MultipartFile file,
@RequestParam(value="imageId", required=false) String imageId)
throws NumberFormatException, SpaceDoesNotExistException, IOException, ImageCouldNotBeStoredException, ImageDoesNotExistException {

ISpace space = spaceManager.getSpace(id);
if (space == null) {
Expand All @@ -56,7 +59,8 @@ public ResponseEntity<String> createExternalLink(@PathVariable("id") String id,
ExternalLinkDisplayMode externalLinkOpenMode = howToOpen.isEmpty() ? null
: ExternalLinkDisplayMode.valueOf(howToOpen);
IExternalLinkDisplay display = externalLinkManager.createLink(title, id, new Float(x), new Float(y), 0,
externalLink, title, type, linkImage, filename, externalLinkOpenMode);
externalLink, title, desc, type, linkImage, filename, externalLinkOpenMode, imageId);

ObjectMapper mapper = new ObjectMapper();
ObjectNode linkNode = mapper.createObjectNode();
linkNode.put("id", display.getExternalLink().getId());
Expand All @@ -67,4 +71,4 @@ public ResponseEntity<String> createExternalLink(@PathVariable("id") String id,

return new ResponseEntity<>(mapper.writeValueAsString(linkNode), HttpStatus.OK);
}
}
}
Loading