Permalink
Browse files

solving merge conflict

  • Loading branch information...
dgkncelik committed May 29, 2018
1 parent 0961ca8 commit 1ea1c20329a1422098cd5be27cc0821ea4ed46f0
@@ -8,6 +8,7 @@
import edu.itu.cavabunga.core.entity.parameter.ParameterType;
import edu.itu.cavabunga.core.entity.property.PropertyType;
import java.util.List;
import java.util.Optional;
/**
@@ -26,6 +27,13 @@
*/
Optional<Component> getComponentById(Long id);
/**
* find component which owned by a participant
*
* @param owner participant to find component which owned by
*/
List<Component> getComponentByOwner(Participant owner);
/**
* saves given component
*
@@ -92,4 +100,4 @@
* @param id parameter id to delete
*/
void deleteParameterById(Long id);
}
}
@@ -1,4 +1,5 @@
package edu.itu.cavabunga.core.service;
import java.util.List;
import java.util.Optional;
import edu.itu.cavabunga.core.entity.Component;
import edu.itu.cavabunga.core.entity.Parameter;
@@ -13,12 +14,8 @@
import edu.itu.cavabunga.core.repository.ComponentRepository;
import edu.itu.cavabunga.core.repository.ParameterRepository;
import edu.itu.cavabunga.core.repository.PropertyRepository;
import edu.itu.cavabunga.exception.Validation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.validation.Valid;
/**
* {@inheritDoc}
@@ -49,12 +46,12 @@
*/
@Autowired
public IcalServiceImpl(
ComponentFactory componentFactory,
ComponentRepository componentRepository,
PropertyFactory propertyFactory,
PropertyRepository propertyRepository,
ParameterFactory parameterFactory,
ParameterRepository parameterRepository
ComponentFactory componentFactory,
ComponentRepository componentRepository,
PropertyFactory propertyFactory,
PropertyRepository propertyRepository,
ParameterFactory parameterFactory,
ParameterRepository parameterRepository
) {
this.componentFactory = componentFactory;
this.componentRepository = componentRepository;
@@ -94,14 +91,15 @@ public Component createComponentForParticipant(ComponentType componentType, Part
* {@inheritDoc}
*/
@Override
@Transactional
public void saveComponent(Component component){
try {
component.validate();
}catch (Exception e){
throw new Validation("component couldnor send to repository, validation failed: " + e.getMessage());
}
public List<Component> getComponentByOwner(Participant owner){
return componentRepository.findByOwner(owner);
}
/**
* {@inheritDoc}
*/
@Override
public void saveComponent(Component component){
componentRepository.save(component);
}
@@ -134,12 +132,6 @@ public Property createProperty(PropertyType propertyType){
*/
@Override
public void saveProperty(Property property){
try {
property.validate();
}catch (Exception e){
throw new Validation("Propererty couldnot send reposiyory, validation failed: " + e.getMessage());
}
propertyRepository.save(property);
}
@@ -172,13 +164,6 @@ public Parameter createParameter(ParameterType parameterType){
*/
@Override
public void saveParameter(Parameter parameter){
try {
parameter.validate();
}catch (Exception e){
throw new Validation("Parameter couldnot send to repository, validation failed: " + e.getMessage());
}
parameterRepository.save(parameter);
}
@@ -189,4 +174,4 @@ public void saveParameter(Parameter parameter){
public void deleteParameterById(Long id){
parameterRepository.delete(id);
}
}
}

0 comments on commit 1ea1c20

Please sign in to comment.