Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Push changes submittted in PR#442 to a new branch under develop-2.3.0 #532

Closed
wants to merge 6 commits into from
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.oasp.gastronomy.restaurant.batch.common;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.SkipListener;
import org.springframework.batch.core.listener.SkipListenerSupport;

/**
* Implementation of a {@link SkipListener} for logging skipped items in batch processes.
*
* @author sroeger
*
*/
public class CustomSkipListener<T, S> extends SkipListenerSupport<T, S> {

private static final Logger LOG = LoggerFactory.getLogger(CustomSkipListener.class);

@Override
public void onSkipInRead(Throwable t) {

LOG.warn("skipped item: {}", t.toString());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.transaction.PlatformTransactionManager;

import io.oasp.gastronomy.restaurant.general.configuration.CustomBeanFactoryPostProcessor;

/**
* This class contains the configuration like jobLauncher,Jobrepository etc.
*/
Expand All @@ -36,10 +39,28 @@ public class BeansBatchConfig {

private JobExplorerFactoryBean jobExplorer;

/**
* Datasource configuration
*/
private DataSource dataSource;

private PlatformTransactionManager transactionManager;

/**
* This method is creating beanFactoryPostProcesor bean to register a bean of type 'scope' in
* {@link CustomBeanFactoryPostProcessor}
*
* @return {@link CustomBeanFactoryPostProcessor}
*/
@Bean
public static BeanFactoryPostProcessor beanFactoryPostProcessor() {

return new CustomBeanFactoryPostProcessor();
}

/**
* Isolation level configuration
*/
@Value("ISOLATION_DEFAULT")
private String isolationLevelForCreate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
* This is the interface for the profile of a user interacting with this application. Currently this can only be a
* {@link io.oasp.gastronomy.restaurant.staffmanagement.dataaccess.api.StaffMemberEntity} however in the future a
* customer may login and make a reservation, etc.<br/>
* TODO: Also an external system may access the application via some service. Then there would be no user profile or it
* would be empty...
*
*/
public interface UserProfile extends Principal {
Expand All @@ -21,6 +19,7 @@ public interface UserProfile extends Principal {
/**
* @return the unique login of the user for authentication and identification.
*/
@Override
String getName();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ public String toString() {
return getValue().toPlainString() + " " + getCurrency();
}

/**
* {@inheritDoc}
*/
@Override
public int compareTo(Object o) {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.oasp.gastronomy.restaurant.general.configuration;

import org.springframework.batch.core.scope.StepScope;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
* Registers bean of type 'step' to be used in batch processing. E.g to be able to access jobParameter within a reader.
* Note that the annotation {@code @StepScope} has to be used on an implementation not an interface to function properly
*
* @author sroeger
*
*/
public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

beanFactory.registerScope("step", new StepScope());
}

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package io.oasp.gastronomy.restaurant.general.dataaccess.base.dao;

import org.springframework.stereotype.Repository;

import io.oasp.gastronomy.restaurant.general.dataaccess.api.dao.ApplicationDao;
import io.oasp.module.jpa.dataaccess.api.MutablePersistenceEntity;
import io.oasp.module.jpa.dataaccess.base.AbstractRevisionedDao;

import org.springframework.stereotype.Repository;

/**
* This is the abstract base implementation of {@link ApplicationDao}.
*
* @param <ENTITY> is the {@link #getEntityClass() type} of the managed entity.
*
*/
@Repository
public abstract class ApplicationDaoImpl<ENTITY extends MutablePersistenceEntity<Long>> extends
AbstractRevisionedDao<ENTITY> implements ApplicationDao<ENTITY> {
public abstract class ApplicationDaoImpl<ENTITY extends MutablePersistenceEntity<Long>>
extends AbstractRevisionedDao<ENTITY> implements ApplicationDao<ENTITY> {

/**
* The constructor.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package io.oasp.gastronomy.restaurant.general.logic.base;


import io.oasp.gastronomy.restaurant.general.common.base.AbstractBeanMapperSupport;
import io.oasp.module.jpa.common.api.to.PaginatedListTo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -15,6 +11,9 @@
import net.sf.mmm.util.transferobject.api.AbstractTransferObject;
import net.sf.mmm.util.transferobject.api.TransferObject;

import io.oasp.gastronomy.restaurant.general.common.base.AbstractBeanMapperSupport;
import io.oasp.module.jpa.common.api.to.PaginatedListTo;

/**
* Abstract base class for any management implementation class in this application.
*/
Expand Down Expand Up @@ -55,8 +54,8 @@ protected <T extends TransferObject, E extends PersistenceEntity<?>> PaginatedLi

/**
* Creates a {@link Map} with all {@link GenericEntity entities} from the given {@link Collection} using their
* {@link GenericEntity#getId() ID} as key. All {@link GenericEntity entities} without an
* {@link GenericEntity#getId() ID} ({@code null}) will be ignored.
* {@link GenericEntity#getId() ID} as key. All {@link GenericEntity entities} without an {@link GenericEntity#getId()
* ID} ({@code null}) will be ignored.
*
* @param <ID> is the generic type of the {@link GenericEntity#getId() ID}.
* @param <E> is the generic type of the {@link GenericEntity entity}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package io.oasp.gastronomy.restaurant.general.logic.base;

import io.oasp.gastronomy.restaurant.general.common.base.AbstractBeanMapperSupport;
import io.oasp.module.jpa.common.api.to.PaginatedListTo;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
Expand All @@ -14,6 +11,9 @@
import net.sf.mmm.util.transferobject.api.AbstractTransferObject;
import net.sf.mmm.util.transferobject.api.TransferObject;

import io.oasp.gastronomy.restaurant.general.common.base.AbstractBeanMapperSupport;
import io.oasp.module.jpa.common.api.to.PaginatedListTo;

/**
* Abstract base class for any <em>use case</em> in this application. Actual implementations need to be annotated with
* {@link javax.inject.Named} and {@link io.oasp.gastronomy.restaurant.general.logic.api.UseCase}.
Expand Down Expand Up @@ -56,8 +56,8 @@ protected <T extends TransferObject, E extends PersistenceEntity<?>> PaginatedLi

/**
* Creates a {@link Map} with all {@link GenericEntity entities} from the given {@link Collection} using their
* {@link GenericEntity#getId() ID} as key. All {@link GenericEntity entities} without an
* {@link GenericEntity#getId() ID} ({@code null}) will be ignored.
* {@link GenericEntity#getId() ID} as key. All {@link GenericEntity entities} without an {@link GenericEntity#getId()
* ID} ({@code null}) will be ignored.
*
* @param <ID> is the generic type of the {@link GenericEntity#getId() ID}.
* @param <E> is the generic type of the {@link GenericEntity entity}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
*/
public class DefaultRolesPrefixPostProcessor implements BeanPostProcessor, PriorityOrdered {

// This type allows setting the desired role prefix.
private final String rolePrefix;

/**
* Der Konstruktor.
* The constructor.
*
* @param rolePrefix das gewünschte Rollen-Präfix (z.B. der leere String).
* @param rolePrefix the desired role prefix (e.g., an empty string).
*/
public DefaultRolesPrefixPostProcessor(String rolePrefix) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ public ServletRegistrationBean servletRegistrationBean() {
return servletRegistration;
}

@Bean
public ServletRegistrationBean servletWSRegistrationBean() {

CXFServlet cxfServlet = new CXFServlet();
ServletRegistrationBean servletRegistration = new ServletRegistrationBean(cxfServlet, URL_PATH_WEB_SERVICES + "/*");
return servletRegistration;
}

@Bean
public Server jaxRsServer() {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package io.oasp.gastronomy.restaurant.offermanagement.batch.impl.offerimport.writer;

import io.oasp.gastronomy.restaurant.salesmanagement.logic.api.to.OrderEto;

/**
* Helper entity in order to convert imported data into a {@link OrderEto} as this contains an enum value and a custom
* type. An other solution is to use CustomEditors as done in staffImport.
*
* @author sroeger
*/
public class OfferCsv {

private String name;

private String description;

private String state;

private String mealId;

private String sideDishId;

private String drinkId;

private String price;

/**
* @return name
*/
public String getName() {

return this.name;
}

/**
* @param name new value of name.
*/
public void setName(String name) {

this.name = name;
}

/**
* @return description
*/
public String getDescription() {

return this.description;
}

/**
* @param description new value of description.
*/
public void setDescription(String description) {

this.description = description;
}

/**
* @return state
*/
public String getState() {

return this.state;
}

/**
* @param state new value of state.
*/
public void setState(String state) {

this.state = state;
}

/**
* @return mealId
*/
public String getMealId() {

return this.mealId;
}

/**
* @param mealId new value of mealId.
*/
public void setMealId(String mealId) {

this.mealId = mealId;
}

/**
* @return sideDishId
*/
public String getSideDishId() {

return this.sideDishId;
}

/**
* @param sideDishId new value of sideDishId.
*/
public void setSideDishId(String sideDishId) {

this.sideDishId = sideDishId;
}

/**
* @return drinkId
*/
public String getDrinkId() {

return this.drinkId;
}

/**
* @param drinkId new value of drinkId.
*/
public void setDrinkId(String drinkId) {

this.drinkId = drinkId;
}

/**
* @return price
*/
public String getPrice() {

return this.price;
}

/**
* @param price new value of price.
*/
public void setPrice(String price) {

this.price = price;
}

}
Loading