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

prerna.reactor.prompt.GetPromptMetaValuesReactor Maven / Gradle / Ivy

The newest version!
package prerna.reactor.prompt;

import java.util.List;
import java.util.Map;

import prerna.prompt.PromptUtils;
import prerna.reactor.AbstractReactor;
import prerna.sablecc2.om.GenRowStruct;
import prerna.sablecc2.om.PixelDataType;
import prerna.sablecc2.om.ReactorKeysEnum;
import prerna.sablecc2.om.nounmeta.NounMetadata;

public class GetPromptMetaValuesReactor extends AbstractReactor {

	public GetPromptMetaValuesReactor() {
		this.keysToGet = new String[] {ReactorKeysEnum.META_KEYS.getKey()};
	}

	@Override
	public NounMetadata execute() {
		organizeKeys();

		String userId = this.insight.getUserId();
		if (userId == null || userId.isEmpty()) {
			throw new IllegalArgumentException("User is not properly logged in.");
		}
		List> ret = PromptUtils.getAvailableMetaValues(getListValues(ReactorKeysEnum.META_KEYS.getKey()) );
		return new NounMetadata(ret, PixelDataType.CUSTOM_DATA_STRUCTURE);
	}

	private List getListValues(String key) {
		GenRowStruct grs = this.store.getNoun(key);
		if (grs != null && !grs.isEmpty()) {
			return grs.getAllStrValues();
		}
		return this.curRow.getAllStrValues();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy