summaryrefslogtreecommitdiffstats
path: root/dcaedt_be/src/main/java/org/onap/sdc/dcae/rule/editor/validators/BaseActionValidator.java
blob: 18a12914121f419be637023ee2a372b0f5074b3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package org.onap.sdc.dcae.rule.editor.validators;

import org.onap.sdc.dcae.composition.restmodels.ruleeditor.BaseAction;
import org.onap.sdc.dcae.errormng.ActionStatus;
import org.onap.sdc.dcae.errormng.ErrConfMgr;
import org.onap.sdc.dcae.errormng.ResponseFormat;
import org.onap.sdc.dcae.rule.editor.utils.ValidationUtils;

import java.util.List;

public abstract class BaseActionValidator<A extends BaseAction> implements IRuleElementValidator<A> {

	public boolean validate(A action, List<ResponseFormat> errors) {
		if(!ValidationUtils.validateNotEmpty(action.getId())) {
			errors.add(ErrConfMgr.INSTANCE.getResponseFormat(ActionStatus.INVALID_RULE_FORMAT, "", "missing action id"));
			return false;
		}
		return true;
	}
}