<commit_before>/**
 * Copyright Notice
 *
 * This is a work of the U.S. Government and is not subject to copyright
 * protection in the United States. Foreign copyrights may apply.
 *
 * 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 gov.va.isaac.gui.refsetview;

import gov.va.isaac.AppContext;
import gov.va.isaac.models.cem.importer.CEMMetadataBinding;
import gov.va.isaac.util.WBUtility;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.UUID;
import javafx.beans.property.SimpleStringProperty;
import org.ihtsdo.otf.tcc.api.chronicle.ComponentChronicleBI;
import org.ihtsdo.otf.tcc.api.concept.ConceptVersionBI;
import org.ihtsdo.otf.tcc.api.refex.RefexType;
import org.ihtsdo.otf.tcc.api.refex.RefexVersionBI;
import org.ihtsdo.otf.tcc.api.refex.type_nid.RefexNidVersionBI;
import org.ihtsdo.otf.tcc.api.refex.type_nid_string.RefexNidStringVersionBI;
import org.ihtsdo.otf.tcc.api.refex.type_string.RefexStringVersionBI;
import org.ihtsdo.otf.tcc.api.store.TerminologyStoreDI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * RefsetInstanceAccessor
 *
 * @author <a href="<EMAIL>"><NAME></a>
 */
public class RefsetInstanceAccessor {
	
	private static SimpleDateFormat sdf = new SimpleDateFormat();
	private static final Logger logger = LoggerFactory.getLogger(RefsetInstanceAccessor.class);

	public static class RefsetInstance {
		private SimpleStringProperty refCompConFsn;
		private SimpleStringProperty refCompConUuid;
		private int refCompConNid;
		private int memberNid;
		
		private String status, time, author, module, path;

		private RefsetInstance(ConceptVersionBI con, RefexVersionBI member) {
			memberNid = (member == null ? 0 : member.getNid());

			if (con == null) {
				this.refCompConUuid = new SimpleStringProperty(
						"Add Reference Component UUID");
				this.refCompConFsn = new SimpleStringProperty(
						"Add Reference Component UUID");
				this.refCompConNid = 0;
			} else {
				this.refCompConUuid = new SimpleStringProperty(con
						.getPrimordialUuid().toString());
				this.refCompConNid = con.getNid();
				if (member != null)
				{
					this.status = member.getStatus().toString();
					
					this.time = sdf.format(new Date(member.getTime()));
					try
					{
						this.author = WBUtility.getDescription(AppContext.getService(TerminologyStoreDI.class).getConcept(member.getAuthorNid()).getPrimordialUuid());
					}
					catch (Exception e1)
					{
						logger.error("Error formatting stamp component", e1);
						this.author = member.getAuthorNid() + "";
					}<commit_msg>show "Uncommitted" when not yet committed.<commit_after>/**
 * Copyright Notice
 *
 * This is a work of the U.S. Government and is not subject to copyright
 * protection in the United States. Foreign copyrights may apply.
 *
 * 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 gov.va.isaac.gui.refsetview;

import gov.va.isaac.AppContext;
import gov.va.isaac.models.cem.importer.CEMMetadataBinding;
import gov.va.isaac.util.WBUtility;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.UUID;
import javafx.beans.property.SimpleStringProperty;
import org.ihtsdo.otf.tcc.api.chronicle.ComponentChronicleBI;
import org.ihtsdo.otf.tcc.api.concept.ConceptVersionBI;
import org.ihtsdo.otf.tcc.api.refex.RefexType;
import org.ihtsdo.otf.tcc.api.refex.RefexVersionBI;
import org.ihtsdo.otf.tcc.api.refex.type_nid.RefexNidVersionBI;
import org.ihtsdo.otf.tcc.api.refex.type_nid_string.RefexNidStringVersionBI;
import org.ihtsdo.otf.tcc.api.refex.type_string.RefexStringVersionBI;
import org.ihtsdo.otf.tcc.api.store.TerminologyStoreDI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * RefsetInstanceAccessor
 *
 * @author <a href="<EMAIL>"><NAME></a>
 */
public class RefsetInstanceAccessor {
	
	private static SimpleDateFormat sdf = new SimpleDateFormat();
	private static final Logger logger = LoggerFactory.getLogger(RefsetInstanceAccessor.class);

	public static class RefsetInstance {
		private SimpleStringProperty refCompConFsn;
		private SimpleStringProperty refCompConUuid;
		private int refCompConNid;
		private int memberNid;
		
		private String status, time, author, module, path;

		private RefsetInstance(ConceptVersionBI con, RefexVersionBI member) {
			memberNid = (member == null ? 0 : member.getNid());

			if (con == null) {
				this.refCompConUuid = new SimpleStringProperty(
						"Add Reference Component UUID");
				this.refCompConFsn = new SimpleStringProperty(
						"Add Reference Component UUID");
				this.refCompConNid = 0;
			} else {
				this.refCompConUuid = new SimpleStringProperty(con
						.getPrimordialUuid().toString());
				this.refCompConNid = con.getNid();
				if (member != null)
				{
					this.status = member.getStatus().toString();
					
					this.time = (member.isUncommitted() ? "Uncommitted" : sdf.format(new Date(member.getTime())));
					try
					{
						this.author = WBUtility.getDescription(AppContext.getService(TerminologyStoreDI.class).getConcept(member.getAuthorNid()).getPrimordialUuid());
					}
					catch (Exception e1)
					{
						logger.error("Error formatting stamp component", e1);
						this.author = member.getAuthorNid() + "";
					}
{'fraction_non_alphanumeric': 0.10321758521822236, 'fraction_numerical': 0.0031857279388340237, 'mean_word_length': 4.2853535353535355, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3319703', 'n_tokens_mistral': 2210, 'n_tokens_neox': 2002, 'n_words': 489}