Skip to content

Commit

Permalink
Merge pull request #4 from IQSS/master
Browse files Browse the repository at this point in the history
Update beta branch to 5/6
  • Loading branch information
kcondon committed May 6, 2014
2 parents e424392 + 55e1813 commit 3a5bee9
Show file tree
Hide file tree
Showing 60 changed files with 7,549 additions and 659 deletions.
22 changes: 13 additions & 9 deletions doc/Sphinx/source/User/dataverse-management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,40 @@ Creating a dataverse is easy but first you must be a registered user (see Create
#. Once on the "New Dataverse" page fill in the following fields:
* Enter the name of your Dataverse.
* **Host Dataverse**: select which dataverse you would like this new dataverse to belong to. By default it will be a child dataverse of the parent you clicked from.
* **Dataverse Alias**: This is an abbreviation, usually lower-case, that becomes part of the URL for the new dataverse. Special characters (~,\`, !, @, #, $, %, ^, &, and \*) and spaces are not allowed. **Note**: if you change the Dataverse Alias field, the URL for your Dataverse changes (http//.../dv/'alias'), which affects links to this page.
* **Alias**: This is an abbreviation, usually lower-case, that becomes part of the URL for the new dataverse. Special characters (~,\`, !, @, #, $, %, ^, &, and \*) and spaces are not allowed. **Note**: if you change the Dataverse Alias field, the URL for your Dataverse changes (http//.../dv/'alias'), which affects links to this page.
* **E-mail**: This is the email address you will receive notifications for this particular Dataverse.
* **Affiliation**: Add any Affiliation that can be associated to this particular dataverse (e.g., project name, institute name, department name, journal name, etc).
* **Description**: Provide a description of this dataverse (max. 1000 characters). This will display on the home page of your dataverse and in the search result list.
* **Choose the sets of Metadata Elements for datasets in this Dataverse**: by default the metadata elements will be from the host dataverse that this new dataverse is created in.
3. Click "Create Dataverse" button and you're done! An email will be sent to you with more information, including the URL to access your new dataverse.

\*Required information can vary depending on site policy. Required fields are noted with a red asterisk.
\*Required fields are denoted by a red asterisk.

Edit Dataverse
=================

To edit your Dataverse, navigate to your Dataverse homepage and select the "Edit Dataverse" button.
To edit your Dataverse, navigate to your Dataverse homepage and select the "Edit Dataverse" button,
where you will be presented with the following editing options.

- **General Information**: edit name, host dataverse, alias, email, description, and affilitation for your dataverse.
- **General Information**: edit name, host dataverse, alias, email,
description, affilitation, and Metadata Elements for your dataverse.
- **Roles + Permissions** for this particular dataverse
- **Setup**: Edit the Metadata elements and Facets you want to associate with your dataverse. Note: facets will appear in the order shown on the list.
- **Setup**: Update the Facets you want to associate with your dataverse.
Note: facets will appear in the order shown on the list.


Publish Your Dataverse
=================================================================

Once your dataverse is ready to go public, go to your dataverse page, click on the "Private" button on the right
Once your dataverse is ready to go public, go to your dataverse page, click on the "Unpublished" button on the right
hand side of the page which should indicate:
"This dataverse is Private. To make it public click 'Publish dataverse' link."
"This dataverse is Unpublished. To publish it click 'Publish dataverse' link." Once you click "Publish dataverse" it
will be made public.

**Important Note**: Once a dataverse is made public it can no longer be un-published.
**Important Note**: Once a dataverse is made public it can no longer be unpublished.


.. |image1| image:: ./img/Dataverses-Datasets.png
.. |image1| image:: ./img/Dataverse-Diagram.png



Expand Down
Binary file added doc/Sphinx/source/User/img/Dataverse-Diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 24 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
<!-- Geo Toolkit repository is need to obtain the JAI (advanced imaging) libraries; since Oracle kind of abandoned that project, the jars seem to have disappeared from the central repository as well. -->
<repository>
<id>geotk-repo</id>
<name>Geo Toolkit Maven Repository</name>
<url>http://maven.geotoolkit.org</url>
<layout>default</layout>
</repository>
<repository>
<id>central-repo</id>
Expand Down Expand Up @@ -66,7 +73,6 @@
<version>7.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
Expand Down Expand Up @@ -169,6 +175,23 @@
<artifactId>jhove-handler</artifactId>
<version>1.11.0</version>
</dependency>
<!-- JAI (Java Advanced Imaging) jars: -->
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_imageio</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_core</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
<artifactId>jai_codec</artifactId>
<version>1.1.3</version>
</dependency>

</dependencies>

<build>
Expand Down
16 changes: 15 additions & 1 deletion scripts/installer/install
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ print "FOR EXAMPLE, IF A CONFIGURATION SETTING THAT WE ARE TRYING\n";
print "TO CREATE ALREADY EXISTS; OR IF A JVM OPTION THAT WE ARE\n";
print "DELETING DOESN'T. THESE \"FAILURES\" ARE NORMAL!\n";
print "*********************\n\n";
print "When asadmin asks you to \"Enter admin user name\",\n";
print "When/if asadmin asks you to \"Enter admin user name\",\n";
print "it should be safe to hit return and accept the default\n";
print "(which is \"admin\").\n";

Expand All @@ -838,6 +838,20 @@ system "stty cbreak </dev/tty >/dev/tty 2>&1";
system "stty -cbreak </dev/tty >/dev/tty 2>&1";
print "\n";

# start domain, if not running:

my $DOMAIN_DOWN=`$CONFIG_DEFAULTS{'GLASSFISH_DIRECTORY'}/bin/asadmin list-domains | grep "$DOMAIN " | grep "not running"`;
print STDERR $DOMAIN_DOWN . "\n";
if ($DOMAIN_DOWN)
{
print "Trying to start domain up...\n";
system ($CONFIG_DEFAULTS{'GLASSFISH_DIRECTORY'}."/bin/asadmin start-domain domain1");
}
else
{
print "domain appears to be up...\n";
}

# create asadmin login, so that the user doesn't have to enter
# the username and password for every asadmin command, if
# access to :4848 is password-protected:
Expand Down
30 changes: 18 additions & 12 deletions scripts/search/tests/dataset-versioning04
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
#!/bin/bash
# We assume you've done everything in scripts/search/tests/dataset-versioning03
# There should now be two Solr documents with different titles:
# There should now be two Solr documents for the same dataset with different titles:
#
# Version 1.0 has the published title and a single published file
# Title: Rings of Trees and Other Observations
# to
# files: 18:trees.png
#
# The version that is post 1.0 has a different title
# Title: Rings of Conifers and Other Observations
# files: 18:trees.png
#
# Now let's add a second file to the unpublished version of the study:
#
# http://localhost:8080/dataset.xhtml?id=17
#
# The new file should be named trees2.png and have a description of
# "Another tree image."
#
# anon should be able to see the published 1.0 version but not the new draft (no change from dataset-versioning02anon)
#diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning02anon
# pete should be able to see the published version 1.0 with published=true (same as anon)
#diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete&published=true') scripts/search/tests/expected/dataset-versioning03pete-published-only
# pete should be able to see the newer draft version with unpublished=true
#diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete&unpublished=true') scripts/search/tests/expected/dataset-versioning03pete-unpublished-only
# pete should see just the published version by default
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete') scripts/search/tests/expected/dataset-versioning03pete-published-only
# here's the solr doc for the dataset
#diff -u scripts/search/tests/expected/dataset-versioning02dataset_17solr <(curl -s 'http://localhost:8983/solr/collection1/select?rows=100&wt=json&indent=true&q=id:dataset_17') | egrep -v '_version_|release_or_create_date_dt'
# anon should be able to see the published 1.0 version but not the new draft and not the new file
# (no change from dataset-versioning02anon)
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning02anon
# pete should be able to see the new unpublished file
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&key=pete') scripts/search/tests/expected/dataset-versioning04pete
24 changes: 24 additions & 0 deletions scripts/search/tests/dataset-versioning05
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# We assume you've done everything in scripts/search/tests/dataset-versioning04
# There should now be two Solr documents for datasets with different titles.
#
# Version 1.0 has a single file
# Title: Rings of Trees and Other Observations
# files: 18:trees.png
#
# The version that is post 1.0 but unpublished has two files
# Title: Rings of Conifers and Other Observations
# files: 18:trees.png, 19:trees2.png
#
# Now let's change the description of the published file (18:trees.png) from
# "Trees are lovely."
# to
# "The first picture of trees I uploaded."
#
# anon should be able to see the published 1.0 version but not the new draft and not the new file
# and not the change in description
# (no change from dataset-versioning02anon)
diff -u <(curl -s 'http://localhost:8080/api/search?q=trees&showrelevance=true') scripts/search/tests/expected/dataset-versioning02anon
# What about pete? should he see multiple cards for the two versions
# (with different descriptions) of 18:trees.png? Right now there is only one
# card per file and for published files it always shows the published information.
7 changes: 1 addition & 6 deletions scripts/search/tests/expected/dataset-versioning02anon
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"id":"dataset_17",
"matched_fields":"[dsDescription, title, citation_t, notesText, authorAffiliation, authorName, keyword, contributorName]",
"matched_fields":"[dsDescription, title, notesText, authorAffiliation, authorName, keyword, contributorName]",
"detailsArray":[
{
"dsDescription":[
Expand All @@ -38,11 +38,6 @@
"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations"
]
},
{
"citation_t":[
"<span class=\"search-term-match\">Tree</span>, Tony, 2014, \"Rings of Trees and Other Observations\", http://dx.doi.org/10.5072/FK2/17, Root"
]
},
{
"notesText":[
"Many notes have been taken about <span class=\"search-term-match\">trees</span> over the years."
Expand Down
10 changes: 10 additions & 0 deletions scripts/search/tests/expected/dataset-versioning04pete
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

{
"q":"trees",
"fq_provided":"[]",
"fq_actual":"[({!join from=groups_s to=perms_ss}id:group_public OR {!join from=groups_s to=perms_ss}id:group_user1)]",
"total_count":7,
"start":0,
"count_in_response":7,
"items":"[datafile_18:trees.png:18, datafile_19:trees2.png:19, dataset_17:Rings of Trees and Other Observations:17, dataset_17_draft:Rings of Conifers and Other Observations:17, dataverse_10:Birds:10, dataverse_11:Trees:11, dataverse_16:Chestnut Trees:16]"
}
7 changes: 1 addition & 6 deletions scripts/search/tests/expected/highlighting-nick-trees
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"id":"dataset_17_draft",
"matched_fields":"[dsDescription, title, citation_t, notesText, authorAffiliation, authorName, keyword, contributorName]",
"matched_fields":"[dsDescription, title, notesText, authorAffiliation, authorName, keyword, contributorName]",
"detailsArray":[
{
"dsDescription":[
Expand All @@ -38,11 +38,6 @@
"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations"
]
},
{
"citation_t":[
"<span class=\"search-term-match\">Tree</span>, Tony, 2014, \"Rings of Trees and Other Observations\", http://dx.doi.org/10.5072/FK2/17, Root"
]
},
{
"notesText":[
"Many notes have been taken about <span class=\"search-term-match\">trees</span> over the years."
Expand Down
7 changes: 1 addition & 6 deletions scripts/search/tests/expected/highlighting-pete-trees
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
{
"id":"dataset_17_draft",
"matched_fields":"[dsDescription, title, citation_t, notesText, authorAffiliation, authorName, keyword, contributorName]",
"matched_fields":"[dsDescription, title, notesText, authorAffiliation, authorName, keyword, contributorName]",
"detailsArray":[
{
"dsDescription":[
Expand All @@ -38,11 +38,6 @@
"Rings of <span class=\"search-term-match\">Trees</span> and Other Observations"
]
},
{
"citation_t":[
"<span class=\"search-term-match\">Tree</span>, Tony, 2014, \"Rings of Trees and Other Observations\", http://dx.doi.org/10.5072/FK2/17, Root"
]
},
{
"notesText":[
"Many notes have been taken about <span class=\"search-term-match\">trees</span> over the years."
Expand Down
5 changes: 0 additions & 5 deletions scripts/search/tests/highlighting
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@
# Type: Data Collector
# Name: Edward Trees Jr.
#
# Until https://redmine.hmdc.harvard.edu/issues/3778 is complete:
# Add the following
# Production Date: 2014-05-02
# (Otherwise you won't be able to publish your dataset.)
#
# We assume you add a file called "trees.png" to this dataset
# with a description of "Trees are lovely."
#
Expand Down
64 changes: 51 additions & 13 deletions src/main/java/edu/harvard/iq/dataverse/AdvancedSearchPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,40 +128,78 @@ public String find() throws IOException {
* see also https://redmine.hmdc.harvard.edu/issues/3745
*/
if (!dvFieldName.isEmpty()) {
queryBuilder = new StringBuilder();
queryBuilder.append(SearchFields.DATAVERSE_NAME + ":" + dvFieldName);
queryBuilder = constructQuery(SearchFields.DATAVERSE_NAME, dvFieldName);
}

if (!dvFieldAffiliation.isEmpty()) {
queryBuilder = new StringBuilder();
queryBuilder.append(SearchFields.DATAVERSE_AFFILIATION + ":" + dvFieldAffiliation);
queryBuilder = constructQuery(SearchFields.DATAVERSE_AFFILIATION, dvFieldAffiliation);
}

if (!dvFieldDescription.isEmpty()) {
queryBuilder = new StringBuilder();
queryBuilder.append(SearchFields.DATAVERSE_DESCRIPTION + ":" + dvFieldDescription);
queryBuilder = constructQuery(SearchFields.DATAVERSE_DESCRIPTION, dvFieldDescription);
}

if (!fileFieldName.isEmpty()) {
queryBuilder = new StringBuilder();
queryBuilder.append(SearchFields.FILE_NAME + ":" + fileFieldName);
queryBuilder = constructQuery(SearchFields.FILE_NAME, fileFieldName);
}

if (!fileFieldDescription.isEmpty()) {
queryBuilder = new StringBuilder();
queryBuilder.append(SearchFields.FILE_DESCRIPTION + ":" + fileFieldDescription);
queryBuilder = constructQuery(SearchFields.FILE_DESCRIPTION, fileFieldDescription);
}

if (!fileFieldFiletype.isEmpty()) {
queryBuilder = new StringBuilder();
queryBuilder.append(SearchFields.FILE_TYPE_SEARCHABLE + ":" + fileFieldFiletype);
queryBuilder = constructQuery(SearchFields.FILE_TYPE_SEARCHABLE, fileFieldFiletype);
}

}

return "/dataverse.xhtml?q=" + queryBuilder.toString().trim() + "faces-redirect=true";
}



/**
* @todo have the code that operates on dataset fields call into this?
*/
private StringBuilder constructQuery(String solrField, String userSuppliedQuery) {

StringBuilder queryBuilder = new StringBuilder();
String delimiter = "[\"]+";

List<String> queryStrings = new ArrayList();

if (userSuppliedQuery != null && !userSuppliedQuery.equals("")) {
if (userSuppliedQuery.contains("\"")) {
String[] tempString = userSuppliedQuery.split(delimiter);
for (int i = 1; i < tempString.length; i++) {
if (!tempString[i].equals(" ") && !tempString[i].isEmpty()) {
queryStrings.add(solrField + ":" + "\"" + tempString[i].trim() + "\"");
}
}
} else {
StringTokenizer st = new StringTokenizer(userSuppliedQuery);
while (st.hasMoreElements()) {
queryStrings.add(solrField + ":" + st.nextElement());
}
}
}

if (queryStrings.size() > 1) {
queryBuilder.append("(");
}

for (int i = 0; i < queryStrings.size(); i++) {
if (i > 0) {
queryBuilder.append(" ");
}
queryBuilder.append(queryStrings.get(i));
}

if (queryStrings.size() > 1) {
queryBuilder.append(")");
}

return queryBuilder;
}

public Dataverse getDataverse() {
return dataverse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ public class ControlledVocabularyValueConverter implements Converter {
DatasetFieldServiceBean datasetFieldService;

public Object getAsObject(FacesContext facesContext, UIComponent component, String submittedValue) {
ControlledVocabularyValue cvv = datasetFieldService.findControlledVocabularyValue(new Long(submittedValue));
return cvv;
if (submittedValue == null || submittedValue.equals("")) {
return "";
} else {
ControlledVocabularyValue cvv = datasetFieldService.findControlledVocabularyValue(new Long(submittedValue));
return cvv;
}
}

public String getAsString(FacesContext facesContext, UIComponent component, Object value) {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/edu/harvard/iq/dataverse/DataFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ public boolean isImage() {
if ("image/fits".equalsIgnoreCase(contentType)) {
return false;
}
return (contentType != null && contentType.startsWith("image/"));
// a pdf file is an "image" for practical purposes (we will attempt to
// generate thumbnails and previews for them)
return (contentType != null && (contentType.startsWith("image/") || contentType.equalsIgnoreCase("application/pdf")));
}

public boolean isIngestScheduled() {
Expand Down
Loading

0 comments on commit 3a5bee9

Please sign in to comment.