test_class.declarator: eventMapper
test_class.modifier: @Autowired
      public
test_class.original_string: @Autowired
      public EventMapper eventMapper;
test_class.type: EventMapper
test_class.var_name: eventMapper
test_class.file: cepheus-cep/src/test/java/com/orange/cepheus/cep/EventMapperTest.java
test_class.identifier: EventMapperTest
test_case.body: @Test
      public void testContextElementConversion() throws Exception {
          ContextElement ce = new ContextElement();
          ce.setEntityId(new EntityId("S1", "TempSensor", false));
  
          List<ContextAttribute> attributes = new LinkedList<>();
          attributes.add(new ContextAttribute("1", "string", "hello"));
          attributes.add(new ContextAttribute("1_string", null, "hello"));
          attributes.add(new ContextAttribute("2", "float", 1.4f));
          attributes.add(new ContextAttribute("3", "double", 3.1d));
          attributes.add(new ContextAttribute("4", "int", 3));
          attributes.add(new ContextAttribute("5", "long", 3l));
          attributes.add(new ContextAttribute("6", "boolean", true));
          attributes.add(new ContextAttribute("7", "boolean", false));
          attributes.add(new ContextAttribute("8", "date", "2015-12-01T17:12:28Z"));
          attributes.add(new ContextAttribute("9", "geo:point", "39.23, -10.3"));
          ce.setContextAttributeList(attributes);
  
          Map<String, Object> values = eventMapper.eventFromContextElement(ce).getValues();
          assertEquals("S1", values.get("id"));
          assertEquals("hello", values.get("1"));
          assertEquals("hello", values.get("1_string"));
          assertEquals(1.4f, values.get("2"));
          assertEquals(3.1d, values.get("3"));
          assertEquals(3, values.get("4"));
          assertEquals(3l, values.get("5"));
          assertEquals(true, values.get("6"));
          assertEquals(false, values.get("7"));
          assertEquals(new Date(1448989948000l), values.get("8"));
          assertEquals(Geospatial.readGeometry("POINT(39.23 -10.3)"), values.get("9"));
      }
test_case.class_method_signature: EventMapperTest.testContextElementConversion()
test_case.full_signature: @Test public void testContextElementConversion()
test_case.identifier: testContextElementConversion
test_case.invocations: setEntityId add add add add add add add add add add setContextAttributeList getValues eventFromContextElement assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals get assertEquals readGeometry get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testContextElementConversion()
focal_class.declarator: jsonpaths = new HashMap<>()
focal_class.modifier: private
focal_class.original_string: private Map<String, JsonPath> jsonpaths = new HashMap<>();
focal_class.type: Map<String, JsonPath>
focal_class.var_name: jsonpaths
focal_class.declarator: iso8691DateFormat = new ISO8601DateFormat()
focal_class.modifier: private
focal_class.original_string: private ISO8601DateFormat iso8691DateFormat = new ISO8601DateFormat();
focal_class.type: ISO8601DateFormat
focal_class.var_name: iso8691DateFormat
focal_class.file: cepheus-cep/src/main/java/com/orange/cepheus/cep/EventMapper.java
focal_class.identifier: EventMapper
focal_class.class_method_signature: EventMapper.setConfiguration(Configuration configuration)
focal_class.full_signature: public void setConfiguration(Configuration configuration)
focal_class.identifier: setConfiguration
focal_class.modifiers: public
focal_class.parameters: (Configuration configuration)
focal_class.return: void
focal_class.signature: void setConfiguration(Configuration configuration)
focal_class.class_method_signature: EventMapper.esperTypeFromEventType(EventType eventType)
focal_class.full_signature: public Map<String, Object> esperTypeFromEventType(EventType eventType)
focal_class.identifier: esperTypeFromEventType
focal_class.modifiers: public
focal_class.parameters: (EventType eventType)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> esperTypeFromEventType(EventType eventType)
focal_class.class_method_signature: EventMapper.eventFromContextElement(ContextElement contextElement)
focal_class.full_signature: public Event eventFromContextElement(ContextElement contextElement)
focal_class.identifier: eventFromContextElement
focal_class.modifiers: public
focal_class.parameters: (ContextElement contextElement)
focal_class.return: Event
focal_class.signature: Event eventFromContextElement(ContextElement contextElement)
focal_class.class_method_signature: EventMapper.contextElementFromEvent(EventBean eventBean, EventType eventType)
focal_class.full_signature: public ContextElement contextElementFromEvent(EventBean eventBean, EventType eventType)
focal_class.identifier: contextElementFromEvent
focal_class.modifiers: public
focal_class.parameters: (EventBean eventBean, EventType eventType)
focal_class.return: ContextElement
focal_class.signature: ContextElement contextElementFromEvent(EventBean eventBean, EventType eventType)
focal_class.class_method_signature: EventMapper.attributeValueFromEventProperty(Object value, String type)
focal_class.full_signature: public Object attributeValueFromEventProperty(Object value, String type)
focal_class.identifier: attributeValueFromEventProperty
focal_class.modifiers: public
focal_class.parameters: (Object value, String type)
focal_class.return: Object
focal_class.signature: Object attributeValueFromEventProperty(Object value, String type)
focal_class.class_method_signature: EventMapper.classForType(String attributeType)
focal_class.full_signature: private Class classForType(String attributeType)
focal_class.identifier: classForType
focal_class.modifiers: private
focal_class.parameters: (String attributeType)
focal_class.return: Class
focal_class.signature: Class classForType(String attributeType)
focal_class.class_method_signature: EventMapper.valueForType(Object value, String type, String name)
focal_class.full_signature: private Object valueForType(Object value, String type, String name)
focal_class.identifier: valueForType
focal_class.modifiers: private
focal_class.parameters: (Object value, String type, String name)
focal_class.return: Object
focal_class.signature: Object valueForType(Object value, String type, String name)
focal_class.class_method_signature: EventMapper.valueForString(String value, String type, String name)
focal_class.full_signature: private Object valueForString(String value, String type, String name)
focal_class.identifier: valueForString
focal_class.modifiers: private
focal_class.parameters: (String value, String type, String name)
focal_class.return: Object
focal_class.signature: Object valueForString(String value, String type, String name)
focal_method.body: public Event eventFromContextElement(ContextElement contextElement) throws EventProcessingException, TypeNotFoundException {
          String eventId = contextElement.getEntityId().getId();
          String eventType = contextElement.getEntityId().getType();
  
          Event event = new Event(eventType);
  
          // Add metadata values first
          for(ContextAttribute contextAttribute : contextElement.getContextAttributeList()) {
              String attrName = contextAttribute.getName();
              for (ContextMetadata contextMetada : contextAttribute.getMetadata()) {
                  String name = contextMetada.getName();
                  String type = contextMetada.getType();
  
                  Object value = contextMetada.getValue();
  
                  // Extract value from jsonpath if any
                  JsonPath jsonPath = jsonpaths.get(eventType + "/" + attrName + "/" + name);
                  if (jsonPath != null) {
                      value = jsonPath.read(value);
                  }
  
                  value = valueForType(value, type, name);
                  event.addValue(attrName + "_" + name, value);
              }
          }
  
          // Override with attributes values
          for(ContextAttribute contextAttribute : contextElement.getContextAttributeList()) {
              String name = contextAttribute.getName();
              String type = contextAttribute.getType();
  
              Object value = contextAttribute.getValue();
  
              // Extract value from jsonpath if any
              JsonPath jsonPath = jsonpaths.get(eventType + "/" + name);
              if (jsonPath != null) {
                  value = jsonPath.read(value);
              }
  
              value = valueForType(value, type, name);
              if (value == null) {
                  throw new EventProcessingException("Value cannot be null for attribute "+name);
              }
  
              event.addValue(name, value);
          }
  
          // Override with id
          event.addValue("id", eventId);
  
          return event;
      }
focal_method.class_method_signature: EventMapper.eventFromContextElement(ContextElement contextElement)
focal_method.full_signature: public Event eventFromContextElement(ContextElement contextElement)
focal_method.identifier: eventFromContextElement
focal_method.invocations: getId getEntityId getType getEntityId getContextAttributeList getName getMetadata getName getType getValue get read valueForType addValue getContextAttributeList getName getType getValue get read valueForType addValue addValue
focal_method.modifiers: public
focal_method.parameters: (ContextElement contextElement)
focal_method.return: Event
focal_method.signature: Event eventFromContextElement(ContextElement contextElement)