001package org.kuali.ole.select.document;
002
003import org.apache.commons.lang3.StringUtils;
004import org.kuali.ole.sys.OLEConstants;
005import org.kuali.rice.core.api.config.property.ConfigContext;
006import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
007import org.kuali.rice.krad.service.KRADServiceLocator;
008import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
009
010import java.util.HashMap;
011import java.util.List;
012import java.util.Map;
013
014/**
015 * Created with IntelliJ IDEA.
016 * User: srinivasane
017 * Date: 6/27/13
018 * Time: 11:25 AM
019 * To change this template use File | Settings | File Templates.
020 */
021public class OLEEResourceInstance extends PersistableBusinessObjectBase {
022
023    private String oleEResourceInstanceId;
024    private String oleERSIdentifier;
025    private String instanceId;
026    private String holdingsId;
027    private String instanceFlag;
028    private String bibId;
029    private String instanceTitle;
030    private String isbn;
031    private String instanceHoldings;
032    private String publicDisplayNote;
033    private String instancePublisher;
034    private String platformId;
035    private String platformName;
036    private String status;
037    private String tippStatus;
038    private String subscriptionStatus;
039    private String autoAddTitlesFromGOKb;
040    private String autoRemoveTitlesFromGOKb;
041    private String autoUpdateMetaDataFromGOKb;
042    private String autoArcInstanceRec;
043    private String covStartDate;
044    private String covStartVolume;
045    private String covStartIssue;
046    private String covEndDate;
047    private String covEndVolume;
048    private String covEndIssue;
049    private String perpetualAccStartDate;
050    private String perpetualAccStartVolume;
051    private String perpetualAccStartIssue;
052    private String perpetualAccEndDate;
053    private String perpetualAccEndVolume;
054    private String perpetualAccEndIssue;
055    private String url;
056    private OLEEResourceRecordDocument oleERSDocument;
057    private boolean select;
058    private String redirectUrl;
059    private String eResourceName;
060    private String eResourceDocNum;
061    private Integer gokbId;
062
063    // private List<OLEEResourceCopy> oleCopyList = new ArrayList<OLEEResourceCopy>();
064    public String getOleEResourceInstanceId() {
065        return oleEResourceInstanceId;
066    }
067
068    public void setOleEResourceInstanceId(String oleEResourceInstanceId) {
069        this.oleEResourceInstanceId = oleEResourceInstanceId;
070    }
071
072    public String getOleERSIdentifier() {
073        return oleERSIdentifier;
074    }
075
076    public void setOleERSIdentifier(String oleERSIdentifier) {
077        this.oleERSIdentifier = oleERSIdentifier;
078    }
079
080    public String getHoldingsId() {
081        return holdingsId;
082    }
083
084    public void setHoldingsId(String holdingsId) {
085        this.holdingsId = holdingsId;
086    }
087
088    public String getInstanceFlag() {
089        return instanceFlag;
090    }
091
092    public void setInstanceFlag(String instanceFlag) {
093        this.instanceFlag = instanceFlag;
094    }
095
096    public String getInstanceId() {
097        return instanceId;
098    }
099
100    public void setInstanceId(String instanceId) {
101        this.instanceId = instanceId;
102    }
103
104    public String getBibId() {
105        return bibId;
106    }
107
108    public void setBibId(String bibId) {
109        this.bibId = bibId;
110    }
111
112    public String getInstanceTitle() {
113        return instanceTitle;
114    }
115
116    public void setInstanceTitle(String instanceTitle) {
117        this.instanceTitle = instanceTitle;
118    }
119
120    public String getIsbn() {
121        return isbn;
122    }
123
124    public void setIsbn(String isbn) {
125        this.isbn = isbn;
126    }
127
128    public String getInstanceHoldings() {
129        return instanceHoldings;
130    }
131
132    public void setInstanceHoldings(String instanceHoldings) {
133        this.instanceHoldings = instanceHoldings;
134    }
135
136    public String getPublicDisplayNote() {
137        return publicDisplayNote;
138    }
139
140    public void setPublicDisplayNote(String publicDisplayNote) {
141        this.publicDisplayNote = publicDisplayNote;
142    }
143
144    public String getInstancePublisher() {
145        return instancePublisher;
146    }
147
148    public void setInstancePublisher(String instancePublisher) {
149        this.instancePublisher = instancePublisher;
150    }
151
152    public String getPlatformId() {
153        return platformId;
154    }
155
156    public void setPlatformId(String platformId) {
157        this.platformId = platformId;
158    }
159
160    public String getPlatformName() {
161        if (this.platformId != null) {
162            Map platformMap = new HashMap();
163            platformMap.put(org.kuali.ole.OLEConstants.OLE_PLATFORM_ID, this.platformId);
164            OLEPlatformRecordDocument olePlatformRecordDocument = KRADServiceLocator.getBusinessObjectService().findByPrimaryKey(OLEPlatformRecordDocument.class, platformMap);
165            if (olePlatformRecordDocument != null) {
166                return olePlatformRecordDocument.getName();
167            }
168        }
169        return platformName;
170    }
171
172    public void setPlatformName(String platformName) {
173        this.platformName = platformName;
174    }
175
176    public String getStatus() {
177        return status;
178    }
179
180    public void setStatus(String status) {
181        this.status = status;
182    }
183
184    public String getSubscriptionStatus() {
185        return subscriptionStatus;
186    }
187
188    public void setSubscriptionStatus(String subscriptionStatus) {
189        this.subscriptionStatus = subscriptionStatus;
190    }
191
192    public String getAutoAddTitlesFromGOKb() {
193        return autoAddTitlesFromGOKb;
194    }
195
196    public void setAutoAddTitlesFromGOKb(String autoAddTitlesFromGOKb) {
197        this.autoAddTitlesFromGOKb = autoAddTitlesFromGOKb;
198    }
199
200    public String getAutoRemoveTitlesFromGOKb() {
201        return autoRemoveTitlesFromGOKb;
202    }
203
204    public void setAutoRemoveTitlesFromGOKb(String autoRemoveTitlesFromGOKb) {
205        this.autoRemoveTitlesFromGOKb = autoRemoveTitlesFromGOKb;
206    }
207
208    public String getAutoUpdateMetaDataFromGOKb() {
209        return autoUpdateMetaDataFromGOKb;
210    }
211
212    public void setAutoUpdateMetaDataFromGOKb(String autoUpdateMetaDataFromGOKb) {
213        this.autoUpdateMetaDataFromGOKb = autoUpdateMetaDataFromGOKb;
214    }
215
216    public String getAutoArcInstanceRec() {
217        return autoArcInstanceRec;
218    }
219
220    public void setAutoArcInstanceRec(String autoArcInstanceRec) {
221        this.autoArcInstanceRec = autoArcInstanceRec;
222    }
223
224    public String getCovStartDate() {
225        return covStartDate;
226    }
227
228    public void setCovStartDate(String covStartDate) {
229        this.covStartDate = covStartDate;
230    }
231
232    public String getCovStartVolume() {
233        return covStartVolume;
234    }
235
236    public void setCovStartVolume(String covStartVolume) {
237        this.covStartVolume = covStartVolume;
238    }
239
240    public String getCovStartIssue() {
241        return covStartIssue;
242    }
243
244    public void setCovStartIssue(String covStartIssue) {
245        this.covStartIssue = covStartIssue;
246    }
247
248    public String getCovEndDate() {
249        return covEndDate;
250    }
251
252    public void setCovEndDate(String covEndDate) {
253        this.covEndDate = covEndDate;
254    }
255
256    public String getCovEndVolume() {
257        return covEndVolume;
258    }
259
260    public void setCovEndVolume(String covEndVolume) {
261        this.covEndVolume = covEndVolume;
262    }
263
264    public String getCovEndIssue() {
265        return covEndIssue;
266    }
267
268    public void setCovEndIssue(String covEndIssue) {
269        this.covEndIssue = covEndIssue;
270    }
271
272    public String getPerpetualAccStartDate() {
273        return perpetualAccStartDate;
274    }
275
276    public void setPerpetualAccStartDate(String perpetualAccStartDate) {
277        this.perpetualAccStartDate = perpetualAccStartDate;
278    }
279
280    public String getPerpetualAccStartVolume() {
281        return perpetualAccStartVolume;
282    }
283
284    public void setPerpetualAccStartVolume(String perpetualAccStartVolume) {
285        this.perpetualAccStartVolume = perpetualAccStartVolume;
286    }
287
288    public String getPerpetualAccStartIssue() {
289        return perpetualAccStartIssue;
290    }
291
292    public void setPerpetualAccStartIssue(String perpetualAccStartIssue) {
293        this.perpetualAccStartIssue = perpetualAccStartIssue;
294    }
295
296    public String getPerpetualAccEndDate() {
297        return perpetualAccEndDate;
298    }
299
300    public void setPerpetualAccEndDate(String perpetualAccEndDate) {
301        this.perpetualAccEndDate = perpetualAccEndDate;
302    }
303
304    public String getPerpetualAccEndVolume() {
305        return perpetualAccEndVolume;
306    }
307
308    public void setPerpetualAccEndVolume(String perpetualAccEndVolume) {
309        this.perpetualAccEndVolume = perpetualAccEndVolume;
310    }
311
312    public String getPerpetualAccEndIssue() {
313        return perpetualAccEndIssue;
314    }
315
316    public void setPerpetualAccEndIssue(String perpetualAccEndIssue) {
317        this.perpetualAccEndIssue = perpetualAccEndIssue;
318    }
319
320    public OLEEResourceRecordDocument getOleERSDocument() {
321        return oleERSDocument;
322    }
323
324    public void setOleERSDocument(OLEEResourceRecordDocument oleERSDocument) {
325        this.oleERSDocument = oleERSDocument;
326    }
327
328    public String getUrl() {
329        return url;
330    }
331
332    public void setUrl(String url) {
333        this.url = url;
334    }
335
336    public String geteResourceName() {
337        eResourceName = this.oleERSDocument.getTitle();
338        return eResourceName;
339    }
340
341    public void seteResourceName(String eResourceName) {
342        this.eResourceName = eResourceName;
343    }
344
345    public String geteResourceDocNum() {
346        this.eResourceDocNum = this.oleERSDocument.getDocumentNumber();
347        return eResourceDocNum;
348    }
349
350    public void seteResourceDocNum(String eResourceDocNum) {
351        this.eResourceDocNum = eResourceDocNum;
352    }
353
354    /*
355    public List<OLEEResourceCopy> getOleCopyList() {
356        return oleCopyList;
357    }
358
359    public void setOleCopyList(List<OLEEResourceCopy> oleCopyList) {
360        this.oleCopyList = oleCopyList;
361    }*/
362
363    public boolean isSelect() {
364        return select;
365    }
366
367    public void setSelect(boolean select) {
368        this.select = select;
369    }
370
371    public String getRedirectUrl() {
372        if (StringUtils.isNotBlank(this.getPlatformId())) {
373            Map map = new HashMap<>();
374            map.put(org.kuali.ole.OLEConstants.OLE_PLATFORM_ID, this.getPlatformId());
375            List<OLEPlatformRecordDocument> olePlatformRecordDocumentList = (List<OLEPlatformRecordDocument>) KRADServiceLocator.getBusinessObjectService().findMatching(OLEPlatformRecordDocument.class, map);
376            if (olePlatformRecordDocumentList != null && olePlatformRecordDocumentList.size() == 1) {
377                redirectUrl = ConfigContext.getCurrentContextConfig().getProperty("ole.platform.url") + "platformRecordController?viewId=OLEPlatformRecordView&methodToCall=docHandler&docId=" + olePlatformRecordDocumentList.get(0).getDocumentNumber()+"&command=displayDocSearchView";
378
379            }
380        }
381        return redirectUrl;
382    }
383
384    public void setRedirectUrl(String redirectUrl) {
385        this.redirectUrl = redirectUrl;
386    }
387
388    public Integer getGokbId() {
389        return gokbId;
390    }
391
392    public void setGokbId(Integer gokbId) {
393        this.gokbId = gokbId;
394    }
395
396    public String getTippStatus() {
397        return tippStatus;
398    }
399
400    public void setTippStatus(String tippStatus) {
401        this.tippStatus = tippStatus;
402    }
403}