package consulo.hub.backend.property;

import consulo.hub.backend.property.domain.Property;
import consulo.hub.backend.property.repository.PropertyRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author VISTALL
 * @since 28/08/2021
 */
@Service
public class PropertyService
{
	private PropertyRepository myPropertyRepository;

	@Autowired
	public PropertyService(PropertyRepository propertyRepository)
	{
		myPropertyRepository = propertyRepository;
	}

	public boolean getValue(String name)
	{
		Property property = myPropertyRepository.findOne(name);
		if(property != null)
		{
			return Boolean.valueOf(name);
		}
		return false;
	}

	public void setValue(String name, boolean value)
	{
		Property property = myPropertyRepository.findOne(name);
		if(property == null)
		{
			property = new Property();
			property.setKey(name);
		}

		property.setValue(String.valueOf(value));

		myPropertyRepository.save(property);
	}
}

@@ -681,20 +681,35 @@
 valueOf(
-name
+property.getValue()
 );%0A%09%09%7D%0A%09

fix value