handle = Val.chkStr(handle);
xml = Val.chkStr(Val.removeBOM(xml));
TransactionOptions tOptions = context.getRequestOptions().getTransactionOptions();
TransactionSummary tSummary = tOptions.getSummary();
PublicationRequest pubRequest = new PublicationRequest(
context.getRequestContext(),publisher,xml);
PublicationRecord pubRecord = pubRequest.getPublicationRecord();
pubRecord.setPublicationMethod(MmdEnums.PublicationMethod.upload.toString());
if (tOptions.getAutoApprove()) {
pubRecord.setAutoApprove(true);
}
if ((tOptions.getApprovalStatus() != null) && (tOptions.getApprovalStatus().length() > 0)) {
pubRecord.setApprovalStatus(MmdEnums.ApprovalStatus.valueOf(tOptions.getApprovalStatus()).toString());
}
if ((tOptions.getPublicationMethod() != null) && (tOptions.getPublicationMethod().length() > 0)) {
pubRecord.setPublicationMethod(MmdEnums.PublicationMethod.valueOf(tOptions.getPublicationMethod()).toString());
}
// TODO: need a sourceUri
//this.determineSourceUri(request,context,pubRequest);
try {
pubRequest.publish();
if (pubRecord.getWasDocumentUnchanged()) {
} else if (pubRecord.getWasDocumentReplaced()) {
tSummary.setTotalUpdated(tSummary.getTotalUpdated() + 1);
} else {
tSummary.setTotalInserted(tSummary.getTotalInserted() + 1);