All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jk.webstack.services.workflow.WorkflowController Maven / Gradle / Ivy

/*
 * Copyright 2002-2022 Dr. Jalal Kiswani. 
 * Email: [email protected]
 * Check out https://smart-api.com for more details
 * 
 * All the opensource projects of Dr. Jalal Kiswani are free for personal and academic use only, 
 * for commercial usage and support, please contact the author.
 *
 * 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.
 */
package com.jk.webstack.services.workflow; 

import java.util.List;

import com.jk.core.util.JK;
import com.jk.core.util.JKCollectionUtil;
import com.jk.services.client.workflow.JKWorkflowServiceClient;
import com.jk.services.client.workflow.models.PayloadModel;
import com.jk.web.faces.controllers.JKWebController;

import jakarta.annotation.ManagedBean;
import jakarta.faces.view.ViewScoped;

// TODO: Auto-generated Javadoc
/**
 * The Class WorkflowController.
 */
@ViewScoped
@ManagedBean("workflow")
public class WorkflowController extends JKWebController {
	
	/** The payload. */
	private PayloadModel payload;
	
	/** The filter list 2. */
	private List filterList2;
	
	/** The client. */
	JKWorkflowServiceClient client = new JKWorkflowServiceClient();
	
	/** The pay loads. */
	private List payLoads;

	/**
	 * Gets the payloads.
	 *
	 * @return the payloads
	 */
	public List getPayloads() {
		if (payLoads == null) {
			payLoads = client.getPayLoads(JK.getAppName(), JKCollectionUtil.toString(getRoles(), false));
		}
		return payLoads;
	}

	/**
	 * Gets the payload.
	 *
	 * @return the payload
	 */
	public PayloadModel getPayload() {
		return payload;
	}

	/**
	 * Approve payload.
	 *
	 * @param entityName the entity name
	 * @param id the id
	 * @return the string
	 */
	public String approvePayload(String entityName, int id) {
		return null;
	}

	/**
	 * Reject payload.
	 *
	 * @param entityName the entity name
	 * @param id the id
	 * @return the string
	 */
	public String rejectPayload(String entityName, int id) {
		String rejectAction = client.rejectWorkflowEntity(id);
		return null;
	}

	/**
	 * Find payload.
	 *
	 * @param id the id
	 * @return the payload model
	 */
	public PayloadModel findPayload(int id) {
		for (PayloadModel payload : getPayloads()) {
			if (payload.getId().equals(id)) {
				return payload;
			}
		}
		return null;
	}

	/**
	 * Gets the filter list 2.
	 *
	 * @return the filter list 2
	 */
	public List getFilterList2() {
		return filterList2;
	}

	/**
	 * Sets the filter list 2.
	 *
	 * @param filterList2 the new filter list 2
	 */
	public void setFilterList2(List filterList2) {
		this.filterList2 = filterList2;
	}
	
	/**
	 * Reset.
	 */
	public void reset() {
		this.payload=null;
		this.filterList2=null;
		this.payload=null;
		this.payLoads=null;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy