Skip to content

Commit

Permalink
File Landing Page: Add Date formats; update Citation
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed Oct 28, 2016
1 parent 5133e01 commit 2ab8664
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/DataFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
Expand Down Expand Up @@ -693,4 +694,19 @@ public boolean hasGeospatialTag(){
}
return false;
}

public String getPublicationDateFormattedYYYYMMDD() {
if (getPublicationDate() != null){
return new SimpleDateFormat("yyyy-MM-dd").format(getPublicationDate());
}
return null;
}

public String getCreateDateFormattedYYYYMMDD() {
if (getCreateDate() != null){
return new SimpleDateFormat("yyyy-MM-dd").format(getCreateDate());
}
return null;
}

}
4 changes: 2 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/FileMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ public String getFileCitation(){
", #{FilePage.fileMetadata.label} [fileName]"
<h:outputText value=", #{FilePage.file.unf}" rendered="#{FilePage.file.tabularData and !(empty FilePage.file.unf)}"/>
*/
citation += ", " + this.getLabel() + " [fileName]" ;
citation += "; " + this.getLabel() + " [fileName]" ;
if (this.dataFile.isTabularData() && this.dataFile.getUnf() != null && !this.dataFile.getUnf().isEmpty()){
citation += ", " + this.dataFile.getUnf();
citation += ", " + this.dataFile.getUnf() + " [fileUNF]";
}
return citation;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/file.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
#{bundle['file.metadataTab.fileMetadata.publicationDate.label']}
</label>
<div class="col-sm-9">
<h:outputText value="#{FilePage.file.publicationDate}"/>
<h:outputText value="#{FilePage.file.publicationDateFormattedYYYYMMDD}"/>
</div>
</div>

Expand Down Expand Up @@ -358,7 +358,7 @@
#{bundle['file.metadataTab.fileMetadata.depositDate.label']}
</label>
<div class="col-sm-9">
<h:outputText value="#{FilePage.file.createDate}"/>
<h:outputText value="#{FilePage.file.createDateFormattedYYYYMMDD}"/>
</div>
</div>

Expand Down

0 comments on commit 2ab8664

Please sign in to comment.