Advertisement
Guest User

Untitled

a guest
Feb 27th, 2013
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. /**
  2.  
  3. * The contents of this file are subject to the OpenMRS Public License
  4.  
  5. * Version 1.0 (the "License"); you may not use this file except in
  6.  
  7. * compliance with the License. You may obtain a copy of the License at
  8.  
  9. * http://license.openmrs.org
  10.  
  11. *
  12.  
  13. * Software distributed under the License is distributed on an "AS IS"
  14.  
  15. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  16.  
  17. * License for the specific language governing rights and limitations
  18.  
  19. * under the License.
  20.  
  21. *
  22.  
  23. * Copyright (C) OpenMRS, LLC. All Rights Reserved.
  24.  
  25. */
  26.  
  27. package org.openmrs.customdatatype.datatype;
  28.  
  29.  
  30.  
  31. import org.apache.commons.lang.StringUtils;
  32.  
  33. import org.openmrs.Concept;
  34.  
  35. import org.openmrs.Obs;
  36.  
  37. import org.openmrs.customdatatype.SerializingCustomDatatype;
  38.  
  39. import org.springframework.stereotype.Component;
  40.  
  41.  
  42.  
  43. /**
  44.  
  45. * Datatype for Concept, represented by org.openmrs.Concept.
  46.  
  47. * @since 1.9
  48.  
  49. */
  50.  
  51. @Component
  52.  
  53. public class ConceptDatatype extends SerializingCustomDatatype<Concept> {
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. /**
  62.  
  63. * @see org.openmrs.customdatatype.SerializingCustomDatatype#doGetTextSummary(java.lang.Object)
  64.  
  65. */
  66.  
  67. @Override
  68.  
  69. public String serialize(Concept typedValue) {
  70.  
  71. if (typedValue == null)
  72.  
  73. return null;
  74.  
  75. return typedValue.getUuid();
  76.  
  77. }
  78.  
  79.  
  80.  
  81. /**
  82.  
  83. * @see org.openmrs.customdatatype.SerializingCustomDatatype#doGetTextSummary(java.lang.Object)
  84.  
  85. */
  86.  
  87. @Override
  88.  
  89. public Concept deserialize(String serializedValue) {
  90.  
  91. if (StringUtils.isEmpty(serializedValue))
  92.  
  93. return null;
  94.  
  95. Concept concept = new Concept();
  96.  
  97. return concept.getUuid();
  98.  
  99. }
  100.  
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement