Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

package gov.va.med.pbm.ampl.fhir.unmarshall.dstu2.unbundle;

import java.util.ArrayList;
import java.util.Collection;

import gov.va.med.pbm.ampl.constant.MockDataConstants;
import gov.va.med.pbm.ampl.model.patientdemographics.EnvironmentalExposure;
import gov.va.med.pbm.ampl.model.patientdemographics.MilitaryService;
import gov.va.med.pbm.ampl.model.patientdemographics.Service;
import gov.va.med.pbm.ampl.model.patientdemographics.ServiceLocation;
import gov.va.med.pbm.ampl.utility.operations.SortOperation;

/**
* The UnbundleFacility class marshals a patients military resource to a client readable JSON format.
*
* @author Ian Meinert
*
*/
public class UnbundleMilitaryService {

/**
* The default constructor accepting no parameters.
*/
public UnbundleMilitaryService() {
}

/**
* This method marshals resources into a {@link MilitaryService}.
*
* @return {@link MilitaryService}
*/
public MilitaryService getMilitaryService() {
MilitaryService military = new MilitaryService();

military.setCombatInformation(this.getLocationsForMilitaryService()[0]);
military.setConflictLocations(this.getLocationsForMilitaryService());
military.setDentalExtraction(MockDataConstants.NOT_MAPPED);
military.setDentalInjury(MockDataConstants.NOT_MAPPED);
military.setDisabilityDischarge(MockDataConstants.NOT_MAPPED);
military.setDisabilityRetirement(MockDataConstants.NOT_MAPPED);
military.setEnvironmentalExposures(this.getExposuresForMilitary());
military.setPowInformation(this.getLocationsForMilitaryService()[0]);
military.setPurpleHeartIndicator(MockDataConstants.NOT_MAPPED);
military.setPurpleHeartStatus(MockDataConstants.NOT_MAPPED);
military.setServiceInformation(this.getMilitaryServices());

return military;
}

/**
* This method generates a mock {@link ServiceLocation} array for a patient's military service.
*
* @return {@link ServiceLocation} array
*/
private ServiceLocation[] getLocationsForMilitaryService() {
Collection<ServiceLocation> locationCollection = new ArrayList<ServiceLocation>();
SortOperation<ServiceLocation> sortOperation = new SortOperation<ServiceLocation>();
ServiceLocation location = new ServiceLocation();

sortOperation.setSortParams("fromDate[ASC]");

location.setLocation(MockDataConstants.NOT_MAPPED);
location.setServiceIndicated(false);
// location.setFromDate(dateTime);
// location.setToDate();

locationCollection.add(location);

Collection<ServiceLocation> temp = sortOperation.sortFieldWithNull(locationCollection);

return temp.toArray(new ServiceLocation[temp.size()]);
}

/**
* This method generates a mock {@link EnvironmentalExposure} array for a patient's military service.
*
* @return {@link EnvironmentalExposure} array
*/
private EnvironmentalExposure[] getExposuresForMilitary() {
Collection<EnvironmentalExposure> exposureCollection = new ArrayList<EnvironmentalExposure>();
EnvironmentalExposure exposure = new EnvironmentalExposure();

// exposure.setExamDate();
exposure.setExposureIndicated(false);
// exposure.setRegistrationDate();
exposure.setTypeOfExposure(MockDataConstants.NOT_MAPPED);
exposure.setExposureMethod(MockDataConstants.NOT_MAPPED);
exposure.setScreeningStatus(MockDataConstants.NOT_MAPPED);

exposureCollection.add(exposure);

return exposureCollection.toArray(new EnvironmentalExposure[exposureCollection.size()]);
}

/**
* This method generates a mock {@link Service} information array for a patient's military service.
*
* @return {@link Service} array
*/
private Service[] getMilitaryServices() {
Collection<Service> serviceCollection = new ArrayList<Service>();

SortOperation<Service> sortOperation = new SortOperation<Service>();
sortOperation.setSortParams("entryDate[ASC]");

Service service = new Service();

service.setBranch(MockDataConstants.NOT_MAPPED);
service.setComponent(MockDataConstants.NOT_MAPPED);
service.setNumber(MockDataConstants.NOT_MAPPED);
service.setDischargeType(MockDataConstants.NOT_MAPPED);
// service.setEntryDate();
// service.setSeparationDate();

serviceCollection.add(service);

Collection<Service> temp = sortOperation.sortFieldWithNull(serviceCollection);

return temp.toArray(new Service[temp.size()]);
}
}