Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/bin/
/.classpath
/.project
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is the begining of the README file
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,16 @@

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

@Entity
public class Component {

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
private String name;
private String author;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.aurea.antipattern.sample.spring.repository;

import org.springframework.data.repository.CrudRepository;

import com.aurea.antipattern.sample.spring.bean.Component;

public interface ComponentRepository extends CrudRepository<Component, Long> {

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,35 @@

import com.aurea.antipattern.sample.spring.bean.Component;
import com.aurea.antipattern.sample.spring.helper.ComponentHelper;
import com.aurea.antipattern.sample.spring.repository.ComponentRepository;

import lombok.extern.log4j.Log4j;

@Service
@Log4j
public class ComponentService {

private ComponentHelper helper;
private ComponentHelper helper;
private ComponentRepository compomentRepository;

public void setHelper(ComponentHelper helper) {
this.helper = helper;
}

public void setHelper(ComponentHelper helper) {
this.helper = helper;
}
public ComponentHelper getHelper() {
return helper;
}

public ComponentHelper getHelper() {
return helper;
}
public String getComponentDetails(String component) {
log.debug("Entering component details method");
log.debug("Trying to find" + component + " details.");

public String getComponentDetails(String component) {
return helper.findComponentDetails(component);
}
return helper.findComponentDetails(component);
}

public void saveComponent(Component component) {
System.out.println("Saving component");
}
public void saveComponent(Component component) {
log.debug("Saving component");
compomentRepository.save(component);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,22 @@
import com.aurea.antipattern.sample.spring.bean.Status;
import com.aurea.antipattern.sample.spring.repository.StatusRepository;

import lombok.extern.log4j.Log4j;

@Service
@Log4j
public class StatusService {

@Autowired
private StatusRepository statusRepository;

public Iterable<Status> getStatusForAllComponents() {
return statusRepository.findAll();
}

public Status getStatusByComponent(String component) {
return statusRepository.findByComponent(component);
}
@Autowired
private StatusRepository statusRepository;

public Iterable<Status> getStatusForAllComponents() {
log.debug("Getting status for all components..");
return statusRepository.findAll();
}

public Status getStatusByComponent(String component) {
log.debug("Find status for" + component);
return statusRepository.findByComponent(component);
}
}