001package org.kuali.ole.sip2.constants;
002
003import org.kuali.ole.OLEConstants;
004import org.kuali.ole.sip2.service.OLENettyServer;
005import org.kuali.rice.coreservice.api.CoreServiceApiServiceLocator;
006import org.kuali.rice.coreservice.api.parameter.Parameter;
007import org.kuali.rice.coreservice.api.parameter.ParameterKey;
008
009/**
010 * CreCated by sheiksalahudeenm on 12/30/14.
011 */
012public class OLESIP2Constants {
013
014    public static OLENettyServer olesip2Server = null;
015
016    public static final String NON_ROMAN_REGEX="[^\\w\\s\\-_,:\\(\\)\\[\\]\\/\\!]";
017    public static final String SIP2_FORMAT = "sip";
018    public static final String SIP_SERVICE = "sipService";
019    public static final String REQUEST_DATA = "requestData";
020    public static final String LOGIN_USER = "loginUser";
021    public static final String FAIL_TO_LOAD = "Failed to start Socket server";
022    public static final String SERVER_RUNNING = "Server Status: Socket Server is Running";
023    public static final String REFRESH_PAGE = "Already request is send by someone else to start server. Please wait for few seconds and refresh the page";
024    public static final String STARTED_SUCCESSFULLY = "Socket server started Successfully";
025    public static final String PROBLEM_WITH_SERVER = "Problem with starting Socket Server";
026    public static final String PARAMETER_MISSING = "Some parameters are missing from request";
027    public static final String SERVER_STOPPED = "Server Status: Socket Server Stopped";
028    public static final String SERVER_DOWN = "Server Status: Socket Server is Down";
029    public static final String INSTITUTION = getParameter("SIP2_INSTITUTION_NAME");  
030    public static final String REQUEST_TYPE = getParameter("SIP2_REQUEST_TYPE");  
031    public static final String OPERATOR_ID = getParameter("SIP2_OPERATOR_ID"); 
032    public static String ALREADY_REQUEST_PROCESSING = "N";
033    public static final String SIP2_DATE_FORMAT = "yyyyMMdd    HHmmss";
034    public static final String SPLIT = "|";
035
036    //SIP Version
037    public static final String SIP_VERSION = "2.00";
038    //YES or NO
039    public static final String Y="Y";
040    public static final String N="N";
041
042    public static final String TIME_OUT_PERIOD="600";
043    public static final String RETRIES_ALLOWED="010";
044    public static final String ACS_SCREEN_MSG="System is Available";
045
046    //SIP2 Codes
047    public static final String PATRON_IDENTIFIER_CODE="AA";
048    public static final String ITEM_IDENTIFIER_CODE="AB";
049    public static final String TERMINAL_PWD_CODE="AC";
050    public static final String PATRON_PWD_CODE="AD";
051    public static final String PERSONAL_NAME_CODE="AE";
052    public static final String SCREEN_MSG_CODE="AF";
053    public static final String PRINT_LINE_CODE="AG";
054    public static final String DUE_DATE_CODE="AH";
055    public static final String TITLE_IDENTIFIER_CODE="AJ";
056    public static final String BLOCKED_CARD_MSG="AL";
057    public static final String LIBRARY_NAME_CODE="AN";
058    public static final String TERMINAL_LOCATION_CODE="AM";
059    public static final String INSTITUTION_ID_CODE="AO";
060    public static final String CURRENT_LOCATION_CODE="AP";
061    public static final String PERMANENT_LOCATION_CODE="AQ";
062    public static final String HOLE_ITEMS_CODE="AS";
063    public static final String OVERDUE_ITEMS_CODE="AT";
064    public static final String CHARGED_ITEMS_CODE="AU";
065    public static final String FINE_ITEMS_CODE="AV";
066    public static final String SEQUENCE_NUM_CODE="AY";
067    public static final String CHECKSUM_CODE="AZ";
068    public static final String HOME_ADDRESS_CODE="BD";
069    public static final String EMAIL_ADDRESS_CODE="BE";
070    public static final String HOME_PHONE_NUM_CODE="BF";
071    public static final String OWNER_CODE="BG";
072    public static final String CURRENCY_TYPE_CODE="BH";
073    public static final String CANCEL_CODE="BI";
074    public static final String TRANSACTION_ID_CODE="BK";
075    public static final String VALID_PATRON_CODE="BL";
076    public static final String RENEWED_ITEMS_CODE="BM";
077    public static final String UN_RENEWED_ITEMS_CODE="BN";
078    public static final String FEE_ACKNOWLEDGED_CODE="BO";
079    public static final String START_ITEM_CODE="BP";
080    public static final String END_ITEM_CODE="BQ";
081    public static final String QUEUE_POSITION_CODE="BR";
082    public static final String PICKUP_LOCATION_CODE="BS";
083    public static final String FEE_TYPE_CODE="BT";
084    public static final String RECALL_ITEMS_CODE="BU";
085    public static final String FEE_AMOUNT_CODE="BV";
086    public static final String EXPIRATION_DATE_CODE="BW";
087    public static final String SUPPORTED_MSG_CODE="BX";
088    public static final String HOLD_TYPE_CODE="BY";
089    public static final String HOLD_ITEMS_LIMIT_CODE="BZ";
090    public static final String OVERDUE_ITEMS_LIMIT_CODE="CA";
091    public static final String CHARGED_ITEMS_LIMIT_CODE="CB";
092    public static final String FEE_LIMIT_CODE="CC";
093    public static final String UN_AVA_HOLD_ITEMS_CODE="CD";
094    public static final String HOLD_QUEUE_LENGTH_CODE="CF";
095    public static final String FEE_IDENTIFIER_CODE="CG";
096    public static final String ITEM_PROPERTIES_CODE="CH";
097    public static final String SECURITY_INHIBIT_CODE="CI";
098    public static final String RECALL_DATE_CODE="CJ";
099    public static final String MEDIA_TYPE_CODE="CK";
100    public static final String SORT_BIN_CODE="CL";
101    public static final String HOLD_PICKUP_DATE_CODE="CM";
102    public static final String LOGIN_USER_ID_CODE="CN";
103    public static final String LOGIN_PWD_ID_CODE="CO";
104    public static final String LOCATION_CODE_SIP="CP";
105    public static final String VALID_PATRON_PWD="CQ";
106
107    //SIP2 Request Code
108    public static final String PATRON_STATUS_REQUEST="23";
109    public static final String CHECKOUT_REQUEST="11";
110    public static final String CHECK_IN_REQUEST="09";
111    public static final String BLOCK_PATRON_REQUEST="01";
112    public static final String SC_STATUS_REQUEST="99";
113    public static final String ACS_REQUEST="97";
114    public static final String LOGIN_REQUEST="93";
115    public static final String PATRON_INFORMATION_REQUEST="63";
116    public static final String END_PATRON_SESSION_REQUEST="35";
117    public static final String FEE_PAID_REQUEST="37";
118    public static final String ITEM_INFORMATION_REQUEST="17";
119    public static final String ITEM_STATUS_UPDATE_REQUEST="19";
120    public static final String PATRON_ENABLE_REQUEST="25";
121    public static final String HOLD_REQUEST="15";
122    public static final String RENEW_REQUEST="29";
123    public static final String RENEW_ALL_REQUEST="65";
124
125    //SIP2 Response Code
126    public static final String PATRON_STATUS_RESPONSE="24";
127    public static final String CHECKOUT_RESPONSE="12";
128    public static final String CHECK_IN_RESPONSE="10";
129    public static final String ACS_STATUS_RESPONSE="98";
130    public static final String SC_RESEND_RESPONSE="96";
131    public static final String LOGIN_RESPONSE="94";
132    public static final String PATRON_INFORMATION_RESPONSE="64";
133    public static final String END_PATRON_SESSION_RESPONSE="36";
134    public static final String FEE_PAID_RESPONSE="38";
135    public static final String ITEM_INFORMATION_RESPONSE="18";
136    public static final String ITEM_STATUS_UPDATE_RESPONSE="20";
137    public static final String PATRON_ENABLE_RESPONSE="26";
138    public static final String HOLD_RESPONSE="16";
139    public static final String RENEW_RESPONSE="30";
140    public static final String RENEW_ALL_RESPONSE="66";
141
142    //SIP2 Hold Type
143    public static final String ADD_HOLD="add";
144    public static final String DELETE_HOLD="delete";
145    public static final String UPDATE_HOLD="updateHold";
146
147    public static final String CHECK_IN_SUCCESS="SuccessFully Checked-in";
148    public static final String RENEW_SUCCESS="Item successFully renewed";
149    public static final String CHECK_OUT_SUCCESS="Successfully loaned";
150    public static final String CHECK_OUT_SUCCESSFULLY="Item Successfully loaned";
151    public static final String CHECK_OUT_FAILED="Item cannot be loaned : any query see help desk";
152    public static final String PATRON_SESSION_END="Patron Session Ended Successfully";
153    public static final String FEE_PAID="Successfully Paid the Amount";
154    public static final String SERVICE_ERROR="Cannot Able to process this service";
155    public static final String REQUEST_RAISED="Request Raised Succesfully";
156    public static final String SUCCESSFULLY="Succesfully";
157    public static final String SERVICE_UNAVAILABLE="Update Hold Request Service Currently Not Available in OLE";
158    public static final String ITEM_UNAVAILABLE="Item is Not Available";
159    public static final String ITEM_SERVICE_NOT_SUPPORTED="Item Status Update Service - Not supported in OLE";
160    public static final String PATRON_ENABLED="Patron Enabled successfully";
161    public static final String YES="YES";
162    public static final String ONHOLD="ONHOLD";
163    public static final String REQUEST_PROCESSED="Requested process completed successfully.";
164
165    public static String getParameter(String name) {
166        ParameterKey parameterKey = ParameterKey.create(OLEConstants.APPL_ID, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT,name);
167        Parameter parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(parameterKey);
168        if(parameter==null){
169            parameterKey = ParameterKey.create(OLEConstants.APPL_ID_OLE, OLEConstants.DLVR_NMSPC, OLEConstants.DLVR_CMPNT,name);
170            parameter = CoreServiceApiServiceLocator.getParameterRepositoryService().getParameter(parameterKey);
171        }
172        return parameter!=null?parameter.getValue():null;
173    }
174}