* ============LICENSE_START=======================================================
* ONAP CLAMP
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
* reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
* ===================================================================
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ *
*/
package org.onap.clamp.clds.model;
* Represent a CLDS Event.
*/
public class CldsEvent {
- public static final String ACTION_CREATE = "CREATE";
- public static final String ACTION_SUBMIT = "SUBMIT";
- public static final String ACTION_RESUBMIT = "RESUBMIT"; // an update before model is active
- public static final String ACTION_DISTRIBUTE = "DISTRIBUTE"; // only from dcae
- public static final String ACTION_DEPLOY = "DEPLOY"; // only from dcae
- public static final String ACTION_UNDEPLOY = "UNDEPLOY"; // only from dcae
- public static final String ACTION_UPDATE = "UPDATE";
- public static final String ACTION_DELETE = "DELETE";
- public static final String ACTION_STOP = "STOP";
- public static final String ACTION_RESTART = "RESTART";
+ public static final String ACTION_TEST = "TEST";
+ public static final String ACTION_CREATE = "CREATE";
+ public static final String ACTION_MODIFY = "MODIFY";
+ public static final String ACTION_SUBMIT = "SUBMIT";
+ // an update before model is active
+ public static final String ACTION_RESUBMIT = "RESUBMIT";
+ // For simplified models
+ public static final String ACTION_SUBMITDCAE = "SUBMITDCAE";
+ // only from dcae
+ public static final String ACTION_DISTRIBUTE = "DISTRIBUTE";
+ // only from dcae
+ public static final String ACTION_DEPLOY = "DEPLOY";
+ // only from dcae
+ public static final String ACTION_UNDEPLOY = "UNDEPLOY";
+ public static final String ACTION_UPDATE = "UPDATE";
+ public static final String ACTION_DELETE = "DELETE";
+ public static final String ACTION_STOP = "STOP";
+ public static final String ACTION_RESTART = "RESTART";
public static final String ACTION_STATE_INITIATED = "INITIATED";
- public static final String ACTION_STATE_SENT = "SENT";
+ public static final String ACTION_STATE_SENT = "SENT";
public static final String ACTION_STATE_COMPLETED = "COMPLETED";
- public static final String ACTION_STATE_RECEIVED = "RECEIVED";
- public static final String ACTION_STATE_ERROR = "ERROR";
- public static final String ACTION_STATE_ANY = null;
+ public static final String ACTION_STATE_RECEIVED = "RECEIVED";
+ public static final String ACTION_STATE_ERROR = "ERROR";
+ public static final String ACTION_STATE_ANY = null;
- private String id;
- private String actionCd;
- private String actionStateCd;
- private String processInstanceId;
- private String userid;
+ private String id;
+ private String actionCd;
+ private String actionStateCd;
+ private String processInstanceId;
+ private String userid;
public String getId() {
return id;
* @param processInstanceId
* @return
*/
- public static CldsEvent insEvent(CldsDao cldsDao, String controlName, String userid, String actionCd, String actionStateCd, String processInstanceId) {
+ public static CldsEvent insEvent(CldsDao cldsDao, String controlName, String userid, String actionCd,
+ String actionStateCd, String processInstanceId) {
CldsModel model = CldsModel.createUsingControlName(controlName);
- return insEvent(cldsDao, model, actionCd, actionStateCd, processInstanceId);
+ return insEvent(cldsDao, model, userid, actionCd, actionStateCd, processInstanceId);
}
/**
- * Insert event using controlNameUuid to find the model.
- * This method meant for processing events from dcae.
+ * Insert event using controlNameUuid to find the model. This method meant
+ * for processing events from dcae.
+ *
* @param cldsDao
* @param model
+ * @param userId
* @param actionCd
* @param actionStateCd
* @param processInstanceId
* @return
*/
- public static CldsEvent insEvent(CldsDao cldsDao, CldsModel model, String actionCd, String actionStateCd, String processInstanceId) {
+ public static CldsEvent insEvent(CldsDao cldsDao, CldsModel model, String userId, String actionCd,
+ String actionStateCd, String processInstanceId) {
CldsEvent event = new CldsEvent();
+ event.setUserid(userId);
event.setActionCd(actionCd);
event.setActionStateCd(actionStateCd);
event.setProcessInstanceId(processInstanceId);
}
/**
- * Check if actionCd and actionStateCd are equal to the supplied checkActionCd and checkActionStateCd.
- * Treat checkActionStateCd == null as a wildcard
- * checkActionCd should not be null.
+ * Check if actionCd is equal to the supplied checkActionCd checkActionCd
+ * should not be null.
+ *
+ * @param checkActionCd
+ * @return
+ */
+ public boolean isActionCd(String checkActionCd) {
+ if (actionCd == null) {
+ return false;
+ }
+ return actionCd.equals(checkActionCd);
+ }
+
+ /**
+ * Check if actionCd and actionStateCd are equal to the supplied
+ * checkActionCd and checkActionStateCd. Treat checkActionStateCd == null as
+ * a wildcard checkActionCd should not be null.
*
* @param checkActionCd
* @param checkActionStateCd
if (actionCd == null) {
return false;
}
- // treat checkActionStateCd == null as a wildcard (same for actionStateCd, although it shouln't be null...)
+ // treat checkActionStateCd == null as a wildcard (same for
+ // actionStateCd, although it shouln't be null...)
if (checkActionStateCd == null || actionStateCd == null) {
return actionCd.equals(checkActionCd);
}
}
/**
- * @param actionCd the actionCd to set
+ * @param actionCd
+ * the actionCd to set
*/
public void setActionCd(String actionCd) {
this.actionCd = actionCd;
}
/**
- * @param actionStateCd the actionStateCd to set
+ * @param actionStateCd
+ * the actionStateCd to set
*/
public void setActionStateCd(String actionStateCd) {
this.actionStateCd = actionStateCd;
}
/**
- * @param processInstanceId the processInstanceId to set
+ * @param processInstanceId
+ * the processInstanceId to set
*/
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
/**
- * @param userid the userid to set
+ * @param userid
+ * the userid to set
*/
public void setUserid(String userid) {
this.userid = userid;