Subversion Repositories SmartDukaan

Rev

Rev 5536 | Rev 5674 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5536 Rev 5563
Line 56... Line 56...
56
	}
56
	}
57
 
57
 
58
	public void endMonitoring(EntityType entityType, String key) {
58
	public void endMonitoring(EntityType entityType, String key) {
59
		in.shop2020.alert.domain.MonitoredEntity entity = entityMapper.getEntity(entityType, key);
59
		in.shop2020.alert.domain.MonitoredEntity entity = entityMapper.getEntity(entityType, key);
60
		if(entity.getEntityProcessedState().getValue() > EntityProcessedState.UNEXPIRED.getValue()) {
60
		if(entity.getEntityProcessedState().getValue() > EntityProcessedState.UNEXPIRED.getValue()) {
-
 
61
			in.shop2020.alert.domain.AlertedEntity alertedEntity = new in.shop2020.alert.domain.AlertedEntity();
-
 
62
			alertedEntity.setEntityType(entity.getEntityType());
-
 
63
			alertedEntity.setEventType(entity.getEventType());
-
 
64
			alertedEntity.setEntityIdentifier(entity.getEntityIdentifier());
-
 
65
			alertedEntity.setEntityProperties(entity.getEntityProperties());
61
			if(entity.getEntityProcessedState().getValue() == EntityProcessedState.WARNING_SENT.getValue()) {
66
			if(entity.getEntityProcessedState().getValue() == EntityProcessedState.WARNING_SENT.getValue()) {
62
				entityMapper.insertAlertedEntity(entity, entity.getWarnExpiryTime());
67
				alertedEntity.setLastAlertedTime(entity.getWarnExpiryTime());
-
 
68
				alertedEntity.setEntityProcessedState(EntityProcessedState.WARNING_SENT);
-
 
69
				entityMapper.insertAlertedEntity(alertedEntity);
63
			}
70
			}
64
			else {
71
			else {
65
				entityMapper.insertAlertedEntity(entity, entity.getCriticalExpiryTime());
72
				alertedEntity.setLastAlertedTime(entity.getCriticalExpiryTime());
-
 
73
				alertedEntity.setEntityProcessedState(EntityProcessedState.CRITICAL_SENT);
-
 
74
				entityMapper.insertAlertedEntity(alertedEntity);
66
			}
75
			}
67
		}
76
		}
68
		entityMapper.removeMonitoredEntity(entityType, key);
77
		entityMapper.removeMonitoredEntity(entityType, key);
69
	}
78
	}
70
 
79
 
71
	public void updateMonitoredObject(MonitoredEntity monitoredEntity) {
80
	public void updateMonitoredObject(MonitoredEntity monitoredEntity) {
72
		in.shop2020.alert.domain.MonitoredEntity entity = entityMapper.getEntity(monitoredEntity.getEntityType(), monitoredEntity.getEntityIdentifier());
81
		in.shop2020.alert.domain.MonitoredEntity entity = entityMapper.getEntity(monitoredEntity.getEntityType(), monitoredEntity.getEntityIdentifier());
73
		if(entity.getEntityProcessedState().getValue() > EntityProcessedState.UNEXPIRED.getValue()) {
82
		if(entity.getEntityProcessedState().getValue() > EntityProcessedState.UNEXPIRED.getValue()) {
-
 
83
			in.shop2020.alert.domain.AlertedEntity alertedEntity = new in.shop2020.alert.domain.AlertedEntity();
-
 
84
			alertedEntity.setEntityType(entity.getEntityType());
-
 
85
			alertedEntity.setEventType(entity.getEventType());
-
 
86
			alertedEntity.setEntityIdentifier(entity.getEntityIdentifier());
-
 
87
			alertedEntity.setEntityProperties(entity.getEntityProperties());
74
			if(entity.getEntityProcessedState().getValue() == EntityProcessedState.WARNING_SENT.getValue()) {
88
			if(entity.getEntityProcessedState().getValue() == EntityProcessedState.WARNING_SENT.getValue()) {
75
				entityMapper.insertAlertedEntity(entity, entity.getWarnExpiryTime());
89
				alertedEntity.setLastAlertedTime(entity.getWarnExpiryTime());
-
 
90
				alertedEntity.setEntityProcessedState(EntityProcessedState.WARNING_SENT);
-
 
91
				entityMapper.insertAlertedEntity(alertedEntity);
76
			}
92
			}
77
			else {
93
			else {
78
				entityMapper.insertAlertedEntity(entity, entity.getCriticalExpiryTime());
94
				alertedEntity.setLastAlertedTime(entity.getCriticalExpiryTime());
-
 
95
				alertedEntity.setEntityProcessedState(EntityProcessedState.CRITICAL_SENT);
-
 
96
				entityMapper.insertAlertedEntity(alertedEntity);
79
			}
97
			}
80
		}
98
		}
81
			monitoredEntity.setId(entity.getId());
99
			monitoredEntity.setId(entity.getId());
82
			entityMapper.updateEntity(Converter.toDbEntity(monitoredEntity));
100
			entityMapper.updateEntity(Converter.toDbEntity(monitoredEntity));
83
	}
101
	}