Allow dynamic control of operations

4.x.x
Charitha Goonetilleke 4 years ago
parent c5e26804dc
commit a16c82bebd

@ -22,6 +22,10 @@ public class CommandOperation extends Operation {
private boolean enabled; private boolean enabled;
public CommandOperation() {
setControl(Control.NO_REPEAT);
}
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return enabled;
} }
@ -34,8 +38,4 @@ public class CommandOperation extends Operation {
return Type.COMMAND; return Type.COMMAND;
} }
public Control getControl(){
return Control.NO_REPEAT;
}
} }

@ -23,10 +23,11 @@ import java.util.List;
public class ConfigOperation extends Operation { public class ConfigOperation extends Operation {
private List<Property> properties; private final List<Property> properties;
public ConfigOperation() { public ConfigOperation() {
properties = new ArrayList<Property>(); properties = new ArrayList<>();
setControl(Control.REPEAT);
} }
public List<Property> getConfigProperties() { public List<Property> getConfigProperties() {
@ -37,6 +38,10 @@ public class ConfigOperation extends Operation {
properties.add(new Property(name, value, type)); properties.add(new Property(name, value, type));
} }
public Type getType() {
return Type.CONFIG;
}
public static class Property { public static class Property {
private String name; private String name;
private Object value; private Object value;
@ -73,13 +78,4 @@ public class ConfigOperation extends Operation {
} }
} }
public Type getType() {
return Type.CONFIG;
}
public Control getControl(){
return Control.REPEAT;
}
} }

@ -21,6 +21,12 @@ import java.util.List;
public class PolicyOperation extends Operation { public class PolicyOperation extends Operation {
private List<ProfileOperation> profileOperations;
public PolicyOperation() {
setControl(Control.REPEAT);
}
public List<ProfileOperation> getProfileOperations() { public List<ProfileOperation> getProfileOperations() {
return profileOperations; return profileOperations;
} }
@ -29,10 +35,4 @@ public class PolicyOperation extends Operation{
this.profileOperations = profileOperations; this.profileOperations = profileOperations;
} }
private List<ProfileOperation> profileOperations;
public Control getControl(){
return Control.REPEAT;
}
} }

@ -22,13 +22,12 @@ import java.io.Serializable;
public class ProfileOperation extends ConfigOperation implements Serializable { public class ProfileOperation extends ConfigOperation implements Serializable {
public Type getType() { public ProfileOperation() {
return Type.PROFILE; super();
} }
public Type getType() {
public Control getControl(){ return Type.PROFILE;
return Control.REPEAT;
} }
} }

@ -24,6 +24,10 @@ public class CommandOperation extends Operation {
private boolean enabled; private boolean enabled;
public CommandOperation() {
setControl(Control.NO_REPEAT);
}
public boolean isEnabled() { public boolean isEnabled() {
return enabled; return enabled;
} }
@ -35,8 +39,5 @@ public class CommandOperation extends Operation {
public Type getType() { public Type getType() {
return Type.COMMAND; return Type.COMMAND;
} }
public Control getControl(){
return Control.NO_REPEAT;
}
} }

@ -21,8 +21,6 @@ package org.wso2.carbon.device.mgt.core.operation.mgt;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
public class ConfigOperation extends Operation { public class ConfigOperation extends Operation {
@ -38,6 +36,15 @@ public class ConfigOperation extends Operation {
properties.add(new Property(name, value, type)); properties.add(new Property(name, value, type));
}*/ }*/
public ConfigOperation() {
//properties = new ArrayList<>();
setControl(Control.REPEAT);
}
public Type getType() {
return Type.CONFIG;
}
public static class Property implements Serializable { public static class Property implements Serializable {
private String name; private String name;
private Object value; private Object value;
@ -74,12 +81,4 @@ public class ConfigOperation extends Operation {
} }
} }
public Type getType() {
return Type.CONFIG;
}
public Control getControl(){
return Control.REPEAT;
}
} }

@ -18,6 +18,7 @@
package org.wso2.carbon.device.mgt.core.operation.mgt; package org.wso2.carbon.device.mgt.core.operation.mgt;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.util.List; import java.util.List;
public class PolicyOperation extends Operation { public class PolicyOperation extends Operation {
@ -25,6 +26,10 @@ public class PolicyOperation extends Operation {
public static final String POLICY_OPERATION_CODE = "POLICY_BUNDLE"; public static final String POLICY_OPERATION_CODE = "POLICY_BUNDLE";
private List<ProfileOperation> profileOperations; private List<ProfileOperation> profileOperations;
public PolicyOperation() {
setControl(Control.REPEAT);
}
public List<ProfileOperation> getProfileOperations() { public List<ProfileOperation> getProfileOperations() {
return profileOperations; return profileOperations;
} }
@ -33,8 +38,4 @@ public class PolicyOperation extends Operation {
this.profileOperations = profileOperations; this.profileOperations = profileOperations;
} }
public Control getControl(){
return Control.REPEAT;
}
} }

@ -19,21 +19,21 @@
package org.wso2.carbon.device.mgt.core.operation.mgt; package org.wso2.carbon.device.mgt.core.operation.mgt;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class ProfileOperation extends ConfigOperation implements Serializable { public class ProfileOperation extends ConfigOperation implements Serializable {
private static final long serialVersionUID = -3322674908775087365L; private static final long serialVersionUID = -3322674908775087365L;
private List<Integer> correctiveActionIds; private List<Integer> correctiveActionIds;
private List<Integer> reactiveActionIds; private List<Integer> reactiveActionIds;
public Type getType() { public ProfileOperation() {
return Type.PROFILE; super();
} }
public Control getControl(){ public Type getType() {
return Control.REPEAT; return Type.PROFILE;
} }
public List<Integer> getCorrectiveActionIds() { public List<Integer> getCorrectiveActionIds() {
@ -51,4 +51,5 @@ public class ProfileOperation extends ConfigOperation implements Serializable {
public void setReactiveActionIds(List<Integer> reactiveActionIds) { public void setReactiveActionIds(List<Integer> reactiveActionIds) {
this.reactiveActionIds = reactiveActionIds; this.reactiveActionIds = reactiveActionIds;
} }
} }

Loading…
Cancel
Save