<commit_before>/*
 * Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.usu.sdl.openstorefront.service.io.parser;

import java.io.InputStream;

public class AttributeStandardParser
		extends BaseAttributeParser
{

	@Override
	public String checkFormat(String mimeType, InputStream input)
	{
		throw new UnsupportedOperationException("Not supported yet.");
	}

	@Override
	protected <T> Object parseRecord(T record)
	{
		throw new UnsupportedOperationException("Not supported yet.");
	}

}
<commit_msg>Parse JSON into objects using mapper<commit_after>/*
 * Copyright 2016 Space Dynamics Laboratory - Utah State University Research Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.usu.sdl.openstorefront.service.io.parser;

import com.fasterxml.jackson.core.type.TypeReference;
import edu.usu.sdl.openstorefront.common.exception.OpenStorefrontRuntimeException;
import edu.usu.sdl.openstorefront.common.util.StringProcessor;
import edu.usu.sdl.openstorefront.core.model.AttributeAll;
import edu.usu.sdl.openstorefront.service.io.reader.GenericReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;

public class AttributeStandardParser
		extends BaseAttributeParser
{

	private static final Logger log = Logger.getLogger(ComponentStandardParser.class.getName());

	@Override
	public String checkFormat(String mimeType, InputStream input)
	{
		return "";
	}

	@Override
	protected GenericReader getReader(InputStream in)
	{
		return new GenericReader<AttributeAll>(in)
		{

			private List<AttributeAll> listOfAttributeAlls = new ArrayList<>();

			@Override
			public void preProcess()
			{
				try (InputStream inTemp = in) {
					listOfAttributeAlls = StringProcessor.defaultObjectMapper().readValue(inTemp, new TypeReference<List<AttributeAll>>()
					{
					});
				} catch (IOException ex) {
					throw new OpenStorefrontRuntimeException(ex);
				}
			}

			@Override
			public AttributeAll nextRecord()
			{
				if (listOfAttributeAlls.size() > 0) {
					currentRecordNumber++;
					return listOfAttributeAlls.remove(0);
				} else {
					return null;
				}
			}

		};
	}

	@Override
	protected <T> Object parseRecord(T record)
	{
		AttributeAll attributeAll = (AttributeAll) record;
		return attributeAll;
	}

}

{'fraction_non_alphanumeric': 0.08559861191440139, 'fraction_numerical': 0.005205320994794679, 'mean_word_length': 4.264840182648402, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6750034', 'n_tokens_mistral': 1042, 'n_tokens_neox': 933, 'n_words': 312}