test_class.declarator: url = "http://35.61.56.113:8443"
test_class.modifier: private
test_class.original_string: private String url = "http://35.61.56.113:8443";
test_class.type: String
test_class.var_name: url
test_class.declarator: incidentDao
test_class.modifier: @Mock
test_class.original_string: @Mock
      IncidentDao incidentDao;
test_class.type: IncidentDao
test_class.var_name: incidentDao
test_class.declarator: incidentService
test_class.modifier: @InjectMocks
test_class.original_string: @InjectMocks
      IncidentService incidentService;
test_class.type: IncidentService
test_class.var_name: incidentService
test_class.file: app/src/test/java/org/unicef/rapidreg/service/IncidentServiceTest.java
test_class.identifier: IncidentServiceTest
test_case.body: @Test
      public void should_save_incident_when_give_item_values_and_item_values_map_have_register_date()
              throws IOException {
          String url = "http://35.61.65.113:8443";
          Mockito.when(PrimeroAppConfiguration.getApiBaseUrl()).thenReturn(url);
  
          String uniqueId = "test save incident";
          IncidentService incidentServiceSpy = spy(incidentService);
          when(incidentServiceSpy.generateUniqueId()).thenReturn(uniqueId);
          User user = new User("userName");
          when(PrimeroAppConfiguration.getCurrentUser()).thenReturn(user);
          ItemValuesMap itemValuesMap = new ItemValuesMap();
          itemValuesMap.addStringItem(DATE_OF_INTERVIEW, "1111/1111/11");
  
          Incident incident = incidentServiceSpy.save(itemValuesMap);
          when(incidentDao.save(any(Incident.class))).thenReturn(incident);
  
          assertThat(incident.getAge(), is(-1));
          assertThat(incident.getUniqueId(), is(uniqueId));
          assertThat(incident.getServerUrl(), is(TextUtils.lintUrl(url)));
          assertThat(incident.getRegistrationDate(), is(Utils.getRegisterDateByYyyyMmDd("1111/1111/11")));
          assertThat(incident.getRegistrationDate(), is(Utils.getRegisterDateByYyyyMmDd("1111/1111/11")));
  
      }
test_case.class_method_signature: IncidentServiceTest.should_save_incident_when_give_item_values_and_item_values_map_have_register_date()
test_case.full_signature: @Test public void should_save_incident_when_give_item_values_and_item_values_map_have_register_date()
test_case.identifier: should_save_incident_when_give_item_values_and_item_values_map_have_register_date
test_case.invocations: thenReturn when getApiBaseUrl spy thenReturn when generateUniqueId thenReturn when getCurrentUser addStringItem save thenReturn when save any assertThat getAge is assertThat getUniqueId is assertThat getServerUrl is lintUrl assertThat getRegistrationDate is getRegisterDateByYyyyMmDd assertThat getRegistrationDate is getRegisterDateByYyyyMmDd
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void should_save_incident_when_give_item_values_and_item_values_map_have_register_date()
focal_class.declarator: TAG = IncidentService.class.getSimpleName()
focal_class.modifier: public static final
focal_class.original_string: public static final String TAG = IncidentService.class.getSimpleName();
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: INCIDENT_DISPLAY_ID = "incident_id_display"
focal_class.modifier: public static final
focal_class.original_string: public static final String INCIDENT_DISPLAY_ID = "incident_id_display";
focal_class.type: String
focal_class.var_name: INCIDENT_DISPLAY_ID
focal_class.declarator: INCIDENT_ID = "incident_id"
focal_class.modifier: public static final
focal_class.original_string: public static final String INCIDENT_ID = "incident_id";
focal_class.type: String
focal_class.var_name: INCIDENT_ID
focal_class.declarator: INCIDENT_PRIMARY_ID = "incident_primary_id"
focal_class.modifier: public static final
focal_class.original_string: public static final String INCIDENT_PRIMARY_ID = "incident_primary_id";
focal_class.type: String
focal_class.var_name: INCIDENT_PRIMARY_ID
focal_class.declarator: EMPTY_ID = ""
focal_class.modifier: public static final
focal_class.original_string: public static final String EMPTY_ID = "";
focal_class.type: String
focal_class.var_name: EMPTY_ID
focal_class.declarator: incidentDao = new IncidentDaoImpl()
focal_class.modifier: private
focal_class.original_string: private IncidentDao incidentDao = new IncidentDaoImpl();
focal_class.type: IncidentDao
focal_class.var_name: incidentDao
focal_class.file: app/src/main/java/org/unicef/rapidreg/service/IncidentService.java
focal_class.identifier: IncidentService
focal_class.class_method_signature: IncidentService.IncidentService()
focal_class.full_signature: public  IncidentService()
focal_class.identifier: IncidentService
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  IncidentService()
focal_class.class_method_signature: IncidentService.IncidentService(IncidentDao incidentDao)
focal_class.full_signature: public  IncidentService(IncidentDao incidentDao)
focal_class.identifier: IncidentService
focal_class.modifiers: public
focal_class.parameters: (IncidentDao incidentDao)
focal_class.signature:  IncidentService(IncidentDao incidentDao)
focal_class.class_method_signature: IncidentService.getById(long incidentId)
focal_class.full_signature: public Incident getById(long incidentId)
focal_class.identifier: getById
focal_class.modifiers: public
focal_class.parameters: (long incidentId)
focal_class.return: Incident
focal_class.signature: Incident getById(long incidentId)
focal_class.class_method_signature: IncidentService.getByUniqueId(String uniqueId)
focal_class.full_signature: public Incident getByUniqueId(String uniqueId)
focal_class.identifier: getByUniqueId
focal_class.modifiers: public
focal_class.parameters: (String uniqueId)
focal_class.return: Incident
focal_class.signature: Incident getByUniqueId(String uniqueId)
focal_class.class_method_signature: IncidentService.getAll()
focal_class.full_signature: public List<Incident> getAll()
focal_class.identifier: getAll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Incident>
focal_class.signature: List<Incident> getAll()
focal_class.class_method_signature: IncidentService.getAllOrderByDateASC()
focal_class.full_signature: public List<Long> getAllOrderByDateASC()
focal_class.identifier: getAllOrderByDateASC
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Long>
focal_class.signature: List<Long> getAllOrderByDateASC()
focal_class.class_method_signature: IncidentService.getAllOrderByDateDES()
focal_class.full_signature: public List<Long> getAllOrderByDateDES()
focal_class.identifier: getAllOrderByDateDES
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Long>
focal_class.signature: List<Long> getAllOrderByDateDES()
focal_class.class_method_signature: IncidentService.getAllOrderByAgeASC()
focal_class.full_signature: public List<Long> getAllOrderByAgeASC()
focal_class.identifier: getAllOrderByAgeASC
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Long>
focal_class.signature: List<Long> getAllOrderByAgeASC()
focal_class.class_method_signature: IncidentService.getAllOrderByAgeDES()
focal_class.full_signature: public List<Long> getAllOrderByAgeDES()
focal_class.identifier: getAllOrderByAgeDES
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Long>
focal_class.signature: List<Long> getAllOrderByAgeDES()
focal_class.class_method_signature: IncidentService.getSearchResult(String uniqueId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.full_signature: public List<Long> getSearchResult(String uniqueId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.identifier: getSearchResult
focal_class.modifiers: public
focal_class.parameters: (String uniqueId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.return: List<Long>
focal_class.signature: List<Long> getSearchResult(String uniqueId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.class_method_signature: IncidentService.getSearchCondition(String shortId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.full_signature: private ConditionGroup getSearchCondition(String shortId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.identifier: getSearchCondition
focal_class.modifiers: private
focal_class.parameters: (String shortId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.return: ConditionGroup
focal_class.signature: ConditionGroup getSearchCondition(String shortId, String survivorCode, int ageFrom, int ageTo, String
              typeOfViolence, String location)
focal_class.class_method_signature: IncidentService.saveOrUpdate(ItemValuesMap itemValues)
focal_class.full_signature: public Incident saveOrUpdate(ItemValuesMap itemValues)
focal_class.identifier: saveOrUpdate
focal_class.modifiers: public
focal_class.parameters: (ItemValuesMap itemValues)
focal_class.return: Incident
focal_class.signature: Incident saveOrUpdate(ItemValuesMap itemValues)
focal_class.class_method_signature: IncidentService.save(ItemValuesMap itemValues)
focal_class.full_signature: public Incident save(ItemValuesMap itemValues)
focal_class.identifier: save
focal_class.modifiers: public
focal_class.parameters: (ItemValuesMap itemValues)
focal_class.return: Incident
focal_class.signature: Incident save(ItemValuesMap itemValues)
focal_class.class_method_signature: IncidentService.update(ItemValuesMap itemValues)
focal_class.full_signature: public Incident update(ItemValuesMap itemValues)
focal_class.identifier: update
focal_class.modifiers: public
focal_class.parameters: (ItemValuesMap itemValues)
focal_class.return: Incident
focal_class.signature: Incident update(ItemValuesMap itemValues)
focal_class.class_method_signature: IncidentService.deleteByRecordId(long recordId)
focal_class.full_signature: public Incident deleteByRecordId(long recordId)
focal_class.identifier: deleteByRecordId
focal_class.modifiers: public
focal_class.parameters: (long recordId)
focal_class.return: Incident
focal_class.signature: Incident deleteByRecordId(long recordId)
focal_class.class_method_signature: IncidentService.getName(ItemValuesMap values)
focal_class.full_signature: private String getName(ItemValuesMap values)
focal_class.identifier: getName
focal_class.modifiers: private
focal_class.parameters: (ItemValuesMap values)
focal_class.return: String
focal_class.signature: String getName(ItemValuesMap values)
focal_class.class_method_signature: IncidentService.getByInternalId(String id)
focal_class.full_signature: public Incident getByInternalId(String id)
focal_class.identifier: getByInternalId
focal_class.modifiers: public
focal_class.parameters: (String id)
focal_class.return: Incident
focal_class.signature: Incident getByInternalId(String id)
focal_class.class_method_signature: IncidentService.hasSameRev(String id, String rev)
focal_class.full_signature: public boolean hasSameRev(String id, String rev)
focal_class.identifier: hasSameRev
focal_class.modifiers: public
focal_class.parameters: (String id, String rev)
focal_class.return: boolean
focal_class.signature: boolean hasSameRev(String id, String rev)
focal_class.class_method_signature: IncidentService.getAllSyncedRecordsId()
focal_class.full_signature: public List<Long> getAllSyncedRecordsId()
focal_class.identifier: getAllSyncedRecordsId
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: List<Long>
focal_class.signature: List<Long> getAllSyncedRecordsId()
focal_class.superclass: extends RecordService
focal_method.body: public Incident save(ItemValuesMap itemValues) throws IOException {
          if (!itemValues.has(DATE_OF_INTERVIEW)) {
              itemValues.addStringItem(DATE_OF_INTERVIEW, getCurrentRegistrationDateAsString());
          }
          String uniqueId = generateUniqueId();
          itemValues.addStringItem(INCIDENT_DISPLAY_ID, getShortUUID(uniqueId));
          itemValues.addStringItem(INCIDENT_ID, uniqueId);
          String username = PrimeroAppConfiguration.getCurrentUser().getUsername();
          itemValues.addStringItem(MODULE, MODULE_GBV_CASE);
          itemValues.addStringItem(RECORD_OWNED_BY, username);
          itemValues.addStringItem(RECORD_CREATED_BY, username);
          itemValues.addStringItem(PREVIOUS_OWNER, username);
  
          Gson gson = new Gson();
          Date date = new Date(Calendar.getInstance().getTimeInMillis());
          Blob tracingBlob = new Blob(gson.toJson(itemValues.getValues()).getBytes());
  
          Incident incident = new Incident();
          incident.setUniqueId(uniqueId);
          incident.setShortId(getShortUUID(uniqueId));
          incident.setCreateDate(date);
          incident.setLastUpdatedDate(date);
          incident.setContent(tracingBlob);
          incident.setName(getName(itemValues));
          incident.setSurvivorCode(getSurvivorCode(itemValues));
          incident.setTypeOfViolence(getTypeOfViolence(itemValues));
          incident.setLocation(getLocation(itemValues));
          incident.setServerUrl(TextUtils.lintUrl(PrimeroAppConfiguration.getApiBaseUrl()));
          int age = itemValues.getAsInt(AGE) != null ? itemValues.getAsInt(AGE) : EMPTY_AGE;
          incident.setAge(age);
          incident.setCaregiver(getCaregiverName(itemValues));
          incident.setRegistrationDate(Utils.getRegisterDateByYyyyMmDd(itemValues.getAsString(DATE_OF_INTERVIEW)));
          incident.setCreatedBy(username);
          incident.setOwnedBy(username);
          String caseId = itemValues.has(CASE_ID) ? itemValues.getAsString(CASE_ID) : EMPTY_ID;
          incident.setCaseUniqueId(caseId);
          incidentDao.save(incident);
          return incident;
      }
focal_method.class_method_signature: IncidentService.save(ItemValuesMap itemValues)
focal_method.full_signature: public Incident save(ItemValuesMap itemValues)
focal_method.identifier: save
focal_method.invocations: has addStringItem getCurrentRegistrationDateAsString generateUniqueId addStringItem getShortUUID addStringItem getUsername getCurrentUser addStringItem addStringItem addStringItem addStringItem getTimeInMillis getInstance getBytes toJson getValues setUniqueId setShortId getShortUUID setCreateDate setLastUpdatedDate setContent setName getName setSurvivorCode getSurvivorCode setTypeOfViolence getTypeOfViolence setLocation getLocation setServerUrl lintUrl getApiBaseUrl getAsInt getAsInt setAge setCaregiver getCaregiverName setRegistrationDate getRegisterDateByYyyyMmDd getAsString setCreatedBy setOwnedBy has getAsString setCaseUniqueId save
focal_method.modifiers: public
focal_method.parameters: (ItemValuesMap itemValues)
focal_method.return: Incident
focal_method.signature: Incident save(ItemValuesMap itemValues)