Skip to content

Commit

Permalink
Merge pull request #61 from diging/develop
Browse files Browse the repository at this point in the history
Story/vspc 16 (#31)
  • Loading branch information
jdamerow authored Apr 26, 2019
2 parents a5188f4 + bd331ea commit c1ca5a6
Show file tree
Hide file tree
Showing 47 changed files with 1,314 additions and 162 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.DS_Store
1 change: 1 addition & 0 deletions vspace/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target/
/Users/
/.settings/
.DS_Store
11 changes: 11 additions & 0 deletions vspace/.project
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,19 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.core.springbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.springframework.ide.eclipse.core.springnature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
Expand Down
4 changes: 3 additions & 1 deletion vspace/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<db.url>jdbc:mysql://localhost:3306/vspace</db.url>
<db.user>vspace</db.user>
<db.password>vspace</db.password>
<uploaded.files.path></uploaded.files.path>
<uploaded.files.path>/Users/neehaarikadasari/Documents</uploaded.files.path>

<email.user></email.user>
<email.password></email.password>
Expand All @@ -36,6 +36,8 @@
<tomcat.deploy.path></tomcat.deploy.path>
<tomcat.app.name>vspace</tomcat.app.name>
<tomcat.server.id>TomcatServer</tomcat.server.id>

<hibernate.show_sql></hibernate.show_sql>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
Expand All @@ -24,71 +23,69 @@
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:config.properties")
public class PersistenceJPAConfig{

@Autowired
private Environment env;

private String dbDriver;

private String dbUrl;

private String dbUser;

private String dbPassword;

@PostConstruct
public void init() {
dbDriver = env.getProperty("db_driver");
dbUrl = env.getProperty("db_url");
dbUser = env.getProperty("db_user");
dbPassword = env.getProperty("db_password");
}

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em
= new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "edu.asu.diging.vspace.core.model", "edu.asu.diging.simpleusers.core.model" });

JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());

return em;
}

@Bean
public DataSource dataSource(){
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(dbDriver);
dataSource.setUrl(dbUrl);
dataSource.setUsername(dbUser);
dataSource.setPassword(dbPassword);
return dataSource;
}

@Bean
public PlatformTransactionManager transactionManager(
EntityManagerFactory emf){
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);

return transactionManager;
}

@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation(){
return new PersistenceExceptionTranslationPostProcessor();
}

Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
properties.setProperty(
"hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");

return properties;
}
public class PersistenceJPAConfig {

@Autowired
private Environment env;

private String dbDriver;

private String dbUrl;

private String dbUser;

private String dbPassword;

@PostConstruct
public void init() {
dbDriver = env.getProperty("db_driver");
dbUrl = env.getProperty("db_url");
dbUser = env.getProperty("db_user");
dbPassword = env.getProperty("db_password");
}

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(
new String[] { "edu.asu.diging.vspace.core.model", "edu.asu.diging.simpleusers.core.model" });

JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());

return em;
}

@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(dbDriver);
dataSource.setUrl(dbUrl);
dataSource.setUsername(dbUser);
dataSource.setPassword(dbPassword);
return dataSource;
}

@Bean
public PlatformTransactionManager transactionManager(EntityManagerFactory emf) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(emf);

return transactionManager;
}

@Bean
public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
return new PersistenceExceptionTranslationPostProcessor();
}

Properties additionalProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "update");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");

return properties;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.asu.diging.vspace.core.data;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.impl.ContentBlock;

@Repository
@JaversSpringDataAuditable
public interface ContentBlockRepository extends PagingAndSortingRepository<ContentBlock, String> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package edu.asu.diging.vspace.core.data;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.IImageBlock;
import edu.asu.diging.vspace.core.model.impl.ImageBlock;

@Repository
@JaversSpringDataAuditable
public interface ImageContentBlockRepository extends PagingAndSortingRepository<ImageBlock, String> {

}
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
package edu.asu.diging.vspace.core.data;

import java.util.List;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.impl.Module;
import edu.asu.diging.vspace.core.model.impl.Slide;

@Repository
@JaversSpringDataAuditable
public interface SlideRepository extends PagingAndSortingRepository<Slide, String> {

public List<Slide> findByModule(Module module);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.asu.diging.vspace.core.data;

import org.javers.spring.annotation.JaversSpringDataAuditable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import edu.asu.diging.vspace.core.model.impl.TextBlock;

@Repository
@JaversSpringDataAuditable
public interface TextContentBlockRepository extends PagingAndSortingRepository<TextBlock, String> {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package edu.asu.diging.vspace.core.exception;

public class ModuleDoesNotExistException extends Exception {

/**
*
*/
private static final long serialVersionUID = -5831237220255515528L;

public ModuleDoesNotExistException() {
super();
// TODO Auto-generated constructor stub
}

public ModuleDoesNotExistException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
// TODO Auto-generated constructor stub
}

public ModuleDoesNotExistException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}

public ModuleDoesNotExistException(String message) {
super(message);
// TODO Auto-generated constructor stub
}

public ModuleDoesNotExistException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.asu.diging.vspace.core.factory;

import edu.asu.diging.vspace.core.model.IImageBlock;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.IVSImage;

public interface IImageBlockFactory {

IImageBlock createImageBlock(ISlide slide, IVSImage image);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package edu.asu.diging.vspace.core.factory;

import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.web.staff.forms.SlideForm;

public interface ISlideFactory {

ISlide createSlide(IModule modfule, SlideForm form);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package edu.asu.diging.vspace.core.factory;

import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.ITextBlock;

public interface ITextBlockFactory {

ITextBlock createTextBlock(ISlide slide, String text);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package edu.asu.diging.vspace.core.factory.impl;

import org.springframework.stereotype.Service;

import edu.asu.diging.vspace.core.factory.IImageBlockFactory;
import edu.asu.diging.vspace.core.model.IImageBlock;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.IVSImage;
import edu.asu.diging.vspace.core.model.impl.ImageBlock;

@Service
public class ImageBlockFactory implements IImageBlockFactory {

/*
* (non-Javadoc)
*
* @see
* edu.asu.diging.vspace.core.factory.impl.IImageBlockFactory#createImageBlock(
* edu.asu.diging.vspace.core.model.ISlide,
* edu.asu.diging.vspace.core.model.IVSImage)
*/
@Override
public IImageBlock createImageBlock(ISlide slide, IVSImage image) {
IImageBlock imageBlock = new ImageBlock();
imageBlock.setImage(image);
imageBlock.setSlide(slide);

return imageBlock;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package edu.asu.diging.vspace.core.factory.impl;

import java.util.ArrayList;

import org.springframework.stereotype.Service;

import edu.asu.diging.vspace.core.factory.ISlideFactory;
import edu.asu.diging.vspace.core.model.IContentBlock;
import edu.asu.diging.vspace.core.model.IModule;
import edu.asu.diging.vspace.core.model.ISlide;
import edu.asu.diging.vspace.core.model.impl.Slide;
import edu.asu.diging.vspace.web.staff.forms.SlideForm;

@Service
public class SlideFactory implements ISlideFactory {

/*
* (non-Javadoc)
*
* @see
* edu.asu.diging.vspace.core.factory.impl.ISlideFactory#createSlide(java.lang.
* String, java.lang.String)
*/
@Override
public ISlide createSlide(IModule module, SlideForm form) {
ISlide slide = new Slide();

slide.setContents(new ArrayList<IContentBlock>());
slide.setName(form.getName());
slide.setDescription(form.getDescription());
slide.setModule(module);
return slide;
}
}
Loading

0 comments on commit c1ca5a6

Please sign in to comment.