rolling back some imports

revert-70aa11f8
Arcane94 7 years ago
parent 27ae7cfed8
commit 1ffaad6fb7

@ -48,7 +48,6 @@ import org.wso2.carbon.device.mgt.jaxrs.util.DeviceMgtUtil;
import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.api.UserStoreException;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
import javax.persistence.EntityExistsException;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.ArrayList; import java.util.ArrayList;

@ -310,7 +310,7 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
@Override @Override
public boolean createGeoAlert(Alert alert, String alertType) public boolean createGeoAlert(Alert alert, String alertType)
throws GeoLocationBasedServiceException { throws GeoLocationBasedServiceException,AlertAlreadyExist {
return saveGeoAlert(alert, alertType, false); return saveGeoAlert(alert, alertType, false);
} }
@ -322,12 +322,12 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
@Override @Override
public boolean updateGeoAlert(Alert alert, String alertType) public boolean updateGeoAlert(Alert alert, String alertType)
throws GeoLocationBasedServiceException { throws GeoLocationBasedServiceException,AlertAlreadyExist {
return saveGeoAlert(alert, alertType, true); return saveGeoAlert(alert, alertType, true);
} }
public boolean saveGeoAlert(Alert alert, String alertType, boolean isUpdate) public boolean saveGeoAlert(Alert alert, String alertType, boolean isUpdate)
throws GeoLocationBasedServiceException { throws GeoLocationBasedServiceException,AlertAlreadyExist {
Type type = new TypeToken<Map<String, String>>() { Type type = new TypeToken<Map<String, String>>() {
}.getType(); }.getType();
@ -369,29 +369,34 @@ public class GeoLocationProviderServiceImpl implements GeoLocationProviderServic
"Unrecognized execution plan type: " + alertType + " while creating geo alert"); "Unrecognized execution plan type: " + alertType + " while creating geo alert");
} }
//persist alert in registry
updateRegistry(getRegistryPath(alertType, alert.getQueryName()), content,
options);
//deploy alert into event processor //deploy alert into event processor
EventProcessorAdminServiceStub eventprocessorStub = null; EventProcessorAdminServiceStub eventprocessorStub = null;
String action = (isUpdate ? "updating" : "creating"); String action = (isUpdate ? "updating" : "creating");
try { try {
String existingPlanName = null;
String executionPlanName = getExecutionPlanName(alertType, alert.getQueryName());
eventprocessorStub = getEventProcessorAdminServiceStub(); eventprocessorStub = getEventProcessorAdminServiceStub();
String parsedTemplate = parseTemplateForGeoClusters(alertType, parseMap); String parsedTemplate = parseTemplateForGeoClusters(alertType, parseMap);
String validationResponse = eventprocessorStub.validateExecutionPlan(parsedTemplate); String validationResponse = eventprocessorStub.validateExecutionPlan(parsedTemplate);
if (validationResponse.equals("success")) { if (validationResponse.equals("success")) {
if (isUpdate) { if (isUpdate) {
String executionPlanName = getExecutionPlanName(alertType, alert.getQueryName());
try { try {
String existingPlanName = eventprocessorStub.getActiveExecutionPlan(executionPlanName); existingPlanName = eventprocessorStub.getActiveExecutionPlan(executionPlanName);
} catch (Exception e) { } catch (AxisFault axisFault) {
eventprocessorStub.deployExecutionPlan(parsedTemplate); eventprocessorStub.deployExecutionPlan(parsedTemplate);
} }
eventprocessorStub.editActiveExecutionPlan(parsedTemplate, executionPlanName); eventprocessorStub.editActiveExecutionPlan(parsedTemplate, executionPlanName);
} else { } else {
try {
existingPlanName = eventprocessorStub.getActiveExecutionPlan(executionPlanName);
if (existingPlanName.contains(executionPlanName)) {
throw new AlertAlreadyExist("Execution plan with this name already exists");
}
} catch (AxisFault axisFault) {
updateRegistry(getRegistryPath(alertType, alert.getQueryName()), content,options);
eventprocessorStub.deployExecutionPlan(parsedTemplate); eventprocessorStub.deployExecutionPlan(parsedTemplate);
} }
}
} else { } else {
if (validationResponse.startsWith( if (validationResponse.startsWith(
"'within' is neither a function extension nor an aggregated attribute extension" "'within' is neither a function extension nor an aggregated attribute extension"

Loading…
Cancel
Save