Repository navigation
Feature/ggw 369/export import structures #4518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brianbrix
wants to merge
83
commits into
future/v4.0
Choose a base branch
from
feature/GGW-369/Export-Import-Structures
base: future/v4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
ccbcf4b
Ad import export structures buttons
brianbrix 4661655
Ad import export structures buttons
brianbrix da65a34
Ad import export structures buttons
brianbrix af64f8b
Ad import export structures buttons
brianbrix 5e96f3f
Ad import export structures buttons
brianbrix 26fd0d7
Ad import export structures buttons
brianbrix 8897dda
Ad import export structures buttons
brianbrix 35e7f55
Add import export structures buttons
brianbrix 0c38bc1
Import button color
brianbrix d13e4a0
GGW-369: Resolve project saving ajax issue
brianbrix e35889c
GGW-369: Resolve project saving ajax issue
brianbrix b14ca23
GGW-369: Resolve project saving ajax issue
brianbrix 23f05c2
GGW-369: Resolve project saving ajax issue
brianbrix b5c2f77
GGW-369: Resolve project saving ajax issue
brianbrix cddc9f2
GGW-369: Resolve project saving ajax issue
brianbrix a7d570d
GGW-369: Resolve project saving ajax issue
brianbrix 64710e5
GGW-369: Resolve project saving ajax issue
brianbrix 4efac49
GGW-369: Resolve project saving ajax issue
brianbrix ac17a61
GGW-369: Resolve project saving ajax issue
brianbrix a368cf5
GGW-369: Resolve project saving ajax issue
brianbrix a925a5c
GGW-369: Resolve project saving ajax issue
brianbrix 6bda795
GGW-369: Resolve project saving ajax issue
brianbrix 964d352
GGW-369: Resolve project saving ajax issue
brianbrix 82f28d0
GGW-369: Resolve project saving ajax issue
brianbrix 26c05ba
GGW-369: Structures section styling
brianbrix 32b470b
GGW-369: Structures section styling
brianbrix b188988
GGW-369: Structures section styling
brianbrix 516e766
GGW-369: Structures section styling
brianbrix 42d6ea9
GGW-369: Structures section styling
brianbrix 4e3d3ed
GGW-369: Structures section styling
brianbrix 7ca9109
GGW-369 arrange colors
jdeanquin-dg bf2927a
GGW-369 arrange colors
jdeanquin-dg 563c0a6
AMP-31212 : Enhance security by securing cookies and ensuring coss-si…
brianbrix f258f39
AMP-31212 : Fixing failing docker build
brianbrix 9c62ce9
AMP-31212 : Fixing failing docker build
brianbrix 4d6f010
AMP-31212 : Wrongly formatted patch
brianbrix 9db5021
Remove HttpOnly setting from cookie
brianbrix e715e5f
Change SameSite cookie policy from strict to lax
brianbrix bc47814
Failing to load assets
brianbrix 103c23c
Failing to load assets
brianbrix 3b68b90
Failing to load assets
brianbrix 09f0ee7
Failing to load assets
brianbrix 153fd4b
Secure cookies in HttpLoginManager
brianbrix 53f13f1
Upgrade tomcat to v9
brianbrix 5571752
Downgrade back to tomcat 8.5.100
brianbrix 3937b68
Set secure flag for userNameCookie to true
brianbrix 941fe4a
Set session cookie to secure mode
brianbrix 4a8df0d
Merge pull request #4515 from devgateway/fix/AMP-31205/PIDC-Security-…
jdeanquin-dg 32ef2e8
Merge branch 'develop' into feature/GGW-369/Export-Import-Structures
brianbrix c1883c3
Refactor Excel export to use AmpStructure list directly
brianbrix 64abb3e
Refactor loop to iterate over AmpStructure list
brianbrix 910940a
Close file stream automatically
brianbrix 88c1bc7
Merge remote-tracking branch 'origin/feature/GGW-369/Export-Import-St…
brianbrix 332ef3c
Refactor resource panel setup in AmpStructuresFormSection
brianbrix 524dec3
Copilot comments resolution
brianbrix 841e8c6
Merge remote-tracking branch 'origin/feature/GGW-369/Export-Import-St…
brianbrix 393cc4f
Potential fix for pull request finding 'Secure login cookie breaks pe…
brianbrix 637cb43
Add check for empty sheet in AmpStructuresFormSectionFeature
brianbrix c3aa0da
Add missing shape column
brianbrix 0ba2907
Merge remote-tracking branch 'origin/feature/GGW-369/Export-Import-St…
brianbrix e08f406
Check for structure title duplicates
brianbrix 5b8e49c
Allign structures section correctly
brianbrix 9f32bf7
Avoid automatic upload on file chooser
brianbrix d7ad2b2
Use rest endpoitn to upload structures
brianbrix 67d965b
Use rest endpoint to upload files
brianbrix 6b4453a
Use rest endpoint to upload files
brianbrix 2d453de
Change upload status message
brianbrix fd23745
Correct upload status message
brianbrix 399f228
Change downloadLink addition to rc.add method
brianbrix 3f17829
Add stagedUploadResponse to target after setting model
brianbrix ef918e1
Fix method call to add exportStructures
brianbrix c002b69
Update file size validation for uploads
brianbrix 070e3fa
Expire staged uploads and limit file size and number
brianbrix 7f2542d
Merge remote-tracking branch 'origin/feature/GGW-369/Export-Import-St…
brianbrix 4757e87
Refactor byte limit calculation for uploads
brianbrix 30cbb66
Fix content length check for workbook upload
brianbrix eb750d1
Expire staged uploads and limit file size and number
brianbrix 813172c
Add exception for exceeding workbook size limit
brianbrix fb806f8
Merge remote-tracking branch 'origin/feature/GGW-369/Export-Import-St…
brianbrix ff0bc22
Wrongly placed container error
brianbrix 3a43de1
Wrongly placed container error
brianbrix 74542bb
Wrongly placed container error
brianbrix 6ce49d1
Remove deleteOnExit for staged upload file
brianbrix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
31 changes: 31 additions & 0 deletions
31
amp/src/main/java/org/dgfoundation/amp/onepager/XFrameOptionsFilter.java
This file contains hidden or 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,31 @@ | ||
| package org.dgfoundation.amp.onepager; | ||
|
|
||
| import javax.servlet.Filter; | ||
| import javax.servlet.FilterChain; | ||
| import javax.servlet.FilterConfig; | ||
| import javax.servlet.ServletException; | ||
| import javax.servlet.ServletRequest; | ||
| import javax.servlet.ServletResponse; | ||
| import javax.servlet.http.HttpServletResponse; | ||
| import java.io.IOException; | ||
|
|
||
| public class XFrameOptionsFilter implements Filter { | ||
| @Override | ||
| public void init(FilterConfig filterConfig) throws ServletException { | ||
| // Initialization code if needed | ||
| } | ||
|
|
||
| @Override | ||
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) | ||
| throws IOException, ServletException { | ||
| HttpServletResponse httpResponse = (HttpServletResponse) response; | ||
| httpResponse.setHeader("Access-Control-Allow-Origin", "*"); | ||
| httpResponse.setHeader("X-Frame-Options", "SAMEORIGIN"); | ||
| chain.doFilter(request, response); | ||
| } | ||
|
|
||
| @Override | ||
| public void destroy() { | ||
| // Cleanup code if needed | ||
| } | ||
| } |
This file contains hidden or 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
...ava/org/dgfoundation/amp/onepager/components/features/CustomResourceLinkResourceLink.java
This file contains hidden or 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 org.dgfoundation.amp.onepager.components.features; | ||
|
|
||
| import org.apache.wicket.markup.html.link.ResourceLink; | ||
| import org.apache.wicket.request.resource.ResourceReference; | ||
|
|
||
| public class CustomResourceLinkResourceLink<Void> extends ResourceLink<Void> { | ||
| public CustomResourceLinkResourceLink(String id, ResourceReference resourceReference) { | ||
| super(id, resourceReference); | ||
| } | ||
| private ExportExcelResourceReference exportExcelResourceReference; | ||
| public void setReference(ExportExcelResourceReference resourceReference) { | ||
| this.exportExcelResourceReference=resourceReference; | ||
| } | ||
|
|
||
| } |
102 changes: 102 additions & 0 deletions
102
.../java/org/dgfoundation/amp/onepager/components/features/ExportExcelResourceReference.java
This file contains hidden or 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,102 @@ | ||
| package org.dgfoundation.amp.onepager.components.features; | ||
|
|
||
| import org.apache.poi.xssf.usermodel.XSSFRow; | ||
| import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
| import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
| import org.apache.wicket.Component; | ||
| import org.apache.wicket.request.resource.AbstractResource; | ||
| import org.apache.wicket.request.resource.ContentDisposition; | ||
| import org.apache.wicket.request.resource.IResource; | ||
| import org.apache.wicket.request.resource.ResourceReference; | ||
| import org.apache.wicket.util.io.ByteArrayOutputStream; | ||
| import org.dgfoundation.amp.onepager.components.ListItem; | ||
| import org.dgfoundation.amp.onepager.components.PagingListEditor; | ||
| import org.digijava.module.aim.dbentity.AmpStructure; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import javax.servlet.http.HttpServletResponse; | ||
| import java.io.IOException; | ||
|
|
||
| public class ExportExcelResourceReference extends ResourceReference { | ||
|
|
||
| private static final Logger logger = LoggerFactory.getLogger(ExportExcelResourceReference.class); | ||
| PagingListEditor<AmpStructure> list; | ||
| public void setList(PagingListEditor<AmpStructure> list) | ||
| { | ||
| this.list = list; | ||
| } | ||
| public PagingListEditor<AmpStructure> getList() | ||
| { | ||
| return list; | ||
| } | ||
| public ExportExcelResourceReference() { | ||
| super("export-excel"); | ||
| } | ||
|
|
||
| @Override | ||
| public IResource getResource() { | ||
| return new AbstractResource() { | ||
| @Override | ||
| protected ResourceResponse newResourceResponse(Attributes attributes) { | ||
| ResourceResponse response = new ResourceResponse(); | ||
|
|
||
| // Set response metadata | ||
| response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); | ||
| response.setContentDisposition(ContentDisposition.ATTACHMENT); | ||
| response.setFileName("structures.xlsx"); | ||
|
|
||
| if (response.dataNeedsToBeWritten(attributes)) { | ||
| try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | ||
| XSSFWorkbook workbook = new XSSFWorkbook()) { | ||
| // Create Excel sheet | ||
| XSSFSheet sheet = workbook.createSheet("Structures"); | ||
|
|
||
| // Create header row | ||
| XSSFRow headerRow = sheet.createRow(0); | ||
| headerRow.createCell(0).setCellValue("Title"); | ||
| headerRow.createCell(1).setCellValue("Description"); | ||
| headerRow.createCell(2).setCellValue("Latitude"); | ||
| headerRow.createCell(3).setCellValue("Longitude"); | ||
|
|
||
| int rowIndex = 1; | ||
| for (AmpStructure structure : getList().getModel().getObject()) { | ||
| XSSFRow row = sheet.createRow(rowIndex); | ||
| if (structure != null) { | ||
| createCellIfNotNull(row, 0, structure.getTitle()); | ||
| createCellIfNotNull(row, 1, structure.getDescription()); | ||
| createCellIfNotNull(row, 2, structure.getLatitude()); | ||
| createCellIfNotNull(row, 3, structure.getLongitude()); | ||
| } | ||
| rowIndex++; | ||
| } | ||
|
|
||
| // Write workbook content to the output stream | ||
| workbook.write(outputStream); | ||
|
|
||
| // Respond with the written content | ||
| response.setWriteCallback(new WriteCallback() { | ||
| @Override | ||
| public void writeData(Attributes attributes) throws IOException { | ||
| attributes.getResponse().write(outputStream.toByteArray()); | ||
| } | ||
| }); | ||
| } catch (IOException e) { | ||
| logger.error("Error exporting data to Excel", e); | ||
| response.setError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); | ||
| } | ||
| } | ||
|
|
||
| return response; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| // Helper method for creating cells | ||
| private void createCellIfNotNull(XSSFRow row, int columnIndex, Object value) { | ||
| if (value != null) { | ||
| row.createCell(columnIndex).setCellValue(value.toString()); | ||
| } | ||
| } | ||
|
|
||
| } |
31 changes: 31 additions & 0 deletions
31
...src/main/java/org/dgfoundation/amp/onepager/components/features/FileUploadModalPanel.java
This file contains hidden or 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,31 @@ | ||
| package org.dgfoundation.amp.onepager.components.features; | ||
| import org.apache.wicket.ajax.AjaxRequestTarget; | ||
| import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink; | ||
| import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow; | ||
| import org.apache.wicket.markup.html.form.Form; | ||
| import org.apache.wicket.markup.html.panel.Panel; | ||
| import org.apache.wicket.model.IModel; | ||
| import org.apache.wicket.model.Model; | ||
| import org.apache.wicket.util.upload.FileItem; | ||
| import org.dgfoundation.amp.onepager.components.upload.FileUploadPanel; | ||
|
|
||
| public class FileUploadModalPanel extends Panel { | ||
|
|
||
| public FileUploadModalPanel(String id, ModalWindow modalWindow) { | ||
| super(id); | ||
|
|
||
| Form<?> form = new Form<>("uploadForm"); | ||
| IModel<FileItem> fileItemModel = new Model<>(); | ||
| form.add(new FileUploadPanel("fileUploadField", "new", fileItemModel)); | ||
|
|
||
| form.add(new AjaxSubmitLink("uploadButton", form) { | ||
| protected void onSubmit(AjaxRequestTarget target) { | ||
| if (fileItemModel.getObject() != null) { | ||
| modalWindow.close(target); | ||
| } | ||
| } | ||
| }); | ||
|
|
||
| add(form); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.