&& !data.getActivityId().equals("")) {
if (data.getXPathEvaluations() != null) {
ServiceDO service;
OperationDO operation;
ActivityDO activity;
MessagePropertyDO messagePropertyDO = null;
messagePropertyDO = new MessagePropertyDO();
try {
ServerDO serverDO = dsAdmin.getServer(data.getServerName());
if (serverDO != null) {
messagePropertyDO.setServerId(serverDO.getId());
} else {
log.error("Server is not in the Database" + data.getServerName());
}
} catch (BAMException e) {
log.error("Could not retrieve server from DB ", e);
}
try {
if (dsAdmin.getService(messagePropertyDO.getServerId(), data.getServiceName()) == null) {
service = new ServiceDO();
ServerDO serverDO = dsAdmin.getServer(data.getServerName());
if (serverDO != null) {
service.setServerID(serverDO.getId());
service.setName(data.getServiceName());
dsAdmin.addService(service);
messagePropertyDO.setServiceId(dsAdmin.getService(messagePropertyDO.getServerId(),
data.getServiceName()).getId());
}
} else {
messagePropertyDO.setServiceId(dsAdmin.getService(messagePropertyDO.getServerId(),
data.getServiceName()).getId());
}
} catch (BAMException e) {
log.error("Could not retrieve service from DB ", e);
}
try {
if (dsAdmin.getOperation(messagePropertyDO.getServiceId(), data.getOperationName()) == null) {
operation = new OperationDO();
ServiceDO serviceDO = dsAdmin.getService(messagePropertyDO.getServerId(),
data.getServiceName());
if (serviceDO != null) {
operation.setServiceID(messagePropertyDO.getServiceId());
operation.setName(data.getOperationName());
dsAdmin.addOperation(operation);
messagePropertyDO.setOperationId(dsAdmin.getOperation(
messagePropertyDO.getServiceId(), data.getOperationName())
.getOperationID());
} else {
serviceDO = new ServiceDO();
serviceDO.setServerID(messagePropertyDO.getServerId());
serviceDO.setName(data.getServiceName());
dsAdmin.addService(serviceDO);
messagePropertyDO.setServiceId(dsAdmin.getService(messagePropertyDO.getServerId(),
data.getServiceName()).getId());
operation.setServiceID(messagePropertyDO.getServiceId());
operation.setName(data.getOperationName());
dsAdmin.addOperation(operation);
messagePropertyDO.setOperationId(dsAdmin.getOperation(
messagePropertyDO.getServiceId(), data.getOperationName())
.getOperationID());
}
} else {
messagePropertyDO.setOperationId(dsAdmin.getOperation(messagePropertyDO.getServiceId(),
data.getOperationName()).getOperationID());
}
} catch (BAMException e) {
log.error("Could not retrieve operation from DB ", e);
}
try {
if (dsAdmin.getActivityForActivityID(data.getActivityId()) == null) {
activity = new ActivityDO();
activity.setActivityId(data.getActivityId());
activity.setName(data.getActivityName());
activity.setDescription(data.getActivityDescription());
dsAdmin.addActivity(activity);
messagePropertyDO.setActivityKeyId(dsAdmin.getActivityForActivityID(
data.getActivityId()).getActivityKeyId());
} else {
messagePropertyDO.setActivityKeyId(dsAdmin.getActivityForActivityID(
data.getActivityId()).getActivityKeyId());
}
} catch (BAMException e) {
log.error("Could not retrieve activity from DB ", e);
}
try {
MessageDO msg = dsAdmin.getMessage(data.getMessageId(), messagePropertyDO.getOperationId(),
messagePropertyDO.getActivityKeyId());
if (msg != null) {
messagePropertyDO.setMessageKeyId(msg.getMessageKeyId());
} else {
MessageDO mesg = new MessageDO();
ActivityDO activityDO = dsAdmin.getActivityForActivityID(data.getActivityId());
if (activityDO != null) {
mesg.setMessageId(data.getMessageId());
mesg.setActivityKeyId(messagePropertyDO.getActivityKeyId());
mesg.setOperationId(messagePropertyDO.getOperationId());
// TODO timestamp fix