Package org.xembly

Examples of org.xembly.Directives


     * @checkstyle MultipleStringLiterals (10 lines)
     */
    @Override
    public void star() throws IOException {
        this.storage.apply(
            new Directives()
                .xpath(this.xpath())
                .attr("starred", Boolean.toString(true))
        );
    }
View Full Code Here


     * @checkstyle MultipleStringLiterals (10 lines)
     */
    @Override
    public void unstar() throws IOException {
        this.storage.apply(
            new Directives()
                .xpath(this.xpath())
                .attr("starred", Boolean.toString(false))
        );
    }
View Full Code Here

        try {
            final XML xml = this.storage.xml();
            number = Integer.toString(
                1 + xml.xpath("/github/gists/gist/id/text()").size()
            );
            final Directives dirs = new Directives().xpath("/github/gists")
                .add("gist")
                .add("id").set(number).up()
                .add("files");
            final List<XML> files = xml.nodes(
                String.format("%s/files/file", this.xpath())
            );
            for (final XML file : files) {
                final String filename = file.xpath("filename/text()").get(0);
                // @checkstyle MultipleStringLiterals (3 lines)
                dirs.add("file")
                    .add("filename").set(filename).up()
                    .add("raw_content").set(this.read(filename)).up().up();
            }
            this.storage.apply(dirs);
        } finally {
View Full Code Here

    ) throws IOException {
        this.storage = stg;
        this.self = login;
        this.coords = rep;
        this.storage.apply(
            new Directives().xpath(
                String.format(
                    "/github/repos/repo[@coords='%s']",
                    this.coords
                )
            ).addIf("forks")
View Full Code Here

        try {
            number = 1 + this.storage.xml().xpath(
                String.format("%s/fork/id/text()", this.xpath())
            ).size();
            this.storage.apply(
                new Directives().xpath(this.xpath()).add("fork")
                    .add("id").set(Integer.toString(number)).up()
                    .attr("organization", org)
            );
        } finally {
            this.storage.unlock();
View Full Code Here

    ) throws IOException {
        this.storage = stg;
        this.self = login;
        this.coords = rep;
        this.storage.apply(
            new Directives().xpath(
                String.format(
                    "/github/repos/repo[@coords='%s']",
                    this.coords
                )
            ).addIf("hooks")
View Full Code Here

        final int number;
        try {
            number = 1 + this.storage.xml().xpath(
                String.format("%s/hook/id/text()", this.xpath())
            ).size();
            final Directives dirs = new Directives().xpath(this.xpath())
                .add("hook")
                .add("id").set(String.valueOf(number)).up()
                .add("name").set(name).up()
                .add("active").set("true").up()
                .add("events").up()
                .add("config");
            for (final Map.Entry<String, String> entr : config.entrySet()) {
                dirs.add(entr.getKey()).set(entr.getValue()).up();
            }
            this.storage.apply(dirs);
        } finally {
            this.storage.unlock();
        }
View Full Code Here

    }

    @Override
    public void remove(final int number) throws IOException {
        this.storage.apply(
            new Directives().xpath(
                String.format("%s/hook[id='%d']", this.xpath(), number)
            ).remove()
        );
    }
View Full Code Here

    ) throws IOException {
        this.storage = stg;
        this.self = login;
        this.coords = rep;
        this.storage.apply(
            new Directives().xpath(
                String.format(
                    "/github/repos/repo[@coords='%s']",
                    this.coords
                )
            ).addIf("pulls")
View Full Code Here

        final int number;
        try {
            final Issue issue = this.repo().issues().create(title, "some body");
            number = issue.number();
            this.storage.apply(
                new Directives().xpath(this.xpath()).add("pull")
                    .add("number").set(Integer.toString(number)).up()
                    .add("head").set(head).up()
                    .add("base").set(base).up()
            );
        } finally {
View Full Code Here

TOP

Related Classes of org.xembly.Directives

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.