-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
..and Dataverse Type
- Loading branch information
Showing
13 changed files
with
527 additions
and
162 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
39 changes: 39 additions & 0 deletions
39
src/main/java/edu/harvard/iq/dataverse/DataverseConverter.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,39 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
|
||
package edu.harvard.iq.dataverse; | ||
|
||
import javax.ejb.EJB; | ||
import javax.faces.component.UIComponent; | ||
import javax.faces.context.FacesContext; | ||
import javax.faces.convert.Converter; | ||
import javax.faces.convert.FacesConverter; | ||
|
||
/** | ||
* | ||
* @author skraffmiller | ||
*/ | ||
@FacesConverter("dataverseConverter") | ||
public class DataverseConverter implements Converter { | ||
|
||
|
||
@EJB | ||
DataverseServiceBean dataverseService; | ||
|
||
@Override | ||
public Object getAsObject(FacesContext facesContext, UIComponent component, String submittedValue) { | ||
return dataverseService.find(new Long(submittedValue)); | ||
} | ||
|
||
@Override | ||
public String getAsString(FacesContext facesContext, UIComponent component, Object value) { | ||
if (value == null || value.equals("")) { | ||
return ""; | ||
} else { | ||
return ((Dataverse) value).getId().toString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.