AbstractWorkflowView.java 1.31 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.day.crx.statistics.Entry
 *  javax.jcr.Item
 *  javax.jcr.Node
 *  javax.jcr.Property
 *  javax.jcr.RepositoryException
 *  javax.jcr.Session
 */
package com.day.cq.workflow.impl.statistics;

import com.day.crx.statistics.Entry;
import javax.jcr.Item;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.Session;

public abstract class AbstractWorkflowView
extends Entry {
    public AbstractWorkflowView(String pathPrefix) {
        super(pathPrefix);
    }

    protected long get(Session session, String propertyName) {
        Node node = this.getNode(session);
        try {
            if (node != null && node.hasProperty(propertyName)) {
                return node.getProperty(propertyName).getLong();
            }
        }
        catch (RepositoryException re) {
            // empty catch block
        }
        return 0;
    }

    protected Node getNode(Session session) {
        try {
            Item item;
            if (session.itemExists(this.getPath()) && (item = session.getItem(this.getPath())).isNode()) {
                return (Node)item;
            }
        }
        catch (RepositoryException e) {
            // empty catch block
        }
        return null;
    }
}