This integration is a web service. It is called via a batch job. Data will be retrieved from Aim, via a web service. The data is in JSON format. The batch job will execute using Spring Batch to retrieve the data, insert or update records in the database, and send an email with a report file attached.
AIM links
Test URL | https://aimdev.uconn.edu/api/index?key=[API KEY]&method=BLDG_UPDATES&days=7&format=json |
Stage URL | https://aimtest.uconn.edu/api/index?key=[API KEY]&method=BLDG_UPDATES&days=7&format=json |
Prod URL | https://aim.uconn.edu/api/index?key=[API KEY]&method=BLDG_UPDATES&days=7&format=json |
The Aim links are included in the Batch Properties file on the AEWEB server. The days= parameter can be adjusted to capture data for a longer period of time or for a lesser period of time. It is currently set at 7 days.
Aim Web Service Documentation
Test Aim from local machine
Access/permission to the Aim site is needed. Contact Aim ITS Administrator for access. Provide IP address and machine name.
Sample JSON Building input
[{"CAMPUS_ID":"01",
"CAMPUS_DESCRIPTION":"STORRS CAMPUS",
"BLDG":"0186",
"BLDG_DESCRIPTION":"MANSFIELD APTS BLDG 10 (4 UNITS)",
"BLDG_ADDRESS1":"ONE SOUTH EAGLEVILLE ROAD",
"BLDG_ADDRESS2":null,
"BLDG_CITY":"STORRS",
"BLDG_STATE_CODE":"CT",
"BLDG_ZIP":"06269",
"LATITUDE":"41.7991589200",
"LONGITUDE":"-72.2430733700",
"PROP_TYPE":"BUILDING",
"BLDG_CLASS":"RESIDENTIAL",
"BLDG_STATUS":"IN SERVICE",
"BLDG_OWNED_YN":"Y",
"DATE_BUILT":"1951",
"RENOVATION_YEAR":null,
"DATE_DISPOSED":null,
"BLDG_ABBREVIATION ":null,
"EXTRA_DESCRIPTION":null,
"GROSS_SQFT":"4,521.00",
"NET_SQFT":"3,280.00",
"ASSIGNABLE_SQFT":"3,117.34"}]
Source Code Definition for Aim Building Data
JSON formatted |
---|
edu.uconn.webapi.model.aim.AimBuilding.java |
KFS Table Definition
SH_BUILDING_T | java field | Aim field | Description |
---|---|---|---|
CAMPUS_CD | campusCode | CAMPUS_ID | |
OBJ_ID | objectID | if new building, create new OBJ_ID | |
VER_NBR | versioNumber | if new building, set version number to 1 | |
BLDG_CD | buildingCode | BLDG | |
BLDG_NM | name | BLDG_DESCRIPTION | |
BLDG_STR_ADDR | streetAddress | BLDG_ADDRESS1 | |
BLDG_ADDR_CTY_NM | city | BLDG_CITY | |
BLDG_ADDR_ST_CD | stateCode | BLDG_STATE_CODE | |
BLDG_ADDR_ZIP_CD | zipCode | BLDG_ZIP | |
ALTRNT_BLDG_CD | alternateBuildingCode | BLDG_OWNED_YN | |
ROW_ACTV_IND | activeIndicator | BLDG_STATUS | when Aim is "disposed", set KFS to "N", otherwise set to "Y" |
BLDG_CNTRY_CD | countryCode | hardcode "US" |
Requirements
- When the building does not exist in KFS, create an object id using java.util.UUID.randomUUID().toString() and set the version number to 1.
- When the building status is “DISPOSED”, the set the active indicator to “N”, otherwise set it to “Y”.
- Set the country code to “US”.
- Truncate Building Address so that it matches the length in KFS (to prevent a SQL error).
- When the building exists in KFS, just update the row with the supplied data, otherwise insert a new row using the supplied data.
- Create a formatted report file to list all transactions. The first line of the file is contains the process date and report title, the second line contains the column headings, and the last line of the file is “***End of Report ***”.
- Send an email to inventorycontrol@uconn.edu with the input JSON in the body and the formatted report as an attachment.
- If there are SQL errors, capture and print the error.
Location and name of the report file
uconn_configs/webapi/config/batch | |
---|---|
roomData_yyyymmdd_hhMMSS_SSS.txt | where yyyy = year, mm=month, dd=day, hh=hour, MM = minute, SS=seconds, SSS=sequence number |
Sample Report
(Use Notepad++ to view)
buildingData_20200507_105737_319.txt
Execution Command
/webapi/updateBuildingsFromAim.html |
Control-M Schedule and Job
UAT | UAT_AEWEB_AIM_SCHEDULE_1 | UAT_AEWEB_FROM_AIM_BUILDING |
PRD | PRD_AEWEB_AIM_SCHEDULE | PRD_AEWEB_FROM_AIM_BUILDING |
The UAT job is manually loaded and run. The production job is scheduled to run every Friday evening. If this job is to be moved, the days= parameter in the batch properties files may need to be adjusted.