Working on converting organizationHasPositionHistory to date time with precision NIHVIVO-631
This commit is contained in:
parent
ec36eb7893
commit
4309c7582e
2 changed files with 23 additions and 0 deletions
|
@ -456,6 +456,8 @@ public class InputElementFormattingTag extends TagSupport {
|
||||||
|
|
||||||
if( field != null && field.getEditElement() != null ){
|
if( field != null && field.getEditElement() != null ){
|
||||||
out.print( field.getEditElement().draw(getId(), editConfig, editSub, fmConfig));
|
out.print( field.getEditElement().draw(getId(), editConfig, editSub, fmConfig));
|
||||||
|
}else if( getType() == null ){
|
||||||
|
log.error("type or editElement must be specified for input element " + getId() );
|
||||||
}else if( getType().equalsIgnoreCase("date") ||
|
}else if( getType().equalsIgnoreCase("date") ||
|
||||||
(field != null && field.getRangeDatatypeUri() != null && field.getRangeDatatypeUri().equals(XSD.date.getURI())) ){
|
(field != null && field.getRangeDatatypeUri() != null && field.getRangeDatatypeUri().equals(XSD.date.getURI())) ){
|
||||||
//if its a dataprop that should be a string override type and use date picker
|
//if its a dataprop that should be a string override type and use date picker
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.edit.elements;
|
package edu.cornell.mannlib.vitro.webapp.edit.elements;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -15,11 +16,31 @@ import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditSubmission;
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field;
|
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.Field;
|
||||||
|
|
||||||
|
|
||||||
public class DateTimeWithPrecisionTest {
|
public class DateTimeWithPrecisionTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void fieldNameTemplateVariableTest() throws Exception{
|
||||||
|
String FIELDNAME = "testfield";
|
||||||
|
Field field = new Field();
|
||||||
|
field.setName(FIELDNAME);
|
||||||
|
DateTimeWithPrecision dtwp = new DateTimeWithPrecision(field);
|
||||||
|
|
||||||
|
EditSubmission editSub = null;
|
||||||
|
EditConfiguration editConfig = new EditConfiguration();
|
||||||
|
editConfig.setUrisInScope(Collections.EMPTY_MAP);
|
||||||
|
editConfig.setLiteralsInScope(Collections.EMPTY_MAP);
|
||||||
|
|
||||||
|
Map templateVars = dtwp.getMapForTemplate(editConfig, editSub);
|
||||||
|
Assert.assertNotNull(templateVars);
|
||||||
|
|
||||||
|
Assert.assertTrue( templateVars.containsKey("fieldName") );
|
||||||
|
Assert.assertEquals(templateVars.get("fieldName"), "testfield");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void precisionSecondsValidationTest() throws Exception{
|
public void precisionSecondsValidationTest() throws Exception{
|
||||||
String FIELDNAME = "testfield";
|
String FIELDNAME = "testfield";
|
||||||
|
|
Loading…
Add table
Reference in a new issue