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

com.lesstif.jira.issue.CustomFieldDeSerializer Maven / Gradle / Ivy

Go to download

A Java client library for integrating with the JIRA issue and bug tracking software.

The newest version!
package com.lesstif.jira.issue;

import java.io.IOException;
import java.util.Iterator;

import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.ObjectCodec;
import org.codehaus.jackson.map.DeserializationContext;
import org.codehaus.jackson.map.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

// JIRA Custom Field Serialize
public class CustomFieldDeSerializer extends JsonDeserializer {

	Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public Object deserialize(JsonParser jp, DeserializationContext ctxt)
			throws IOException, JsonProcessingException {
		logger.info("Deserialize...");

		ObjectCodec oc = jp.getCodec();
		JsonNode node = oc.readTree(jp);
		
		for (int i = 0; i < node.size(); i++)
		{
			JsonNode child = node.get(i);
			
			if (child == null) {
				logger.info(i + "th Child node is null");
				continue;
			}
			//String
			if (child.isTextual()) {
				Iterator it = child.getFieldNames();
				while (it.hasNext()) {
					String field = it.next();
					logger.info("in while loop " + field);
					if (field.startsWith("customfield")) {
						
					}
				}
			}
		}
		return null;
	}

}