Update info about MySQL.

Update i18n dependencies (Gettext).
Resolve Spring Security logout issue.
Code refactoring.
This commit is contained in:
Vova Perebykivskyi 2016-05-13 17:01:29 +03:00 committed by Dgray16
parent cfc416e4ec
commit ebe9869547
29 changed files with 171 additions and 180 deletions

View file

@ -70,11 +70,12 @@ Changes
* Update JodaTime
* Update Jasper Reports
* Update EasyMock
* Update JDBC driver
* Update JDBC drivers (PostgreSQL + MySQL)
* Update AspectJ Weaver
* Update JAX-RS API
* Update BeanShell
* Update Quartz Framework
* Update Hibernate
* Update LibrePlan version to 1.6.0

View file

@ -92,11 +92,11 @@ Develop LibrePlan in Intellij IDEA using MySQL
LibrePlan using MySQL you have to do 2 small changes:
* In section `Configure project to run`_ you have to set the *Profiles* to:
``-dev -mysql -userguide -reports -i18n``
``dev mysql -userguide -reports -i18n``
* Remember that the three last profiles that are being disabled is just to save
compilation time and not mandatory. However, to develop using MySQL you have
to set at least the first two: ``-dev`` and ``-mysql``.
to set at least the first two: ``dev`` and ``mysql``.
.. _LibrePlan: http://www.libreplan.com/

View file

@ -21,8 +21,8 @@
<build>
<plugins>
<plugin>
<groupId>org.xnap.commons</groupId>
<artifactId>maven-gettext-plugin</artifactId>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-maven-plugin</artifactId>
<configuration>
<targetBundle>app.i18n.Messages</targetBundle>
<poDirectory>${project.build.sourceDirectory}/../resources/i18n</poDirectory>
@ -40,16 +40,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>default</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
@ -59,7 +59,7 @@
<dependencies>
<!-- Gettext commons -->
<dependency>
<groupId>org.xnap.commons</groupId>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-commons</artifactId>
</dependency>

View file

@ -31,20 +31,24 @@ import org.zkoss.util.Locales;
public class I18nHelper {
private static HashMap<Locale, I18n> localesCache = new HashMap<Locale, I18n>();
private static HashMap<Locale, I18n> localesCache = new HashMap<>();
public static I18n getI18n() {
if (localesCache.keySet().contains(Locales.getCurrent())) {
if ( localesCache.keySet().contains(Locales.getCurrent()) ) {
return localesCache.get(Locales.getCurrent());
}
I18n i18n = I18nFactory.getI18n(I18nHelper.class, "app.i18n.Messages", Locales.getCurrent(),
I18n i18n = I18nFactory.getI18n(
I18nHelper.class,
"app.i18n.Messages",
Locales.getCurrent(),
org.xnap.commons.i18n.I18nFactory.FALLBACK);
localesCache.put(Locales.getCurrent(), i18n);
return i18n;
}
// TODO refactor symbol _
public static String _(String str) {
return getI18n().tr(str);
}

View file

@ -14,7 +14,7 @@
<dependencies>
<!-- Gettext commons -->
<dependency>
<groupId>org.xnap.commons</groupId>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-commons</artifactId>
</dependency>
@ -149,7 +149,7 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<executions>
<execution>
<phase>process-resources</phase>
@ -178,7 +178,7 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
<executions>
<execution>
<phase>process-resources</phase>

View file

@ -38,8 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Repository
@Scope(BeanDefinition.SCOPE_SINGLETON)
public class ConnectorDAO extends GenericDAOHibernate<Connector, Long>
implements IConnectorDAO {
public class ConnectorDAO extends GenericDAOHibernate<Connector, Long> implements IConnectorDAO {
@Override
@Transactional(readOnly = true)
@ -50,8 +49,8 @@ public class ConnectorDAO extends GenericDAOHibernate<Connector, Long>
@Override
@Transactional(readOnly = true)
public Connector findUniqueByName(String name) {
Criteria c = getSession().createCriteria(Connector.class).add(
Restrictions.eq("name", name));
Criteria c = getSession().createCriteria(Connector.class).add(Restrictions.eq("name", name));
return (Connector) c.uniqueResult();
}
@ -63,6 +62,7 @@ public class ConnectorDAO extends GenericDAOHibernate<Connector, Long>
private boolean existsOtherConnectorByName(Connector connector) {
Connector found = findUniqueByName(connector.getName());
return found != null && found != connector;
}

View file

@ -28,8 +28,7 @@ import org.libreplan.business.common.entities.JobSchedulerConfiguration;
*
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
*/
public interface IJobSchedulerConfigurationDAO extends
IGenericDAO<JobSchedulerConfiguration, Long> {
public interface IJobSchedulerConfigurationDAO extends IGenericDAO<JobSchedulerConfiguration, Long> {
/**
* Returns all {@link JobSchedulerConfiguration}
@ -52,8 +51,7 @@ public interface IJobSchedulerConfigurationDAO extends
* @param jobGroup
* @param jobName
*/
JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup,
String jobName);
JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup, String jobName);
/**
* Returns true if there exists other @{link JobSchedulerConfiguration} with
@ -63,8 +61,7 @@ public interface IJobSchedulerConfigurationDAO extends
* @param jobSchedulerConfiguration
* the <code>{@link JobSchedulerConfiguration}</code>
*/
boolean existsByJobGroupAndJobNameAnotherTransaction(
JobSchedulerConfiguration jobSchedulerConfiguration);
boolean existsByJobGroupAndJobNameAnotherTransaction(JobSchedulerConfiguration jobSchedulerConfiguration);
/**
* Returns unique {@link JobSchedulerConfiguration} for the specified
@ -75,6 +72,5 @@ public interface IJobSchedulerConfigurationDAO extends
* @param jobName
* the jobName
*/
JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction(
String jobGroup, String jobName);
JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction(String jobGroup, String jobName);
}

View file

@ -38,9 +38,8 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Repository
@Scope(BeanDefinition.SCOPE_SINGLETON)
public class JobSchedulerConfigurationDAO extends
GenericDAOHibernate<JobSchedulerConfiguration, Long> implements
IJobSchedulerConfigurationDAO {
public class JobSchedulerConfigurationDAO extends GenericDAOHibernate<JobSchedulerConfiguration, Long>
implements IJobSchedulerConfigurationDAO {
@Override
@Transactional(readOnly = true)
@ -50,28 +49,24 @@ public class JobSchedulerConfigurationDAO extends
@Override
@Transactional(readOnly = true)
public JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup,
String jobName) {
return (JobSchedulerConfiguration) getSession()
.createCriteria(JobSchedulerConfiguration.class)
public JobSchedulerConfiguration findByJobGroupAndJobName(String jobGroup, String jobName) {
return (JobSchedulerConfiguration) getSession().createCriteria(JobSchedulerConfiguration.class)
.add(Restrictions.eq("jobGroup", jobGroup))
.add(Restrictions.eq("jobName", jobName)).uniqueResult();
}
@Override
@Transactional(readOnly = true)
public List<JobSchedulerConfiguration> findByConnectorName(
String connectorName) {
Criteria c = getSession().createCriteria(
JobSchedulerConfiguration.class).add(
Restrictions.eq("connectorName", connectorName));
public List<JobSchedulerConfiguration> findByConnectorName(String connectorName) {
Criteria c = getSession().createCriteria(JobSchedulerConfiguration.class)
.add(Restrictions.eq("connectorName", connectorName));
return ((List<JobSchedulerConfiguration>) c.list());
}
@Override
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
public boolean existsByJobGroupAndJobNameAnotherTransaction(
JobSchedulerConfiguration jobSchedulerConfiguration) {
public boolean existsByJobGroupAndJobNameAnotherTransaction(JobSchedulerConfiguration jobSchedulerConfiguration) {
return existsOtherJobByGroupAndName(jobSchedulerConfiguration);
}
@ -82,18 +77,17 @@ public class JobSchedulerConfigurationDAO extends
* @param jobSchedulerConfiguration
* the {@link JobSchedulerConfiguration}
*/
private boolean existsOtherJobByGroupAndName(
JobSchedulerConfiguration jobSchedulerConfiguration) {
private boolean existsOtherJobByGroupAndName(JobSchedulerConfiguration jobSchedulerConfiguration) {
JobSchedulerConfiguration found = findByJobGroupAndJobName(
jobSchedulerConfiguration.getJobGroup(),
jobSchedulerConfiguration.getJobName());
return found != null && found != jobSchedulerConfiguration;
}
@Override
@Transactional(readOnly = true, propagation = Propagation.REQUIRES_NEW)
public JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction(
String jobGroup, String jobName) {
public JobSchedulerConfiguration findUniqueByJobGroupAndJobNameAnotherTransaction(String jobGroup, String jobName) {
return findByJobGroupAndJobName(jobGroup, jobName);
}

View file

@ -55,7 +55,7 @@ public class Connector extends BaseEntity {
private String name;
private List<ConnectorProperty> properties = new ArrayList<ConnectorProperty>();
private List<ConnectorProperty> properties = new ArrayList<>();
/**
* Constructor for Hibernate. Do not use!
@ -90,34 +90,33 @@ public class Connector extends BaseEntity {
}
public Map<String, String> getPropertiesAsMap() {
Map<String, String> map = new HashMap<String, String>();
Map<String, String> map = new HashMap<>();
for (ConnectorProperty property : properties) {
map.put(property.getKey(), property.getValue());
}
return map;
}
@AssertTrue(message = "connector name is already being used")
public boolean isUniqueConnectorNameConstraint() {
if (StringUtils.isBlank(name)) {
if ( StringUtils.isBlank(name) ) {
return true;
}
IConnectorDAO connectorDAO = Registry.getConnectorDAO();
if (isNewObject()) {
if ( isNewObject() ) {
return !connectorDAO.existsByNameAnotherTransaction(this);
} else {
Connector found = connectorDAO
.findUniqueByNameAnotherTransaction(name);
Connector found = connectorDAO.findUniqueByNameAnotherTransaction(name);
return found == null || found.getId().equals(getId());
}
}
public boolean isActivated() {
return getPropertiesAsMap()
.get(PredefinedConnectorProperties.ACTIVATED).equalsIgnoreCase(
"Y");
return getPropertiesAsMap().get(PredefinedConnectorProperties.ACTIVATED).equalsIgnoreCase("Y");
}
/**
@ -126,23 +125,15 @@ public class Connector extends BaseEntity {
* @return true if connection values are valid
*/
public boolean areConnectionValuesValid() {
String serverUrl = getPropertiesAsMap().get(
PredefinedConnectorProperties.SERVER_URL);
String serverUrl = getPropertiesAsMap().get(PredefinedConnectorProperties.SERVER_URL);
try {
new URL(serverUrl);
} catch (MalformedURLException e) {
return false;
}
if (StringUtils.isBlank(getPropertiesAsMap().get(
PredefinedConnectorProperties.USERNAME))) {
return false;
}
return !StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.USERNAME)) &&
!StringUtils.isBlank(getPropertiesAsMap().get(PredefinedConnectorProperties.PASSWORD));
if (StringUtils.isBlank(getPropertiesAsMap().get(
PredefinedConnectorProperties.PASSWORD))) {
return false;
}
return true;
}
}

View file

@ -41,12 +41,11 @@ public class ConnectorBootstrap implements IConnectorBootstrap {
@Override
@Transactional
public void loadRequiredData() {
for (PredefinedConnectors predefinedConnector : PredefinedConnectors
.values()) {
for (PredefinedConnectors predefinedConnector : PredefinedConnectors.values()) {
String name = predefinedConnector.getName();
Connector connector = connectorDAO.findUniqueByName(name);
if (connector == null) {
if ( connector == null ) {
connector = Connector.create(name);
connector.setProperties(predefinedConnector.getProperties());
connectorDAO.save(connector);

View file

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="use-capacity-instead-of-effort_duration-and-not_over_assignable" author="ogonzalez">
<comment>Convert from duration + notAssignable (not over assignable) to capacity property</comment>

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="add-new-column-ldap-host" author="calvarinop">
<comment>Add new column to store ldap host</comment>
<addColumn tableName="configuration">

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="smontes" id="initial-database-creation-customer-comunication">
<createTable tableName="customer_comunication">

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="change-column-notes-in-task_element-to-text"
author="jaragunde" dbms="postgresql">

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="add-id_cost_category-column-to-criterion-table" author="ltilve">
<comment>Add column to criterion table to store the relationship with cost category</comment>

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="adding-email_template-table" author="vova/jeroen">
@ -25,10 +24,10 @@
tableName="email_template"
/>
<createIndex tableName="email_template" indexName="language_index">
<column name="language"></column>
<column name="language"/>
</createIndex>
<createIndex tableName="email_template" indexName="type_index">
<column name="type"></column>
<column name="type"/>
</createIndex>
<sql>
INSERT INTO email_template VALUES(1, 0, 3, 'Task assigned to resource : Autogenerated content text', 'Autogenerated subject text');

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="mrego" id="initial-database-creation-1">
<createTable tableName="advance_assignment">

View file

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet id="resize-precision-in-planning_data" author="dpino">
<comment>Resize precision for 'progress_by_duration' and 'progress_by_num_hours' fields</comment>

View file

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<include file="src/main/resources/db.changelog-database.xml"/>
<include file="src/main/resources/db.changelog-initial.xml"/>

View file

@ -1,11 +1,11 @@
changeLogFile src/main/resources/db.changelog.xml
driver ${jdbcDriver.className}
url ${dataSource.url}
username ${dataSource.user}
password ${dataSource.password}
verbose true
dropFirst false
promptOnNonLocalDatabase false
changeLogFile: src/main/resources/db.changelog.xml
driver: ${jdbcDriver.className}
url: ${dataSource.url}
username: ${dataSource.user}
password: ${dataSource.password}
verbose: true
dropFirst: false
promptOnNonLocalDatabase: false
# If there will be an error with checksum use this command:
#clearCheckSums true
#clearCheckSums: true

View file

@ -50,7 +50,7 @@ import org.springframework.test.context.transaction.TransactionalTestExecutionLi
* @author Bob McCune
* @version 1.0
*/
public class DBUnitTestExecutionListener extends TransactionalTestExecutionListener {
class DBUnitTestExecutionListener extends TransactionalTestExecutionListener {
private static final Log logger = LogFactory.getLog(DBUnitTestExecutionListener.class);
@ -65,6 +65,7 @@ public class DBUnitTestExecutionListener extends TransactionalTestExecutionListe
DataSource dataSource = getDataSource(testContext);
Connection conn = DataSourceUtils.getConnection(dataSource);
IDatabaseConnection dbUnitConn = getDBUnitConnection(conn);
try {
IDataSet dataSets[] = getDataSets(testContext);
for (IDataSet dataSet : dataSets) {
@ -78,63 +79,65 @@ public class DBUnitTestExecutionListener extends TransactionalTestExecutionListe
private DataSource getDataSource(TestContext context) {
DataSource dataSource;
Map beans = context.getApplicationContext().getBeansOfType(
DataSource.class);
if (beans.size() > 1) {
Map beans = context.getApplicationContext().getBeansOfType(DataSource.class);
if ( beans.size() > 1 ) {
dataSource = (DataSource) beans.get(DEFAULT_DATASOURCE_NAME);
if (dataSource == null) {
throw new NoSuchBeanDefinitionException(
"Unable to locate default data source.");
if ( dataSource == null ) {
throw new NoSuchBeanDefinitionException("Unable to locate default data source.");
}
} else {
dataSource = (DataSource) beans.values().iterator().next();
}
return dataSource;
}
private IDatabaseConnection getDBUnitConnection(Connection c)
throws DatabaseUnitException
{
private IDatabaseConnection getDBUnitConnection(Connection c) throws DatabaseUnitException {
IDatabaseConnection conn = new DatabaseConnection(c);
DatabaseConfig config = conn.getConfig();
config.setFeature("http://www.dbunit.org/features/qualifiedTableNames",
true);
config.setProperty("http://www.dbunit.org/properties/tableType",
TABLE_TYPES);
// TODO resolve depracated method
config.setFeature("http://www.dbunit.org/features/qualifiedTableNames", true);
config.setProperty("http://www.dbunit.org/properties/tableType", TABLE_TYPES);
return conn;
}
private IDataSet[] getDataSets(TestContext context) throws Exception {
String dataFiles[] = getDataLocations(context);
IDataSet dataSets[] = new IDataSet[dataFiles.length];
for (int i = 0; i < dataFiles.length; i++) {
Resource resource = new ClassPathResource(dataFiles[i]);
Class clazz = getDataSetType(context);
Constructor con = clazz.getConstructor(InputStream.class);
dataSets[i] = (IDataSet) con.newInstance(resource.getInputStream());
}
return dataSets;
}
protected Class getDataSetType(TestContext context) {
private Class getDataSetType(TestContext context) {
Class<?> testClass = context.getTestClass();
DBUnitConfiguration config = testClass
.getAnnotation(DBUnitConfiguration.class);
DBUnitConfiguration config = testClass.getAnnotation(DBUnitConfiguration.class);
return config.type();
}
private String[] getDataLocations(TestContext context) {
Class<?> testClass = context.getTestClass();
DBUnitConfiguration config = testClass
.getAnnotation(DBUnitConfiguration.class);
if (config == null) {
throw new IllegalStateException("Test class '" + testClass
+ " has is missing @DBUnitConfiguration annotation.");
DBUnitConfiguration config = testClass.getAnnotation(DBUnitConfiguration.class);
if ( config == null ) {
throw new IllegalStateException(
"Test class '" + testClass + " has is missing @DBUnitConfiguration annotation.");
}
if (config.locations().length == 0) {
if ( config.locations().length == 0 ) {
throw new IllegalStateException(
"@DBUnitConfiguration annotation doesn't specify any DBUnit configuration locations.");
}
return config.locations();
}
}

View file

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
<bean id="dataSourceReal"
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"

View file

@ -213,8 +213,8 @@
-->
<plugins>
<plugin>
<groupId>org.xnap.commons</groupId>
<artifactId>maven-gettext-plugin</artifactId>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-maven-plugin</artifactId>
<configuration>
<targetBundle>i18n.Messages</targetBundle>
<poDirectory>${project.build.sourceDirectory}/../resources/i18n</poDirectory>
@ -273,10 +273,6 @@
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
@ -297,6 +293,10 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<!-- Spring Test -->
<dependency>
@ -418,6 +418,8 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-client</artifactId>
</dependency>
<!-- Jackson -->
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>

View file

@ -297,7 +297,8 @@ public class SchedulerManager implements ISchedulerManager {
@Override
public String getNextFireTime(JobSchedulerConfiguration jobSchedulerConfiguration) {
try {
CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger(TriggerKey.triggerKey(
CronTrigger trigger = (CronTrigger)
this.scheduler.getTrigger(TriggerKey.triggerKey(
jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX,
jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX));

View file

@ -61,7 +61,8 @@ import static org.libreplan.web.I18nHelper._;
/**
* Controller for managing Order files
* Controller for managing Order files.
*
* Created by
* @author Vova Perebykivskiy <vova@libreplan-enterprise.com>
* on 12.24.2015.
@ -69,6 +70,7 @@ import static org.libreplan.web.I18nHelper._;
public class OrderFilesController extends GenericForwardComposer {
// TODO refactor Autowired?
@Autowired
IConfigurationModel configurationModel;
@ -88,6 +90,7 @@ public class OrderFilesController extends GenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
// TODO resolve deprecated
comp.setVariable("orderFilesController", this, true);
messages = new MessagesForUser(messagesContainer);
}
@ -99,15 +102,12 @@ public class OrderFilesController extends GenericForwardComposer {
if ( !(configurationModel.getRepositoryLocation() == null) )
repositoryDirectory = new File(configurationModel.getRepositoryLocation());
if ( repositoryDirectory != null && repositoryDirectory.exists() ) return true;
return repositoryDirectory != null && repositoryDirectory.exists();
return false;
}
public boolean isUploadButtonDisabled(){
if ( isRepositoryExists() ) return false;
return true;
return !isRepositoryExists();
}
public ListitemRenderer getFilesRenderer(){
@ -119,6 +119,7 @@ public class OrderFilesController extends GenericForwardComposer {
Listcell nameCell = new Listcell();
listitem.appendChild(nameCell);
Label label = new Label(file.getName());
label.addEventListener("onClick", new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
@ -130,6 +131,7 @@ public class OrderFilesController extends GenericForwardComposer {
Filedownload.save(fileToDownload.getAbsoluteFile(), null);
}
});
label.setClass("label-highlight");
label.setTooltiptext("Download file");
nameCell.appendChild(label);
@ -170,7 +172,7 @@ public class OrderFilesController extends GenericForwardComposer {
if ( Messagebox.OK != status ) {
return;
}
} catch (InterruptedException e) {}
} catch (InterruptedException ignored) {}
if ( isRepositoryExists() ) {
@ -206,20 +208,18 @@ public class OrderFilesController extends GenericForwardComposer {
public void upload() {
configurationModel.init();
String directory = "";
String directory;
if ( isRepositoryExists() ){
String projectCode = orderElementModel.getOrderElement().getCode();
directory = configurationModel.getRepositoryLocation() + "orders" + "/" + projectCode;
try {
Fileupload fileupload = new Fileupload();
// Location of file: libreplan-webapp/src/main/webapp/planner/fileupload.zul
fileupload.setTemplate("fileupload.zul");
Fileupload.setTemplate("fileupload.zul");
Media media = fileupload.get();
Media media = Fileupload.get();
File dir = new File(directory);
String filename = media.getName();
@ -277,13 +277,14 @@ public class OrderFilesController extends GenericForwardComposer {
public void openWindow(IOrderElementModel orderElementModel) {
setOrderElementModel(orderElementModel);
if ( isRepositoryExists() ) updateListbox();
if ( isRepositoryExists() )
updateListbox();
}
/**
* Listbox is updating after re set the model for it
*/
public void updateListbox(){
private void updateListbox(){
OrderElement currentOrder = orderElementModel.getOrderElement();
filesList.setModel(new ListModelList(orderFileModel.findByParent(currentOrder)));
}

View file

@ -135,7 +135,7 @@
username-parameter="j_username"
password-parameter="j_password"/>
<http-basic />
<logout />
<logout logout-url="/j_spring_security_logout" />
<remember-me />
<csrf disabled="true"/>

View file

@ -104,7 +104,11 @@
</div>
</n:td>
<n:td class="usuario">${i18n:_('user')}: ${templateCtrl.username}</n:td>
<n:td><n:a href="${contextPath}/j_spring_security_logout" class="cerrar_sesion">[${i18n:_('Log out')}]</n:a></n:td>
<n:td>
<n:a href="${contextPath}/j_spring_security_logout" class="cerrar_sesion">
[${i18n:_('Log out')}]
</n:a>
</n:td>
</n:tr>
</n:table>
</n:div>
@ -113,7 +117,6 @@
<center border="none">
<borderlayout width="auto" height="100%">
<!-- borderlayout class="main-layout" height="2000px" width="2000px"-->
<west class="perspectives-column" width="90px" >
<vbox vflex="1" height="100%">
<hbox id="perspectiveButtonsInsertionPoint" sclass="toolbar-box global-commands" height="30px" width="100%">

View file

@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd">
<bean id="dataSourceReal"
class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"
p:driverClass="${jdbcDriver.className}" p:jdbcUrl="${testDataSource.url}"
p:username="${testDataSource.user}" p:password="${testDataSource.password}"
p:maxConnectionsPerPartition="10"
p:minConnectionsPerPartition="4"
p:partitionCount="3"/>
p:driverClass="${jdbcDriver.className}"
p:jdbcUrl="${testDataSource.url}"
p:username="${testDataSource.user}"
p:password="${testDataSource.password}"
p:maxConnectionsPerPartition="10"
p:minConnectionsPerPartition="4"
p:partitionCount="3"/>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy"

31
pom.xml
View file

@ -128,16 +128,22 @@
</properties>
</profile>
<!-- MySQL profile
TODO change version mysql for JDK8
-->
<!-- MySQL profile -->
<profile>
<id>mysql</id>
<properties>
<!-- JDBC driver properties -->
<!--
If 6.X driver will not throw exceptions (with Timezone), use this configuration:
<jdbcDriver.className>com.mysql.cj.jdbc.Driver</jdbcDriver.className>
<dataSource.url>jdbc:mysql://localhost/libreplan${libreplan.mode}?useSSL=false</dataSource.url>
-->
<jdbcDriver.groupId>mysql</jdbcDriver.groupId>
<jdbcDriver.artifactId>mysql-connector-java</jdbcDriver.artifactId>
<jdbcDriver.version>5.1.38</jdbcDriver.version>
<jdbcDriver.version>5.1.39</jdbcDriver.version>
<jdbcDriver.className>com.mysql.jdbc.Driver</jdbcDriver.className>
<!-- Data source properties -->
<dataSource.url>jdbc:mysql://localhost/libreplan${libreplan.mode}</dataSource.url>
@ -212,9 +218,9 @@
<!-- Gettext commons -->
<dependency>
<groupId>org.xnap.commons</groupId>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-commons</artifactId>
<version>0.9.6</version>
<version>0.9.8</version>
</dependency>
<!--
@ -612,12 +618,12 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
</dependency>
<!-- jqPlot -->
@ -761,8 +767,8 @@
<version>3.5.1</version>
<configuration>
<verbose>true</verbose>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
@ -820,8 +826,7 @@
<!-- Log to the console. -->
<requestLog implementation="org.mortbay.jetty.NCSARequestLog">
<!--
This do anything for Jetty,
but is aworkaround for a Maven bug
This do anything for Jetty, but is a workaround for a Maven bug
that prevents the requestLog from being set.
-->
<append>true</append>
@ -891,7 +896,7 @@
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.0</version>
<version>3.5.1</version>
</plugin>
</plugins>