-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
203 additions
and
29 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
*/ | ||
package edu.harvard.iq.dataverse; | ||
|
||
import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException; | ||
import edu.harvard.iq.dataverse.engine.command.impl.PublishDatasetCommand; | ||
import edu.harvard.iq.dataverse.settings.SettingsServiceBean; | ||
import java.net.InetAddress; | ||
import java.net.UnknownHostException; | ||
|
@@ -49,7 +51,7 @@ public String createIdentifier(Dataset dataset) { | |
metadata.put("_status", "reserved"); | ||
try { | ||
logger.log(Level.INFO, "doiDataCiteRegisterService.toString : " + doiDataCiteRegisterService.toString()); | ||
retString = doiDataCiteRegisterService.createIdentifier(identifier, metadata); | ||
retString = doiDataCiteRegisterService.createIdentifier(identifier, metadata, dataset); | ||
logger.log(Level.INFO, "create DOI identifier retString : " + retString); | ||
} catch (Exception e) { | ||
logger.log(Level.INFO, "Identifier not created: create failed"); | ||
|
@@ -99,7 +101,7 @@ public String getIdentifierForLookup(String protocol, String authority, String s | |
public String modifyIdentifier(Dataset dataset, HashMap metadata) { | ||
String identifier = getIdentifierFromDataset(dataset); | ||
try { | ||
doiDataCiteRegisterService.createIdentifier(identifier, metadata); | ||
doiDataCiteRegisterService.createIdentifier(identifier, metadata, dataset); | ||
} catch (Exception e) { | ||
logger.log(Level.INFO, "modifyMetadata failed"); | ||
logger.log(Level.INFO, "String " + e.toString()); | ||
|
@@ -111,7 +113,7 @@ public String modifyIdentifier(Dataset dataset, HashMap metadata) { | |
return identifier; | ||
} | ||
|
||
public void deleteIdentifier(Dataset datasetIn) { | ||
public void deleteIdentifier(Dataset datasetIn) throws RuntimeException { | ||
This comment has been minimized.
Sorry, something went wrong.
bencomp
Contributor
|
||
String identifier = getIdentifierFromDataset(datasetIn); | ||
HashMap doiMetadata = new HashMap(); | ||
try { | ||
|
@@ -240,16 +242,16 @@ private String getIdentifierFromDataset(Dataset dataset) { | |
return dataset.getGlobalId(); | ||
} | ||
|
||
public void publicizeIdentifier(Dataset studyIn) { | ||
public void publicizeIdentifier(Dataset studyIn) throws IllegalCommandException { | ||
updateIdentifierStatus(studyIn, "public"); | ||
} | ||
|
||
private void updateIdentifierStatus(Dataset dataset, String statusIn) { | ||
private void updateIdentifierStatus(Dataset dataset, String statusIn) throws RuntimeException { | ||
String identifier = getIdentifierFromDataset(dataset); | ||
HashMap metadata = getUpdateMetadataFromDataset(dataset); | ||
metadata.put("_status", statusIn); | ||
try { | ||
doiDataCiteRegisterService.createIdentifier(identifier, metadata); | ||
doiDataCiteRegisterService.createIdentifier(identifier, metadata, dataset); | ||
} catch (Exception e) { | ||
logger.log(Level.INFO, "modifyMetadata failed"); | ||
logger.log(Level.INFO, "String " + e.toString()); | ||
|
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
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
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
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,6 @@ | ||
package edu.harvard.iq.dataverse; | ||
|
||
import edu.harvard.iq.dataverse.util.MarkupChecker; | ||
import edu.harvard.iq.dataverse.util.StringUtil; | ||
import java.io.Serializable; | ||
import java.sql.Timestamp; | ||
|
@@ -596,14 +597,92 @@ public String getProductionDate() { | |
//todo get "Production Date" from datasetfieldvalue table | ||
return "Production Date"; | ||
} | ||
|
||
public String getDescription() { | ||
for (DatasetField dsf : this.getDatasetFields()) { | ||
if (dsf.getDatasetFieldType().getName().equals(DatasetFieldConstant.description)) { | ||
String descriptionString = ""; | ||
if (dsf.getDatasetFieldCompoundValues() != null && dsf.getDatasetFieldCompoundValues().get(0) != null) { | ||
DatasetFieldCompoundValue descriptionValue = dsf.getDatasetFieldCompoundValues().get(0); | ||
for (DatasetField subField : descriptionValue.getChildDatasetFields()) { | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.descriptionText) && !subField.isEmptyForDisplay()) { | ||
descriptionString = subField.getValue(); | ||
} | ||
} | ||
} | ||
return MarkupChecker.sanitizeBasicHTML(descriptionString); | ||
} | ||
} | ||
return ""; | ||
} | ||
|
||
public List<String[]> getDatasetContacts(){ | ||
List retList = new ArrayList(); | ||
This comment has been minimized.
Sorry, something went wrong.
bencomp
Contributor
|
||
for (DatasetField dsf : this.getDatasetFields()) { | ||
Boolean addContributor = true; | ||
String contributorName = ""; | ||
String contributorAffiliation = ""; | ||
if (dsf.getDatasetFieldType().getName().equals(DatasetFieldConstant.datasetContact)) { | ||
for (DatasetFieldCompoundValue authorValue : dsf.getDatasetFieldCompoundValues()) { | ||
for (DatasetField subField : authorValue.getChildDatasetFields()) { | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.datasetContactName)) { | ||
if (subField.isEmptyForDisplay()) { | ||
addContributor = false; | ||
} | ||
contributorName = subField.getDisplayValue(); | ||
} | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.datasetContactAffiliation)) { | ||
contributorAffiliation = subField.getDisplayValue(); | ||
} | ||
|
||
} | ||
if (addContributor) { | ||
String[] datasetContributor = new String[] {contributorName, contributorAffiliation}; | ||
retList.add(datasetContributor); | ||
} | ||
} | ||
} | ||
} | ||
return retList; | ||
} | ||
|
||
public List<String[]> getDatasetProducers(){ | ||
List retList = new ArrayList(); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
for (DatasetField dsf : this.getDatasetFields()) { | ||
Boolean addContributor = true; | ||
String contributorName = ""; | ||
String contributorAffiliation = ""; | ||
if (dsf.getDatasetFieldType().getName().equals(DatasetFieldConstant.producer)) { | ||
for (DatasetFieldCompoundValue authorValue : dsf.getDatasetFieldCompoundValues()) { | ||
for (DatasetField subField : authorValue.getChildDatasetFields()) { | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.producerName)) { | ||
if (subField.isEmptyForDisplay()) { | ||
addContributor = false; | ||
} | ||
contributorName = subField.getDisplayValue(); | ||
} | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.producerAffiliation)) { | ||
contributorAffiliation = subField.getDisplayValue(); | ||
} | ||
|
||
} | ||
if (addContributor) { | ||
String[] datasetContributor = new String[] {contributorName, contributorAffiliation}; | ||
retList.add(datasetContributor); | ||
} | ||
} | ||
} | ||
} | ||
return retList; | ||
} | ||
|
||
public List<DatasetAuthor> getDatasetAuthors() { | ||
//todo get "List of Authors" from datasetfieldvalue table | ||
List retList = new ArrayList(); | ||
for (DatasetField dsf : this.getDatasetFields()) { | ||
Boolean addAuthor = true; | ||
if (dsf.getDatasetFieldType().getName().equals(DatasetFieldConstant.author)) { | ||
for (DatasetFieldCompoundValue authorValue : dsf.getDatasetFieldCompoundValues()) { | ||
for (DatasetFieldCompoundValue authorValue : dsf.getDatasetFieldCompoundValues()) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
DatasetAuthor datasetAuthor = new DatasetAuthor(); | ||
for (DatasetField subField : authorValue.getChildDatasetFields()) { | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorName)) { | ||
|
@@ -615,8 +694,14 @@ public List<DatasetAuthor> getDatasetAuthors() { | |
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorAffiliation)) { | ||
datasetAuthor.setAffiliation(subField); | ||
} | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorIdType)){ | ||
datasetAuthor.setIdType(subField.getDisplayValue()); | ||
} | ||
if (subField.getDatasetFieldType().getName().equals(DatasetFieldConstant.authorIdValue)){ | ||
datasetAuthor.setIdValue(subField.getDisplayValue()); | ||
} | ||
} | ||
if (addAuthor) { | ||
if (addAuthor) { | ||
retList.add(datasetAuthor); | ||
} | ||
} | ||
|
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
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
Please use loggers!