Search in sources :

Example 6 with WorkflowStepData

use of com.emc.storageos.db.client.model.WorkflowStepData in project coprhd-controller by CoprHD.

the class WorkflowService method getWorkflowStepData.

/**
 * Returns a WorkflowStepData from database based on workflowURI and stepId
 *
 * @param workflowURI -- required workflow URI
 * @param stepId -- optional stepId (required); can either be stepId or workflowId
 * @param label -- optional label (ignored if not supplied)
 * @return WorkflowStepData
 */
private WorkflowStepData getWorkflowStepData(URI workflowURI, String stepId, String label) {
    AlternateIdConstraint constraint = AlternateIdConstraint.Factory.getWorkflowStepDataByStep(stepId);
    List<WorkflowStepData> dataRecords = CustomQueryUtility.queryActiveResourcesByConstraint(_dbClient, WorkflowStepData.class, constraint);
    if (dataRecords == null || dataRecords.isEmpty()) {
        _log.info(String.format("data records null or empty for workflow %s and step %s", workflowURI, stepId));
    }
    for (WorkflowStepData dataRecord : dataRecords) {
        if (dataRecord == null || dataRecord.getInactive()) {
            _log.info("WorkflowStepData record inactive: " + ((dataRecord != null) ? dataRecord.getId().toString() : stepId));
            continue;
        }
        if (dataRecord.getWorkflowId().equals(workflowURI) && dataRecord.getStepId().equals(stepId)) {
            if (label == null && NullColumnValueGetter.isNullValue(dataRecord.getLabel()) || label != null && label.equals(dataRecord.getLabel())) {
                return dataRecord;
            }
        }
    }
    return null;
}
Also used : WorkflowStepData(com.emc.storageos.db.client.model.WorkflowStepData) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint)

Aggregations

WorkflowStepData (com.emc.storageos.db.client.model.WorkflowStepData)6 DataObject (com.emc.storageos.db.client.model.DataObject)2 WorkflowStep (com.emc.storageos.db.client.model.WorkflowStep)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 LockRetryException (com.emc.storageos.locking.LockRetryException)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 URI (java.net.URI)2 Stat (org.apache.zookeeper.data.Stat)2 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 NamedURI (com.emc.storageos.db.client.model.NamedURI)1 Workflow (com.emc.storageos.db.client.model.Workflow)1 Step (com.emc.storageos.workflow.Workflow.Step)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1 Test (org.junit.Test)1