AutoAssignRule.java 2.08 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.cq.workflow.WorkflowException
 *  com.day.cq.workflow.WorkflowSession
 *  com.day.cq.workflow.model.WorkflowModel
 *  javax.jcr.Node
 *  javax.jcr.Property
 *  javax.jcr.RepositoryException
 */
package com.day.cq.wcm.workflow.impl;

import com.day.cq.workflow.WorkflowException;
import com.day.cq.workflow.WorkflowSession;
import com.day.cq.workflow.model.WorkflowModel;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;

public class AutoAssignRule {
    public static final String GLOBBING = "globbing";
    public static final String WORKFLOW_MODEL = "workflowModel";
    public static final String TEMPLATE_PATH = "templatePath";
    public static final String TEMPLATE_RESOURCE_TYPE = "templResourceType";
    private Node node;
    private WorkflowSession session;

    public AutoAssignRule(Node node, WorkflowSession session) {
        this.session = session;
        this.node = node;
    }

    public WorkflowModel getWorkflowModel() {
        try {
            String modelId = this.node.getProperty("workflowModel").getString();
            return this.session.getModel(modelId);
        }
        catch (RepositoryException re) {
        }
        catch (WorkflowException we) {
            // empty catch block
        }
        return null;
    }

    public String getTemplatePath() {
        try {
            return this.node.getParent().getProperty("templatePath").getString();
        }
        catch (RepositoryException re) {
            return null;
        }
    }

    public String getTemplResourceType() {
        try {
            return this.node.getParent().getProperty("templResourceType").getString();
        }
        catch (RepositoryException re) {
            return null;
        }
    }

    public String getGlobbing() {
        try {
            return this.node.getProperty("globbing").getString();
        }
        catch (RepositoryException re) {
            return null;
        }
    }

    public Node getNode() {
        return this.node;
    }
}