Cq61ConfContentUpgrade.java 1.33 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.jcr.Node
 *  javax.jcr.Property
 *  javax.jcr.RepositoryException
 *  javax.jcr.Session
 *  org.slf4j.Logger
 *  org.slf4j.LoggerFactory
 */
package com.day.cq.compat.codeupgrade.impl.cq61;

import com.day.cq.compat.codeupgrade.internal.api.ProgressInfoProvider;
import javax.jcr.Node;
import javax.jcr.Property;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Cq61ConfContentUpgrade
implements ProgressInfoProvider {
    private final Logger log;
    private String progressInfo;

    public Cq61ConfContentUpgrade() {
        this.log = LoggerFactory.getLogger(this.getClass());
    }

    @Override
    public String getProgressInfo() {
        return this.progressInfo;
    }

    void setProgressInfo(String info) {
        this.progressInfo = info;
        this.log.info(this.progressInfo);
    }

    public void doUpgrade(Session session) throws RepositoryException {
        this.setProgressInfo("Adding cq:conf default references to /content");
        Node content = session.getNode("/content");
        if (!content.hasProperty("cq:conf")) {
            content.setProperty("cq:conf", new String[]{"/libs", "/apps", "/conf/global"});
        }
        session.save();
    }
}