diff --git a/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/DefaultModularValueConverter.java b/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/DefaultModularValueConverter.java index 529a4e930..d431bae9f 100644 --- a/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/DefaultModularValueConverter.java +++ b/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/DefaultModularValueConverter.java @@ -115,6 +115,7 @@ import de.gebit.integrity.parameter.conversion.conversions.java.other.CalendarToSQLDate; import de.gebit.integrity.parameter.conversion.conversions.java.other.CalendarToSQLTime; import de.gebit.integrity.parameter.conversion.conversions.java.other.CalendarToString; +import de.gebit.integrity.parameter.conversion.conversions.java.other.CalendarToTimestamp; import de.gebit.integrity.parameter.conversion.conversions.java.other.DateToFormattedString; import de.gebit.integrity.parameter.conversion.conversions.java.other.DateToSQLDate; import de.gebit.integrity.parameter.conversion.conversions.java.other.DateToSQLTime; @@ -200,6 +201,7 @@ protected void initializeConversions() { addConversion(BooleanToFormattedString.class); addConversion(DateToString.class); addConversion(DateToFormattedString.class); + addConversion(CalendarToTimestamp.class); addConversion(CalendarToDate.class); addConversion(CalendarToSQLDate.class); addConversion(CalendarToSQLTime.class); diff --git a/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/conversions/java/other/CalendarToTimestamp.java b/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/conversions/java/other/CalendarToTimestamp.java new file mode 100644 index 000000000..a51d13e17 --- /dev/null +++ b/de.gebit.integrity.dsl/src/de/gebit/integrity/parameter/conversion/conversions/java/other/CalendarToTimestamp.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2013 Rene Schneider, GEBIT Solutions GmbH and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + *******************************************************************************/ +package de.gebit.integrity.parameter.conversion.conversions.java.other; + +import java.sql.Timestamp; +import java.util.Calendar; + +import de.gebit.integrity.parameter.conversion.Conversion; +import de.gebit.integrity.parameter.conversion.ConversionContext; +import de.gebit.integrity.parameter.conversion.ConversionFailedException; + +/** + * A default Integrity conversion. + * + * + * @author Rene Schneider - initial API and implementation + * + */ +public class CalendarToTimestamp extends Conversion { + + @Override + public Timestamp convert(Calendar aSource, Class aTargetType, + ConversionContext aConversionContext) throws ConversionFailedException { + return new Timestamp(aSource.getTimeInMillis()); + } + +}