1 package org.kuali.ole.describe.controller;
2
3 import org.apache.commons.lang.StringUtils;
4 import org.apache.solr.client.solrj.SolrServerException;
5 import org.kuali.asr.service.ASRHelperServiceImpl;
6 import org.kuali.ole.DocumentUniqueIDPrefix;
7 import org.kuali.ole.OLEConstants;
8 import org.kuali.ole.deliver.bo.ASRItem;
9 import org.kuali.ole.deliver.bo.OleDeliverRequestBo;
10 import org.kuali.ole.deliver.bo.OleLoanDocument;
11 import org.kuali.ole.describe.bo.DocumentSelectionTree;
12 import org.kuali.ole.describe.bo.DocumentTreeNode;
13 import org.kuali.ole.describe.bo.InstanceEditorFormDataHandler;
14 import org.kuali.ole.describe.form.EditorForm;
15 import org.kuali.ole.describe.form.WorkBibMarcForm;
16 import org.kuali.ole.describe.form.WorkInstanceOlemlForm;
17 import org.kuali.ole.describe.keyvalue.LocationValuesBuilder;
18 import org.kuali.ole.docstore.common.client.DocstoreClient;
19 import org.kuali.ole.docstore.common.document.*;
20 import org.kuali.ole.docstore.common.document.HoldingsTree;
21 import org.kuali.ole.docstore.common.document.Item;
22 import org.kuali.ole.docstore.common.document.content.enums.DocCategory;
23 import org.kuali.ole.docstore.common.document.content.enums.DocFormat;
24 import org.kuali.ole.docstore.common.document.content.enums.DocType;
25 import org.kuali.ole.docstore.common.document.content.instance.*;
26 import org.kuali.ole.docstore.common.document.content.instance.xstream.HoldingOlemlRecordProcessor;
27 import org.kuali.ole.docstore.common.document.content.instance.xstream.ItemOlemlRecordProcessor;
28 import org.kuali.ole.docstore.common.exception.DocstoreException;
29 import org.kuali.ole.docstore.engine.client.DocstoreLocalClient;
30 import org.kuali.ole.select.bo.OLESerialReceivingDocument;
31 import org.kuali.ole.select.bo.OLESerialReceivingHistory;
32 import org.kuali.ole.select.businessobject.OleCopy;
33 import org.kuali.ole.service.impl.OLESerialReceivingServiceImpl;
34 import org.kuali.rice.core.api.util.tree.Node;
35 import org.kuali.rice.kim.api.permission.PermissionService;
36 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
37 import org.kuali.rice.krad.service.BusinessObjectService;
38 import org.kuali.rice.krad.service.KRADServiceLocator;
39 import org.kuali.rice.krad.uif.UifParameters;
40 import org.kuali.rice.krad.util.GlobalVariables;
41 import org.kuali.rice.krad.util.KRADConstants;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
44
45 import javax.servlet.http.HttpServletRequest;
46 import java.text.Format;
47 import java.text.SimpleDateFormat;
48 import java.util.*;
49
50
51
52
53
54
55
56
57 public class WorkHoldingsOlemlEditor extends AbstractEditor {
58
59 private static final Logger LOG = LoggerFactory.getLogger(WorkHoldingsOlemlEditor.class);
60 private InstanceEditorFormDataHandler instanceEditorFormDataHandler = null;
61 private static WorkHoldingsOlemlEditor workHoldingsOlemlEditor = null;
62 private ItemOlemlRecordProcessor itemOlemlRecordProcessor ;
63 private ASRHelperServiceImpl asrHelperService ;
64 private BusinessObjectService businessObjectService ;
65 private DocstoreClient docstoreClient = getDocstoreLocalClient();
66
67 public static WorkHoldingsOlemlEditor getInstance() {
68 if (workHoldingsOlemlEditor == null) {
69 workHoldingsOlemlEditor = new WorkHoldingsOlemlEditor();
70 }
71 return workHoldingsOlemlEditor;
72 }
73
74 public ItemOlemlRecordProcessor getItemOlemlRecordProcessor(){
75 if(itemOlemlRecordProcessor == null){
76 itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
77 }
78 return itemOlemlRecordProcessor;
79 }
80
81
82 public ASRHelperServiceImpl getAsrHelperService(){
83 if(asrHelperService == null){
84 asrHelperService = new ASRHelperServiceImpl();
85 }
86 return asrHelperService;
87
88 }
89
90 public BusinessObjectService getBusinessObjectService(){
91 if(businessObjectService == null){
92 businessObjectService = KRADServiceLocator.getBusinessObjectService();
93 }
94 return businessObjectService;
95 }
96
97 private WorkHoldingsOlemlEditor() {
98
99 }
100
101 @Override
102 public EditorForm loadDocument(EditorForm editorForm) {
103
104
105 WorkInstanceOlemlForm workInstanceOlemlForm = new WorkInstanceOlemlForm();
106
107 editorForm.setHeaderText("Holdings");
108 editorForm.setHasLink(true);
109 editorForm.setShowEditorFooter(true);
110 String bibId = editorForm.getBibId();
111 List<BibTree> bibTreeList = new ArrayList();
112 Date date = new Date();
113 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
114 String dateStr = sdf.format(date);
115 BibTree bibTree = null;
116 if (!StringUtils.isNotEmpty(bibId)) {
117 workInstanceOlemlForm.setMessage("Error: Invalid bibId id:" + bibId);
118 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO, "invalid.bib");
119 return workInstanceOlemlForm;
120 }
121
122 Bib bib = null;
123 try {
124 bibTree = docstoreClient.retrieveBibTree(bibId);
125 }catch (DocstoreException e) {
126 LOG.error("Exception : ", e);
127 DocstoreException docstoreException = (DocstoreException) e;
128 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
129 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
130 } else {
131 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
132 }
133 return workInstanceOlemlForm;
134 } catch (Exception e) {
135 LOG.error("Exception ", e);
136 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,"docstore.response", e.getMessage() );
137 }
138 bibTreeList.add(bibTree);
139 workInstanceOlemlForm.setBibTreeList(bibTreeList);
140 bib = bibTree.getBib();
141 editorForm.setTitle(bib.getTitle() + " / " + bib.getAuthor());
142 editorForm.setHasLink(true);
143 if (!isValidBib(bib.getContent())) {
144 workInstanceOlemlForm.setMessage("Error: Invalid bibId id:" + bibId);
145 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO, "invalid.bib");
146 return workInstanceOlemlForm;
147 }
148
149 String docId = editorForm.getDocId();
150 if (StringUtils.isNotEmpty(docId)) {
151 editorForm.setHoldingLocalIdentifier(DocumentUniqueIDPrefix.getDocumentId(editorForm.getDocId()));
152 Holdings holdings = null;
153 try {
154 holdings = docstoreClient.retrieveHoldings(editorForm.getDocId());
155 }catch (DocstoreException e) {
156 LOG.error("Exception : ", e);
157 DocstoreException docstoreException = (DocstoreException) e;
158 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
159 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
160 } else {
161 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
162 }
163 return workInstanceOlemlForm;
164 } catch (Exception e) {
165 LOG.error("Exception ", e);
166 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,"docstore.response", e.getMessage() );
167 } String docStoreData = holdings.getContent();
168 OleHoldings oleHoldings = null;
169 if (StringUtils.isNotEmpty(docStoreData)) {
170 oleHoldings = new HoldingOlemlRecordProcessor().fromXML(docStoreData);
171 editorForm.setStaffOnlyFlagForHoldings(holdings.isStaffOnly());
172 editorForm.setHoldingCreatedDate(holdings.getCreatedOn());
173 editorForm.setHoldingCreatedBy(holdings.getCreatedBy());
174 editorForm.setHoldingUpdatedDate(holdings.getUpdatedOn());
175 editorForm.setHoldingUpdatedBy(holdings.getUpdatedBy());
176
177
178 ensureMultipleValuesInOleHoldings(oleHoldings);
179
180 workInstanceOlemlForm.setSelectedHolding(oleHoldings);
181 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
182 } else {
183 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, "ds.error.holdings.notfound");
184 workInstanceOlemlForm.setViewId("WorkHoldingsViewPage");
185 return workInstanceOlemlForm;
186 }
187
188 if (editorForm.getEditable().equalsIgnoreCase("false")) {
189 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO,
190 "holdings.record.load.message");
191 } else {
192 boolean hasPermission = canEditInstance(GlobalVariables.getUserSession().getPrincipalId());
193 if (hasPermission) {
194 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO, "holdings.record.load.message");
195 } else {
196 editorForm.setHideFooter(false);
197 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_INFO, OLEConstants.ERROR_EDIT_INSTANCE);
198 }
199 }
200 } else {
201 editorForm.setHoldingLocalIdentifier("");
202 editorForm.setHoldingUpdatedBy("");
203 editorForm.setHoldingUpdatedDate("");
204 editorForm.setStaffOnlyFlagForHoldings(false);
205 editorForm.setHoldingCreatedBy(GlobalVariables.getUserSession().getPrincipalName());
206 editorForm.setHoldingCreatedDate(dateStr);
207 boolean hasPermission = canCreateInstance(GlobalVariables.getUserSession().getPrincipalId());
208 if (hasPermission) {
209 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO, "holdings.record.new.load.message");
210 } else {
211 editorForm.setHideFooter(false);
212 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_INFO, OLEConstants.ERROR_CREATE_INSTANCE);
213 }
214 }
215 if (editorForm.getDocId() != null) {
216 OLESerialReceivingServiceImpl oleSerialReceivingService = new OLESerialReceivingServiceImpl();
217 Map<String, String> map = new HashMap<>();
218 map.put("instanceId", editorForm.getDocId());
219 List<OLESerialReceivingDocument> oleSerialReceivingDocuments = (List<OLESerialReceivingDocument>) KRADServiceLocator.getBusinessObjectService().findMatching(OLESerialReceivingDocument.class, map);
220 for (OLESerialReceivingDocument oleSerialReceivingDocument : oleSerialReceivingDocuments) {
221 if (oleSerialReceivingDocument.isActive()) {
222 editorForm.setSerialFlag(true);
223 oleSerialReceivingService.readReceivingRecordType(oleSerialReceivingDocument);
224 oleSerialReceivingService.updateEnumCaptionValues(oleSerialReceivingDocument, null);
225 if (oleSerialReceivingDocument.getOleSerialReceivingHistoryList() != null && oleSerialReceivingDocument.getOleSerialReceivingHistoryList().size() > 0) {
226 for (int serialReceivingHistoryList = 0; serialReceivingHistoryList < oleSerialReceivingDocument.getOleSerialReceivingHistoryList().size(); serialReceivingHistoryList++) {
227 oleSerialReceivingService.setEnumerationAndChronologyValues(oleSerialReceivingDocument.getOleSerialReceivingHistoryList().get(serialReceivingHistoryList));
228 }
229 }
230 if (oleSerialReceivingDocument.getUnboundLocation() != null) {
231 editorForm.setUnboundLocation(oleSerialReceivingDocument.getUnboundLocation());
232 }
233 oleSerialReceivingService.sortById(oleSerialReceivingDocument.getOleSerialReceivingHistoryList());
234 for (OLESerialReceivingHistory oleSerialReceivingHistory : oleSerialReceivingDocument.getOleSerialReceivingHistoryList()) {
235 if (oleSerialReceivingHistory.isPublicDisplay()) {
236 if (oleSerialReceivingHistory.getReceivingRecordType().equalsIgnoreCase("Main")) {
237 editorForm.getMainSerialReceivingHistoryList().add(oleSerialReceivingHistory);
238 }
239 if (oleSerialReceivingHistory.getReceivingRecordType().equalsIgnoreCase("Supplementary")) {
240 editorForm.getSupplementSerialReceivingHistoryList().add(oleSerialReceivingHistory);
241 }
242 if (oleSerialReceivingHistory.getReceivingRecordType().equalsIgnoreCase("Index")) {
243 editorForm.getIndexSerialReceivingHistoryList().add(oleSerialReceivingHistory);
244 }
245 }
246 }
247 }
248 }
249 }
250 workInstanceOlemlForm.setViewId("WorkHoldingsViewPage");
251 return workInstanceOlemlForm;
252 }
253
254 private void ensureMultipleValuesInOleHoldings(OleHoldings oleHoldings) {
255 List<ExtentOfOwnership> extentOfOwnerships = ensureAtleastOneExtentOfOwnership(
256 oleHoldings.getExtentOfOwnership());
257 oleHoldings.setExtentOfOwnership(extentOfOwnerships);
258
259 List<Note> notes = ensureAtleastOneNote(oleHoldings.getNote());
260 oleHoldings.setNote(notes);
261
262 List<Uri> uriList = ensureAtleastOneUri(oleHoldings.getUri());
263 oleHoldings.setUri(uriList);
264 }
265
266 @Override
267 public EditorForm saveDocument(EditorForm editorForm) {
268 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
269 String bibId = editorForm.getBibId();
270 List<BibTree> bibTreeList = null;
271 BibTree bibTree = null;
272 HoldingsTree holdingsTree = new HoldingsTree();
273 String editorMessage = "";
274 Bib bib = null;
275 Date date = new Date();
276 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
277 String dateStr = sdf.format(date);
278 String user = GlobalVariables.getUserSession().getPrincipalName();
279 try {
280 bibTree = docstoreClient.retrieveBibTree(bibId);
281 }catch (DocstoreException e) {
282 LOG.error("Exception : ", e);
283 DocstoreException docstoreException = (DocstoreException) e;
284 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
285 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
286 } else {
287 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
288 }
289 return workInstanceOlemlForm;
290 } catch (Exception e) {
291 LOG.error("Exception ", e);
292 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,"docstore.response", e.getMessage() );
293 }
294 bibTreeList = new ArrayList();
295 bibTreeList.add(bibTree);
296 workInstanceOlemlForm.setBibTreeList(bibTreeList);
297 bib = bibTree.getBib();
298 editorForm.setTitle(bib.getTitle() + " / " + bib.getAuthor());
299 editorForm.setHasLink(true);
300
301 editorForm.setHeaderText("Holdings");
302 editorForm.setShowEditorFooter(true);
303 String docId = editorForm.getDocId();
304 if (StringUtils.isNotEmpty(docId)) {
305 List<HoldingsTree> holdingsTreeList = new ArrayList<>();
306 for(HoldingsTree holdingsTree1 : bibTree.getHoldingsTrees()) {
307 if(!holdingsTree1.getHoldings().getId().equals(docId)) {
308 holdingsTreeList.add(holdingsTree1);
309 }
310 }
311 bibTree.getHoldingsTrees().clear();
312 bibTree.getHoldingsTrees().addAll(holdingsTreeList);
313 Holdings holdings = new PHoldings();
314 OleHoldings holdingData = workInstanceOlemlForm.getSelectedHolding();
315 if (!isValidHoldingsData(workInstanceOlemlForm)) {
316 return workInstanceOlemlForm;
317 }
318 try {
319 String holdingXmlContent = getInstanceEditorFormDataHandler().buildHoldingContent(holdingData);
320 holdings.setContent(holdingXmlContent);
321 } catch (Exception e) {
322 LOG.error("Exception :", e);
323 GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(KRADConstants.GLOBAL_ERRORS,
324 "docstore.response", e.getMessage());
325 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
326 return workInstanceOlemlForm;
327 }
328 holdings.setId(docId);
329 holdings.setStaffOnly(editorForm.isStaffOnlyFlagForHoldings());
330 holdings.setCreatedBy(editorForm.getCreatedBy());
331 holdings.setCreatedOn(editorForm.getCreatedDate());
332 holdings.setUpdatedBy(user);
333 holdings.setUpdatedOn(dateStr);
334 String holdingsCreatedDate = null;
335 Format formatter = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss");
336 holdingsCreatedDate = formatter.format(new Date());
337 holdings.setLastUpdated(holdingsCreatedDate);
338 holdings.setBib(bib);
339 holdings.setCategory(editorForm.getDocCategory());
340 holdings.setType(editorForm.getDocType());
341 holdings.setFormat(editorForm.getDocFormat());
342 long startTime = System.currentTimeMillis();
343 try {
344 docstoreClient.updateHoldings(holdings);
345 } catch (Exception e) {
346 LOG.error("Exception :", e);
347 DocstoreException docstoreException = (DocstoreException) e;
348 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
349 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
350 } else {
351 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
352 }
353 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
354 return workInstanceOlemlForm;
355 }
356 long endTime = System.currentTimeMillis();
357 editorForm.setSolrTime(String.valueOf((endTime-startTime)/1000));
358 editorForm.setUpdatedDate(holdings.getUpdatedOn());
359 editorForm.setUpdatedBy(holdings.getUpdatedBy());
360 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
361 editorMessage = "holdings.record.update.message";
362 workInstanceOlemlForm.setViewId("WorkHoldingsViewPage");
363 } else {
364
365 if (!isValidHoldingsData(workInstanceOlemlForm)) {
366 return workInstanceOlemlForm;
367 }
368 String content = null;
369 try {
370 content = getInstanceEditorFormDataHandler().buildHoldingContent(workInstanceOlemlForm.getSelectedHolding());
371 } catch (Exception e) {
372 LOG.error("Exception :", e);
373 e.printStackTrace();
374 return workInstanceOlemlForm;
375 }
376
377 String staffOnlyFlagForHoldings = String.valueOf(editorForm.isStaffOnlyFlagForHoldings());
378
379
380
381 Holdings holdings = new PHoldings();
382 holdings.setCategory(DocCategory.WORK.getCode());
383 holdings.setType(DocType.HOLDINGS.getCode());
384 holdings.setFormat(DocFormat.OLEML.getCode());
385 holdings.setCreatedOn(dateStr);
386 holdings.setCreatedBy(user);
387 holdings.setStaffOnly(editorForm.isStaffOnlyFlagForHoldings());
388 holdings.setContent(content);
389 holdings.setBib(bib);
390
391 holdingsTree.setHoldings(holdings);
392 holdingsTree.getItems().add(getItemRecord());
393
394 long startTime = System.currentTimeMillis();
395 try {
396 docstoreClient.createHoldingsTree(holdingsTree);
397 editorForm.setDocId(holdingsTree.getHoldings().getId());
398 editorForm.setHoldingCreatedBy(holdingsTree.getHoldings().getCreatedBy());
399 editorForm.setHoldingCreatedDate(holdingsTree.getHoldings().getCreatedOn());
400 if (workInstanceOlemlForm.getBibTreeList() == null && workInstanceOlemlForm.getBibTreeList().size() == 0) {
401 bibTreeList = new ArrayList<>();
402 bibTree = new BibTree();
403 bibTree.setId(bib.getId());
404 bibTree.setBib(bib);
405 bibTreeList.add(bibTree);
406 workInstanceOlemlForm.setBibTreeList(bibTreeList);
407 } else {
408 bibTreeList = workInstanceOlemlForm.getBibTreeList();
409 bibTree = bibTreeList.get(0);
410 }
411
412 List<HoldingsTree> holdingsTreeList = new ArrayList<>();
413 holdingsTreeList.add(holdingsTree);
414
415 }catch (DocstoreException e) {
416 LOG.error("Exception : ", e);
417 DocstoreException docstoreException = (DocstoreException) e;
418 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
419 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
420 } else {
421 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
422 }
423 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
424 return workInstanceOlemlForm;
425 } catch (Exception e) {
426 LOG.error("Exception ", e);
427 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,"docstore.response", e.getMessage() );
428 }
429 long endTime = System.currentTimeMillis();
430 editorForm.setSolrTime(String.valueOf((endTime-startTime)/1000));
431 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
432 editorMessage = "record.create.message";
433 }
434
435
436
437 if (processAsr(editorForm, workInstanceOlemlForm, bibTree, holdingsTree, editorMessage, bib)){
438 return workInstanceOlemlForm;
439 }
440
441 return workInstanceOlemlForm;
442 }
443
444 private boolean processAsr(EditorForm editorForm, WorkInstanceOlemlForm workInstanceOlemlForm, BibTree bibTree, HoldingsTree holdingsTree, String editorMessage, Bib bib) {
445 try {
446 if(holdingsTree.getHoldings() == null) {
447 holdingsTree = docstoreClient.retrieveHoldingsTree(editorForm.getDocId());
448 }
449 String holdingLocation = null;
450 if (workInstanceOlemlForm.getSelectedHolding() != null && workInstanceOlemlForm.getSelectedHolding().getLocation() != null && workInstanceOlemlForm.getSelectedHolding().getLocation().getLocationLevel() != null) {
451 holdingLocation = instanceEditorFormDataHandler.getLocationCode(workInstanceOlemlForm.getSelectedHolding().getLocation().getLocationLevel());
452 }
453 String callNumber;
454 String prefix;
455 if(holdingLocation != null){
456 if(getAsrHelperService().isAnASRItem(holdingLocation)){
457 List<Item> items = holdingsTree.getItems();
458 List<ASRItem> asrItems = new ArrayList<ASRItem>();
459 ASRItem asrItem = null;
460 if(items != null && items.size()>0){
461 for(Item item : items){
462 org.kuali.ole.docstore.common.document.content.instance.Item itemData = getItemOlemlRecordProcessor().fromXML(item.getContent());
463 asrItem = new ASRItem();
464 if(itemData.getAccessInformation()!=null && itemData.getAccessInformation().getBarcode()!=null){
465 asrItem.setItemBarcode(itemData.getAccessInformation().getBarcode());
466 }
467
468 Map<String,String> asrItemMap = new HashMap<String,String>();
469 asrItemMap.put("itemBarcode",itemData.getAccessInformation().getBarcode());
470 List<ASRItem> existingASRItems = (List<ASRItem>)getBusinessObjectService().findMatching(ASRItem.class,asrItemMap);
471
472 if(existingASRItems.size()==0){
473 if(bib.getTitle()!=null){
474 asrItem.setTitle((bib.getTitle().length()>37)?bib.getTitle().substring(0,36):bib.getTitle());
475 }
476 if(bib.getAuthor()!=null){
477 asrItem.setAuthor((bib.getAuthor().length()>37)?bib.getAuthor().substring(0,36):bib.getAuthor());
478 }
479 if (itemData.getCallNumber() != null && itemData.getCallNumber().getNumber() != null && !itemData.getCallNumber().getNumber().isEmpty()) {
480 callNumber=(itemData.getCallNumber().getNumber().length() > 37) ? itemData.getCallNumber().getNumber().substring(0, 36) : itemData.getCallNumber().getNumber();
481 prefix=itemData.getCallNumber().getPrefix()!=null&&!itemData.getCallNumber().getPrefix().isEmpty()?itemData.getCallNumber().getPrefix():"";
482 asrItem.setCallNumber(prefix+" "+callNumber);
483 } else if(workInstanceOlemlForm.getSelectedHolding() !=null && workInstanceOlemlForm.getSelectedHolding().getCallNumber() !=null &&
484 workInstanceOlemlForm.getSelectedHolding().getCallNumber().getNumber() !=null && !workInstanceOlemlForm.getSelectedHolding().getCallNumber().getNumber().isEmpty()){
485 callNumber=(workInstanceOlemlForm.getSelectedHolding().getCallNumber().getNumber().length() > 37) ? workInstanceOlemlForm.getSelectedHolding().getCallNumber().getNumber().substring(0, 36) : workInstanceOlemlForm.getSelectedHolding().getCallNumber().getNumber();
486 prefix=workInstanceOlemlForm.getSelectedHolding().getCallNumber().getPrefix()!=null&&!workInstanceOlemlForm.getSelectedHolding().getCallNumber().getPrefix().isEmpty()?workInstanceOlemlForm.getSelectedHolding().getCallNumber().getPrefix():"";
487 asrItem.setCallNumber(prefix+" "+callNumber);
488 }
489
490 asrItems.add(asrItem);
491 }
492 }
493 }
494 getBusinessObjectService().save(asrItems);
495 }
496 }
497 Holdings holdings = holdingsTree.getHoldings();
498 bibTree.getHoldingsTrees().add(holdingsTree);
499 Collections.sort(bibTree.getHoldingsTrees());
500 String docStoreData = holdings.getContent();
501 OleHoldings oleHoldings = new HoldingOlemlRecordProcessor().fromXML(docStoreData);
502 workInstanceOlemlForm.setSelectedHolding(oleHoldings);
503 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
504 editorForm.setHoldingLocalIdentifier(DocumentUniqueIDPrefix.getDocumentId(holdings.getId()));
505 editorForm.setHoldingUpdatedBy(holdings.getUpdatedBy());
506 editorForm.setHoldingCreatedDate(holdings.getCreatedOn());
507 editorForm.setHoldingCreatedBy(holdings.getCreatedBy());
508 editorForm.setHoldingUpdatedDate(holdings.getUpdatedOn());
509 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_MESSAGES, editorMessage);
510 ensureMultipleValuesInOleHoldings(oleHoldings);
511 }catch (DocstoreException e) {
512 LOG.error("Exception : ", e);
513 DocstoreException docstoreException = (DocstoreException) e;
514 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
515 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
516 } else {
517 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
518 }
519 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
520 return true;
521 } catch (Exception e) {
522 LOG.error("Exception ", e);
523 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS,"docstore.response", e.getMessage() );
524 }
525 return false;
526 }
527
528 private List<Uri> ensureAtleastOneUri(List<Uri> uris) {
529 if (uris == null) {
530 uris = new ArrayList<Uri>();
531 }
532 if (uris.size() == 0) {
533 Uri uri = new Uri();
534 uris.add(uri);
535 }
536 return uris;
537 }
538
539 private List<Note> ensureAtleastOneNote(List<Note> notes) {
540 if (notes == null) {
541 notes = new ArrayList<Note>();
542 }
543 if (notes.size() == 0) {
544 Note note = new Note();
545 notes.add(note);
546 }
547 return notes;
548 }
549
550
551 private List<ExtentOfOwnership> ensureAtleastOneExtentOfOwnership(List<ExtentOfOwnership> extentOfOwnerships) {
552 if (extentOfOwnerships == null) {
553 extentOfOwnerships = new ArrayList<ExtentOfOwnership>();
554 }
555 if (extentOfOwnerships.size() == 0) {
556 ExtentOfOwnership extentOfOwnership = new ExtentOfOwnership();
557 extentOfOwnership.getNote().add(new Note());
558 extentOfOwnerships.add(0, extentOfOwnership);
559 }
560 return extentOfOwnerships;
561 }
562
563
564
565
566
567
568 private InstanceEditorFormDataHandler getInstanceEditorFormDataHandler() {
569 if (null == instanceEditorFormDataHandler) {
570 instanceEditorFormDataHandler = new InstanceEditorFormDataHandler();
571 }
572 return instanceEditorFormDataHandler;
573 }
574
575 private boolean canCreateInstance(String principalId) {
576 PermissionService service = KimApiServiceLocator.getPermissionService();
577 return service.hasPermission(principalId, OLEConstants.CAT_NAMESPACE, OLEConstants.INSTANCE_EDITOR_ADD_INSTANCE);
578 }
579
580 private boolean canEditInstance(String principalId) {
581 PermissionService service = KimApiServiceLocator.getPermissionService();
582 return service.hasPermission(principalId, OLEConstants.CAT_NAMESPACE, OLEConstants.INSTANCE_EDITOR_EDIT_INSTANCE);
583 }
584
585
586
587
588
589
590 private boolean isValidHoldingsData(WorkInstanceOlemlForm workInstanceOlemlForm) {
591 OleHoldings oleHoldings = workInstanceOlemlForm.getSelectedHolding();
592 String location = null;
593 if (oleHoldings != null && oleHoldings.getLocation() != null && oleHoldings.getLocation().getLocationLevel() != null) {
594 location = oleHoldings.getLocation().getLocationLevel().getName();
595 }
596 if (location != null && location.length() != 0 && !isValidLocation(location)) {
597
598 GlobalVariables.getMessageMap().putError("documentForm.selectedHolding.location.locationLevel.name", "error.location");
599 workInstanceOlemlForm.setValidInput(false);
600 return false;
601 }
602 return true;
603 }
604
605 private boolean isValidLocation(String location) {
606
607 List<String> locationList = LocationValuesBuilder.retrieveLocationDetailsForSuggest(location);
608 if (locationList != null && locationList.size() > 0) {
609 for (String locationValue : locationList) {
610 if (locationValue.equalsIgnoreCase(location)) {
611 return true;
612 }
613 }
614 }
615 return false;
616 }
617
618 @Override
619 public EditorForm addORRemoveExtentOfOwnership(EditorForm editorForm, HttpServletRequest request) {
620 String methodName = request.getParameter("methodToCall");
621 if (methodName.equalsIgnoreCase("addExtentOfOwnership")) {
622 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
623 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
624 index++;
625 List<ExtentOfOwnership> extentOfOwnershipForUI = workInstanceOlemlForm.getSelectedHolding().getExtentOfOwnership();
626 ExtentOfOwnership extentOfOwnership = new ExtentOfOwnership();
627 extentOfOwnership.getNote().add(new Note());
628 extentOfOwnershipForUI.add(index, extentOfOwnership);
629 editorForm.setDocumentForm(workInstanceOlemlForm);
630 } else if (methodName.equalsIgnoreCase("removeExtentOfOwnership")) {
631 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
632 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
633 List<ExtentOfOwnership> extentOfOwnershipForUI = workInstanceOlemlForm.getSelectedHolding().getExtentOfOwnership();
634 if (extentOfOwnershipForUI.size() > 1) {
635 extentOfOwnershipForUI.remove(index);
636 } else {
637 if (extentOfOwnershipForUI.size() == 1) {
638 extentOfOwnershipForUI.remove(index);
639 ExtentOfOwnership extentOfOwnership = new ExtentOfOwnership();
640 extentOfOwnershipForUI.add(extentOfOwnership);
641 extentOfOwnership.getNote().add(new Note());
642 }
643 }
644 editorForm.setDocumentForm(workInstanceOlemlForm);
645 } else if (methodName.equalsIgnoreCase("addEOWHoldingNotes")) {
646 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
647 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
648 String selectedPath = editorForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
649 int selectedExtentIndex = Integer.parseInt(StringUtils.substring(selectedPath,
650 (StringUtils.indexOf(selectedPath, "[") + 1),
651 StringUtils.lastIndexOf(selectedPath, "]")));
652 index++;
653 List<Note> holdingsNote = workInstanceOlemlForm.getSelectedHolding().getExtentOfOwnership()
654 .get(selectedExtentIndex).getNote();
655 holdingsNote.add(index, new Note());
656 editorForm.setDocumentForm(workInstanceOlemlForm);
657 } else if (methodName.equalsIgnoreCase("removeEOWHoldingNotes")) {
658 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
659 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
660 String selectedPath = editorForm.getActionParamaterValue(UifParameters.SELLECTED_COLLECTION_PATH);
661 int selectedExtentIndex = Integer.parseInt(StringUtils.substring(selectedPath,
662 (StringUtils.indexOf(selectedPath, "[") + 1),
663 StringUtils.lastIndexOf(selectedPath, "]")));
664 List<Note> holdingsNote = workInstanceOlemlForm.getSelectedHolding().getExtentOfOwnership()
665 .get(selectedExtentIndex).getNote();
666 if (holdingsNote.size() > 1) {
667 holdingsNote.remove(index);
668 } else {
669 if (holdingsNote.size() == 1) {
670 holdingsNote.remove(index);
671 Note note = new Note();
672 holdingsNote.add(note);
673 }
674 }
675 editorForm.setDocumentForm(workInstanceOlemlForm);
676 }
677 return editorForm;
678 }
679
680 @Override
681 public EditorForm addORRemoveAccessInformationAndHoldingsNotes(EditorForm editorForm, HttpServletRequest request) {
682 String methodName = request.getParameter("methodToCall");
683 if (methodName.equalsIgnoreCase("addAccessInformation")) {
684 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
685 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
686 index++;
687 List<Uri> accessInformation = workInstanceOlemlForm.getSelectedHolding().getUri();
688 accessInformation.add(index, new Uri());
689 editorForm.setDocumentForm(workInstanceOlemlForm);
690 } else if (methodName.equalsIgnoreCase("removeAccessInformation")) {
691 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
692 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
693 List<Uri> accessInformation = workInstanceOlemlForm.getSelectedHolding().getUri();
694 if (accessInformation.size() > 1) {
695 accessInformation.remove(index);
696 } else {
697 if (accessInformation.size() == 1) {
698 accessInformation.remove(index);
699 Uri uri = new Uri();
700 accessInformation.add(uri);
701 }
702 }
703 editorForm.setDocumentForm(workInstanceOlemlForm);
704 } else if (methodName.equalsIgnoreCase("addHoldingNotes")) {
705 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
706 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
707 index++;
708 List<Note> holdingsNote = workInstanceOlemlForm.getSelectedHolding().getNote();
709 holdingsNote.add(index, new Note());
710 editorForm.setDocumentForm(workInstanceOlemlForm);
711 } else if (methodName.equalsIgnoreCase("removeHoldingNotes")) {
712 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
713 int index = Integer.parseInt(editorForm.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX));
714 List<Note> holdingsNote = workInstanceOlemlForm.getSelectedHolding().getNote();
715 if (holdingsNote.size() > 1) {
716 holdingsNote.remove(index);
717 } else {
718 if (holdingsNote.size() == 1) {
719 holdingsNote.remove(index);
720 Note note = new Note();
721 holdingsNote.add(note);
722 }
723 }
724 editorForm.setDocumentForm(workInstanceOlemlForm);
725 }
726 return editorForm;
727 }
728
729 private boolean isValidBib(String bibData) {
730 if (bibData.contains("collection") || bibData.contains("OAI-PMH")) {
731 return true;
732 }
733 return false;
734 }
735
736 @Override
737 public EditorForm createNewRecord(EditorForm editorForm, BibTree bibTree) {
738
739 if (editorForm.getDocumentForm().getViewId().equalsIgnoreCase("WorkHoldingsViewPage")) {
740 editorForm.setNeedToCreateInstance(true);
741 }
742 editNewRecord(editorForm, bibTree);
743 return editorForm.getDocumentForm();
744 }
745
746
747 @Override
748 public EditorForm editNewRecord(EditorForm editorForm, BibTree bibTree) {
749 WorkInstanceOlemlForm workInstanceOlemlForm = new WorkInstanceOlemlForm();
750 if ((editorForm.getDocumentForm() instanceof WorkInstanceOlemlForm)) {
751 workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
752 workInstanceOlemlForm.setViewId(editorForm.getDocumentForm().getViewId());
753 }
754
755 workInstanceOlemlForm.setDocCategory("work");
756 workInstanceOlemlForm.setDocType("holdings");
757 workInstanceOlemlForm.setDocFormat("oleml");
758
759 if (bibTree != null && bibTree.getHoldingsTrees() != null) {
760 HoldingsTree holdingsTree = bibTree.getHoldingsTrees().get(0);
761 HoldingOlemlRecordProcessor holdingOlemlRecordProcessor = new HoldingOlemlRecordProcessor();
762 ItemOlemlRecordProcessor itemOlemlRecordProcessor = new ItemOlemlRecordProcessor();
763 OleHoldings oleHoldings = holdingOlemlRecordProcessor.fromXML(holdingsTree.getHoldings().getContent());
764 if (editorForm.getDocumentForm().getViewId().equalsIgnoreCase("WorkHoldingsViewPage")) {
765
766 editorForm.setHeaderText("Import Bib Step-4 Item");
767
768 if (!isValidHoldingsData(workInstanceOlemlForm)) {
769 return workInstanceOlemlForm;
770 }
771 holdingsTree.getHoldings().setStaffOnly(editorForm.isStaffOnlyFlagForHoldings());
772 holdingsTree.getHoldings().setCreatedBy(GlobalVariables.getUserSession().getPrincipalName());
773 org.kuali.ole.docstore.common.document.content.instance.Item item = itemOlemlRecordProcessor.fromXML(holdingsTree.getItems().get(0).getContent());
774 List<Note> notes = ensureAtleastOneNote(item.getNote());
775 item.setNote(notes);
776 workInstanceOlemlForm.setSelectedItem(item);
777 workInstanceOlemlForm.setViewId("WorkItemViewPage");
778
779 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO,
780 "item.details.new.message");
781 } else if (editorForm.getDocumentForm().getViewId().equalsIgnoreCase("WorkBibEditorViewPage")) {
782
783 editorForm.setHeaderText("Import Bib Step-4 Holdings");
784 workInstanceOlemlForm.setViewId("WorkHoldingsViewPage");
785
786 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO,
787 "holdings.record.new.load.message");
788 workInstanceOlemlForm
789 .setSelectedHolding(oleHoldings);
790 }
791 }
792 editorForm.setDocumentForm(workInstanceOlemlForm);
793 return editorForm;
794 }
795
796 public EditorForm deleteVerify(EditorForm editorForm) {
797
798 WorkInstanceOlemlForm workInstanceOlemlForm = new WorkInstanceOlemlForm();
799 String docId = editorForm.getDocId();
800 String operation = "deleteVerify";
801
802
803
804 editorForm.setShowDeleteTree(true);
805 editorForm.setHasLink(true);
806
807 List<String> uuidList = new ArrayList<>(0);
808 uuidList.add(editorForm.getDocId());
809 DocumentSelectionTree documentSelectionTree = new DocumentSelectionTree();
810 Node<DocumentTreeNode, String> docTree = null;
811 try {
812 docTree = documentSelectionTree.add(uuidList, editorForm.getDocType());
813 } catch (SolrServerException e) {
814 LOG.error("Exception :", e);
815 e.printStackTrace();
816 }
817 editorForm.getDocTree().setRootElement(docTree);
818 editorForm.setViewId("DeleteViewPage");
819 return editorForm;
820
821 }
822
823
824
825
826
827
828
829 public EditorForm delete(EditorForm editorForm) throws Exception {
830 return deleteFromDocStore(editorForm);
831 }
832
833 @Override
834 public EditorForm showBibs(EditorForm editorForm) {
835 String instanceId = "";
836 String docType = editorForm.getDocType();
837 List<Bib> bibs = new ArrayList<Bib>();
838 if ((docType.equalsIgnoreCase(DocType.HOLDINGS.getCode())) || (docType
839 .equalsIgnoreCase(DocType.ITEM.getCode()))) {
840 instanceId = editorForm.getHoldingsId();
841 }
842 if (StringUtils.isNotEmpty(instanceId)) {
843 try {
844 Holdings holdings = docstoreClient.retrieveHoldings(instanceId);
845 bibs = holdings.getBibs().getBibs();
846 } catch (Exception e) {
847 LOG.error("Exception :", e);
848 e.printStackTrace();
849 }
850 }
851 editorForm.setBibList(bibs);
852 editorForm.setViewId("ShowBibViewPage");
853 return editorForm;
854 }
855
856
857 public EditorForm bulkUpdate(EditorForm editorForm,List<String> holdingIds) {
858 WorkInstanceOlemlForm workInstanceOlemlForm = (WorkInstanceOlemlForm) editorForm.getDocumentForm();
859 String bibId = editorForm.getBibId();
860 List<BibTree> bibTreeList = new ArrayList<BibTree>();
861 BibTree bibTree = null;
862 String editorMessage = "";
863 Bib bib = null;
864 Date date = new Date();
865 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
866 String dateStr = sdf.format(date);
867 String user = GlobalVariables.getUserSession().getPrincipalName();
868 workInstanceOlemlForm.setBibTreeList(bibTreeList);
869 editorForm.setHeaderText("Global Instance Editor");
870 String docId = editorForm.getDocId();
871 Holdings holdings = new PHoldings();
872 OleHoldings holdingData = workInstanceOlemlForm.getSelectedHolding();
873 if (!isValidHoldingsData(workInstanceOlemlForm)) {
874 return workInstanceOlemlForm;
875 }
876 try {
877 String holdingXmlContent = getInstanceEditorFormDataHandler().buildHoldingContent(holdingData);
878 holdings.setCategory(holdingXmlContent);
879 holdings.setContent(holdingXmlContent);
880 } catch (Exception e) {
881 LOG.error("Exception :", e);
882 GlobalVariables.getMessageMap().putErrorWithoutFullErrorPath(KRADConstants.GLOBAL_ERRORS,
883 "docstore.response", e.getMessage());
884 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
885 return workInstanceOlemlForm;
886 }
887 holdings.setId(docId);
888 String canUpdateStaffOnlyFlag = "false";
889 if (editorForm.getStaffOnlyFlagInGlobalEdit() != null && editorForm.getStaffOnlyFlagInGlobalEdit().equalsIgnoreCase("Y")) {
890 canUpdateStaffOnlyFlag = "true";
891 editorForm.setStaffOnlyFlagForHoldings(true);
892 holdings.setStaffOnly(editorForm.isStaffOnlyFlagForHoldings());
893 }
894 else if (editorForm.getStaffOnlyFlagInGlobalEdit() != null && editorForm.getStaffOnlyFlagInGlobalEdit().equalsIgnoreCase("N")) {
895 canUpdateStaffOnlyFlag = "true";
896 editorForm.setStaffOnlyFlagForHoldings(false);
897 holdings.setStaffOnly(editorForm.isStaffOnlyFlagForHoldings());
898 }
899 holdings.setStaffOnly(editorForm.isStaffOnlyFlagForHoldings());
900 holdings.setCreatedBy(editorForm.getCreatedBy());
901 holdings.setCreatedOn(editorForm.getCreatedDate());
902 holdings.setUpdatedBy(user);
903 holdings.setUpdatedOn(dateStr);
904 String holdingsCreatedDate = null;
905 Format formatter = new SimpleDateFormat("dd-MM-yyyy HH-mm-ss");
906 holdingsCreatedDate = formatter.format(new Date());
907 holdings.setLastUpdated(holdingsCreatedDate);
908
909 holdings.setCategory(editorForm.getDocCategory());
910 holdings.setType(editorForm.getDocType());
911 holdings.setFormat(editorForm.getDocFormat());
912 try {
913 getDocstoreClientLocator().getDocstoreClient().bulkUpdateHoldings(holdings, holdingIds,canUpdateStaffOnlyFlag);
914 }
915 catch (DocstoreException e) {
916 LOG.error("Exception :", e);
917 DocstoreException docstoreException = (DocstoreException) e;
918 if (org.apache.commons.lang3.StringUtils.isNotEmpty(docstoreException.getErrorCode())) {
919 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, docstoreException.getErrorCode());
920 } else {
921 GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, e.getMessage());
922 }
923
924 return workInstanceOlemlForm;
925 }
926 catch(Exception ne){
927 LOG.error("Exception :", ne);
928 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO, "record.submit.fail.message");
929 return workInstanceOlemlForm;
930 }
931 editorForm.setUpdatedDate(holdings.getUpdatedOn());
932 editorForm.setUpdatedBy(holdings.getUpdatedBy());
933 getInstanceEditorFormDataHandler().setLocationDetails(workInstanceOlemlForm);
934 editorMessage = "holdings.record.update.message";
935 workInstanceOlemlForm.setViewId("WorkHoldingsViewPage");
936
937
938 GlobalVariables.getMessageMap().putInfo(KRADConstants.GLOBAL_INFO, editorMessage);
939 return workInstanceOlemlForm;
940
941 }
942
943 }