forked from vivo-community/scholars-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add analytic views default with test
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/edu/tamu/scholars/middleware/defaults/AnalyticViewsDefaults.java
This file contains 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,35 @@ | ||
package edu.tamu.scholars.middleware.defaults; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Service; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
|
||
import edu.tamu.scholars.middleware.view.model.AnalyticView; | ||
import edu.tamu.scholars.middleware.view.model.repo.AnalyticViewRepo; | ||
|
||
@Service | ||
public class AnalyticViewsDefaults extends AbstractDefaults<AnalyticView, AnalyticViewRepo> { | ||
|
||
public AnalyticViewsDefaults() { | ||
super(); | ||
} | ||
|
||
@Override | ||
public String path() { | ||
return "classpath:defaults/analyticViews.yml"; | ||
} | ||
|
||
@Override | ||
public List<AnalyticView> read(InputStream is) throws IOException { | ||
List<AnalyticView> views = mapper.readValue(is, new TypeReference<List<AnalyticView>>() {}); | ||
for (AnalyticView view : views) { | ||
loadTemplateMap(view.getTemplates()); | ||
} | ||
return views; | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
src/main/java/edu/tamu/scholars/middleware/view/model/Layout.java
This file contains 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
package edu.tamu.scholars.middleware.view.model; | ||
|
||
public enum Layout { | ||
LIST, GRID | ||
LIST, GRID, CONTAINER | ||
} |
This file contains 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,5 @@ | ||
--- | ||
- name: Test | ||
layout: CONTAINER | ||
templates: | ||
default: "defaults/analyticViews/test/default.html" |
This file contains 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 @@ | ||
<h1>Test Analytics</h1> |