use of com.serotonin.m2m2.rt.script.ScriptPermissions in project ma-modules-public by infiniteautomation.
the class ScriptPermissionsModel method toPermissions.
public ScriptPermissions toPermissions() {
ScriptPermissions permissions = new ScriptPermissions();
permissions.setDataPointReadPermissions(dataPointReadPermissions);
permissions.setDataPointSetPermissions(dataPointSetPermissions);
permissions.setDataSourcePermissions(dataSourcePermissions);
return permissions;
}
use of com.serotonin.m2m2.rt.script.ScriptPermissions in project ma-modules-public by infiniteautomation.
the class PointLinksDwr method savePointLink.
@DwrPermission(user = true)
public ProcessResult savePointLink(int id, String xid, int sourcePointId, int targetPointId, String script, int event, boolean writeAnnotation, boolean disabled, ScriptPermissions permissions, int logLevel) {
// Validate the given information. If there is a problem, return an appropriate error message.
PointLinkVO vo = new PointLinkVO();
vo.setId(id);
vo.setXid(xid);
vo.setSourcePointId(sourcePointId);
vo.setTargetPointId(targetPointId);
vo.setScript(script);
vo.setEvent(event);
vo.setWriteAnnotation(writeAnnotation);
vo.setDisabled(disabled);
vo.setScriptPermissions(permissions);
vo.setLogLevel(logLevel);
ProcessResult response = new ProcessResult();
PointLinkDao pointLinkDao = PointLinkDao.instance;
if (StringUtils.isBlank(xid))
response.addContextualMessage("xid", "validate.required");
else if (!pointLinkDao.isXidUnique(xid, id))
response.addContextualMessage("xid", "validate.xidUsed");
vo.validate(response);
// Save it
if (!response.getHasMessages())
RTMDefinition.instance.savePointLink(vo);
response.addData("plId", vo.getId());
return response;
}
use of com.serotonin.m2m2.rt.script.ScriptPermissions in project ma-core-public by infiniteautomation.
the class EventHandlersDwr method saveSetPointEventHandler.
@DwrPermission(user = true)
public ProcessResult saveSetPointEventHandler(String eventType, String eventSubtype, int eventTypeRef1, int eventTypeRef2, int handlerId, String xid, String alias, boolean disabled, int targetPointId, int activeAction, String activeValueToSet, int activePointId, String activeScript, int inactiveAction, String inactiveValueToSet, int inactivePointId, String inactiveScript, List<IntStringPair> additionalContext, ScriptPermissions scriptPermissions) {
SetPointEventHandlerVO handler = new SetPointEventHandlerVO();
handler.setDefinition(ModuleRegistry.getEventHandlerDefinition(SetPointEventHandlerDefinition.TYPE_NAME));
handler.setTargetPointId(targetPointId);
handler.setActiveAction(activeAction);
handler.setActiveValueToSet(activeValueToSet);
handler.setActivePointId(activePointId);
handler.setActiveScript(activeScript);
handler.setInactiveAction(inactiveAction);
handler.setInactiveValueToSet(inactiveValueToSet);
handler.setInactivePointId(inactivePointId);
handler.setInactiveScript(inactiveScript);
handler.setAdditionalContext(additionalContext);
handler.setScriptPermissions(scriptPermissions);
return save(eventType, eventSubtype, eventTypeRef1, eventTypeRef2, handler, handlerId, xid, alias, disabled);
}
use of com.serotonin.m2m2.rt.script.ScriptPermissions in project ma-core-public by infiniteautomation.
the class EventHandlersDwr method saveEmailEventHandler.
@DwrPermission(user = true)
public ProcessResult saveEmailEventHandler(String eventType, String eventSubtype, int eventTypeRef1, int eventTypeRef2, int handlerId, String xid, String alias, boolean disabled, List<RecipientListEntryBean> activeRecipients, String customTemplate, boolean sendEscalation, boolean repeatEscalations, int escalationDelayType, int escalationDelay, List<RecipientListEntryBean> escalationRecipients, boolean sendInactive, boolean inactiveOverride, List<RecipientListEntryBean> inactiveRecipients, boolean includeSystemInfo, int includePointValueCount, boolean includeLogfile, List<IntStringPair> additionalContext, ScriptPermissions permissions, String script) {
EmailEventHandlerVO handler = new EmailEventHandlerVO();
handler.setDefinition(ModuleRegistry.getEventHandlerDefinition(EmailEventHandlerDefinition.TYPE_NAME));
handler.setActiveRecipients(activeRecipients);
handler.setCustomTemplate(customTemplate);
handler.setSendEscalation(sendEscalation);
handler.setRepeatEscalations(repeatEscalations);
handler.setEscalationDelayType(escalationDelayType);
handler.setEscalationDelay(escalationDelay);
handler.setEscalationRecipients(escalationRecipients);
handler.setSendInactive(sendInactive);
handler.setInactiveOverride(inactiveOverride);
handler.setInactiveRecipients(inactiveRecipients);
handler.setIncludeSystemInfo(includeSystemInfo);
handler.setIncludePointValueCount(includePointValueCount);
handler.setIncludeLogfile(includeLogfile);
handler.setAdditionalContext(additionalContext);
handler.setScriptPermissions(permissions);
handler.setScript(script);
return save(eventType, eventSubtype, eventTypeRef1, eventTypeRef2, handler, handlerId, xid, alias, disabled);
}
use of com.serotonin.m2m2.rt.script.ScriptPermissions in project ma-core-public by infiniteautomation.
the class EmailEventHandlerVO method readObject.
@SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
int ver = in.readInt();
if (ver == 1) {
activeRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(activeRecipients);
sendEscalation = in.readBoolean();
repeatEscalations = false;
escalationDelayType = in.readInt();
escalationDelay = in.readInt();
escalationRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(escalationRecipients);
sendInactive = in.readBoolean();
inactiveOverride = in.readBoolean();
inactiveRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(inactiveRecipients);
includeSystemInfo = in.readBoolean();
includePointValueCount = in.readInt();
includeLogfile = in.readBoolean();
customTemplate = null;
additionalContext = new ArrayList<IntStringPair>();
scriptPermissions = new ScriptPermissions();
script = null;
} else if (ver == 2) {
activeRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(activeRecipients);
sendEscalation = in.readBoolean();
repeatEscalations = false;
escalationDelayType = in.readInt();
escalationDelay = in.readInt();
escalationRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(escalationRecipients);
sendInactive = in.readBoolean();
inactiveOverride = in.readBoolean();
inactiveRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(inactiveRecipients);
includeSystemInfo = in.readBoolean();
includePointValueCount = in.readInt();
includeLogfile = in.readBoolean();
customTemplate = SerializationHelper.readSafeUTF(in);
additionalContext = new ArrayList<IntStringPair>();
scriptPermissions = new ScriptPermissions();
script = null;
} else if (ver == 3) {
activeRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(activeRecipients);
sendEscalation = in.readBoolean();
repeatEscalations = false;
escalationDelayType = in.readInt();
escalationDelay = in.readInt();
escalationRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(escalationRecipients);
sendInactive = in.readBoolean();
inactiveOverride = in.readBoolean();
inactiveRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(inactiveRecipients);
includeSystemInfo = in.readBoolean();
includePointValueCount = in.readInt();
includeLogfile = in.readBoolean();
customTemplate = SerializationHelper.readSafeUTF(in);
additionalContext = (List<IntStringPair>) in.readObject();
scriptPermissions = new ScriptPermissions();
script = null;
} else if (ver == 4) {
activeRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(activeRecipients);
sendEscalation = in.readBoolean();
repeatEscalations = false;
escalationDelayType = in.readInt();
escalationDelay = in.readInt();
escalationRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(escalationRecipients);
sendInactive = in.readBoolean();
inactiveOverride = in.readBoolean();
inactiveRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(inactiveRecipients);
includeSystemInfo = in.readBoolean();
includePointValueCount = in.readInt();
includeLogfile = in.readBoolean();
customTemplate = SerializationHelper.readSafeUTF(in);
additionalContext = (List<IntStringPair>) in.readObject();
scriptPermissions = (ScriptPermissions) in.readObject();
script = SerializationHelper.readSafeUTF(in);
} else if (ver == 5) {
activeRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(activeRecipients);
sendEscalation = in.readBoolean();
repeatEscalations = in.readBoolean();
escalationDelayType = in.readInt();
escalationDelay = in.readInt();
escalationRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(escalationRecipients);
sendInactive = in.readBoolean();
inactiveOverride = in.readBoolean();
inactiveRecipients = (List<RecipientListEntryBean>) in.readObject();
RecipientListEntryBean.cleanRecipientList(inactiveRecipients);
includeSystemInfo = in.readBoolean();
includePointValueCount = in.readInt();
includeLogfile = in.readBoolean();
customTemplate = SerializationHelper.readSafeUTF(in);
additionalContext = (List<IntStringPair>) in.readObject();
scriptPermissions = (ScriptPermissions) in.readObject();
script = SerializationHelper.readSafeUTF(in);
}
}
Aggregations