Skip to content

Commit

Permalink
OLE-8996 : Added the system parameter to decide to audit while update…
Browse files Browse the repository at this point in the history
… bib/holdings/item.
  • Loading branch information
sheiksalahudeen committed Sep 6, 2016
1 parent 6fb712b commit f8ce06b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -862,3 +862,4 @@ OLE-DLVR,Deliver,ASR_ITEM_RETRIVED,118,"1","CONFG",csp,This is for configuring A
"OLE-DESC","Describe","PROCESS_SOLR_IND","OLE7006","1","CONFG","true","This parameter is added for docstore API process for solr indexing","A","OLE"
"OLE-DESC","Describe","SLEEP_TIME_FOR_ORDER_PROCESS","OLE7060","1","CONFG","1000","This parameter value is used for holding the sleep time for order process.","A","OLE"
"OLE-DESC","Describe","MAX_NO_OF_THREAD_FOR_EXPORT_SERVICE","OLE7061","1","CONFG","10","This parameter value is used for holding the max number of thread for export process.","A","OLE"
"OLE-DESC","Describe","PROCESS_AUDIT_FOR_BIB_HOLDINGS_ITEM","OLE7062","1","CONFG","Y","This parameter value is used for holding value to decide whether need to do auditing for bib, holdings and item.","A","OLE"
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ NMSPC_CD,CMPNT_CD,PARM_NM,OBJ_ID,VER_NBR,PARM_TYP_CD,VAL,PARM_DESC_TXT,EVAL_OPRT
"OLE-DLVR","Deliver","DEFAULT_USER_FOR_REST_CALLS","OLE7058","1","CONFG","ole-quickstart","This parameter value is used for configuring the default user for the rest calls.","A","OLE"
"OLE-DESC","Describe","CHUNK_SIZE_FOR_BATCH_PROCESSING","OLE7059","1","CONFG","1000","This parameter value is used for configuring the chunk size for batch processing.","A","OLE"
"OLE-DESC","Describe","SLEEP_TIME_FOR_ORDER_PROCESS","OLE7060","1","CONFG","1000","This parameter value is used for holding the sleep time for order process.","A","OLE"
"OLE-DESC","Describe","MAX_NO_OF_THREAD_FOR_EXPORT_SERVICE","OLE7061","1","CONFG","10","This parameter value is used for holding the max number of thread for export process.","A","OLE"
"OLE-DESC","Describe","MAX_NO_OF_THREAD_FOR_EXPORT_SERVICE","OLE7061","1","CONFG","10","This parameter value is used for holding the max number of thread for export process.","A","OLE"
"OLE-DESC","Describe","PROCESS_AUDIT_FOR_BIB_HOLDINGS_ITEM","OLE7062","1","CONFG","Y","This parameter value is used for holding value to decide whether need to do auditing for bib, holdings and item.","A","OLE"
Original file line number Diff line number Diff line change
Expand Up @@ -416,5 +416,11 @@ public static final class BatchProcess {
public final static String ERR_HOLDINGS_HAS_REQ_OR_PO = "Requisition/PO linked with holdings/eholdings : ";
public final static String ERR_ITEM_HAS_REQ_OR_PO = "Requisition/PO linked with item : ";
public static final String MAX_NO_OF_THREAD_FOR_EXPORT_SERVICE = "MAX_NO_OF_THREAD_FOR_EXPORT_SERVICE";
public static final String PROCESS_AUDIT_FOR_BIB_HOLDINGS_ITEM = "PROCESS_AUDIT_FOR_BIB_HOLDINGS_ITEM";


public static final String DESCRIBE_COMPONENT = "Describe";
public static final String DESC_NMSPC = "OLE-DESC";
public static final String APPL_ID_OLE = "OLE";

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.apache.commons.lang.StringUtils;
import org.kuali.ole.DocumentUniqueIDPrefix;
import org.kuali.ole.constants.OleNGConstants;
import org.kuali.ole.docstore.DocStoreConstants;
import org.kuali.ole.docstore.common.exception.DocstoreException;
import org.kuali.ole.docstore.common.exception.DocstoreResources;
Expand Down Expand Up @@ -182,4 +183,9 @@ public String getParameter(String applicationId, String namespace, String compon
return parameter!=null?parameter.getValue():null;
}

public boolean isAuditRequired() {
return ParameterValueResolver.getInstance().getParameterAsBoolean(OleNGConstants
.APPL_ID_OLE, OleNGConstants.DESC_NMSPC, OleNGConstants.DESCRIBE_COMPONENT, OleNGConstants.PROCESS_AUDIT_FOR_BIB_HOLDINGS_ITEM);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ public void update(Object object) {
}

createBibInfoRecord(bibRecord);
try {
OleAuditManager.getInstance().audit(BibAudit.class,oldBibRecord,bibRecord,bibRecord.getBibId(),"ole");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
if (Boolean.TRUE == isAuditRequired()) {
try {
OleAuditManager.getInstance().audit(BibAudit.class,oldBibRecord,bibRecord,bibRecord.getBibId(),"ole");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,18 @@ public void update(Object object) {
content = workHoldingOlemlRecordProcessor.toXML(oleHoldings);
holdings.setContent(content);
buildLabelForHoldings(holdingsRecord, holdings);
try {
oldHoldingsRecord = processHoldingsForAudit(oldHoldingsRecord);
holdingsRecord = processHoldingsForAudit(holdingsRecord);
List<Audit> auditList= OleAuditManager.getInstance().audit(HoldingsAudit.class, oldHoldingsRecord, holdingsRecord, holdingsRecord.getHoldingsId(), "ole");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
if (Boolean.TRUE == isAuditRequired()) {
try {
oldHoldingsRecord = processHoldingsForAudit(oldHoldingsRecord);
holdingsRecord = processHoldingsForAudit(holdingsRecord);
List<Audit> auditList= OleAuditManager.getInstance().audit(HoldingsAudit.class, oldHoldingsRecord, holdingsRecord, holdingsRecord.getHoldingsId(), "ole");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,12 @@ public void update(Object object) {
String content = itemOlemlRecordProcessor.toXML(item);
itemDocument.setContent(content);
try {
oldItemRecord = processItemRecordForAudit(oldItemRecord);
ItemRecord modifiedItemRecord = (ItemRecord) SerializationUtils.clone(itemRecord);
modifiedItemRecord = processItemRecordForAudit(modifiedItemRecord);
List<Audit> itemAuditedFields = OleAuditManager.getInstance().audit(ItemAudit.class, oldItemRecord, modifiedItemRecord, itemRecord.getItemId(), "ole");
if (Boolean.TRUE == isAuditRequired()) {
oldItemRecord = processItemRecordForAudit(oldItemRecord);
ItemRecord modifiedItemRecord = (ItemRecord) SerializationUtils.clone(itemRecord);
modifiedItemRecord = processItemRecordForAudit(modifiedItemRecord);
List<Audit> itemAuditedFields = OleAuditManager.getInstance().audit(ItemAudit.class, oldItemRecord, modifiedItemRecord, itemRecord.getItemId(), "ole");
}
String oldBarcode = oldItemRecord.getBarCode();
String newBarcode = itemRecord.getBarCode();
if((oldBarcode!=null && (!oldBarcode.equals(newBarcode))) || (oldBarcode==null && newBarcode!=null)){
Expand Down

0 comments on commit f8ce06b

Please sign in to comment.