<commit_before>package qora.web;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;

import javax.ws.rs.WebApplicationException;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.json.simple.JSONObject;

import qora.naming.Name;
import utils.KeyVariation;
import utils.Pair;
import utils.ProfileUtils;
import utils.Qorakeys;
import utils.StorageUtils;
import api.NameStorageResource;
import controller.Controller;
import database.DBSet;

@SuppressWarnings("unchecked")
public class Profile {

	public static boolean isAllowedProfileName(String name) {
		// RULES FOR PROFILES
		if (name == null || name.length() < 3 || name.contains(";")
				|| name.endsWith(" ") || name.startsWith(" ")) {
			return false;
		}

		return true;
	}

	private final BlogBlackWhiteList blogBlackWhiteList;
	private JSONObject jsonRepresenation;
	private Name name;
	private List<Name> followerCache = null;
	private List<Name> likeCache = null;

	public static Profile getProfileOpt(String name) {
		Profile result = null;
		if (name != null) {
			Name nameObj = DBSet.getInstance().getNameMap().get(name);
			result = Profile.getProfileOpt(nameObj);
		}

		return result;
	}

	public static Profile getProfileOpt(Name name) {
		if (!isAllowedProfileName(name.getName())) {
			return null;
		}
		Name nameReloaded = DBSet.getInstance().getNameMap()
				.get(name.getName());
		return new Profile(nameReloaded);
	}

	private Profile(Name name) {
		this.name = name;
		blogBlackWhiteList = BlogBlackWhiteList.getBlogBlackWhiteList(name
				.toString());
		jsonRepresenation = ProfileUtils.getProfile(name.getName());
	}

	public List<Name> getFollower() {

		if (followerCache != null) {
			return followerCache;
		}

		List<Name> results = new ArrayList<>();
		List<Name> resultsLike = new ArrayList<>();<commit_msg>fixed get enabledProfilesBug<commit_after>package qora.web;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;

import javax.ws.rs.WebApplicationException;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.json.simple.JSONObject;

import qora.naming.Name;
import utils.KeyVariation;
import utils.Pair;
import utils.ProfileUtils;
import utils.Qorakeys;
import utils.StorageUtils;
import api.NameStorageResource;
import controller.Controller;
import database.DBSet;

@SuppressWarnings("unchecked")
public class Profile {

	public static boolean isAllowedProfileName(String name) {
		// RULES FOR PROFILES
		if (name == null || name.length() < 3 || name.contains(";")
				|| name.endsWith(" ") || name.startsWith(" ")) {
			return false;
		}

		return true;
	}

	private final BlogBlackWhiteList blogBlackWhiteList;
	private JSONObject jsonRepresenation;
	private Name name;
	private List<Name> followerCache = null;
	private List<Name> likeCache = null;

	public static Profile getProfileOpt(String name) {
		Profile result = null;
		if (name != null) {
			Name nameObj = DBSet.getInstance().getNameMap().get(name);
			result = Profile.getProfileOpt(nameObj);
		}

		return result;
	}

	public static Profile getProfileOpt(Name name) {
		if (!isAllowedProfileName(name.getName())) {
			return null;
		}
		Name nameReloaded = DBSet.getInstance().getNameMap()
				.get(name.getName());
		if(nameReloaded == null)
		{
			return null;
		}
		return new Profile(nameReloaded);
	}

	private Profile(Name name) {
		this.name = name;
		blogBlackWhiteList = BlogBlackWhiteList.getBlogBlackWhiteList(name
				.toString());
		jsonRepresenation = ProfileUtils.getProfile(name.getName());
	}

	public List<Name> getFollower() {

		if (followerCache != null) {
			return followerCache;
		}

		List<Name> results = new ArrayList<>();
		List<Name> resultsLike = new ArrayList<>();
{'fraction_non_alphanumeric': 0.11780890445222611, 'fraction_numerical': 0.0015007503751875938, 'mean_word_length': 4.837956204379562, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3284526', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1247, 'n_words': 289}