Class: DatatypeMappingCalendar

Inherits:
DatatypeMapping show all
Defined in:
lib/ontomde-java/flex/ValueObjectAS.rb,
lib/ontomde-java/jpa/mapping.rb,
lib/ontomde-java/struts/jsp_edit.rb,
lib/ontomde-java/flex/Editor.mxml.rb,
lib/ontomde-java/kbjava/rdfToJava.rb,
lib/ontomde-java/flex/Editor.mxml.as.rb,
lib/ontomde-java/struts/mappingForJsp.rb,
lib/ontomde-java/struts/mappingForBean.rb,
lib/ontomde-java/java/xsdDatatypeMapping.rb,
lib/ontomde-java/java/javaDatatypeMapping.rb

Overview

EXAMPLES: public var datedenaissance:Date;

Instance Method Summary collapse

Methods inherited from DatatypeMapping

#addActionFieldMethod!, #crank_validation_annotation, #flex_writeMXML_MXvalidator, #getFormType, #java_Name, #java_getUndefinedValue, #java_helper_addMethods!, #java_helper_customCode, #java_qualifiedName, #prot_init, #rdf_uri, #struts_generateHelper

Instance Method Details

#flex_prefixObject



487
488
489
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 487

def flex_prefix
	return "df"
end

#flex_writeMXML_Form_item_property(prop) ⇒ Object

<mx:DateField width=“150” id=“dfDatedenaissance” selectedDate=“DatatypeMappingCalendar.modelmodel.datedenaissance” yearNavigationEnabled=“true” formatString=“DD/MM/YYYY”/>



492
493
494
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 492

def flex_writeMXML_Form_item_property(prop)
	prop.write %{<mx:DateField width="150" id="#{flex_prefix}#{prop.java_NameBean}" selectedDate="{model.#{prop.java_Name}}" yearNavigationEnabled="true"  formatString="DD/MM/YYYY"/>}
end

#flex_writeMXML_Form_item_property_column(pcol) ⇒ Object



500
501
502
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 500

def flex_writeMXML_Form_item_property_column(pcol)
	pcol.write(%{<mx:DataGridColumn headerText="Column " dataField="#{pcol.java_Name}"/>\n})
end

#flex_writeMXML_validate(prop) ⇒ Object



166
167
168
# File 'lib/ontomde-java/flex/Editor.mxml.as.rb', line 166

def flex_writeMXML_validate(prop)
	super
end

#flex_writeMXML_vo_mapping(prop) ⇒ Object

datedenaissance=“DatatypeMappingCalendar.dfDatedenaissancedfDatedenaissance.selectedDate”



497
498
499
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 497

def flex_writeMXML_vo_mapping(prop)
	prop.write(%{ #{prop.java_Name}="{#{flex_prefix}#{prop.java_NameBean}.selectedDate}"})
end

#flex_writeVO_getParameter(prop) ⇒ Object

EXAMPLES:

param.datedenaissance = utils.DateUtil.FormatForDatabase(datedenaissance);


248
249
250
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 248

def flex_writeVO_getParameter(prop)
	prop.write("param.#{prop.java_Name} = utils.DateUtil.FormatForDatabase(#{prop.java_Name});\n")
end

#flex_writeVO_initFromXML_mapping(prop) ⇒ Object

EXAMPLES: datedenaissance = DeserializeXMLUtil.getFormDateAttributValue(source, ‘datedenaissance’);



254
255
256
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 254

def flex_writeVO_initFromXML_mapping(prop)
	prop.write("#{prop.java_Name} = DeserializeXMLUtil.getFormDateAttributValue(source, '#{prop.java_Name}');\n")
end

#flex_writeVO_initItemFromXML_mapping(prop) ⇒ Object



258
259
260
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 258

def flex_writeVO_initItemFromXML_mapping(prop)
	prop.write("#{prop.java_Name}=DeserializeXMLUtil.getOptionDateAttributValue(source,'#{prop.java_Name}');\n")
end

#flex_writeVO_vars_datatype(prop) ⇒ Object



242
243
244
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 242

def flex_writeVO_vars_datatype(prop)
	prop.write("public var #{prop.java_Name}:Date;\n")
end

#getFormCopyTo(field) ⇒ Object



106
107
108
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 106

def getFormCopyTo(field)
  return "if(get#{field.java_NameBean}().length()>0){try {_to.set#{field.java_NameBean}(#{::Muml_Classifier::STRUTS_DATE_FORMATER_INSTANCE}.parse(get#{field.java_NameBean}()));\n} catch(java.text.ParseException e) {log.error(e);}}\n"
end

#getFormInitFrom(field) ⇒ Object



110
111
112
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 110

def getFormInitFrom(field)
  return "this.set#{field.java_NameBean}(_from.get#{field.java_NameBean}()==null?null:#{::Muml_Classifier::STRUTS_DATE_FORMATER_INSTANCE}.format(_from.get#{field.java_NameBean}()));\n"
end

#getJSP(datatype, field, owner) ⇒ Object



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/ontomde-java/struts/mappingForJsp.rb', line 121

def getJSP(datatype,field,owner)
  n="string"
  #TODO: provide nicer html template
  #isCalendar="true"
  return <<END
 <xmda:dateText isCalendar="true" property="#{field.java_Name}" size="20%" maxlength="#{self.maxStringLength}" styleId="#{field.java_Name}Id" #{::Muml_DataType::STRUTS_ERROR_STYLE}/>
 <script type="text/javascript">
function formatDate_#{field.java_Name}(cal) {
      var date = cal.date;
      var field = document.getElementById("#{field.java_Name}");
      var locale = document.getElementById("#{field.java_Name}Locale").value;
      field.value = transformToServerFormat(date, field, locale);
  }
Calendar.setup(\{
 inputField     :    "#{field.java_Name}Id",  // id of the input field
 localeField    :	   "#{field.java_Name}Locale", //field containing locale (hidden)
 onUpdate       :    formatDate_#{field.java_Name}
\});
 </script>
END
end

#java_getTypeObject



95
96
97
# File 'lib/ontomde-java/java/javaDatatypeMapping.rb', line 95

def java_getType
  return "java.util.Date"
end

#jpa_addTypeModificator(ah) ⇒ Object



335
336
337
338
339
340
# File 'lib/ontomde-java/jpa/mapping.rb', line 335

def jpa_addTypeModificator(ah)
  super
  ah.java_annotation_add('@Temporal(TemporalType.DATE)')
  ah.umlx_owner_one.java_import_add('javax.persistence.Temporal')
  ah.umlx_owner_one.java_import_add('javax.persistence.TemporalType')
end

#prot_convertToJava(umlprop, valitem) ⇒ Object

Protege string to Java code conversions



400
401
402
# File 'lib/ontomde-java/kbjava/rdfToJava.rb', line 400

def prot_convertToJava(umlprop,valitem)
  return %{convertCalendar("#{valitem}")}
end

#struts_edit_writeFieldGeneric_DisplayTable_displayTag_column(prop) ⇒ Object



876
877
878
879
880
881
# File 'lib/ontomde-java/struts/jsp_edit.rb', line 876

def struts_edit_writeFieldGeneric_DisplayTable_displayTag_column(prop)
  #TODO: on ne passe pas ici
  #Note: Because Calendar and TimeStamp share the same java type (java.util.Date)
  #      the decorator cannot detect which is which.
  prop.write %{<display:column property="#{prop.java_Name}" titleKey="#{prop.umlx_owner_one.java_qualifiedName}.#{prop.java_Name}" decorator="xmda.displayTag.extensions.I18nCalendarColumnDecorator" />\n}
end

#xsd_getTypeObject



61
62
63
# File 'lib/ontomde-java/java/xsdDatatypeMapping.rb', line 61

def xsd_getType
  return "xsd:date"
end