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

b4j.core.session.bugzilla.json.BugzillaClassificationParser Maven / Gradle / Ivy

/*
 * This file is part of Bugzilla for Java.
 *
 *  Bugzilla for Java is free software: you can redistribute it 
 *  and/or modify it under the terms of version 3 of the GNU 
 *  Lesser General Public  License as published by the Free Software 
 *  Foundation.
 *  
 *  Bugzilla for Java is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public 
 *  License along with Bugzilla for Java.  If not, see 
 *  .
 */
package b4j.core.session.bugzilla.json;

import java.util.ArrayList;
import java.util.List;

import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;

import b4j.core.Classification;
import b4j.core.DefaultClassification;
import b4j.util.LazyRetriever;

import com.atlassian.jira.rest.client.internal.json.JsonObjectParser;

/**
 * Parses the classification for Bugzilla REST API.
 * @author ralph
 * @since 2.0
 *
 */
public class BugzillaClassificationParser extends AbstractJsonParser implements JsonObjectParser> {

	/**
	 * Constructor.
	 */
	public BugzillaClassificationParser() {
		this(null);
	}

	/**
	 * Constructor.
	 */
	public BugzillaClassificationParser(LazyRetriever lazyRetriever) {
		super(lazyRetriever);
	}

	@Override
	public Iterable parse(JSONObject json) throws JSONException {
		List rc = new ArrayList();
		// Error 900 (no classification will be ignored)
		BugzillaJsonError error = getError(json);
		if (error == null) {
			JSONArray arr = getResult(json).getJSONArray("classifications");
			for (int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy