001package org.kuali.ole.sip2.response; 002 003 004import org.kuali.ole.sip2.sip2Server.MessageUtil; 005 006/** 007 * Created by gayathria on 17/9/14. 008 */ 009public class OLESIP2ItemInfoTurnedOffResponse extends OLESIP2TurnedOffResponse { 010 011 012 public OLESIP2ItemInfoTurnedOffResponse() { 013 this.code = "18"; 014 } 015 016 017 public String getOLESIP2ItemInfoTurnedOffResponse(String requestData) { 018 019 String[] requestDataArray = requestData.split("\\|"); 020 021 StringBuilder builder = new StringBuilder(); 022 builder.append(code); 023 builder.append("08"); 024 builder.append("00"); 025 builder.append("01"); 026 builder.append(MessageUtil.getSipDateTime()); 027 builder.append("AB"); 028 for (String data : requestDataArray) { 029 if (data.startsWith("AB")) { 030 builder.append((data.replaceFirst("AB", "")).trim()); 031 } 032 } 033 builder.append("|AJ "); 034 /*for (String data : requestDataArray) { 035 if (data.startsWith("AJ")) { 036 builder.append((data.replaceFirst("|AJ", "")).trim()); 037 } 038 }*/ 039 builder.append("|AF"); 040 builder.append("Item Information Service Currently turned Off"); 041 042 for (String data : requestDataArray) { 043 if (data.startsWith("AY")) { 044 builder.append("|AY"); 045 builder.append(data.substring(2, 5)); 046 builder.append(MessageUtil.computeChecksum(builder.toString())); 047 } 048 } 049 050 return builder.toString() + '\r'; 051 } 052 053 054}