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

io.mosip.kernel.vidgenerator.utils.VIDMetaDataUtil Maven / Gradle / Ivy

package io.mosip.kernel.vidgenerator.utils;

import java.time.LocalDateTime;
import java.time.ZoneId;

import org.springframework.stereotype.Component;

import io.mosip.kernel.vidgenerator.constant.VIDGeneratorConstant;
import io.mosip.kernel.vidgenerator.entity.BaseEntity;

/**
 * Utility class for Vid Generator
 * 
 * @author Urvil Joshi
 * @since 1.0.0
 *
 */
@Component
public class VIDMetaDataUtil {

	/**
	 * Function to set metadata
	 * 
	 * @param entity entity
	 * @return  Entity with metadata
	 */
	public  T setCreateMetaData(T entity) {
		String contextUser = VIDGeneratorConstant.DEFAULTADMIN_MOSIP_IO;
		LocalDateTime time = LocalDateTime.now(ZoneId.of(VIDGeneratorConstant.UTC));
		entity.setCreatedBy(contextUser);
		entity.setCreatedtimes(time);
		entity.setIsDeleted(false);
		return entity;
	}

	/**
	 * Function to set metadata for update operation
	 * 
	 * @param entity entity
	 * @return  Entity with metadata
	 */
	public  T setUpdateMetaData(T entity) {
		String contextUser = VIDGeneratorConstant.DEFAULTADMIN_MOSIP_IO;
		LocalDateTime time = LocalDateTime.now(ZoneId.of(VIDGeneratorConstant.UTC));
		entity.setUpdatedBy(contextUser);
		entity.setUpdatedtimes(time);
		entity.setIsDeleted(false);
		return entity;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy