Class: DatatypeMappingTimeStamp

Inherits:
DatatypeMapping show all
Defined in:
lib/ontomde-java/struts/jsp_edit.rb,
lib/ontomde-java/flex/Editor.mxml.rb,
lib/ontomde-java/kbjava/rdfToJava.rb,
lib/ontomde-java/flex/ValueObjectAS.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

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, #jpa_addTypeModificator, #prot_init, #rdf_uri, #struts_generateHelper

Instance Method Details

#flex_prefixObject



466
467
468
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 466

def flex_prefix
	return "df"
end

#flex_writeMXML_Form_item_property(prop) ⇒ Object

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



471
472
473
474
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 471

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"/>}
	prop.write %{<components:mon_timestamp id="#{flex_prefix}#{prop.java_NameBean}"  is24Hour="true" backgroundColor="#000000" backgroundAlpha="0.05" borderColor="#00FF00" borderThickness="1" borderStyle="solid" cornerRadius="5" showDate="true" showTimes="true" showSeconds="true" timeValue="{model.#{prop.java_Name}}" />}
end

#flex_writeMXML_Form_item_property_column(pcol) ⇒ Object



481
482
483
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 481

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



161
162
163
# File 'lib/ontomde-java/flex/Editor.mxml.as.rb', line 161

def flex_writeMXML_validate(prop)
	super
end

#flex_writeMXML_vo_mapping(prop) ⇒ Object

datedenaissance=“DatatypeMappingTimeStamp.dfDatedenaissancedfDatedenaissance.selectedDate”



477
478
479
480
# File 'lib/ontomde-java/flex/Editor.mxml.rb', line 477

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

#flex_writeVO_getParameter(prop) ⇒ Object

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



225
226
227
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 225

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’);



231
232
233
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 231

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



234
235
236
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 234

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

public var datedenaissance:Date;



220
221
222
# File 'lib/ontomde-java/flex/ValueObjectAS.rb', line 220

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

#getFormCopyTo(field) ⇒ Object



89
90
91
92
93
94
95
96
97
98
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 89

def getFormCopyTo(field)
  return %{
      if(get#{field.java_NameBean}().length()>0) { try {
          java.util.Date local=#{::Muml_Classifier::STRUTS_TIMESTAMP_FORMATER_INSTANCE}.parse(get#{field.java_NameBean}());
  java.util.Date gmt = xmda.struts.FormHelper.transformFromCurrentTZToGMT(currentTimeZone, local);
  // the date is saved in the GMT timeZone
  _to.set#{field.java_NameBean}(gmt);
  } catch(java.text.ParseException e) { log.error(e);}\n
  }}
end

#getFormInitFrom(field) ⇒ Object



100
101
102
# File 'lib/ontomde-java/struts/mappingForBean.rb', line 100

def getFormInitFrom(field)
  return "this.set#{field.java_NameBean}(_from.get#{field.java_NameBean}()==null?null:#{::Muml_Classifier::STRUTS_TIMESTAMP_FORMATER_INSTANCE}.format(xmda.struts.FormHelper.transformFromGMTToCurrentTZ(currentTimeZone,_from.get#{field.java_NameBean}())));\n"
end

#getJSP(datatype, field, owner) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/ontomde-java/struts/mappingForJsp.rb', line 93

def getJSP(datatype,field,owner)
  n="string"
  #TODO: provide nicer html template
  #xmda:dateText isCalendar defaults to "false"
  return <<END
 <xmda:dateText property="#{field.java_Name}" size="20%" maxlength="30" 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)
 showsTime      :    true,
 timeFormat     :    "24",
 onUpdate       :    formatDate_#{field.java_Name}
\});
 </script>
END

end

#java_getTypeObject



89
90
91
# File 'lib/ontomde-java/java/javaDatatypeMapping.rb', line 89

def java_getType
  return "java.util.Date"
end

#prot_convertToJava(umlprop, valitem) ⇒ Object

Protege string to Java code conversions



394
395
396
# File 'lib/ontomde-java/kbjava/rdfToJava.rb', line 394

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

#struts_edit_writeFieldGeneric_DisplayTable_displayTag_column(prop) ⇒ Object



885
886
887
888
889
# File 'lib/ontomde-java/struts/jsp_edit.rb', line 885

def struts_edit_writeFieldGeneric_DisplayTable_displayTag_column(prop)
  #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.I18nColumnDecorator" />\n}
end

#xsd_getTypeObject



55
56
57
# File 'lib/ontomde-java/java/xsdDatatypeMapping.rb', line 55

def xsd_getType
  return "xsd:datetime"
end