Merge pull request #90 from dgray16/master

Update Spring stack
This commit is contained in:
Jeroen Baten 2016-05-13 10:24:08 +02:00
commit 5eeefda9ad
46 changed files with 1708 additions and 1853 deletions

View file

@ -49,6 +49,15 @@ Changes
* Update CXF-frontend-jaxrs
* Add CXF-rs-client
* Update Spring ORM
* Update Spring Context Support
* Update Spring Test
* Update Spring Web
* Update Spring Security LDAP
* Update Spring Security ACL
* Update Spring Security Web
* Update Spring Security Config
* Update MPXJ
* Update Bonecp
* Update Guava
@ -65,12 +74,14 @@ Changes
* Update AspectJ Weaver
* Update JAX-RS API
* Update BeanShell
* Update Quartz Framework
* Update LibrePlan version to 1.6.0
* Remove Ezmorph
* Remove Json-lib
* Remove M2E plugin
* Code refactoring

View file

@ -56,39 +56,6 @@
</profile>
</profiles>
<!-- TODO delete it? -->
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.xnap.commons</groupId>
<artifactId>maven-gettext-plugin</artifactId>
<versionRange>[1.2.4,)</versionRange>
<goals>
<goal>dist</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- Gettext commons -->
<dependency>

View file

@ -23,15 +23,16 @@ package org.zkoss.ganttz;
import static org.zkoss.ganttz.i18n.I18nHelper._;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.List;
import java.util.Collection;
import java.util.Collections;
import java.util.ArrayList;
import org.apache.commons.logging.Log;
import org.zkoss.ganttz.adapters.IDisabilityConfiguration;
@ -77,64 +78,51 @@ import org.zkoss.zul.api.Combobox;
public class Planner extends HtmlMacroComponent {
private static final Log PROFILING_LOG = ProfilingLogFactory
.getLog(Planner.class);
private static final Log PROFILING_LOG = ProfilingLogFactory.getLog(Planner.class);
public static boolean guessContainersExpandedByDefaultGivenPrintParameters(
Map<String, String> printParameters) {
public static boolean guessContainersExpandedByDefaultGivenPrintParameters(Map<String, String> printParameters) {
return guessContainersExpandedByDefault(convertToURLParameters(printParameters));
}
private static Map<String, String[]> convertToURLParameters(
Map<String, String> printParameters) {
Map<String, String[]> result = new HashMap<String, String[]>();
private static Map<String, String[]> convertToURLParameters(Map<String, String> printParameters) {
Map<String, String[]> result = new HashMap<>();
for (Entry<String, String> each : printParameters.entrySet()) {
result.put(each.getKey(), new String[] { each.getValue() });
}
return result;
}
public static boolean guessContainersExpandedByDefault(
Map<String, String[]> queryURLParameters) {
public static boolean guessContainersExpandedByDefault(Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("expanded");
if (values == null) {
return false;
}
return toLowercaseSet(values).contains("all");
return values != null && toLowercaseSet(values).contains("all");
}
public static boolean guessShowAdvancesByDefault(
Map<String, String[]> queryURLParameters) {
public static boolean guessShowAdvancesByDefault(Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("advances");
if (values == null) {
return false;
}
return toLowercaseSet(values).contains("all");
return values != null && toLowercaseSet(values).contains("all");
}
public static boolean guessShowReportedHoursByDefault(
Map<String, String[]> queryURLParameters) {
public static boolean guessShowReportedHoursByDefault(Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("reportedHours");
if (values == null) {
return false;
}
return toLowercaseSet(values).contains("all");
return values != null && toLowercaseSet(values).contains("all");
}
public static boolean guessShowMoneyCostBarByDefault(
Map<String, String[]> queryURLParameters) {
public static boolean guessShowMoneyCostBarByDefault(Map<String, String[]> queryURLParameters) {
String[] values = queryURLParameters.get("moneyCostBar");
if (values == null) {
return false;
}
return toLowercaseSet(values).contains("all");
return values != null && toLowercaseSet(values).contains("all");
}
private static Set<String> toLowercaseSet(String[] values) {
Set<String> result = new HashSet<String>();
Set<String> result = new HashSet<>();
for (String each : values) {
result.add(each.toLowerCase());
}
return result;
}
@ -146,8 +134,6 @@ public class Planner extends HtmlMacroComponent {
private List<? extends CommandContextualized<?>> contextualizedGlobalCommands;
private CommandContextualized<?> goingDownInLastArrowCommand;
private List<? extends CommandOnTaskContextualized<?>> commandsOnTasksContextualized;
private CommandOnTaskContextualized<?> doubleClickCommand;
@ -176,17 +162,18 @@ public class Planner extends HtmlMacroComponent {
private Listbox listZoomLevels = null;
private WeakReferencedListeners<IChartVisibilityChangedListener> chartVisibilityListeners = WeakReferencedListeners
.create();
private WeakReferencedListeners<IChartVisibilityChangedListener> chartVisibilityListeners =
WeakReferencedListeners.create();
public Planner() {
}
TaskList getTaskList() {
if (ganttPanel == null) {
if ( ganttPanel == null ) {
return null;
}
List<Object> children = ganttPanel.getChildren();
return ComponentsFinder.findComponentsOfType(TaskList.class, children).get(0);
}
@ -194,9 +181,6 @@ public class Planner extends HtmlMacroComponent {
return getTaskList().getTasksNumber();
}
private static int PIXELS_PER_TASK_LEVEL = 21;
private static int PIXELS_PER_CHARACTER = 5;
public int calculateMinimumWidthForTaskNameColumn(boolean expand) {
return calculateMinimumWidthForTaskNameColumn(expand, getTaskList().getAllTasks());
}
@ -204,18 +188,22 @@ public class Planner extends HtmlMacroComponent {
private int calculateMinimumWidthForTaskNameColumn(boolean expand, List<Task> tasks) {
IDomainAndBeansMapper<?> mapper = getContext().getMapper();
int widest = 0;
for(Task task : tasks) {
int numberOfAncestors =
mapper.findPositionFor(task).getAncestors().size();
int numberOfAncestors = mapper.findPositionFor(task).getAncestors().size();
int numberOfCharacters = task.getName().length();
widest = Math.max(widest,
numberOfCharacters * PIXELS_PER_CHARACTER +
numberOfAncestors * PIXELS_PER_TASK_LEVEL);
if(expand && !task.isLeaf()) {
widest = Math.max(widest,
calculateMinimumWidthForTaskNameColumn(expand, task.getTasks()));
int PIXELS_PER_TASK_LEVEL = 21;
int PIXELS_PER_CHARACTER = 5;
widest = Math.max(
widest,
numberOfCharacters * PIXELS_PER_CHARACTER + numberOfAncestors * PIXELS_PER_TASK_LEVEL);
if( expand && !task.isLeaf() ) {
widest = Math.max(widest, calculateMinimumWidthForTaskNameColumn(expand, task.getTasks()));
}
}
return widest;
}
@ -228,50 +216,56 @@ public class Planner extends HtmlMacroComponent {
}
public DependencyList getDependencyList() {
if (ganttPanel == null) {
if ( ganttPanel == null ) {
return null;
}
List<Object> children = ganttPanel.getChildren();
List<DependencyList> found = ComponentsFinder.findComponentsOfType(DependencyList.class,
children);
if (found.isEmpty()) {
List<DependencyList> found = ComponentsFinder.findComponentsOfType(DependencyList.class, children);
if ( found.isEmpty() ) {
return null;
}
return found.get(0);
}
public void addTasks(Position position, Collection<? extends Task> newTasks) {
TaskList taskList = getTaskList();
if (taskList != null && leftPane != null) {
if ( taskList != null && leftPane != null ) {
taskList.addTasks(position, newTasks);
leftPane.addTasks(position, newTasks);
}
}
public void addTask(Position position, Task task) {
addTasks(position, Arrays.asList(task));
addTasks(position, Collections.singletonList(task));
}
void addDependencies(Collection<? extends Dependency> dependencies) {
DependencyList dependencyList = getDependencyList();
if (dependencyList == null) {
if ( dependencyList == null ) {
return;
}
for (DependencyComponent d : getTaskList().asDependencyComponents(
dependencies)) {
for (DependencyComponent d : getTaskList().asDependencyComponents(dependencies)) {
dependencyList.addDependencyComponent(d);
}
}
public ListModel getZoomLevels() {
ZoomLevel[] selectableZoomlevels = { ZoomLevel.DETAIL_ONE,
ZoomLevel.DETAIL_TWO, ZoomLevel.DETAIL_THREE,
ZoomLevel.DETAIL_FOUR, ZoomLevel.DETAIL_FIVE };
ZoomLevel[] selectableZoomlevels = {
ZoomLevel.DETAIL_ONE,
ZoomLevel.DETAIL_TWO,
ZoomLevel.DETAIL_THREE,
ZoomLevel.DETAIL_FOUR,
ZoomLevel.DETAIL_FIVE };
return new SimpleListModel(selectableZoomlevels);
}
public void setZoomLevel(final ZoomLevel zoomLevel, int scrollLeft) {
if (ganttPanel == null) {
if ( ganttPanel == null ) {
return;
}
this.zoomLevel = zoomLevel;
@ -279,7 +273,7 @@ public class Planner extends HtmlMacroComponent {
}
public void zoomIncrease() {
if (ganttPanel == null) {
if ( ganttPanel == null ) {
return;
}
LongOperationFeedback.execute(ganttPanel, new ILongOperation() {
@ -297,7 +291,7 @@ public class Planner extends HtmlMacroComponent {
}
public void zoomDecrease() {
if (ganttPanel == null) {
if ( ganttPanel == null ) {
return;
}
LongOperationFeedback.execute(ganttPanel, new ILongOperation() {
@ -314,13 +308,14 @@ public class Planner extends HtmlMacroComponent {
}
public <T> void setConfiguration(PlannerConfiguration<T> configuration) {
if (configuration == null) {
if ( configuration == null ) {
return;
}
if (isShowingLabels)
if ( isShowingLabels )
Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels()");
if (isShowingResources)
if ( isShowingResources )
Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips()");
this.diagramGraph = GanttDiagramGraph.create(
@ -328,24 +323,24 @@ public class Planner extends HtmlMacroComponent {
configuration.getStartConstraints(),
configuration.getEndConstraints(),
configuration.isDependenciesConstraintsHavePriority());
FunctionalityExposedForExtensions<T> newContext = new FunctionalityExposedForExtensions<T>(
this, configuration, diagramGraph);
FunctionalityExposedForExtensions<T> newContext =
new FunctionalityExposedForExtensions<>(this, configuration, diagramGraph);
addGraphChangeListenersFromConfiguration(configuration);
this.contextualizedGlobalCommands = contextualize(newContext,
configuration.getGlobalCommands());
this.commandsOnTasksContextualized = contextualize(newContext,
configuration.getCommandsOnTasks());
goingDownInLastArrowCommand = contextualize(newContext, configuration
.getGoingDownInLastArrowCommand());
doubleClickCommand = contextualize(newContext, configuration
.getDoubleClickCommand());
this.contextualizedGlobalCommands = contextualize(newContext, configuration.getGlobalCommands());
this.commandsOnTasksContextualized = contextualize(newContext, configuration.getCommandsOnTasks());
CommandContextualized<?> goingDownInLastArrowCommand =
contextualize(newContext, configuration.getGoingDownInLastArrowCommand());
doubleClickCommand = contextualize(newContext, configuration.getDoubleClickCommand());
this.context = newContext;
this.disabilityConfiguration = configuration;
resettingPreviousComponentsToNull();
long timeAddingData = System.currentTimeMillis();
newContext.add(configuration.getData());
PROFILING_LOG.debug("It took to add data: "
+ (System.currentTimeMillis() - timeAddingData) + " ms");
PROFILING_LOG.debug("It took to add data: " + (System.currentTimeMillis() - timeAddingData) + " ms");
long timeSetupingAndAddingComponents = System.currentTimeMillis();
setupComponents();
setAt("insertionPointLeftPanel", leftPane);
@ -354,34 +349,38 @@ public class Planner extends HtmlMacroComponent {
ganttPanel.afterCompose();
leftPane.setGoingDownInLastArrowCommand(goingDownInLastArrowCommand);
TimeTrackerComponent timetrackerheader = new TimeTrackerComponentWithoutColumns(
ganttPanel.getTimeTracker(), "timetrackerheader");
TimeTrackerComponent timetrackerheader =
new TimeTrackerComponentWithoutColumns(ganttPanel.getTimeTracker(), "timetrackerheader");
setAt("insertionPointTimetracker", timetrackerheader);
timetrackerheader.afterCompose();
Component chartComponent = configuration.getChartComponent();
if (chartComponent != null) {
if ( chartComponent != null ) {
setAt("insertionPointChart", chartComponent);
}
if (!configuration.isCriticalPathEnabled()) {
if ( !configuration.isCriticalPathEnabled() ) {
Button showCriticalPathButton = (Button) getFellow("showCriticalPath");
showCriticalPathButton.setVisible(false);
}
if (!configuration.isExpandAllEnabled()) {
if ( !configuration.isExpandAllEnabled() ) {
Button expandAllButton = (Button) getFellow("expandAll");
expandAllButton.setVisible(false);
}
if (!configuration.isFlattenTreeEnabled()) {
if ( !configuration.isFlattenTreeEnabled() ) {
Button flattenTree = (Button) getFellow("flattenTree");
flattenTree.setVisible(false);
}
if (!configuration.isShowAllResourcesEnabled()) {
if ( !configuration.isShowAllResourcesEnabled() ) {
Button showAllResources = (Button) getFellow("showAllResources");
showAllResources.setVisible(false);
}
if (!configuration.isMoneyCostBarEnabled()) {
if ( !configuration.isMoneyCostBarEnabled() ) {
Button showMoneyCostBarButton = (Button) getFellow("showMoneyCostBar");
showMoneyCostBarButton.setVisible(false);
}
@ -391,35 +390,33 @@ public class Planner extends HtmlMacroComponent {
this.visibleChart = configuration.isExpandPlanningViewCharts();
((South) getFellow("graphics")).setOpen(this.visibleChart);
PROFILING_LOG
.debug("it took doing the setup of components and adding them: "
+ (System.currentTimeMillis() - timeSetupingAndAddingComponents)
+ " ms");
PROFILING_LOG.debug(
"It took doing the setup of components and adding them: " +
(System.currentTimeMillis() - timeSetupingAndAddingComponents) + " ms");
setAuService(new AuService(){
public boolean service(AuRequest request, boolean everError){
String command = request.getCommand();
String[] requestData;
int zoomindex;
int scrollLeft;
if (command.equals("onZoomLevelChange")){
if ( command.equals("onZoomLevelChange") ){
zoomindex= (Integer) retrieveData(request, "zoomindex");
scrollLeft = (Integer) retrieveData(request, "scrollLeft");
setZoomLevel((ZoomLevel)((Listbox)getFellow("listZoomLevels"))
.getModel().getElementAt(zoomindex),
scrollLeft);
.getModel().getElementAt(zoomindex), scrollLeft);
return true;
}
return false;
}
private Object retrieveData(AuRequest request, String key){
Object value = request.getData().get(key);
if ( value == null)
throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA,
new Object[] { key, this });
if ( value == null )
throw new UiException(MZk.ILLEGAL_REQUEST_WRONG_DATA, new Object[] { key, this });
return value;
}
@ -438,36 +435,38 @@ public class Planner extends HtmlMacroComponent {
}
private <T> List<CommandOnTaskContextualized<T>> contextualize(
FunctionalityExposedForExtensions<T> context,
List<ICommandOnTask<T>> commands) {
List<CommandOnTaskContextualized<T>> result = new ArrayList<CommandOnTaskContextualized<T>>();
FunctionalityExposedForExtensions<T> context, List<ICommandOnTask<T>> commands) {
List<CommandOnTaskContextualized<T>> result = new ArrayList<>();
for (ICommandOnTask<T> c : commands) {
result.add(contextualize(context, c));
}
return result;
}
private <T> CommandOnTaskContextualized<T> contextualize(
FunctionalityExposedForExtensions<T> context,
ICommandOnTask<T> commandOnTask) {
return CommandOnTaskContextualized.create(commandOnTask, context
.getMapper(), context);
FunctionalityExposedForExtensions<T> context, ICommandOnTask<T> commandOnTask) {
return CommandOnTaskContextualized.create(commandOnTask, context.getMapper(), context);
}
private <T> CommandContextualized<T> contextualize(IContext<T> context,
ICommand<T> command) {
private <T> CommandContextualized<T> contextualize(IContext<T> context, ICommand<T> command) {
if (command == null) {
return null;
}
return CommandContextualized.create(command, context);
}
private <T> List<CommandContextualized<T>> contextualize(
IContext<T> context, Collection<? extends ICommand<T>> commands) {
ArrayList<CommandContextualized<T>> result = new ArrayList<CommandContextualized<T>>();
ArrayList<CommandContextualized<T>> result = new ArrayList<>();
for (ICommand<T> command : commands) {
result.add(contextualize(context, command));
}
return result;
}
@ -475,16 +474,16 @@ public class Planner extends HtmlMacroComponent {
insertGlobalCommands();
predicate = new FilterAndParentExpandedPredicates(context) {
@Override
public boolean accpetsFilterPredicate(Task task) {
return true;
}
};
this.leftPane = new LeftPane(disabilityConfiguration, this, predicate);
this.ganttPanel = new GanttPanel(this,
commandsOnTasksContextualized, doubleClickCommand,
disabilityConfiguration, predicate);
this.ganttPanel = new GanttPanel(
this, commandsOnTasksContextualized, doubleClickCommand, disabilityConfiguration, predicate);
Button button = (Button) getFellow("btnPrint");
button.setDisabled(!context.isPrintEnabled());
@ -502,16 +501,18 @@ public class Planner extends HtmlMacroComponent {
private void insertGlobalCommands() {
Component commontoolbar = getCommonCommandsInsertionPoint();
Component plannerToolbar = getSpecificCommandsInsertionPoint();
if (!contextualizedGlobalCommands.isEmpty()) {
if ( !contextualizedGlobalCommands.isEmpty() ) {
commontoolbar.getChildren().removeAll(commontoolbar.getChildren());
}
for (CommandContextualized<?> c : contextualizedGlobalCommands) {
// Comparison through icon as name is internationalized
if (c.getCommand().isPlannerCommand()) {
if ( c.getCommand().isPlannerCommand() ) {
// FIXME Avoid hard-coding the number of planner commands
// At this moment we have 2 planner commands: reassign and adapt
// planning
if (plannerToolbar.getChildren().size() < 2) {
// At this moment we have 2 planner commands: reassign and adapt planning
if ( plannerToolbar.getChildren().size() < 2 ) {
plannerToolbar.appendChild(c.toButton());
}
} else {
@ -522,14 +523,11 @@ public class Planner extends HtmlMacroComponent {
}
private Component getCommonCommandsInsertionPoint() {
Component insertionPoint = getPage().getFellow(
"perspectiveButtonsInsertionPoint");
return insertionPoint;
return getPage().getFellow("perspectiveButtonsInsertionPoint");
}
private Component getSpecificCommandsInsertionPoint() {
Component insertionPoint = getFellow("plannerButtonsInsertionPoint");
return insertionPoint;
return getFellow("plannerButtonsInsertionPoint");
}
void removeTask(Task task) {
@ -537,7 +535,10 @@ public class Planner extends HtmlMacroComponent {
taskList.remove(task);
getDependencyList().taskRemoved(task);
leftPane.taskRemoved(task);
setHeight(getHeight());// forcing smart update
// forcing smart update
setHeight(getHeight());
ganttPanel.adjustZoomColumnsHeight();
getDependencyList().redrawDependencies();
}
@ -609,40 +610,47 @@ public class Planner extends HtmlMacroComponent {
public void showCriticalPath() {
Button showCriticalPathButton = (Button) getFellow("showCriticalPath");
if (disabilityConfiguration.isCriticalPathEnabled()) {
if (isShowingCriticalPath) {
if ( disabilityConfiguration.isCriticalPathEnabled() ) {
if ( isShowingCriticalPath ) {
context.hideCriticalPath();
diagramGraph.removePostGraphChangeListener(showCriticalPathOnChange);
showCriticalPathButton.setSclass("planner-command");
showCriticalPathButton.setTooltiptext(_("Show critical path"));
} else {
context.showCriticalPath();
diagramGraph.addPostGraphChangeListener(showCriticalPathOnChange);
showCriticalPathButton.setSclass("planner-command clicked");
showCriticalPathButton.setTooltiptext(_("Hide critical path"));
}
isShowingCriticalPath = !isShowingCriticalPath;
}
}
public void forcedShowAdvances() {
if (!isShowingAdvances) {
if ( !isShowingAdvances ) {
showAdvances();
}
}
public void showAdvances() {
Button showAdvancesButton = (Button) getFellow("showAdvances");
if (disabilityConfiguration.isAdvancesEnabled()) {
if ( disabilityConfiguration.isAdvancesEnabled() ) {
Combobox progressTypesCombo = (Combobox) getFellow("cbProgressTypes");
if (isShowingAdvances) {
if ( isShowingAdvances ) {
context.hideAdvances();
diagramGraph.removePostGraphChangeListener(showAdvanceOnChange);
showAdvancesButton.setSclass("planner-command");
showAdvancesButton.setTooltiptext(_("Show progress"));
if (progressTypesCombo.getItemCount() > 0) {
if ( progressTypesCombo.getItemCount() > 0 ) {
progressTypesCombo.setSelectedIndex(0);
}
} else {
context.showAdvances();
diagramGraph.addPostGraphChangeListener(showAdvanceOnChange);
@ -655,21 +663,19 @@ public class Planner extends HtmlMacroComponent {
public void showReportedHours() {
Button showReportedHoursButton = (Button) getFellow("showReportedHours");
if (disabilityConfiguration.isReportedHoursEnabled()) {
if (isShowingReportedHours) {
if ( disabilityConfiguration.isReportedHoursEnabled() ) {
if ( isShowingReportedHours ) {
context.hideReportedHours();
diagramGraph
.removePostGraphChangeListener(showReportedHoursOnChange);
diagramGraph.removePostGraphChangeListener(showReportedHoursOnChange);
showReportedHoursButton.setSclass("planner-command");
showReportedHoursButton
.setTooltiptext(_("Show reported hours"));
showReportedHoursButton.setTooltiptext(_("Show reported hours"));
} else {
context.showReportedHours();
diagramGraph
.addPostGraphChangeListener(showReportedHoursOnChange);
diagramGraph.addPostGraphChangeListener(showReportedHoursOnChange);
showReportedHoursButton.setSclass("planner-command clicked");
showReportedHoursButton
.setTooltiptext(_("Hide reported hours"));
showReportedHoursButton.setTooltiptext(_("Hide reported hours"));
}
isShowingReportedHours = !isShowingReportedHours;
}
@ -677,17 +683,16 @@ public class Planner extends HtmlMacroComponent {
public void showMoneyCostBar() {
Button showMoneyCostBarButton = (Button) getFellow("showMoneyCostBar");
if (disabilityConfiguration.isMoneyCostBarEnabled()) {
if (isShowingMoneyCostBar) {
if ( disabilityConfiguration.isMoneyCostBarEnabled() ) {
if ( isShowingMoneyCostBar ) {
context.hideMoneyCostBar();
diagramGraph
.removePostGraphChangeListener(showMoneyCostBarOnChange);
diagramGraph.removePostGraphChangeListener(showMoneyCostBarOnChange);
showMoneyCostBarButton.setSclass("planner-command");
showMoneyCostBarButton.setTooltiptext(_("Show money cost bar"));
} else {
context.showMoneyCostBar();
diagramGraph
.addPostGraphChangeListener(showMoneyCostBarOnChange);
diagramGraph.addPostGraphChangeListener(showMoneyCostBarOnChange);
showMoneyCostBarButton.setSclass("planner-command clicked");
showMoneyCostBarButton.setTooltiptext(_("Hide money cost bar"));
}
@ -697,41 +702,39 @@ public class Planner extends HtmlMacroComponent {
public void showAllLabels() {
Button showAllLabelsButton = (Button) getFellow("showAllLabels");
if (isShowingLabels) {
if ( isShowingLabels ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().hideAllTaskLabels()");
showAllLabelsButton.setSclass("planner-command show-labels");
} else {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels()");
showAllLabelsButton
.setSclass("planner-command show-labels clicked");
showAllLabelsButton.setSclass("planner-command show-labels clicked");
}
isShowingLabels = !isShowingLabels;
}
public void showAllResources() {
Button showAllLabelsButton = (Button) getFellow("showAllResources");
if (isShowingResources) {
if ( isShowingResources ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().hideResourceTooltips()");
showAllLabelsButton.setSclass("planner-command show-resources");
} else {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips()");
showAllLabelsButton
.setSclass("planner-command show-resources clicked");
showAllLabelsButton.setSclass("planner-command show-resources clicked");
}
isShowingResources = !isShowingResources;
}
public void print() {
// Pending to raise print configuration popup. Information retrieved
// should be passed as parameter to context print method
// Pending to raise print configuration popup.
// Information retrieved should be passed as parameter to context print method.
context.print();
}
public ZoomLevel getZoomLevel() {
if (ganttPanel == null) {
return zoomLevel != null ? zoomLevel
: ZoomLevel.DETAIL_ONE;
if ( ganttPanel == null ) {
return zoomLevel != null ? zoomLevel : ZoomLevel.DETAIL_ONE;
}
return ganttPanel.getTimeTracker().getDetailLevel();
}
@ -743,8 +746,7 @@ public class Planner extends HtmlMacroComponent {
return containersExpandedByDefault;
}
public void setAreContainersExpandedByDefault(
boolean containersExpandedByDefault) {
public void setAreContainersExpandedByDefault(boolean containersExpandedByDefault) {
this.containersExpandedByDefault = containersExpandedByDefault;
}
@ -761,8 +763,7 @@ public class Planner extends HtmlMacroComponent {
this.isShowingAdvances = shownAdvanceByDefault;
}
public void setAreShownReportedHoursByDefault(
boolean shownReportedHoursByDefault) {
public void setAreShownReportedHoursByDefault(boolean shownReportedHoursByDefault) {
this.shownReportedHoursByDefault = shownReportedHoursByDefault;
}
@ -774,8 +775,7 @@ public class Planner extends HtmlMacroComponent {
return (areShownReportedHoursByDefault() || isShowingReportedHours);
}
public void setAreShownMoneyCostBarByDefault(
boolean shownMoneyCostBarByDefault) {
public void setAreShownMoneyCostBarByDefault(boolean shownMoneyCostBarByDefault) {
this.shownMoneyCostBarByDefault = shownMoneyCostBarByDefault;
}
@ -789,8 +789,9 @@ public class Planner extends HtmlMacroComponent {
public void expandAll() {
Button expandAllButton = (Button) getFellow("expandAll");
if (disabilityConfiguration.isExpandAllEnabled()) {
if (isExpandAll) {
if ( disabilityConfiguration.isExpandAllEnabled() ) {
if ( isExpandAll ) {
context.collapseAll();
expandAllButton.setSclass("planner-command");
} else {
@ -803,7 +804,7 @@ public class Planner extends HtmlMacroComponent {
public void expandAllAlways() {
Button expandAllButton = (Button) getFellow("expandAll");
if (disabilityConfiguration.isExpandAllEnabled()) {
if ( disabilityConfiguration.isExpandAllEnabled() ) {
context.expandAll();
expandAllButton.setSclass("planner-command clicked");
}
@ -811,8 +812,7 @@ public class Planner extends HtmlMacroComponent {
public void updateSelectedZoomLevel() {
ganttPanel.getTimeTracker().setZoomLevel(zoomLevel);
Listitem selectedItem = (Listitem) listZoomLevels.getItems().get(
zoomLevel.ordinal());
Listitem selectedItem = (Listitem) listZoomLevels.getItems().get(zoomLevel.ordinal());
listZoomLevels.setSelectedItem(selectedItem);
listZoomLevels.invalidate();
}
@ -827,19 +827,20 @@ public class Planner extends HtmlMacroComponent {
getTaskList().setPredicate(predicate);
getDependencyList().redrawDependencies();
if (isShowingLabels) {
if ( isShowingLabels ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showAllTaskLabels();");
}
if (isShowingResources) {
if ( isShowingResources ) {
Clients.evalJavaScript("ganttz.TaskList.getInstance().showResourceTooltips();");
}
}
public void flattenTree() {
Button flattenTreeButton = (Button) getFellow("flattenTree");
if (disabilityConfiguration.isFlattenTreeEnabled()) {
if (isFlattenTree) {
if ( disabilityConfiguration.isFlattenTreeEnabled() ) {
if ( isFlattenTree ) {
predicate.setFilterContainers(false);
flattenTreeButton.setSclass("planner-command");
} else {
@ -858,31 +859,25 @@ public class Planner extends HtmlMacroComponent {
public void changeChartVisibility(boolean visible) {
visibleChart = visible;
chartVisibilityListeners
.fireEvent(new IListenerNotification<IChartVisibilityChangedListener>() {
@Override
public void doNotify(
IChartVisibilityChangedListener listener) {
listener.chartVisibilityChanged(visibleChart);
}
});
chartVisibilityListeners.fireEvent(new IListenerNotification<IChartVisibilityChangedListener>() {
@Override
public void doNotify(IChartVisibilityChangedListener listener) {
listener.chartVisibilityChanged(visibleChart);
}
});
}
public boolean isVisibleChart() {
return visibleChart;
}
public void addChartVisibilityListener(
IChartVisibilityChangedListener chartVisibilityChangedListener) {
public void addChartVisibilityListener(IChartVisibilityChangedListener chartVisibilityChangedListener) {
chartVisibilityListeners.addListener(chartVisibilityChangedListener);
}
public void addGraphChangeListenersFromConfiguration(
PlannerConfiguration<?> configuration) {
diagramGraph.addPreChangeListeners(configuration
.getPreChangeListeners());
diagramGraph.addPostChangeListeners(configuration
.getPostChangeListeners());
public void addGraphChangeListenersFromConfiguration(PlannerConfiguration<?> configuration) {
diagramGraph.addPreChangeListeners(configuration.getPreChangeListeners());
diagramGraph.addPostChangeListeners(configuration.getPostChangeListeners());
}
public boolean isShowingCriticalPath() {
@ -911,10 +906,11 @@ public class Planner extends HtmlMacroComponent {
public Button findCommandComponent(String name) {
for (CommandContextualized<?> c : contextualizedGlobalCommands) {
if (c.getCommand().getName().equals(name)) {
if ( c.getCommand().getName().equals(name) ) {
return c.toButton();
}
}
return null;
}
@ -928,7 +924,7 @@ public class Planner extends HtmlMacroComponent {
public void updateCompletion(String progressType) {
TaskList taskList = getTaskList();
if (taskList != null) {
if ( taskList != null ) {
taskList.updateCompletion(progressType);
// FIXME Bug #1270
for (TaskComponent each : taskList.getTaskComponents()) {
@ -937,12 +933,11 @@ public class Planner extends HtmlMacroComponent {
}
}
public TaskComponent getTaskComponentRelatedTo(
org.zkoss.ganttz.data.Task task) {
public TaskComponent getTaskComponentRelatedTo(org.zkoss.ganttz.data.Task task) {
TaskList taskList = getTaskList();
if (taskList != null) {
if ( taskList != null ) {
for (TaskComponent each : taskList.getTaskComponents()) {
if (each.getTask().equals(task)) {
if ( each.getTask().equals(task) ) {
return each;
}
}

View file

@ -7,7 +7,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

View file

@ -1,21 +1,27 @@
zk.$package("ganttz");
ganttz.TaskRow = zk.$extends(zk.Widget, {
_labelsHidden : true,
showLabels : function(){
showLabels : function() {
this._labelsHidden = false;
this.firstChild.showLabels();
},
hideLabels : function(){
hideLabels : function() {
this._labelsHidden = true;
this.firstChild.hideLabels();
},
_resourcesHidden : true,
hideResourceTooltip : function(){
hideResourceTooltip : function() {
this._resourcesHidden = true;
this.firstChild.hideResourceTooltip();
},
showResourceTooltip : function(){
showResourceTooltip : function() {
this._resourcesHidden = false;
this.firstChild.showResourceTooltip();
}

View file

@ -207,35 +207,5 @@
</resource>
</resources>
<!-- TODO delete it? -->
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<versionRange>[3.5.0,)</versionRange>
<goals>
<goal>update</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View file

@ -28,7 +28,7 @@ import static org.libreplan.business.i18n.I18nHelper._;
*
* @author Fernando Bellas Permuy <fbellas@udc.es>
* @author Manuel Rego Casasnovas <rego@igalia.com>
* @author Vova Perebykivskiy <vova@libreplan-enterprise.com>
* @author Vova Perebykivskyi <vova@libreplan-enterprise.com>
*/
public enum UserRole {
@ -100,7 +100,7 @@ public enum UserRole {
private final String displayName;
private UserRole(String displayName) {
UserRole(String displayName) {
this.displayName = displayName;
}

View file

@ -1,7 +1,7 @@
<ehcache>
<!-- Uncomment the next line if you want to enable
overflowToDisk (only recommended when the DB server
is in a different machine)
<!--
Uncomment the next line if you want to enable overflowToDisk
(only recommended when the DB server is in a different machine)
<diskStore path="java.io.tmpdir"/>
-->

View file

@ -10,10 +10,10 @@
<property name="hibernate.use_sql_comments">${hibernate.use_sql_comments}</property>
<property name="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</property>
<!-- We explicitly call validation, otherwise infinite loops can happen.
Sometimes DAOs are queried when validating some constraints.
When the DAO does a query, the pending changes are flushed, causing
the validations to be run again.
<!--
We explicitly call validation, otherwise infinite loops can happen.
Sometimes DAOs are queried when validating some constraints.
When the DAO does a query, the pending changes are flushed, causing the validations to be run again.
-->
<property name="javax.persistence.validation.mode">none</property>

View file

@ -112,22 +112,17 @@
class="org.springframework.orm.hibernate4.HibernateTransactionManager"
p:sessionFactory-ref="sessionFactory" />
<!--
Enable configuration of transactional behavior based on annotations
-->
<!-- Enable configuration of transactional behavior based on annotations -->
<tx:annotation-driven transaction-manager="transactionManager" />
<!--
For enabling annotation-based configuration (in particular, required
for Autowired annotation)
-->
<!-- For enabling annotation-based configuration (in particular, required for Autowired annotation) -->
<context:annotation-config />
<context:component-scan base-package="org.libreplan.business" />
<bean id="registry" class="org.libreplan.business.common.Registry" factory-method="getInstance" />
<bean id="CriterionRequirementOrderElementHandler"
<bean id="criterionRequirementOrderElementHandler"
class="org.libreplan.business.orders.entities.CriterionRequirementOrderElementHandler"
factory-method="getInstance" />
@ -135,26 +130,18 @@
class="org.libreplan.business.common.VersionInformation"
factory-method="getInstance"
lazy-init="false">
<property name="projectVersion">
<value>${project.version}</value>
</property>
<property name="projectVersion" value="${project.version}"/>
</bean>
<bean id="configuration"
class="org.libreplan.business.common.Configuration"
factory-method="getInstance"
lazy-init="false">
<property name="defaultPasswordsControl">
<value>${default.passwordsControl}</value>
</property>
<property name="exampleUsersDisabled">
<value>${default.exampleUsersDisabled}</value>
</property>
<property name="emailSendingEnabled">
<value>${default.emailSendingEnabled}</value>
</property>
<property name="defaultPasswordsControl" value="${default.passwordsControl}"/>
<property name="exampleUsersDisabled" value="${default.exampleUsersDisabled}"/>
<property name="emailSendingEnabled" value="${default.emailSendingEnabled}"/>
</bean>
<bean id="scenarioManager" class="org.libreplan.business.scenarios.OnlyMainScenarioAwareManager" scope="singleton"/>
<bean id="scenarioManager" class="org.libreplan.business.scenarios.OnlyMainScenarioAwareManager"/>
</beans>

View file

@ -58,9 +58,7 @@ public class EntitySequenceTest {
for (EntitySequence sequence : entitySequenceDAO.getAll()) {
try {
entitySequenceDAO.remove(sequence.getId());
} catch (InstanceNotFoundException e) {
}
} catch (InstanceNotFoundException ignored) {}
}
}
@ -73,8 +71,8 @@ public class EntitySequenceTest {
} catch (ValidationException e) {
fail("It should not throw an exception");
}
assertTrue(entitySequenceDAO.getAll().size() == 1);
assertTrue(entitySequenceDAO.getAll().size() == 1);
}
@Test
@ -159,8 +157,7 @@ public class EntitySequenceTest {
entitySequenceDAO.save(entitySequenceB);
fail("Expected ValidationException");
} catch (ValidationException e) {
}
} catch (ValidationException ignored) {}
}
@Test

View file

@ -11,8 +11,6 @@
<property name="javax.persistence.validation.mode">none</property>
<property name="javax.persistence.validation.mode">none</property>
<property name="jadira.usertype.autoRegisterUserTypes">true</property>
<property name="jadira.usertype.databaseZone">jvm</property>
<property name="jadira.usertype.javaZone">jvm</property>

View file

@ -236,62 +236,6 @@
<build>
<finalName>libreplan-webapp</finalName>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.8,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<versionRange>[1.0-beta-2,)</versionRange>
<goals>
<goal>compile-reports</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.googlecode.gettext-commons</groupId>
<artifactId>gettext-maven-plugin</artifactId>
<versionRange>[1.2.4,)</versionRange>
<goals>
<goal>dist</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
@ -334,8 +278,8 @@
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- Spring Dependency LDAP -->
@ -354,12 +298,6 @@
<artifactId>spring-security-acl</artifactId>
</dependency>
<!-- Spring Dependency LDAP -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
</dependency>
<!-- Spring Test -->
<dependency>
<groupId>org.springframework</groupId>

View file

@ -21,8 +21,6 @@ package org.libreplan.importers;
import org.libreplan.business.common.entities.JobSchedulerConfiguration;
import org.quartz.SchedulerException;
import org.springframework.scheduling.quartz.CronTriggerBean;
import org.springframework.scheduling.quartz.JobDetailBean;
/**
* A manager(client) that dynamically creates jobs and cron-triggers using
@ -36,8 +34,8 @@ import org.springframework.scheduling.quartz.JobDetailBean;
* {@link JobSchedulerConfiguration} entity once the scheduler starts.
*
* <ul>
* <li>Schedule job:create job {@link JobDetailBean} and cron-trigger
* {@link CronTriggerBean}, associated the trigger with the job and add it to
* <li>Schedule job:create job {@link JobDetailFactoryBean} and cron-trigger
* {@link CronTriggerFactoryBean}, associated the trigger with the job and add it to
* the scheduler.
* <li>
* <li>Delete job: search the job in the scheduler and if found

View file

@ -37,12 +37,13 @@ import org.quartz.CronTrigger;
import org.quartz.JobExecutionContext;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.TriggerKey;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.scheduling.quartz.CronTriggerBean;
import org.springframework.scheduling.quartz.JobDetailBean;
import org.springframework.scheduling.quartz.CronTriggerFactoryBean;
import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -71,7 +72,7 @@ public class SchedulerManager implements ISchedulerManager {
/**
* suffix for trigger -group and -name
* Suffix for trigger -group and -name
*/
private static final String TRIGGER_SUFFIX = "-TRIGGER";
@ -85,8 +86,7 @@ public class SchedulerManager implements ISchedulerManager {
@Override
public void scheduleJobs() {
List<JobSchedulerConfiguration> jobSchedulerConfigurations = jobSchedulerConfigurationDAO
.getAll();
List<JobSchedulerConfiguration> jobSchedulerConfigurations = jobSchedulerConfigurationDAO.getAll();
for (JobSchedulerConfiguration conf : jobSchedulerConfigurations) {
try {
scheduleOrUnscheduleJob(conf);
@ -98,22 +98,24 @@ public class SchedulerManager implements ISchedulerManager {
@Override
@Transactional(readOnly = true)
public void scheduleOrUnscheduleJob(
JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
public void scheduleOrUnscheduleJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
if (hasConnector(jobSchedulerConfiguration.getConnectorName())) {
if (isConnectorActivated(jobSchedulerConfiguration
.getConnectorName())) {
if (jobSchedulerConfiguration.isSchedule()) {
if ( hasConnector(jobSchedulerConfiguration.getConnectorName()) ) {
if ( isConnectorActivated(jobSchedulerConfiguration.getConnectorName()) ) {
if ( jobSchedulerConfiguration.isSchedule() ) {
scheduleNewJob(jobSchedulerConfiguration);
return;
}
}
deleteJob(jobSchedulerConfiguration);
return;
}
if (!jobSchedulerConfiguration.isSchedule()) {
if ( !jobSchedulerConfiguration.isSchedule() ) {
deleteJob(jobSchedulerConfiguration);
return;
}
scheduleNewJob(jobSchedulerConfiguration);
@ -139,32 +141,30 @@ public class SchedulerManager implements ISchedulerManager {
*/
private boolean isConnectorActivated(String connectorName) {
Connector connector = connectorDAO.findUniqueByName(connectorName);
if (connector == null) {
return false;
}
return connector.isActivated();
return connector != null && connector.isActivated();
}
@Override
public void deleteJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
String triggerName = jobSchedulerConfiguration.getJobName()
+ TRIGGER_SUFFIX;
String triggerGroup = jobSchedulerConfiguration.getJobGroup()
+ TRIGGER_SUFFIX;
String triggerName = jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX;
String triggerGroup = jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX;
CronTriggerBean trigger = getTriggerBean(triggerName, triggerGroup);
if (trigger == null) {
CronTriggerFactoryBean trigger = getTriggerBean(triggerName, triggerGroup);
if ( trigger == null ) {
LOG.warn("Trigger not found");
return;
}
if (isJobCurrentlyExecuting(triggerName, triggerGroup)) {
if ( isJobCurrentlyExecuting(triggerName, triggerGroup) ) {
LOG.warn("Job is currently executing...");
return;
}
// deleteJob doesn't work using unscheduleJob
this.scheduler.unscheduleJob(trigger.getName(), trigger.getGroup());
this.scheduler.unscheduleJob(trigger.getObject().getKey());
}
/**
@ -178,26 +178,25 @@ public class SchedulerManager implements ISchedulerManager {
* @return true if job is currently running, otherwise false
*/
@SuppressWarnings("unchecked")
private boolean isJobCurrentlyExecuting(String triggerName,
String triggerGroup) {
private boolean isJobCurrentlyExecuting(String triggerName, String triggerGroup) {
try {
List<JobExecutionContext> currentExecutingJobs = this.scheduler
.getCurrentlyExecutingJobs();
List<JobExecutionContext> currentExecutingJobs = this.scheduler.getCurrentlyExecutingJobs();
for (JobExecutionContext jobExecutionContext : currentExecutingJobs) {
String name = jobExecutionContext.getTrigger().getName();
String group = jobExecutionContext.getTrigger().getGroup();
if (triggerName.equals(name) && triggerGroup.equals(group)) {
String name = jobExecutionContext.getTrigger().getKey().getName();
String group = jobExecutionContext.getTrigger().getKey().getGroup();
if ( triggerName.equals(name) && triggerGroup.equals(group) ) {
return true;
}
}
} catch (SchedulerException e) {
LOG.error("Unable to get currently executing jobs", e);
}
return false;
}
/**
* Creates {@link CronTriggerBean} and {@link JobDetailBean} based on the
* Creates {@link CronTriggerFactoryBean} and {@link JobDetailFactoryBean} based on the
* specified <code>{@link JobSchedulerConfiguration}</code>. First delete
* job if exist and then schedule it
*
@ -206,65 +205,64 @@ public class SchedulerManager implements ISchedulerManager {
* @throws SchedulerException
* if unable to delete and/or schedule job
*/
private void scheduleNewJob(
JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
CronTriggerBean cronTriggerBean = createCronTriggerBean(jobSchedulerConfiguration);
if (cronTriggerBean == null) {
private void scheduleNewJob(JobSchedulerConfiguration jobSchedulerConfiguration) throws SchedulerException {
CronTriggerFactoryBean cronTriggerBean = createCronTriggerBean(jobSchedulerConfiguration);
if ( cronTriggerBean == null ) {
return;
}
JobDetailBean jobDetailBean = createJobDetailBean(jobSchedulerConfiguration);
if (jobDetailBean == null) {
JobDetailFactoryBean jobDetailBean = createJobDetailBean(jobSchedulerConfiguration);
if ( jobDetailBean == null ) {
return;
}
deleteJob(jobSchedulerConfiguration);
this.scheduler.scheduleJob(jobDetailBean, cronTriggerBean);
this.scheduler.scheduleJob(jobDetailBean.getObject(), cronTriggerBean.getObject());
}
/**
* Creates {@link CronTriggerBean} from the specified
* Creates {@link CronTriggerFactoryBean} from the specified
* <code>{@link JobSchedulerConfiguration}</code>
*
* @param jobSchedulerConfiguration
* configuration to create <code>CronTriggerBean</>
* @return the created <code>CronTriggerBean</code> or null if unable to
* configuration to create <code>CronTriggerFactoryBean</>
* @return the created <code>CronTriggerFactoryBean</code> or null if unable to
* create it
*/
private CronTriggerBean createCronTriggerBean(
JobSchedulerConfiguration jobSchedulerConfiguration) {
CronTriggerBean cronTriggerBean = new CronTriggerBean();
private CronTriggerFactoryBean createCronTriggerBean(JobSchedulerConfiguration jobSchedulerConfiguration) {
CronTriggerFactoryBean cronTriggerBean = new CronTriggerFactoryBean();
cronTriggerBean.setName(jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX);
cronTriggerBean.setGroup(jobSchedulerConfiguration.getJobGroup()
+ TRIGGER_SUFFIX);
cronTriggerBean.setGroup(jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX);
try {
cronTriggerBean.setCronExpression(new CronExpression(
jobSchedulerConfiguration.getCronExpression()));
cronTriggerBean.setJobName(jobSchedulerConfiguration.getJobName());
cronTriggerBean
.setJobGroup(jobSchedulerConfiguration.getJobGroup());
cronTriggerBean.setCronExpression(
String.valueOf(new CronExpression(jobSchedulerConfiguration.getCronExpression())));
cronTriggerBean.setName(jobSchedulerConfiguration.getJobName());
cronTriggerBean.setGroup(jobSchedulerConfiguration.getJobGroup());
return cronTriggerBean;
} catch (ParseException e) {
LOG.error("Unable to parse cron expression", e);
}
return null;
}
/**
* Creates {@link JobDetailBean} from the specified
* Creates {@link JobDetailFactoryBean} from the specified
* <code>{@link JobSchedulerConfiguration}</code>
*
* @param jobSchedulerConfiguration
* configuration to create <code>JobDetailBean</>
* @return the created <code>JobDetailBean</code> or null if unable to it
* configuration to create <code>JobDetailFactoryBean</>
* @return the created <code>JobDetailFactoryBean</code> or null if unable to it
*/
private JobDetailBean createJobDetailBean(
JobSchedulerConfiguration jobSchedulerConfiguration) {
JobDetailBean jobDetailBean = new JobDetailBean();
private JobDetailFactoryBean createJobDetailBean(JobSchedulerConfiguration jobSchedulerConfiguration) {
JobDetailFactoryBean jobDetailBean = new JobDetailFactoryBean();
Class<?> jobClass = getJobClass(jobSchedulerConfiguration
.getJobClassName());
if (jobClass == null) {
Class<?> jobClass = getJobClass(jobSchedulerConfiguration.getJobClassName());
if ( jobClass == null ) {
return null;
}
@ -272,9 +270,10 @@ public class SchedulerManager implements ISchedulerManager {
jobDetailBean.setGroup(jobSchedulerConfiguration.getJobGroup());
jobDetailBean.setJobClass(jobClass);
Map<String, Object> jobDataAsMap = new HashMap<String, Object>();
Map<String, Object> jobDataAsMap = new HashMap<>();
jobDataAsMap.put("applicationContext", applicationContext);
jobDetailBean.setJobDataAsMap(jobDataAsMap);
return jobDetailBean;
}
@ -287,49 +286,48 @@ public class SchedulerManager implements ISchedulerManager {
*/
private Class<?> getJobClass(JobClassNameEnum jobClassName) {
try {
return Class.forName(jobClassName.getPackageName() + "."
+ jobClassName.getName());
return Class.forName(jobClassName.getPackageName() + "." + jobClassName.getName());
} catch (ClassNotFoundException e) {
LOG.error("Unable to get class object '" + jobClassName + "'", e);
}
return null;
}
@Override
public String getNextFireTime(
JobSchedulerConfiguration jobSchedulerConfiguration) {
public String getNextFireTime(JobSchedulerConfiguration jobSchedulerConfiguration) {
try {
CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger(
jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX,
jobSchedulerConfiguration.getJobGroup()
+ TRIGGER_SUFFIX);
if (trigger != null) {
CronTrigger trigger = (CronTrigger) this.scheduler.getTrigger(TriggerKey.triggerKey(
jobSchedulerConfiguration.getJobName() + TRIGGER_SUFFIX,
jobSchedulerConfiguration.getJobGroup() + TRIGGER_SUFFIX));
if ( trigger != null ) {
return trigger.getNextFireTime().toString();
}
} catch (SchedulerException e) {
LOG.error("unable to get the trigger", e);
}
return "";
}
/**
* gets the {@link CronTriggerBean} for the specified
* gets the {@link CronTriggerFactoryBean} for the specified
* <code>triggerName</code> and <code>tirggerGroup</code>
*
* @param triggerName
* the trigger name
* @param triggerGroup
* the trigger group
* @return CronTriggerBean if found, otherwise null
* @return CronTriggerFactoryBean if found, otherwise null
*/
private CronTriggerBean getTriggerBean(String triggerName,
String triggerGroup) {
private CronTriggerFactoryBean getTriggerBean(String triggerName, String triggerGroup) {
try {
return (CronTriggerBean) this.scheduler.getTrigger(triggerName,
triggerGroup);
return (CronTriggerFactoryBean) this.scheduler.getTrigger(TriggerKey.triggerKey(triggerName, triggerGroup));
} catch (SchedulerException e) {
LOG.error("Unable to get job trigger", e);
}
return null;
}

View file

@ -48,15 +48,15 @@ public class IndexController extends GenericForwardComposer {
}
private String getInitialPageURL() {
if (SecurityUtils.isUserInRole(UserRole.ROLE_SUPERUSER)) {
if ( SecurityUtils.isUserInRole(UserRole.ROLE_SUPERUSER) ) {
return PLANNING_URL;
}
if (SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER)) {
if ( SecurityUtils.isUserInRole(UserRole.ROLE_BOUND_USER) ) {
return USER_DASHBOARD_URL;
}
if (SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization()) {
if ( SecurityUtils.isSuperuserOrRolePlanningOrHasAnyAuthorization() ) {
return PLANNING_URL;
}

View file

@ -34,12 +34,11 @@ import org.zkoss.zk.ui.util.GenericForwardComposer;
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
// TODO resolve deprecated methods
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class LoginController extends GenericForwardComposer {
private final String autocompletLoginValue = "admin";
@Autowired
private IConfigurationDAO configurationDAO;
@ -53,11 +52,13 @@ public class LoginController extends GenericForwardComposer {
* It returns the login value in function of the property autocompleteLogin.
*/
public String getLoginValue() {
Configuration configuration = configurationDAO
.getConfigurationWithReadOnlyTransaction();
return ((configuration.isAutocompleteLogin()) && (!configuration
.getChangedDefaultAdminPassword())) ? this.autocompletLoginValue
: null;
Configuration configuration = configurationDAO.getConfigurationWithReadOnlyTransaction();
String autocompleteLoginValue = "admin";
boolean condition =
((configuration.isAutocompleteLogin()) && (!configuration.getChangedDefaultAdminPassword()));
return condition ? autocompleteLoginValue : null;
}
}

View file

@ -48,26 +48,24 @@ public class PageForErrorOnEvent extends GenericForwardComposer {
super.doAfterCompose(comp);
logError();
modalWindow = comp;
if (stacktrace != null) {
if ( stacktrace != null ) {
stacktrace.setValue(getStacktrace());
}
}
private void logError() {
Throwable exception = (Throwable) Executions.getCurrent().getAttribute(
"javax.servlet.error.exception");
String errorMessage = (String) Executions.getCurrent().getAttribute(
"javax.servlet.error.message");
Integer code = (Integer) Executions.getCurrent().getAttribute(
"javax.servlet.error.status_code");
if (code != null) {
Throwable exception = (Throwable) Executions.getCurrent().getAttribute("javax.servlet.error.exception");
String errorMessage = (String) Executions.getCurrent().getAttribute("javax.servlet.error.message");
Integer code = (Integer) Executions.getCurrent().getAttribute("javax.servlet.error.status_code");
if ( code != null ) {
errorMessage += " [Status Code: " + code + "]";
if (code == HttpServletResponse.SC_FORBIDDEN) {
String uri = (String) Executions.getCurrent().getAttribute(
"javax.servlet.error.request_uri");
if ( code == HttpServletResponse.SC_FORBIDDEN ) {
String uri = (String) Executions.getCurrent().getAttribute("javax.servlet.error.request_uri");
errorMessage += " [Request URI: " + uri + "]";
}
}
LOG.error(errorMessage, exception);
}
@ -80,20 +78,20 @@ public class PageForErrorOnEvent extends GenericForwardComposer {
}
public void onClick$quitSession() {
HttpServletRequest nativeRequest = (HttpServletRequest) Executions
.getCurrent().getNativeRequest();
HttpServletRequest nativeRequest = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
nativeRequest.getSession().invalidate();
Executions.sendRedirect("/");
}
private String getStacktrace() {
Throwable exception = (Throwable) Executions.getCurrent().getAttribute(
"javax.servlet.error.exception");
Throwable exception = (Throwable) Executions.getCurrent().getAttribute("javax.servlet.error.exception");
if (exception != null) {
Writer stacktrace = new StringWriter();
exception.printStackTrace(new PrintWriter(stacktrace));
return stacktrace.toString();
}
return "";
}

View file

@ -261,37 +261,32 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
@Override
public void typeChanged(ModeType oldType, ModeType newType) {
switch (newType) {
case GLOBAL:
ConfirmCloseUtil.resetConfirmClose();
break;
case GLOBAL:
ConfirmCloseUtil.resetConfirmClose();
break;
case ORDER:
if ( SecurityUtils.loggedUserCanWrite(mode.getOrder()) ) {
ConfirmCloseUtil.setConfirmClose(
desktop,
_("You are about to leave the planning editing. Unsaved changes will be lost!"));
}
break;
case ORDER:
if ( SecurityUtils.loggedUserCanWrite(mode.getOrder()) ) {
ConfirmCloseUtil.setConfirmClose(
desktop,
_("You are about to leave the planning editing. Unsaved changes will be lost!"));
}
break;
default:
break;
default:
break;
}
}
});
planningTab = doFeedbackOn(PlanningTabCreator.create(mode,
companyPlanningController, orderPlanningController, orderDAO,
breadcrumbs, parameters, this));
resourceLoadTab = ResourcesLoadTabCreator.create(mode,
resourceLoadController,
resourceLoadControllerGlobal, new IOrderPlanningGate() {
planningTab = doFeedbackOn(PlanningTabCreator.create(
mode, companyPlanningController, orderPlanningController, orderDAO, breadcrumbs, parameters, this));
resourceLoadTab = ResourcesLoadTabCreator.create(
mode, resourceLoadController, resourceLoadControllerGlobal, new IOrderPlanningGate() {
@Override
public void goToScheduleOf(Order order) {
getTabsRegistry()
.show(planningTab, changeModeTo(order));
getTabsRegistry().show(planningTab, changeModeTo(order));
}
@Override
@ -300,62 +295,28 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
}
@Override
public void goToTaskResourceAllocation(Order order,
TaskElement task) {
public void goToTaskResourceAllocation(Order order, TaskElement task) {
orderPlanningController.setShowedTask(task);
orderPlanningController.setCurrentControllerToShow(orderPlanningController.getEditTaskController());
getTabsRegistry()
.show(planningTab, changeModeTo(order));
orderPlanningController
.setCurrentControllerToShow(orderPlanningController.getEditTaskController());
getTabsRegistry().show(planningTab, changeModeTo(order));
}
@Override
public void goToDashboard(Order order) {
// do nothing
}
}, breadcrumbs);
limitingResourcesTab = LimitingResourcesTabCreator.create(mode,
limitingResourcesController, limitingResourcesControllerGlobal,
breadcrumbs);
ordersTab = OrdersTabCreator.create(mode, orderCRUDController,
breadcrumbs, new IOrderPlanningGate() {
@Override
public void goToScheduleOf(Order order) {
getTabsRegistry()
.show(planningTab, changeModeTo(order));
}
@Override
public void goToOrderDetails(Order order) {
getTabsRegistry().show(ordersTab, changeModeTo(order));
}
@Override
public void goToTaskResourceAllocation(Order order,
TaskElement task) {
// do nothing
}
@Override
public void goToDashboard(Order order) {
// do nothing
}
}, parameters);
dashboardTab = DashboardTabCreator.create(mode, planningStateCreator,
dashboardController, dashboardControllerGlobal, orderPlanningController, breadcrumbs,
resourcesSearcher);
logsTab = LogsTabCreator.create(mode, logsController, logsControllerGlobal, breadcrumbs, new IOrderPlanningGate() {
limitingResourcesTab = LimitingResourcesTabCreator.create(
mode, limitingResourcesController, limitingResourcesControllerGlobal, breadcrumbs);
ordersTab = OrdersTabCreator.create(mode, orderCRUDController, breadcrumbs, new IOrderPlanningGate() {
@Override
public void goToScheduleOf(Order order) {
getTabsRegistry()
.show(planningTab, changeModeTo(order));
getTabsRegistry().show(planningTab, changeModeTo(order));
}
@Override
@ -364,8 +325,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
}
@Override
public void goToTaskResourceAllocation(Order order,
TaskElement task) {
public void goToTaskResourceAllocation(Order order, TaskElement task) {
// do nothing
}
@ -373,37 +333,72 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
public void goToDashboard(Order order) {
// do nothing
}
}, parameters);
dashboardTab = DashboardTabCreator.create(
mode,
planningStateCreator,
dashboardController,
dashboardControllerGlobal,
orderPlanningController,
breadcrumbs,
resourcesSearcher);
logsTab = LogsTabCreator.create(
mode, logsController, logsControllerGlobal, breadcrumbs, new IOrderPlanningGate() {
@Override
public void goToScheduleOf(Order order) {
getTabsRegistry().show(planningTab, changeModeTo(order));
}
@Override
public void goToOrderDetails(Order order) {
getTabsRegistry().show(ordersTab, changeModeTo(order));
}
@Override
public void goToTaskResourceAllocation(Order order, TaskElement task) {
// do nothing
}
@Override
public void goToDashboard(Order order) {
// do nothing
}
}, parameters);
final boolean isMontecarloVisible = isMonteCarloVisible();
if (isMontecarloVisible) {
monteCarloTab = MonteCarloTabCreator.create(mode,
planningStateCreator, monteCarloController,
orderPlanningController, breadcrumbs,
if ( isMontecarloVisible ) {
monteCarloTab = MonteCarloTabCreator.create(
mode,
planningStateCreator,
monteCarloController,
orderPlanningController,
breadcrumbs,
resourcesSearcher);
}
final State<Void> typeChanged = typeChangedState();
advancedAllocationTab = doFeedbackOn(AdvancedAllocationTabCreator
.create(mode, transactionService, planningStateCreator,
returnToPlanningTab(), breadcrumbs));
advancedAllocationTab = doFeedbackOn(AdvancedAllocationTabCreator.create(
mode, transactionService, planningStateCreator, returnToPlanningTab(), breadcrumbs));
TabsConfiguration tabsConfiguration = TabsConfiguration.create()
.add(tabWithNameReloading(planningTab, typeChanged))
.add(tabWithNameReloading(ordersTab, typeChanged));
if (SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
tabsConfiguration.add(
tabWithNameReloading(resourceLoadTab, typeChanged)).add(
tabWithNameReloading(limitingResourcesTab, typeChanged));
} else {
tabsConfiguration.add(visibleOnlyAtOrderModeWithNameReloading(
resourceLoadTab, typeChanged));
}
tabsConfiguration.add(visibleOnlyAtOrderMode(advancedAllocationTab))
.add(tabWithNameReloading(dashboardTab, typeChanged));
if (isMontecarloVisible) {
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING) ) {
tabsConfiguration
.add(tabWithNameReloading(resourceLoadTab, typeChanged))
.add(tabWithNameReloading(limitingResourcesTab, typeChanged));
} else {
tabsConfiguration.add(visibleOnlyAtOrderModeWithNameReloading(resourceLoadTab, typeChanged));
}
tabsConfiguration
.add(visibleOnlyAtOrderMode(advancedAllocationTab))
.add(tabWithNameReloading(dashboardTab, typeChanged));
if ( isMontecarloVisible ) {
tabsConfiguration.add(visibleOnlyAtOrderMode(monteCarloTab));
}
@ -414,7 +409,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
private boolean isMonteCarloVisible() {
Boolean result = configurationDAO.getConfiguration().isMonteCarloMethodTabVisible();
return result != null ? result.booleanValue() : false;
return result != null ? result : false;
}
@SuppressWarnings("unchecked")
@ -458,8 +453,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
};
}
private ChangeableTab tabWithNameReloading(ITab tab,
final State<Void> typeChanged) {
private ChangeableTab tabWithNameReloading(ITab tab, final State<Void> typeChanged) {
return configure(tab).reloadNameOn(typeChanged);
}
@ -472,6 +466,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
typeChanged.changeValueTo(null);
}
});
return typeChanged;
}
@ -479,11 +474,11 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
return visibleOnlyAtOrderModeWithNameReloading(tab, null);
}
private ChangeableTab visibleOnlyAtOrderModeWithNameReloading(ITab tab,
final State<Void> typeChanged) {
private ChangeableTab visibleOnlyAtOrderModeWithNameReloading(ITab tab, final State<Void> typeChanged) {
final State<Boolean> state = State.create(mode.isOf(ModeType.ORDER));
ChangeableTab result;
if (typeChanged == null) {
if ( typeChanged == null ) {
result = configure(tab).visibleOn(state);
} else {
result = configure(tab).visibleOn(state).reloadNameOn(typeChanged);
@ -495,6 +490,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
state.changeValueTo(ModeType.ORDER == newType);
}
});
return result;
}
@ -503,29 +499,29 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
public void doAfterCompose(org.zkoss.zk.ui.Component comp) {
Execution execution = Executions.getCurrent();
WELCOME_URL = "http://" + execution.getServerName() + ":" + execution.getServerPort() + Executions.encodeURL("/planner/index.zul");
WELCOME_URL = "http://" + execution.getServerName() + ":" + execution.getServerPort() +
Executions.encodeURL("/planner/index.zul");
tabsSwitcher = (TabSwitcher) comp;
breadcrumbs = comp.getPage().getFellow("breadcrumbs");
tabsSwitcher
.setConfiguration(buildTabsConfiguration(comp.getDesktop()));
final EntryPointsHandler<IGlobalViewEntryPoints> handler = registry
.getRedirectorFor(IGlobalViewEntryPoints.class);
if (!handler.applyIfMatches(this)) {
tabsSwitcher.setConfiguration(buildTabsConfiguration(comp.getDesktop()));
final EntryPointsHandler<IGlobalViewEntryPoints> handler =
registry.getRedirectorFor(IGlobalViewEntryPoints.class);
if ( !handler.applyIfMatches(this) ) {
planningTab.toggleToNoFeedback();
goToCompanyScheduling();
planningTab.toggleToFeedback();
}
handler.registerBookmarkListener(this, comp.getPage());
if (SecurityUtils
.isSuperuserOrUserInRoles(UserRole.ROLE_CREATE_PROJECTS)) {
org.zkoss.zk.ui.Component createOrderButton = comp.getPage()
.getFellowIfAny(
"createOrderButton");
if (createOrderButton != null) {
createOrderButton.addEventListener(Events.ON_CLICK,
new EventListener() {
if ( SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_CREATE_PROJECTS) ) {
org.zkoss.zk.ui.Component createOrderButton = comp.getPage().getFellowIfAny("createOrderButton");
if ( createOrderButton != null ) {
createOrderButton.addEventListener(Events.ON_CLICK, new EventListener() {
@Override
public void onEvent(Event event) throws Exception {
goToCreateForm();
@ -544,8 +540,15 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
private void sendDataToServer(){
GatheredUsageStats gatheredUsageStats = new GatheredUsageStats();
gatheredUsageStats.setupNotAutowiredClasses(userDAO, orderModel, workReportModel, workerModel, machineModel,
expenseSheetModel, materialsModel, assignedQualityFormsModel);
gatheredUsageStats.setupNotAutowiredClasses(
userDAO,
orderModel,
workReportModel,
workerModel,
machineModel,
expenseSheetModel,
materialsModel,
assignedQualityFormsModel);
gatheredUsageStats.sendGatheredUsageStatsToServer();
SecurityUtils.isGatheredStatsAlreadySent = true;
@ -578,8 +581,7 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
public void goToCreateForm() {
orderCRUDController.prepareForCreate(tabsSwitcher.getDesktop());
orderCRUDController.getCreationPopup().showWindow(orderCRUDController,
this);
orderCRUDController.getCreationPopup().showWindow(orderCRUDController, this);
}
@ -625,14 +627,15 @@ public class MultipleTabsPlannerController implements Composer, IGlobalViewEntry
@Override
public void goToAdvanceTask(Order order,TaskElement task) {
orderPlanningController.setShowedTask(task);
orderPlanningController
.setCurrentControllerToShow(orderPlanningController
.getAdvanceAssignmentPlanningController());
.setCurrentControllerToShow(orderPlanningController.getAdvanceAssignmentPlanningController());
getTabsRegistry().show(planningTab, changeModeTo(order));
}
private IBeforeShowAction changeModeTo(final Order order) {
logsController.goToOrderMode(order);
LogsController.goToOrderMode(order);
return new IBeforeShowAction() {
@Override
public void doAction() {

View file

@ -59,13 +59,10 @@ public class CutyPrint {
private static final Log LOG = LogFactory.getLog(CutyPrint.class);
private static final String CUTYCAPT_COMMAND = "cutycapt";
// Estimated maximum execution time (ms)
private static final int CAPTURE_DELAY = 10000;
// Taskdetails left padding
private static int TASKDETAILS_BASE_WIDTH = 310;
/**
* Default width in pixels of the task name text field for depth level 1.
* <p />
@ -75,59 +72,49 @@ public class CutyPrint {
private static final int BASE_TASK_NAME_PIXELS = 121;
private static int TASK_HEIGHT = 25;
private static int PRINT_VERTICAL_PADDING = 50;
private static int PRINT_VERTICAL_SPACING = 160;
public static void print(Order order) {
print("/planner/index.zul", entryPointForShowingOrder(order),
Collections.<String, String> emptyMap());
print("/planner/index.zul", entryPointForShowingOrder(order), Collections.<String, String> emptyMap());
}
public static void print(Order order, Map<String, String> parameters) {
print("/planner/index.zul", entryPointForShowingOrder(order),
parameters);
print("/planner/index.zul", entryPointForShowingOrder(order), parameters);
}
public static void print(Order order, HashMap<String, String> parameters,
Planner planner) {
print("/planner/index.zul", entryPointForShowingOrder(order),
parameters, planner);
public static void print(Order order, HashMap<String, String> parameters, Planner planner) {
print("/planner/index.zul", entryPointForShowingOrder(order), parameters, planner);
}
public static void print() {
print("/planner/index.zul", Collections.<String, String> emptyMap(),
Collections.<String, String> emptyMap());
print("/planner/index.zul", Collections.<String, String> emptyMap(), Collections.<String, String> emptyMap());
}
public static void print(Map<String, String> parameters) {
print("/planner/index.zul", Collections.<String, String> emptyMap(),
parameters);
print("/planner/index.zul", Collections.<String, String> emptyMap(), parameters);
}
public static void print(HashMap<String, String> parameters, Planner planner) {
print("/planner/index.zul", Collections.<String, String> emptyMap(),
parameters, planner);
print("/planner/index.zul", Collections.<String, String> emptyMap(), parameters, planner);
}
private static Map<String, String> entryPointForShowingOrder(Order order) {
final Map<String, String> result = new HashMap<String, String>();
final Map<String, String> result = new HashMap<>();
result.put("order", order.getCode() + "");
return result;
}
public static void print(final String forwardURL,
final Map<String, String> entryPointsMap,
Map<String, String> parameters) {
public static void print(
final String forwardURL, final Map<String, String> entryPointsMap, Map<String, String> parameters) {
print(forwardURL, entryPointsMap, parameters, null);
}
public static void print(final String forwardURL,
final Map<String, String> entryPointsMap,
Map<String, String> parameters, Planner planner) {
final Map<String, String> entryPointsMap,
Map<String, String> parameters,
Planner planner) {
CutyCaptParameters params = new CutyCaptParameters(forwardURL,
entryPointsMap, parameters, planner);
CutyCaptParameters params = new CutyCaptParameters(forwardURL, entryPointsMap, parameters, planner);
String generatedSnapshotServerPath = takeSnapshot(params);
openInAnotherTab(generatedSnapshotServerPath);
@ -141,10 +128,8 @@ public class CutyPrint {
private static final AtomicLong counter = new AtomicLong();
private final HttpServletRequest request = (HttpServletRequest) Executions
.getCurrent().getNativeRequest();
private final ServletContext context = request.getSession()
.getServletContext();
private final HttpServletRequest request = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
private final ServletContext context = request.getSession().getServletContext();
private final String forwardURL;
private final Map<String, String> entryPointsMap;
@ -159,21 +144,21 @@ public class CutyPrint {
private final int recentUniqueToken = (int) (counter.getAndIncrement() % 1000);
public CutyCaptParameters(final String forwardURL,
final Map<String, String> entryPointsMap,
Map<String, String> printParameters, Planner planner) {
final Map<String, String> entryPointsMap,
Map<String, String> printParameters,
Planner planner) {
this.forwardURL = forwardURL;
this.entryPointsMap = entryPointsMap != null ? entryPointsMap
: Collections.<String, String> emptyMap();
this.printParameters = printParameters != null ? printParameters
: Collections.<String, String> emptyMap();
this.entryPointsMap = (entryPointsMap != null) ? entryPointsMap : Collections.<String, String> emptyMap();
this.printParameters =
(printParameters != null) ? printParameters : Collections.<String, String> emptyMap();
this.planner = planner;
containersExpandedByDefault = Planner
.guessContainersExpandedByDefaultGivenPrintParameters(printParameters);
minWidthForTaskNameColumn = planner
.calculateMinimumWidthForTaskNameColumn(containersExpandedByDefault);
generatedSnapshotServerPath = buildCaptureDestination(printParameters
.get("extension"));
containersExpandedByDefault = Planner.guessContainersExpandedByDefaultGivenPrintParameters(printParameters);
minWidthForTaskNameColumn = planner.calculateMinimumWidthForTaskNameColumn(containersExpandedByDefault);
generatedSnapshotServerPath = buildCaptureDestination(printParameters.get("extension"));
}
String getGeneratedSnapshotServerPath() {
@ -181,36 +166,33 @@ public class CutyPrint {
}
private String buildCaptureDestination(String extension) {
if (StringUtils.isEmpty(extension)) {
if ( StringUtils.isEmpty(extension) ) {
extension = ".pdf";
}
return String.format("/print/%tY%<tm%<td%<tH%<tM%<tS-%s%s",
new Date(),
recentUniqueToken, extension);
return String.format("/print/%tY%<tm%<td%<tH%<tM%<tS-%s%s", new Date(), recentUniqueToken, extension);
}
/**
* An unique recent display number for Xvfb. It's not truly unique
* across all the life of a libreplan application, but it's in the last
* period of time.
* An unique recent display number for Xvfb.
* It's not truly unique across all the life of a LibrePlan application, but it's in the last period of time.
*
* @return the display number to use by Xvfb
*/
public int getXvfbDisplayNumber() {
return recentUniqueToken + 1; // avoid display 0
// avoid display 0
return recentUniqueToken + 1;
}
void fillParameters(ProcessBuilder c) {
Map<String, String> parameters = buildParameters();
for (Entry<String, String> each : parameters.entrySet()) {
c.command()
.add(String.format("--%s=%s", each.getKey(),
each.getValue()));
c.command().add(String.format("--%s=%s", each.getKey(), each.getValue()));
}
}
private Map<String, String> buildParameters() {
Map<String, String> result = new HashMap<String, String>();
Map<String, String> result = new HashMap<>();
result.put("url", buildSnapshotURLParam());
@ -221,8 +203,8 @@ public class CutyPrint {
result.put("delay", CAPTURE_DELAY + "");
result.put("user-style-path", buildCustomCSSParam(width));
result.put("out", buildPathToOutputFileParam());
result.put("header", String.format("Accept-Language:%s", Locales
.getCurrent().getLanguage()));
result.put("header", String.format("Accept-Language:%s", Locales.getCurrent().getLanguage()));
return result;
}
@ -230,39 +212,37 @@ public class CutyPrint {
IServletRequestHandler snapshotRequestHandler = executeOnOriginalContext(new IServletRequestHandler() {
@Override
public void handle(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
public void handle(
HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
EntryPointsHandler.setupEntryPointsForThisRequest(request,
entryPointsMap);
EntryPointsHandler.setupEntryPointsForThisRequest(request, entryPointsMap);
// Pending to forward and process additional parameters
// as show labels, resources, zoom or expand all
request.getRequestDispatcher(forwardURL).forward(request,
response);
request.getRequestDispatcher(forwardURL).forward(request, response);
}
});
String pageToSnapshot = CallbackServlet.registerAndCreateURLFor(
request, snapshotRequestHandler);
String pageToSnapshot = CallbackServlet.registerAndCreateURLFor(request, snapshotRequestHandler);
return createCaptureURL(pageToSnapshot);
}
private String createCaptureURL(String capturePath) {
String hostName = resolveLocalHost();
String uri = String.format("%s://%s:%s", request.getScheme(),
hostName, request.getLocalPort());
String uri = String.format("%s://%s:%s", request.getScheme(), hostName, request.getLocalPort());
UriBuilder result = UriBuilder.fromUri(uri).path(capturePath);
for (Entry<String, String> entry : printParameters.entrySet()) {
result = result.queryParam(entry.getKey(), entry.getValue());
}
return result.build().toASCIIString();
}
private String resolveLocalHost() {
try {
InetAddress host = InetAddress
.getByName(request.getLocalName());
InetAddress host = InetAddress.getByName(request.getLocalName());
return host.getHostName();
} catch (UnknownHostException e) {
throw new RuntimeException(e);
@ -270,46 +250,43 @@ public class CutyPrint {
}
private int buildMinWidthParam() {
if (planner != null && planner.getTimeTracker() != null) {
return planner.getTimeTracker().getHorizontalSize()
+ calculateTaskDetailsWidth();
if ( planner != null && planner.getTimeTracker() != null ) {
return planner.getTimeTracker().getHorizontalSize() + calculateTaskDetailsWidth();
}
return 0;
}
private int calculateTaskDetailsWidth() {
return TASKDETAILS_BASE_WIDTH
+ Math.max(0, minWidthForTaskNameColumn
- BASE_TASK_NAME_PIXELS);
int TASKDETAILS_BASE_WIDTH = 310;
return TASKDETAILS_BASE_WIDTH + Math.max(0, minWidthForTaskNameColumn - BASE_TASK_NAME_PIXELS);
}
private int buildMinHeightParam() {
return (containersExpandedByDefault ? planner.getAllTasksNumber()
: planner.getTaskNumber())
* TASK_HEIGHT
+ PRINT_VERTICAL_SPACING;
int PRINT_VERTICAL_SPACING = 160;
return (containersExpandedByDefault ? planner.getAllTasksNumber() :
planner.getTaskNumber()) * TASK_HEIGHT + PRINT_VERTICAL_SPACING;
}
private String buildCustomCSSParam(int plannerWidth) {
// Calculate application path and destination file relative route
String absolutePath = context.getRealPath("/");
cssLinesToAppend(plannerWidth);
return createCSSFile(absolutePath + "/planner/css/print.css",
cssLinesToAppend(plannerWidth));
return createCSSFile(absolutePath + "/planner/css/print.css", cssLinesToAppend(plannerWidth));
}
private static String createCSSFile(String sourceFile,
String cssLinesToAppend) {
private static String createCSSFile(String sourceFile, String cssLinesToAppend) {
File destination;
try {
destination = File.createTempFile("print", ".css");
FileUtils.copyFile(new File(sourceFile), destination);
} catch (IOException e) {
LOG.error(
"Can't create a temporal file for storing the CSS files",
e);
LOG.error("Can't create a temporal file for storing the CSS files", e);
return sourceFile;
}
FileWriter appendToFile = null;
try {
appendToFile = new FileWriter(destination, true);
@ -320,54 +297,53 @@ public class CutyPrint {
LOG.error("Can't append to the created file " + destination, e);
} finally {
try {
if (appendToFile != null) {
if ( appendToFile != null ) {
appendToFile.close();
}
} catch (IOException e) {
LOG.warn("error closing fileWriter", e);
}
}
return destination.getAbsolutePath();
}
private String cssLinesToAppend(int width) {
String includeCSSLines = " body { width: " + width + "px; } \n";
if ("all".equals(printParameters.get("labels"))) {
if ( "all".equals(printParameters.get("labels")) ) {
includeCSSLines += " .task-labels { display: inline !important;} \n ";
}
if ("all".equals(printParameters.get("resources"))) {
if ( "all".equals(printParameters.get("resources")) ) {
includeCSSLines += " .task-resources { display: inline !important;} \n";
}
includeCSSLines += heightCSS();
includeCSSLines += widthForTaskNamesColumnCSS();
return includeCSSLines;
}
private String heightCSS() {
int tasksNumber = containersExpandedByDefault ? planner
.getAllTasksNumber() : planner
.getTaskNumber();
int tasksNumber = containersExpandedByDefault ? planner.getAllTasksNumber() : planner.getTaskNumber();
int PRINT_VERTICAL_PADDING = 50;
int height = (tasksNumber * TASK_HEIGHT) + PRINT_VERTICAL_PADDING;
String heightCSS = "";
heightCSS += " body div#scroll_container { height: " + height
+ "px !important;} \n"; /* 1110 */
heightCSS += " body div#timetracker { height: " + (height + 20)
+ "px !important; } \n";
heightCSS += " body div.plannerlayout { height: " + (height + 80)
+ "px !important; } \n";
heightCSS += " body div.main-layout { height: " + (height + 90)
+ "px !important; } \n";
heightCSS += " body div#scroll_container { height: " + height + "px !important;} \n"; /* 1110 */
heightCSS += " body div#timetracker { height: " + (height + 20) + "px !important; } \n";
heightCSS += " body div.plannerlayout { height: " + (height + 80) + "px !important; } \n";
heightCSS += " body div.main-layout { height: " + (height + 90) + "px !important; } \n";
return heightCSS;
}
private String widthForTaskNamesColumnCSS() {
String css = "/* ------ Make the area for task names wider ------ */\n";
css += "th.z-tree-col {width: 76px !important;}\n";
css += "th.tree-text {width: " + (34 + minWidthForTaskNameColumn)
+ "px !important;}\n";
css += "th.tree-text {width: " + (34 + minWidthForTaskNameColumn) + "px !important;}\n";
css += ".taskdetailsContainer, .z-west-body, .z-tree-header, .z-tree-body {";
css += "width: " + (176 + minWidthForTaskNameColumn) + "px !important;}\n";
return css;
}
@ -378,8 +354,8 @@ public class CutyPrint {
}
/**
* It blocks until the snapshot is ready. It invokes cutycapt program in
* order to take a snapshot from a specified url
* It blocks until the snapshot is ready.
* It invokes cutycapt program in order to take a snapshot from a specified url.
*
* @return the path in the web application to access via a HTTP GET to the
* generated snapshot.
@ -388,8 +364,7 @@ public class CutyPrint {
ProcessBuilder capture = new ProcessBuilder(CUTYCAPT_COMMAND);
params.fillParameters(capture);
String generatedSnapshotServerPath = params
.getGeneratedSnapshotServerPath();
String generatedSnapshotServerPath = params.getGeneratedSnapshotServerPath();
Process printProcess = null;
Process serverProcess = null;
@ -397,15 +372,15 @@ public class CutyPrint {
LOG.info("calling printing: " + capture.command());
// If there is a not real X server environment then use Xvfb
if (StringUtils.isEmpty(System.getenv("DISPLAY"))) {
ProcessBuilder s = new ProcessBuilder("Xvfb", ":"
+ params.getXvfbDisplayNumber());
if ( StringUtils.isEmpty(System.getenv("DISPLAY")) ) {
ProcessBuilder s = new ProcessBuilder("Xvfb", ":" + params.getXvfbDisplayNumber());
serverProcess = s.start();
capture.environment().put("DISPLAY",
":" + params.getXvfbDisplayNumber() + ".0");
capture.environment().put("DISPLAY", ":" + params.getXvfbDisplayNumber() + ".0");
}
printProcess = capture.start();
printProcess.waitFor();
// once the printProcess finishes, the print snapshot is available
return generatedSnapshotServerPath;
} catch (InterruptedException e) {
@ -414,10 +389,10 @@ public class CutyPrint {
LOG.error("error invoking command", e);
throw new RuntimeException(e);
} finally {
if (printProcess != null) {
if ( printProcess != null ) {
destroy(printProcess);
}
if (serverProcess != null) {
if ( serverProcess != null ) {
destroy(serverProcess);
}
}
@ -431,16 +406,15 @@ public class CutyPrint {
}
}
private static IServletRequestHandler executeOnOriginalContext(
final IServletRequestHandler original) {
final SecurityContext originalContext = SecurityContextHolder
.getContext();
private static IServletRequestHandler executeOnOriginalContext(final IServletRequestHandler original) {
final SecurityContext originalContext = SecurityContextHolder.getContext();
final Locale current = Locales.getCurrent();
return new IServletRequestHandler() {
@Override
public void handle(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
public void handle(
HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Locales.setThreadLocal(current);
SecurityContextHolder.setContext(originalContext);
original.handle(request, response);

View file

@ -36,7 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
/**
* Bootstrapt to create the default {@link User Users}.
* Bootstrap to create the default {@link User Users}.
*
* @author Fernando Bellas Permuy <fbellas@udc.es>
* @author Manuel Rego Casasnovas <rego@igalia.com>
@ -63,11 +63,15 @@ public class UsersBootstrapInDB implements IUsersBootstrapInDB {
@Override
public void loadRequiredData() {
if (userDAO.list(User.class).isEmpty()) {
if ( userDAO.list(User.class).isEmpty() ) {
for (PredefinedUsers u : PredefinedUsers.values()) {
User user = User.create(u.getLoginName(),
getEncodedPassword(u), u.getInitialRoles(),
User user = User.create(
u.getLoginName(),
getEncodedPassword(u),
u.getInitialRoles(),
getProfiles(u.getInitialProfiles()));
user.setDisabled(u.isUserDisabled());
userDAO.save(user);
@ -77,7 +81,7 @@ public class UsersBootstrapInDB implements IUsersBootstrapInDB {
}
private Set<Profile> getProfiles(Set<PredefinedProfiles> initialProfiles) {
Set<Profile> profiles = new HashSet<Profile>();
Set<Profile> profiles = new HashSet<>();
for (PredefinedProfiles each : initialProfiles) {
try {
profiles.add(profileDAO.findByProfileName(each.getName()));
@ -85,13 +89,13 @@ public class UsersBootstrapInDB implements IUsersBootstrapInDB {
throw new RuntimeException(e);
}
}
return profiles;
}
private String getEncodedPassword(PredefinedUsers u) {
return dbPasswordEncoderService.encodePassword(u.getClearPassword(),
u.getLoginName());
return dbPasswordEncoderService.encodePassword(u.getClearPassword(), u.getLoginName());
}

View file

@ -27,8 +27,7 @@ import org.springframework.security.core.AuthenticationException;
public class AuthenticationProviderLoggingDecorator implements AuthenticationProvider {
private static final Log LOG = LogFactory
.getLog(AuthenticationProviderLoggingDecorator.class);
private static final Log LOG = LogFactory.getLog(AuthenticationProviderLoggingDecorator.class);
private AuthenticationProvider decoratedProvider;
@ -41,22 +40,20 @@ public class AuthenticationProviderLoggingDecorator implements AuthenticationPro
}
@Override
public Authentication authenticate(Authentication authentication)
throws AuthenticationException {
Object principal = authentication != null ? authentication
.getPrincipal() : null;
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Object principal = authentication != null ? authentication.getPrincipal() : null;
LOG.info("trying to authenticate " + principal);
try {
Authentication result = decoratedProvider
.authenticate(authentication);
if (result != null) {
LOG.info("successful authentication for: " + principal
+ " with provider: " + decoratedProvider);
Authentication result = decoratedProvider.authenticate(authentication);
if ( result != null ) {
LOG.info("successful authentication for: " + principal + " with provider: " + decoratedProvider);
}
return result;
} catch (AuthenticationException e) {
LOG.info("unsuccessful authentication of " + principal
+ " with provider: " + decoratedProvider);
LOG.info("unsuccessful authentication of " + principal + " with provider: " + decoratedProvider);
throw e;
}
}

View file

@ -30,15 +30,17 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
/**
* For maximum flexibility, the implementation uses the password encoder and
* the salt source configured in the Spring Security configuration file (in
* consequence, it is possible to change the configuration to use any password
* encoder and/or salt source without modifying the implementation of this
* service). The only restriction the implementation imposes is that when using
* a reflection-based salt source, the "username" property must be specified.
* For maximum flexibility, the implementation uses the password encoder and the salt source
* configured in the Spring Security configuration file
* (in consequence, it is possible to change the configuration to use any password encoder and/or salt source
* without modifying the implementation of this service).
*
* The only restriction the implementation imposes is that
* when using a reflection-based salt source, the "username" property must be specified.
*
* @author Fernando Bellas Permuy <fbellas@udc.es>
*/
// TODO resolve deprecated
public class DBPasswordEncoderService implements IDBPasswordEncoderService {
private SaltSource saltSource;
@ -67,12 +69,12 @@ public class DBPasswordEncoderService implements IDBPasswordEncoderService {
* "ReflectionSaltSource". Note that "SystemWideSaltSource" ignores
* the "user" passed as a parameter to "saltSource.getSalt".
*/
UserDetails userDetails = new User(loginName, clearPassword, true,
true, true, true, Collections.<GrantedAuthority>emptyList());
UserDetails userDetails =
new User(loginName, clearPassword, true, true, true, true, Collections.<GrantedAuthority>emptyList());
Object salt = null;
if (saltSource != null) {
if ( saltSource != null ) {
salt = saltSource.getSalt(userDetails);
}

View file

@ -35,7 +35,7 @@ import org.libreplan.business.users.entities.UserRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@ -56,39 +56,36 @@ public class DBUserDetailsService implements UserDetailsService {
@Override
@Transactional(readOnly=true)
public UserDetails loadUserByUsername(String loginName)
throws UsernameNotFoundException, DataAccessException {
public UserDetails loadUserByUsername(String loginName) throws UsernameNotFoundException, DataAccessException {
User user;
try {
user = userDAO.findByLoginName(loginName);
} catch (InstanceNotFoundException e) {
throw new UsernameNotFoundException(MessageFormat.format(
"User with username {0}: not found", loginName));
throw new UsernameNotFoundException(MessageFormat.format("User with username {0}: not found", loginName));
}
Scenario scenario = user.getLastConnectedScenario();
if (scenario == null) {
if ( scenario == null ) {
scenario = PredefinedScenarios.MASTER.getScenario();
}
return new CustomUser(
user.getLoginName(),
user.getPassword(),
user.getLoginName(), user.getPassword(),
!user.isDisabled(),
true, // accountNonExpired
true, // credentialsNonExpired
true, // accountNonLocked
getGrantedAuthorities(user.getAllRoles()),
scenario);
getGrantedAuthorities(user.getAllRoles()), scenario);
}
private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) {
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
List<GrantedAuthority> result = new ArrayList<>();
for (UserRole r : roles) {
result.add(new GrantedAuthorityImpl(r.name()));
result.add(new SimpleGrantedAuthority(r.name()));
}
return result;
}

View file

@ -58,8 +58,8 @@ import org.springframework.transaction.annotation.Transactional;
* An extending from AbstractUserDetailsAuthenticationProvider class which is
* used to implement the authentication against LDAP.
*
* This provider implements the process explained in <https
* ://wiki.libreplan.org/twiki/bin/view/LibrePlan/AnA04S06LdapAuthentication>
* This provider implements the process explained in
* <https://wiki.libreplan.org/twiki/bin/view/LibrePlan/AnA04S06LdapAuthentication>
*
* At this time it authenticates user against LDAP and then searches it in BD to
* use the BD user in application.
@ -68,9 +68,10 @@ import org.springframework.transaction.annotation.Transactional;
* @author Cristina Alvarino Perez <cristina.alvarino@comtecsf.es>
*
*/
public class LDAPCustomAuthenticationProvider extends
AbstractUserDetailsAuthenticationProvider implements
AuthenticationProvider {
// TODO resolve deprecated methods
public class LDAPCustomAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider
implements AuthenticationProvider {
@Autowired
private IAdHocTransactionService transactionService;
@ -94,41 +95,36 @@ public class LDAPCustomAuthenticationProvider extends
private static final String USER_ID_SUBSTITUTION = "[USER_ID]";
private static final Log LOG = LogFactory
.getLog(LDAPCustomAuthenticationProvider.class);
private static final Log LOG = LogFactory.getLog(LDAPCustomAuthenticationProvider.class);
/**
* LDAP role matching could be configured using an asterix (*) to specify
* all users or groups
* LDAP role matching could be configured using an asterix (*)
* to specify all users or groups
*/
private static final String WILDCHAR_ALL = "*";
@Override
protected void additionalAuthenticationChecks(UserDetails arg0,
UsernamePasswordAuthenticationToken arg1)
protected void additionalAuthenticationChecks(UserDetails arg0, UsernamePasswordAuthenticationToken arg1)
throws AuthenticationException {
// No needed at this time
}
@Transactional(readOnly = true)
@Override
public UserDetails retrieveUser(String username,
UsernamePasswordAuthenticationToken authentication)
public UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication)
throws AuthenticationException {
String clearPassword = authentication.getCredentials().toString();
if (StringUtils.isBlank(username) || StringUtils.isBlank(clearPassword)) {
throw new BadCredentialsException(
"Username and password can not be empty");
if ( StringUtils.isBlank(username) || StringUtils.isBlank(clearPassword) ) {
throw new BadCredentialsException("Username and password can not be empty");
}
String encodedPassword = passwordEncoderService.encodePassword(
clearPassword, username);
String encodedPassword = passwordEncoderService.encodePassword(clearPassword, username);
User user = getUserFromDB(username);
// If user != null then exists in LibrePlan
if (null != user && user.isLibrePlanUser()) {
if ( null != user && user.isLibrePlanUser() ) {
// is a LibrePlan user, then we must authenticate against DB
return authenticateInDatabase(username, user, encodedPassword);
}
@ -137,36 +133,39 @@ public class LDAPCustomAuthenticationProvider extends
// Load LDAPConfiguration properties
configuration = loadLDAPConfiguration();
if (configuration.getLdapAuthEnabled()) {
if ( configuration.getLdapAuthEnabled() ) {
// Sets the new context to ldapTemplate
ldapTemplate.setContextSource(loadLDAPContext());
try {
// Test authentication for user against LDAP
if (authenticateAgainstLDAP(username, clearPassword)) {
if ( authenticateAgainstLDAP(username, clearPassword) ) {
// Authentication against LDAP was ok
if (null == user) {
if ( null == user ) {
// User does not exist in LibrePlan must be imported
user = createLDAPUserWithRoles(username, encodedPassword);
} else {
// Update password
if (configuration.isLdapSavePasswordsDB()) {
if ( configuration.isLdapSavePasswordsDB() ) {
user.setPassword(encodedPassword);
}
// Update roles from LDAP
setRoles(user);
}
saveUserOnTransaction(user);
return loadUserDetails(username);
} else {
throw new BadCredentialsException("User is not in LDAP.");
}
} catch (Exception e) {
// This exception captures when LDAP authentication is not
// possible
LOG.info(
"LDAP not reachable. Trying to authenticate against database.",
e);
// This exception captures when LDAP authentication is not possible
LOG.info("LDAP not reachable. Trying to authenticate against database.", e);
}
}
@ -179,10 +178,9 @@ public class LDAPCustomAuthenticationProvider extends
}
private void setRoles(User user) {
if (configuration.getLdapSaveRolesDB()) {
if ( configuration.getLdapSaveRolesDB() ) {
user.clearRoles();
List<String> roles = getMatchedRoles(configuration, ldapTemplate,
user.getLoginName());
List<String> roles = getMatchedRoles(configuration, user.getLoginName());
for (String role : roles) {
user.addRole(UserRole.valueOf(UserRole.class, role));
}
@ -192,58 +190,56 @@ public class LDAPCustomAuthenticationProvider extends
private User createLDAPUserWithRoles(String username, String encodedPassword) {
User user = User.create();
user.setLoginName(username);
// we must check if it is needed to save LDAP
// passwords in DB
if (!configuration.isLdapSavePasswordsDB()) {
// we must check if it is needed to save LDAP passwords in DB
if ( !configuration.isLdapSavePasswordsDB() ) {
encodedPassword = null;
}
user.setPassword(encodedPassword);
user.setLibrePlanUser(false);
user.setDisabled(false);
setRoles(user);
return user;
}
private LDAPConfiguration loadLDAPConfiguration() {
return transactionService
.runOnReadOnlyTransaction(new IOnTransaction<LDAPConfiguration>() {
@Override
public LDAPConfiguration execute() {
return configurationDAO.getConfiguration()
.getLdapConfiguration();
}
});
return transactionService.runOnReadOnlyTransaction(new IOnTransaction<LDAPConfiguration>() {
@Override
public LDAPConfiguration execute() {
return configurationDAO.getConfiguration().getLdapConfiguration();
}
});
}
private User getUserFromDB(String username) {
final String usernameInserted = username;
return transactionService
.runOnReadOnlyTransaction(new IOnTransaction<User>() {
@Override
public User execute() {
try {
return userDAO.findByLoginName(usernameInserted);
} catch (InstanceNotFoundException e) {
LOG.info("User " + usernameInserted
+ " not found in database.");
return null;
}
}
});
return transactionService.runOnReadOnlyTransaction(new IOnTransaction<User>() {
@Override
public User execute() {
try {
return userDAO.findByLoginName(usernameInserted);
} catch (InstanceNotFoundException e) {
LOG.info("User " + usernameInserted + " not found in database.");
return null;
}
}
});
}
private LDAPCustomContextSource loadLDAPContext() {
// Establishes the context for LDAP connection.
LDAPCustomContextSource context = (LDAPCustomContextSource) ldapTemplate
.getContextSource();
context.setUrl(configuration.getLdapHost() + COLON
+ configuration.getLdapPort());
LDAPCustomContextSource context = (LDAPCustomContextSource) ldapTemplate.getContextSource();
context.setUrl(configuration.getLdapHost() + COLON + configuration.getLdapPort());
context.setBase(configuration.getLdapBase());
context.setUserDn(configuration.getLdapUserDn());
context.setPassword(configuration.getLdapPassword());
try {
context.afterPropertiesSet();
} catch (Exception e) {
@ -251,83 +247,83 @@ public class LDAPCustomAuthenticationProvider extends
// properties are well-formed.
LOG.error("There is a problem in LDAP connection: ", e);
}
return context;
}
private boolean authenticateAgainstLDAP(String username,
String clearPassword) {
return ldapTemplate.authenticate(DistinguishedName.EMPTY_PATH,
new EqualsFilter(configuration.getLdapUserId(), username)
.toString(), clearPassword);
private boolean authenticateAgainstLDAP(String username, String clearPassword) {
return ldapTemplate.authenticate(
DistinguishedName.EMPTY_PATH,
new EqualsFilter(configuration.getLdapUserId(), username).toString(),
clearPassword);
}
private void saveUserOnTransaction(User user) {
final User userLibrePlan = user;
transactionService.runOnTransaction(new IOnTransaction<Void>() {
@Override
public Void execute() {
userDAO.save(userLibrePlan);
return null;
}
});
}
private UserDetails authenticateInDatabase(String username, User user,
String encodedPassword) {
if (null != user && null != user.getPassword()
&& encodedPassword.equals(user.getPassword())) {
private UserDetails authenticateInDatabase(String username, User user, String encodedPassword) {
if ( null != user && null != user.getPassword() && encodedPassword.equals(user.getPassword()) ) {
return loadUserDetails(username);
} else {
throw new BadCredentialsException(
"Credentials are not the same as in database.");
throw new BadCredentialsException("Credentials are not the same as in database.");
}
}
@SuppressWarnings("unchecked")
private List<String> getRolesUsingNodeStrategy(
Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles,
final LDAPConfiguration configuration) {
Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles, final LDAPConfiguration configuration) {
String roleProperty = configuration.getLdapRoleProperty();
List<String> rolesReturn = new ArrayList<String>();
List<String> rolesReturn = new ArrayList<>();
for (ConfigurationRolesLDAP roleLDAP : rolesLdap) {
if (roleLDAP.getRoleLdap().equals(WILDCHAR_ALL)) {
if ( roleLDAP.getRoleLdap().equals(WILDCHAR_ALL) ) {
rolesReturn.add(roleLDAP.getRoleLibreplan());
continue;
}
// We must make a search for each role-matching in nodes
List<Attribute> resultsSearch = new ArrayList<Attribute>();
List<Attribute> resultsSearch = new ArrayList<>();
resultsSearch.addAll(ldapTemplate.search(
DistinguishedName.EMPTY_PATH, new EqualsFilter(
roleProperty, roleLDAP.getRoleLdap()).toString(),
DistinguishedName.EMPTY_PATH,
new EqualsFilter(roleProperty, roleLDAP.getRoleLdap()).toString(),
new AttributesMapper() {
@Override
public Object mapFromAttributes(Attributes attributes)
throws NamingException {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
return attributes.get(configuration.getLdapUserId());
}
}));
for (Attribute atrib : resultsSearch) {
if (atrib.contains(queryRoles)) {
if ( atrib.contains(queryRoles) ) {
rolesReturn.add(roleLDAP.getRoleLibreplan());
}
}
}
return rolesReturn;
}
private List<String> getRolesUsingBranchStrategy(
Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles,
LDAPConfiguration configuration) {
Set<ConfigurationRolesLDAP> rolesLdap, String queryRoles, LDAPConfiguration configuration) {
String roleProperty = configuration.getLdapRoleProperty();
String groupsPath = configuration.getLdapGroupPath();
List<String> rolesReturn = new ArrayList<String>();
List<String> rolesReturn = new ArrayList<>();
for (ConfigurationRolesLDAP roleLdap : rolesLdap) {
if (roleLdap.getRoleLdap().equals(WILDCHAR_ALL)) {
if ( roleLdap.getRoleLdap().equals(WILDCHAR_ALL) ) {
rolesReturn.add(roleLdap.getRoleLibreplan());
continue;
}
@ -335,48 +331,41 @@ public class LDAPCustomAuthenticationProvider extends
// We must make a search for each role matching
DirContextAdapter adapter = null;
try {
adapter = (DirContextAdapter) ldapTemplate
.lookup(roleLdap.getRoleLdap() + "," + groupsPath);
adapter = (DirContextAdapter) ldapTemplate.lookup(roleLdap.getRoleLdap() + "," + groupsPath);
} catch (org.springframework.ldap.NamingException ne) {
LOG.error(ne.getMessage());
}
if (adapter != null && adapter.attributeExists(roleProperty)) {
if ( adapter != null && adapter.attributeExists(roleProperty) ) {
Attributes atrs = adapter.getAttributes();
if (atrs.get(roleProperty).contains(queryRoles)) {
if ( atrs.get(roleProperty).contains(queryRoles) ) {
rolesReturn.add(roleLdap.getRoleLibreplan());
}
}
}
return rolesReturn;
}
private List<String> getMatchedRoles(LDAPConfiguration configuration,
LdapTemplate ldapTemplate, String username) {
private List<String> getMatchedRoles(LDAPConfiguration configuration, String username) {
String queryRoles = configuration.getLdapSearchQuery().replace(
USER_ID_SUBSTITUTION, username);
String queryRoles = configuration.getLdapSearchQuery().replace(USER_ID_SUBSTITUTION, username);
Set<ConfigurationRolesLDAP> rolesLdap = configuration
.getConfigurationRolesLdap();
Set<ConfigurationRolesLDAP> rolesLdap = configuration.getConfigurationRolesLdap();
try {
if (!configuration.getLdapGroupStrategy()) {
if ( !configuration.getLdapGroupStrategy() ) {
// The LDAP has a node strategy for groups,
// we must check the roleProperty in user node.
return getRolesUsingNodeStrategy(rolesLdap, queryRoles,
configuration);
return getRolesUsingNodeStrategy(rolesLdap, queryRoles, configuration);
} else {
// The LDAP has a branch strategy for groups
// we must check if the user is in one of the groups.
return getRolesUsingBranchStrategy(rolesLdap, queryRoles,
configuration);
return getRolesUsingBranchStrategy(rolesLdap, queryRoles, configuration);
}
} catch (Exception e) {
LOG.error(
"Configuration of LDAP role-matching is wrong. Please check it.",
e);
LOG.error("Configuration of LDAP role-matching is wrong. Please check it.", e);
return Collections.emptyList();
}
}
@ -385,8 +374,7 @@ public class LDAPCustomAuthenticationProvider extends
return passwordEncoderService;
}
public void setPasswordEncoderService(
DBPasswordEncoderService passwordEncoderService) {
public void setPasswordEncoderService(DBPasswordEncoderService passwordEncoderService) {
this.passwordEncoderService = passwordEncoderService;
}

View file

@ -32,7 +32,7 @@ import org.libreplan.business.users.entities.UserRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@ -55,38 +55,40 @@ public class LDAPUserDetailsService implements UserDetailsService {
@Override
@Transactional(readOnly = true)
public UserDetails loadUserByUsername(String loginName)
throws UsernameNotFoundException, DataAccessException {
public UserDetails loadUserByUsername(String loginName) throws UsernameNotFoundException, DataAccessException {
User user;
try {
user = userDAO.findByLoginName(loginName);
} catch (InstanceNotFoundException e) {
throw new UsernameNotFoundException(MessageFormat.format(
"User with username {0}: not found", loginName));
throw new UsernameNotFoundException(MessageFormat.format("User with username {0}: not found", loginName));
}
Scenario scenario = user.getLastConnectedScenario();
if (scenario == null) {
if ( scenario == null ) {
scenario = PredefinedScenarios.MASTER.getScenario();
}
String password = user.getPassword();
if (null == password)
if ( null == password )
password = "foo";
return new CustomUser(user.getLoginName(), password,
!user.isDisabled(), true, // accountNonExpired
return new CustomUser(
user.getLoginName(), password,
!user.isDisabled(),
true, // accountNonExpired
true, // credentialsNonExpired
true, // accountNonLocked
getGrantedAuthorities(user.getAllRoles()), scenario);
}
private List<GrantedAuthority> getGrantedAuthorities(Set<UserRole> roles) {
List<GrantedAuthority> result = new ArrayList<GrantedAuthority>();
List<GrantedAuthority> result = new ArrayList<>();
for (UserRole r : roles) {
result.add(new GrantedAuthorityImpl(r.name()));
result.add(new SimpleGrantedAuthority(r.name()));
}
return result;
}
}

View file

@ -11,7 +11,7 @@
# Lorenzo Tilve Álvaro <ltilve@igalia.com>, 2013.
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 11:52+0000\n"

View file

@ -11,7 +11,7 @@
# Philippe Poumaroux <philippe.poumaroux@free.fr>, 2012-2013.
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-28 16:59+0000\n"

View file

@ -10,7 +10,7 @@
# Lorenzo Tilve Álvaro <ltilve@igalia.com>, 2013.
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 17:54+0000\n"

View file

@ -8,7 +8,7 @@
# Giuseppe Zizza <gzizza@gmail.com>, 2012.
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.4\6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 14:14+0000\n"

View file

@ -7,7 +7,7 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"

View file

@ -8,7 +8,7 @@
# Jeroen Baten <jeroen@jeroenbaten.nl>, 2012-2013.
msgid ""
msgstr ""
"Project-Id-Version: libreplan-1.4.0\n"
"Project-Id-Version: libreplan-1.6.0\n"
"Report-Msgid-Bugs-To: http://bugs.libreplan.org/\n"
"POT-Creation-Date: 2013-04-22 12:09+0200\n"
"PO-Revision-Date: 2013-04-22 11:54+0000\n"

View file

@ -1,61 +1,56 @@
<?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:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
<!--
For enabling annotation-based configuration (in particular,
required for "@Autowired")
-->
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<!-- For enabling annotation-based configuration (in particular, required for "@Autowired") -->
<context:annotation-config />
<bean id="aspect" class="org.libreplan.web.common.concurrentdetection.ConcurrentModificationHandling">
</bean>
<bean id="aspect" class="org.libreplan.web.common.concurrentdetection.ConcurrentModificationHandling" />
<bean class="org.libreplan.web.common.entrypoints.RedirectorSynthetiser"></bean>
<bean class="org.libreplan.web.common.entrypoints.RedirectorSynthetiser"/>
<bean id="ordersMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.OrdersMultipleFiltersFinder" scope="singleton" />
<bean id="ordersMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.OrdersMultipleFiltersFinder"/>
<bean id="taskGroupsMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.TaskGroupsMultipleFiltersFinder" scope="singleton" />
<bean id="taskGroupsMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.TaskGroupsMultipleFiltersFinder"/>
<bean id="orderElementsMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.OrderElementsMultipleFiltersFinder" scope="singleton"/>
<bean id="orderElementsMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.OrderElementsMultipleFiltersFinder"/>
<bean id="taskElementsMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.TaskElementsMultipleFiltersFinder" scope="singleton" />
<bean id="taskElementsMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.TaskElementsMultipleFiltersFinder"/>
<bean id="resourcesMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.ResourcesMultipleFiltersFinder" scope="singleton" />
<bean id="resourcesMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.ResourcesMultipleFiltersFinder"/>
<bean id="limitingResourceAllocationMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.LimitingResourceAllocationMultipleFiltersFinder" scope="singleton"/>
<bean id="limitingResourceAllocationMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.LimitingResourceAllocationMultipleFiltersFinder"/>
<bean id="nonLimitingResourceAllocationMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.NonLimitingResourceAllocationMultipleFiltersFinder" scope="singleton" />
<bean id="nonLimitingResourceAllocationMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.NonLimitingResourceAllocationMultipleFiltersFinder"/>
<bean id="resourceMultipleFiltersFinderByResourceAndCriterion" class="org.libreplan.web.common.components.finders.ResourceMultipleFiltersFinderByResourceAndCriterion" scope="singleton"/>
<bean id="resourceMultipleFiltersFinderByResourceAndCriterion"
class="org.libreplan.web.common.components.finders.ResourceMultipleFiltersFinderByResourceAndCriterion"/>
<bean id="criterionMultipleFiltersFinder" class="org.libreplan.web.common.components.finders.CriterionMultipleFiltersFinder" scope="singleton"/>
<bean id="criterionMultipleFiltersFinder"
class="org.libreplan.web.common.components.finders.CriterionMultipleFiltersFinder"/>
<bean id="scenarioManager"
class="org.libreplan.web.scenarios.CurrentUserScenarioAwareManager"
scope="singleton"/>
<bean id="scenarioManager" class="org.libreplan.web.scenarios.CurrentUserScenarioAwareManager"/>
<!-- Scheduler -->
<bean id="schedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false" />
<bean id="schedulerFactoryBean"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean" lazy-init="false" />
<bean id="schedulerManager"
class="org.libreplan.importers.SchedulerManager"
scope="singleton"
init-method="scheduleJobs">
<bean id="schedulerManager" class="org.libreplan.importers.SchedulerManager" init-method="scheduleJobs">
<property name="scheduler" ref="schedulerFactoryBean"/>
</bean>

View file

@ -4,150 +4,144 @@
xmlns:beans="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
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.1.xsd">
<!-- NOTE: see http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/vote/AuthenticatedVoter.html
for an explanation of the meaning of IS_AUTHENTICATED_ANONYMOUSLY and IS_AUTHENTICATED_FULLY. -->
<!--
NOTE: see
<http auto-config="false" realm="LibrePlan Web Application">
http://static.springsource.org/spring-security/site/docs/2.0.x/apidocs/org/springframework/security/vote/AuthenticatedVoter.html
for an explanation of the meaning of IS_AUTHENTICATED_ANONYMOUSLY and IS_AUTHENTICATED_FULLY. -->
<http auto-config="false" realm="LibrePlan Web Application" >
<!-- Web services -->
<intercept-url pattern="/ws/rest/bounduser/**"
access="ROLE_BOUND_USER"
method="GET" />
<intercept-url pattern="/ws/rest/bounduser/**"
access="ROLE_BOUND_USER"
method="POST" />
<intercept-url pattern="/ws/rest/subcontracting/**"
access="ROLE_WS_SUBCONTRACTING"
method="GET" />
<intercept-url pattern="/ws/rest/subcontracting/**"
access="ROLE_WS_SUBCONTRACTING"
method="POST" />
<intercept-url pattern="/ws/rest/**"
access="ROLE_WS_READER"
method="GET" />
<intercept-url pattern="/ws/rest/**"
access="ROLE_WS_WRITER"
method="POST" />
<intercept-url pattern="/ws/rest/**"
access="ROLE_WS_WRITER"
method="DELETE" />
<intercept-url pattern="/ws/rest/bounduser/**" access="ROLE_BOUND_USER" method="GET" />
<intercept-url pattern="/ws/rest/bounduser/**" access="ROLE_BOUND_USER" method="POST" />
<intercept-url pattern="/ws/rest/subcontracting/**" access="ROLE_WS_SUBCONTRACTING" method="GET" />
<intercept-url pattern="/ws/rest/subcontracting/**" access="ROLE_WS_SUBCONTRACTING" method="POST" />
<intercept-url pattern="/ws/rest/**" access="ROLE_WS_READER" method="GET" />
<intercept-url pattern="/ws/rest/**" access="ROLE_WS_WRITER" method="POST" />
<intercept-url pattern="/ws/rest/**" access="ROLE_WS_WRITER" method="DELETE" />
<!-- Web application -->
<intercept-url pattern="/common/img/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/common/css/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/planner/css/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/callback/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/zkau/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/help/**"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/common/layout/login.zul"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/common/layout/timeout.zul"
access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/common/img/**" access="permitAll" />
<intercept-url pattern="/common/css/**" access="permitAll" />
<intercept-url pattern="/planner/css/**" access="permitAll" />
<intercept-url pattern="/callback/**" access="permitAll" />
<intercept-url pattern="/zkau/**" access="permitAll" />
<intercept-url pattern="/help/**" access="permitAll" />
<intercept-url pattern="/common/layout/login.zul" access="isAnonymous()" />
<intercept-url pattern="/common/layout/timeout.zul" access="permitAll" />
<!-- Pages -->
<intercept-url pattern="/templates/*"
access="ROLE_SUPERUSER,ROLE_TEMPLATES" />
<intercept-url pattern="/email/*"
access="ROLE_SUPERUSER"/>
<intercept-url pattern="/resources/worker/worker.zul"
access="ROLE_SUPERUSER,ROLE_WORKERS" />
<intercept-url pattern="/resources/machine/*"
access="ROLE_SUPERUSER,ROLE_MACHINES" />
<intercept-url pattern="/templates/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TEMPLATES')" />
<intercept-url pattern="/email/*" access="ROLE_SUPERUSER"/>
<intercept-url pattern="/resources/worker/worker.zul" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_WORKERS')" />
<intercept-url pattern="/resources/machine/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MACHINES')" />
<intercept-url pattern="/resources/worker/virtualWorkers.zul"
access="ROLE_SUPERUSER,ROLE_VIRTUAL_WORKERS" />
<intercept-url pattern="/calendars/*"
access="ROLE_SUPERUSER,ROLE_CALENDARS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_VIRTUAL_WORKERS')" />
<intercept-url pattern="/calendars/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_CALENDARS')" />
<intercept-url pattern="/excetiondays/*"
access="ROLE_SUPERUSER,ROLE_CALENDAR_EXCEPTION_DAYS" />
<intercept-url pattern="/resources/criterions/*"
access="ROLE_SUPERUSER,ROLE_CRITERIA" />
<intercept-url pattern="/advance/*"
access="ROLE_SUPERUSER,ROLE_PROGRESS_TYPES" />
<intercept-url pattern="/labels/*"
access="ROLE_SUPERUSER,ROLE_LABELS" />
<intercept-url pattern="/materials/*"
access="ROLE_SUPERUSER,ROLE_MATERIALS" />
<intercept-url pattern="/unittypes/*"
access="ROLE_SUPERUSER,ROLE_MATERIAL_UNITS" />
<intercept-url pattern="/qualityforms/*"
access="ROLE_SUPERUSER,ROLE_QUALITY_FORMS" />
<intercept-url pattern="/workreports/workReport.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEETS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_CALENDAR_EXCEPTION_DAYS')" />
<intercept-url pattern="/resources/criterions/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_CRITERIA')" />
<intercept-url pattern="/advance/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROGRESS_TYPES')" />
<intercept-url pattern="/labels/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_LABELS')" />
<intercept-url pattern="/materials/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MATERIALS')" />
<intercept-url pattern="/unittypes/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MATERIAL_UNITS')" />
<intercept-url pattern="/qualityforms/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_QUALITY_FORMS')" />
<intercept-url pattern="/workreports/workReport.zul" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS')" />
<intercept-url pattern="/workreports/workReportTypes.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEETS_TEMPLATES" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS_TEMPLATES')" />
<intercept-url pattern="/expensesheet/*"
access="ROLE_SUPERUSER,ROLE_EXPENSES,ROLE_BOUND_USER" />
<intercept-url pattern="/costcategories/*"
access="ROLE_SUPERUSER,ROLE_COST_CATEGORIES" />
<intercept-url pattern="/typeofworkhours/*"
access="ROLE_SUPERUSER,ROLE_HOURS_TYPES" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_EXPENSES', 'ROLE_BOUND_USER')" />
<intercept-url pattern="/costcategories/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_COST_CATEGORIES')" />
<intercept-url pattern="/typeofworkhours/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_HOURS_TYPES')" />
<intercept-url pattern="/common/configuration.zul"
access="ROLE_SUPERUSER,ROLE_MAIN_SETTINGS" />
<intercept-url pattern="/users/*"
access="ROLE_SUPERUSER,ROLE_USER_ACCOUNTS" />
<intercept-url pattern="/profiles/*"
access="ROLE_SUPERUSER,ROLE_PROFILES" />
<intercept-url pattern="/externalcompanies/*"
access="ROLE_SUPERUSER,ROLE_COMPANIES" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MAIN_SETTINGS')" />
<intercept-url pattern="/users/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_USER_ACCOUNTS')" />
<intercept-url pattern="/profiles/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROFILES')" />
<intercept-url pattern="/externalcompanies/*" access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_COMPANIES')" />
<intercept-url pattern="/subcontract/subcontractedTasks.zul"
access="ROLE_SUPERUSER,ROLE_SEND_TO_SUBCONTRACTORS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_SEND_TO_SUBCONTRACTORS')" />
<intercept-url pattern="/subcontract/subcontractorCommunications.zul"
access="ROLE_SUPERUSER,ROLE_RECEIVED_FROM_SUBCONTRACTORS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_RECEIVED_FROM_SUBCONTRACTORS')" />
<intercept-url pattern="/subcontract/reportAdvances.zul"
access="ROLE_SUPERUSER,ROLE_SEND_TO_CUSTOMERS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_SEND_TO_CUSTOMERS')" />
<intercept-url pattern="/subcontract/customerCommunications.zul"
access="ROLE_SUPERUSER,ROLE_RECEIVED_FROM_CUSTOMERS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_RECEIVED_FROM_CUSTOMERS')" />
<intercept-url pattern="/workreports/workReportQuery.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEET_LINES_LIST" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEET_LINES_LIST')" />
<intercept-url pattern="/reports/hoursWorkedPerWorkerReport.zul"
access="ROLE_SUPERUSER,ROLE_HOURS_WORKED_PER_RESOURCE_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_HOURS_WORKED_PER_RESOURCE_REPORT')" />
<intercept-url pattern="/reports/hoursWorkedPerWorkerInAMonthReport.zul"
access="ROLE_SUPERUSER,ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TOTAL_WORKED_HOURS_BY_RESOURCE_IN_A_MONTH_REPORT')" />
<intercept-url pattern="/reports/schedulingProgressPerOrderReport.zul"
access="ROLE_SUPERUSER,ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_WORK_AND_PROGRESS_PER_PROJECT_REPORT')" />
<intercept-url pattern="/reports/workingProgressPerTaskReport.zul"
access="ROLE_SUPERUSER,ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_WORK_AND_PROGRESS_PER_TASK_REPORT')" />
<intercept-url pattern="/reports/completedEstimatedHoursPerTask.zul"
access="ROLE_SUPERUSER,ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_ESTIMATED_PLANNED_HOURS_PER_TASK_REPORT')" />
<intercept-url pattern="/reportsorderCostsPerResource/.zul"
access="ROLE_SUPERUSER,ROLE_PROJECT_COSTS_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_PROJECT_COSTS_REPORT')" />
<intercept-url pattern="/reports/workingArrangementsPerOrderReport.zul"
access="ROLE_SUPERUSER,ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TASK_SCHEDULING_STATUS_IN_PROJECT_REPORT')" />
<intercept-url pattern="/reports/timeLineMaterialReport.zul"
access="ROLE_SUPERUSER,ROLE_MATERIALS_NEED_AT_DATE_REPORT" />
<intercept-url pattern="/myaccount/userDashboard.zul"
access="ROLE_BOUND_USER" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_MATERIALS_NEED_AT_DATE_REPORT')" />
<intercept-url pattern="/myaccount/userDashboard.zul" access="ROLE_BOUND_USER" />
<intercept-url pattern="/myaccount/monthlyTimesheet.zul"
access="ROLE_SUPERUSER,ROLE_TIMESHEETS,ROLE_BOUND_USER" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_TIMESHEETS', 'ROLE_BOUND_USER')" />
<intercept-url pattern="/orders/imports/projectImport.zul"
access="ROLE_SUPERUSER,ROLE_IMPORT_PROJECTS" />
access="hasAnyRole('ROLE_SUPERUSER', 'ROLE_IMPORT_PROJECTS')" />
<intercept-url pattern="/**" access="IS_AUTHENTICATED_FULLY" />
<intercept-url pattern="/**" access="isFullyAuthenticated()" />
<!-- These have been added because of auto-config is false now in order
to use a custom authentication filter.
See: http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ns-config.html#ns-auto-config -->
<!--
These have been added because of auto-config is false now in order to use a custom authentication filter.
See: http://static.springsource.org/spring-security/site/docs/2.0.x/reference/ns-config.html#ns-auto-config
-->
<anonymous />
<form-login login-page="/common/layout/login.zul"
default-target-url="/common/index.zul"
authentication-failure-url="/common/layout/login.zul?login_error=true" />
<form-login
login-page="/common/layout/login.zul"
default-target-url="/common/index.zul"
authentication-failure-url="/common/layout/login.zul?login_error=true"
login-processing-url="/j_spring_security_check"
username-parameter="j_username"
password-parameter="j_password"/>
<http-basic />
<logout />
<remember-me />
<csrf disabled="true"/>
</http>
<!-- Beans used by Spring Security (current configuration assumes users
are registered in the database). -->
<!-- Beans used by Spring Security (current configuration assumes users are registered in the database). -->
<beans:bean id="passwordEncoder"
class="org.springframework.security.authentication.encoding.ShaPasswordEncoder">
<beans:constructor-arg value="512" />
@ -156,12 +150,11 @@
<beans:bean id="saltSource"
class="org.springframework.security.authentication.dao.ReflectionSaltSource"
p:userPropertyToUse="username" />
<!-- <beans:bean id="realAuthenticationProvider" class="org.springframework.security.providers.dao.DaoAuthenticationProvider"
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" p:userDetailsService-ref="dbUserDetailsService">
<custom-authentication-provider/> </beans:bean> -->
<!-- Beans used by the LibrePlan Web application when users are registered
in the database. When users are registered externally (e.g. in a LDAP server),
these lines may be commented. <beans:bean id="dbUserDetailsService" class="org.libreplan.web.users.services.DBUserDetailsService"/> -->
<!--
Beans used by the LibrePlan Web application when users are registered in the database.
When users are registered externally (e.g. in a LDAP server),these lines may be commented.
-->
<beans:bean id="dbPasswordEncoderService"
class="org.libreplan.web.users.services.DBPasswordEncoderService"
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" />
@ -169,10 +162,11 @@
<beans:bean id="usersBootstrapInDB"
class="org.libreplan.web.users.bootstrap.UsersBootstrapInDB"
p:dbPasswordEncoderService-ref="dbPasswordEncoderService" />
<!-- Beans used by the LibrePlan Web Application when users are registerd
in LDAP. At this moment users MUST be also in database with same username.
This will be changed in the near future. the url, base, userDN and password
properties must be set with the proper values -->
<!--
Beans used by the LibrePlan Web Application when users are registerd in LDAP.
At this moment users MUST be also in database with same username.
This will be changed in the near future.
The url, base, userDN and password properties must be set with the proper values -->
<beans:bean id="contextSource"
class="org.libreplan.web.users.services.LDAPCustomContextSource">
</beans:bean>
@ -182,10 +176,10 @@
p:contextSource-ref="contextSource">
</beans:bean>
<!-- This authentication provider will make possible all the login process
when an LDAP is used. Also will allow authenticate users in database. The
property strUserId must be set with the proper value. It represents the property
of the user in LDAP which will be used to check the username. -->
<!-- This authentication provider will make possible all the login process when an LDAP is used.
Also will allow authenticate users in database.
The property strUserId must be set with the proper value.
It represents the property of the user in LDAP which will be used to check the username. -->
<beans:bean id="realAuthenticationProvider"
class="org.libreplan.web.users.services.LDAPCustomAuthenticationProvider"
p:userDetailsService-ref="ldapUserDetailsService"
@ -195,13 +189,10 @@
<beans:bean id="authenticationProvider"
class="org.libreplan.web.users.services.AuthenticationProviderLoggingDecorator">
<beans:property name="decoratedProvider" ref="realAuthenticationProvider"/>
</beans:bean>
<!-- This bean is used to implement UserDetailsService with LDAP authentication
Provider. -->
<!-- This bean is used to implement UserDetailsService with LDAP authentication Provider -->
<beans:bean id="ldapUserDetailsService" class="org.libreplan.web.users.services.LDAPUserDetailsService" />
<authentication-manager>

View file

@ -5,10 +5,9 @@
<addon-name>libreplan-webapp</addon-name>
<language-name>xul/html</language-name>
<!-- When the version is changed, the browser will reload the
JavaScript modules. -->
<javascript-module name="webcommon" version="1.4.0" />
<javascript-module name="limitingresources" version="1.4.0" />
<!-- When the version is changed, the browser will reload the JavaScript modules -->
<javascript-module name="webcommon" version="1.6.0" />
<javascript-module name="limitingresources" version="1.6.0" />
<component>
<component-name>twowayselector</component-name>
@ -113,7 +112,6 @@
<mold>
<mold-name>default</mold-name>
<mold-uri>mold/queue-list-component.js</mold-uri>
<!-- <mold-uri>/limitingresources/queuelistcomponent.dsp</mold-uri> -->
</mold>
</component>
@ -123,14 +121,14 @@
<macro-uri>/limitingresources/leftPane.zul</macro-uri>
</component>
<!-- Limiting resources queue -->
<component>
<component-name>queuecomponent</component-name><!-- Limiting resources queue -->
<component-name>queuecomponent</component-name>
<component-class>org.libreplan.web.limitingresources.QueueComponent</component-class>
<widget-class>limitingresources.QueueComponent</widget-class>
<mold>
<mold-name>default</mold-name>
<mold-uri>mold/queue-component.js</mold-uri>
<!-- <mold-uri>/limitingresources/queuecomponent.dsp</mold-uri> -->
</mold>
</component>
@ -148,7 +146,6 @@
<mold>
<mold-name>default</mold-name>
<mold-uri>mold/limiting-dependency-list.js</mold-uri>
<!-- <mold-uri>/limitingresources/limitingdependencylist.dsp</mold-uri> -->
</mold>
</component>
@ -159,7 +156,6 @@
<mold>
<mold-name>default</mold-name>
<mold-uri>mold/limiting-dependency-component.js</mold-uri>
<!-- <mold-uri>/limitingresources/limitingdependency.dsp</mold-uri> -->
</mold>
</component>

View file

@ -5,11 +5,10 @@
<display-name>libreplan-webapp</display-name>
<!--
It searches all libreplan-business-spring-config.xml files, it can
found several. There must be at least one. It searches
libreplan-webapp-spring-config.xml. There must be just one. It
searches libreplan-override-spring-config.xml to override some
previous definitions. There could be several or none.
It searches all libreplan-business-spring-config.xml files, it can found several.
There must be at least one.
It searches libreplan-webapp-spring-config.xml.
There must be just one.
-->
<context-param>
<param-name>contextConfigLocation</param-name>
@ -21,7 +20,6 @@
</context-param>
<!-- /// -->
<!-- DSP -->
<servlet>
<description><![CDATA[The servlet loads the DSP pages.]]></description>
@ -42,7 +40,6 @@
<servlet-name>dspLoader</servlet-name>
<url-pattern>*.dsp</url-pattern>
</servlet-mapping>
<!-- /// -->
<!-- Spring security -->
<filter>
@ -55,7 +52,6 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- //// -->
<listener>
<listener-class>org.libreplan.web.LoggingConfiguration</listener-class>
</listener>
@ -75,7 +71,6 @@
<listener-class>
org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
<!-- end Spring listeners -->
<!-- Loads all IDataBootstrap and executes them -->
<listener>
@ -87,8 +82,8 @@
<servlet-name>zkLoader</servlet-name>
<servlet-class>org.zkoss.zk.ui.http.DHtmlLayoutServlet</servlet-class>
<!--
Must. Specifies URI of the update engine (DHtmlUpdateServlet). It
must be the same as <url-pattern> for the update engine.
Must specify URI of the update engine (DHtmlUpdateServlet).
It must be the same as <url-pattern> for the update engine.
-->
<init-param>
<param-name>update-uri</param-name>
@ -113,7 +108,6 @@
<servlet-name>auEngine</servlet-name>
<url-pattern>/zkau/*</url-pattern>
</servlet-mapping>
<!-- //// -->
<!-- CXF -->
<servlet>

View file

@ -1,11 +1,11 @@
<zk>
<log>
<log-base></log-base>
<log-base/>
</log>
<desktop-config>
<!-- seconds it takes between requests for a desktop to be invalidated -->
<!-- a timer is introduced to avoid invalidation of pages still open -->
<!-- Seconds it takes between requests for a desktop to be invalidated -->
<!-- A timer is introduced to avoid invalidation of pages still open -->
<desktop-timeout>30</desktop-timeout>
</desktop-config>

View file

@ -37,7 +37,6 @@ body {
.logo {
background-image: url("../img/v3/blue_ga.jpg");
height: 50px;
width: 300px;
height: 100px;
float: left;
@ -51,9 +50,9 @@ body {
}
table {
margin: 0px;
padding: 0px;
border: 0px;
margin: 0;
padding: 0;
border: 0;
}
.errorbox {
@ -75,10 +74,9 @@ body .z-window-embedded .icono .z-button-cm,
body .z-window-modal .icono .z-button-cm,
body .advancedallocationlayout .icono .z-button-cm {
color: #007bbe;
background-color: transparent;
background-image: none;
border: 0px solid #007bbe;
padding: 0px;
background: transparent none;
border: 0 solid #007bbe;
padding: 0;
}
@ -132,7 +130,7 @@ body .advancedallocationlayout .icono .z-button-cm {
.sub_menu .z-button-cm {
background-color: transparent !important;
border: 0px;
border: 0;
color: #EDF2F7;
}
@ -160,15 +158,14 @@ body .advancedallocationlayout .icono .z-button-cm {
.global-action.z-button .z-button-cm {
padding: 4px 25px !important;
background-position: 5px;
background-repeat: no-repeat;
background: no-repeat 5px;
margin-right: 1px;
}
.global-action.z-button .z-button-cm:active {
margin-right: 0px;
border-bottom: 0px;
border-right: 0px;
margin-right: 0;
border-bottom: 0;
border-right: 0;
}
.save-button.z-button .z-button-cm {
@ -217,11 +214,11 @@ body .advancedallocationlayout .icono .z-button-cm {
/* ------------- order element tree ------------- */
.orderTree input {
height: 18px;
border-bottom: 0px;
border-top: 0px;
border-bottom: 0;
border-top: 0;
border-left: 1px dotted #7EAAC6;
padding-left: 2px;
border-right: 0px;
border-right: 0;
}
.orderTree .z-datebox-inp {
@ -234,7 +231,7 @@ body .advancedallocationlayout .icono .z-button-cm {
}
.orderTree td {
padding: 0px !important;
padding: 0 !important;
}
/* These constants may be reviewed when testing with 3 digit tasknumbers */
@ -245,7 +242,7 @@ body .advancedallocationlayout .icono .z-button-cm {
.orderTree .depth_5 input,
.orderTree .depth_6 input
{
border-right: 0px;
border-right: 0;
}
/* Cleaning window borders */
@ -337,8 +334,7 @@ h4.message_WARNING {
.z-window-embedded {
margin: 10px;
margin-top: 5px;
margin: 5px 10px 10px;
}
.main-area .z-center-body > .z-window-embedded {
@ -348,10 +344,7 @@ h4.message_WARNING {
}
/* Hide inner second level embed window titles */
.z-window-embedded
.z-window-embedded
.z-window-embedded
.z-window-embedded-hl {
.z-window-embedded .z-window-embedded .z-window-embedded .z-window-embedded-hl {
display: none;
}
@ -436,16 +429,13 @@ div.z-row-cnt {
.z-window-popup-header,.z-window-highlighted-header,
.z-window-overlapped-header,.z-window-embedded-header {
background-color: #FFFFFF;
color: #0081C3;
font-family: Georgia, Tahoma, Arial, Helvetica, sans-serif;
font-size: 18px;
padding-bottom: 10px;
font-weight: normal;
background-image: url(../img/header_bullet.gif);
background-repeat: no-repeat;
padding-left: 22px;
background-position: 0px 3px;
background: #FFFFFF url(../img/header_bullet.gif) no-repeat 0 3px;
}
.caption-title .z-caption-l {
@ -490,21 +480,21 @@ div.z-footer-cnt,div.z-row-cnt,div.z-group-cnt,div.z-group-foot-cnt,div.z-column
.z-tabs .z-tabs-cnt {
background: none;
border-bottom: 0px;
border-bottom: 0;
border-bottom: 1px solid #7EAAC6;
}
.z-tabs-scroll {
padding-bottom: 0px;
padding-bottom: 0;
background: #F2FBFF none repeat scroll 0 0;
border: 0px solid #000000;
border: 0 solid #000000;
}
.z-tab .z-tab-text {
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
.z-tab-seld .z-tab-text { /* color:#0F3B82; */
.z-tab-seld .z-tab-text { /* color:#0F3B82; */
font-family: Tahoma, Arial, Helvetica, sans-serif;
}
@ -617,7 +607,7 @@ div.z-grid {
}
.orderTree div.z-tree-cell-cnt {
padding:0px;
padding:0;
}
.orderTree td {
@ -633,8 +623,8 @@ div.z-grid {
}
.orderelements-tab .z-datebox-focus .z-datebox-inp {
border-top: 0px;
border-bottom: 0px;
border-top: 0;
border-bottom: 0;
}
.orderelements-tab .z-datebox-focus .z-datebox-inp,
@ -647,8 +637,8 @@ div.z-grid {
}
.listdetails .z-datebox-focus .z-datebox-inp {
border-top: 0px;
border-bottom: 0px;
border-top: 0;
border-bottom: 0;
height: 17px;
font-size: 11px !important;
font-family: Tahoma, Arial, Helvetica, sans-serif;
@ -721,21 +711,6 @@ div.z-grid {
.scheduling-graphics .z-tabs-ver-scroll {
border: 0;
}
.perspectives-column {
/* border-right: solid 1px; */
}
/* Legend colors:
COLOR_CAPABILITY_LINE = "#000000"; // black
COLOR_OVERLOAD = "#FF5A11"; // Red
COLOR_OVERLOAD_OTHER = "#FFD4C2"; // Soft red
COLOR_ASSIGNED_LOAD = "#98D471"; // Green
COLOR_ASSIGNED_OTHER = "#E0F3D3"; // Soft green
*/
.legend .capability {
border-top:solid 2px #000000;
@ -807,14 +782,14 @@ div.z-grid {
.z-panel-header {
background:none;
border: 0px;
margin:0px 0px 0 10px
border: 0;
margin:0 0 0 10px
}
.z-panel-body {
background:none;
border: 1px solid #B1CBD5;
margin:0 10px 0px 10px;
margin:0 10px 0 10px;
}
.z-panel-children {
@ -931,7 +906,7 @@ span.z-dottree-line {
.z-menubar-hor {
border-bottom: 3px solid #2a83b4;
padding: 0px;
padding: 0;
}
.user_row .cerrar_sesion {
@ -939,7 +914,7 @@ span.z-dottree-line {
}
.migas_linea {
border: 0px;
border: 0;
cursor: default;
}
@ -958,8 +933,7 @@ span.z-dottree-line {
.perspective .z-button-cm,
.perspective-active .z-button-cm {
padding-top: 60px;
background-position: 18px 10px;
background-repeat: no-repeat;
background: no-repeat 18px 10px;
border-radius: 2px;
}
@ -1182,18 +1156,18 @@ tr.z-treerow-seld {
}
tr.z-treerow-seld input {
background-color: #fdf3da; /* Soft orange */
background-image: none;
/* Soft orange */
background: #fdf3da none;
}
tr.z-treerow-over input {
background-color: #eff2f6; /* Soft blue */
background-image: none;
/* Soft blue */
background: #eff2f6 none;
}
tr.z-treerow-over input {
background-color: #eff2f6; /* Soft blue */
background-image: none;
/* Soft blue */
background: #eff2f6 none;
}
.timeplot-canvas {
@ -1248,7 +1222,6 @@ tr.z-treerow-over input {
.timeplot-grid-label {
font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
font-size: 10px;
z-index: 2;
color: transparent;
font-size:9px;
@ -1318,15 +1291,15 @@ tr.z-treerow-over input {
}
.allocation-satisfied .resource-allocation tr.z-grid-odd td.z-row-inner, .allocation-satisfied tr.z-grid-odd {
background-color: none;
background-color: transparent;
}
.allocation-satisfied td.z-row-inner {
background-color: none;
background-color: transparent;
}
.assignedresources .allocation-satisfied td.z-row-inner {
background-color: none;
background-color: transparent;
}
/* Advanced allocation */
@ -1457,7 +1430,7 @@ tr.z-tree-row-seld .z-row-cnt {
}
.filter-more-options .z-groupbox-header {
margin-top: 0px;
margin-top: 0;
}
.filter-more-options .z-groupbox-bl {
display: none;
@ -1537,10 +1510,8 @@ tr.z-tree-row-seld .z-row-cnt {
.progress-types.z-combobox .z-combobox-inp {
margin:0;
padding:0;
border:0;
color: transparent;
background: transparent;
border: 0;
border-width: 0;
outline: none;
width: 0;
@ -1571,7 +1542,7 @@ tr.z-tree-row-seld .z-row-cnt {
}
.advancedallocationlayout div.z-grid {
border-top: 0px;
border-top: 0;
}
.advancedallocationlayout .timeTrackedTableWithLeftPane .z-grid-body .z-row-inner {
@ -1596,8 +1567,8 @@ tr.z-tree-row-seld .z-row-cnt {
.advanced-assignment-area td .limiting.z-intbox,
.advanced-assignment-area td .limiting.z-textbox {
height: 20px;
background: #61B598; // LIMITING_ASSIGNED
color: #555555;
background: #61B598; /* LIMITING_ASSIGNED */
color: #555555;
border-right: solid 1px white;
opacity: 1;
-moz-opacity: 1;
@ -1606,13 +1577,12 @@ color: #555555;
.advanced-assignment-area td .limiting.z-intbox[value="0"],
.advanced-assignment-area td .limiting.z-textbox[value="0"] {
background: #C1D9D1; // LIMITING_UNNASSIGNED
color: #555555;
background: #C1D9D1; /* LIMITING_UNNASSIGNED */
color: #555555;
}
.advanced-assignment-area > .z-center-body {
overflow: visible !important;
overflow: visible !important;
}
input.z-spinner-text-disd,

View file

@ -35,14 +35,13 @@
controller = loginController;
contextPath = Executions.getCurrent().getContextPath();
loginError = Executions.getCurrent().getParameter("login_error");
logoLoginLink = contextPath + "/common/img/" +
org.libreplan.web.I18nHelper._("en") + "/logo_login.png";
logoLoginLink = contextPath + "/common/img/" + org.libreplan.web.I18nHelper._("en") + "/logo_login.png";
]]>
</zscript>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<n:tr>
<n:td background="${contextPath}/common/img/flechitas.gif"></n:td>
<n:td background="${contextPath}/common/img/flechitas.gif"/>
</n:tr>
</n:table>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
@ -64,12 +63,13 @@
<n:form action="${contextPath}/j_spring_security_check" method="POST">
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="fondo_identificacion">
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"
class="fondo_identificacion">
<n:tr>
<n:td width="20" height="165" valign="top"></n:td>
<n:td width="20" height="165" valign="top"/>
<n:td valign="top" class="authentication"><n:table border="0" cellpadding="0" cellspacing="0">
<n:tr>
<n:td></n:td>
<n:td/>
</n:tr>
<n:tr>
<n:td class="usuario_clave">${i18n:_('User')}</n:td>
@ -77,7 +77,8 @@
<n:tr>
<n:td><label> </label>
<div align="center">
<n:input name="j_username" type="text" class="campotexto" id="textfield" size="30" value="${controller.loginValue}" autofocus="autofocus"/>
<n:input name="j_username" type="text" class="campotexto" id="textfield" size="30"
value="${controller.loginValue}" autofocus="autofocus"/>
</div></n:td>
</n:tr>
<n:tr>
@ -85,11 +86,12 @@
</n:tr>
<n:tr>
<n:td><div align="center">
<n:input name="j_password" type="password" class="campotexto" id="textfield2" size="30" value="${controller.loginValue}"/>
<n:input name="j_password" type="password" class="campotexto" id="textfield2" size="30"
value="${controller.loginValue}"/>
</div></n:td>
</n:tr>
<n:tr>
<n:td></n:td>
<n:td/>
</n:tr>
<n:tr>
<n:td>
@ -112,12 +114,13 @@
</n:td>
</n:tr>
</n:table>
<n:input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
</n:form>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="tabla_inferior">
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"
class="tabla_inferior">
<n:tr>
<n:td height="10" background="${contextPath}/common/img/linea_pie_login.gif"></n:td>
<n:td height="10" background="${contextPath}/common/img/linea_pie_login.gif"/>
</n:tr>
<n:tr>
<n:td><n:span class="supported-browsers" id="supported-browsers-box">${i18n:_('Supported Chrome, Firefox, Safari and Epiphany browsers')}</n:span>
@ -129,7 +132,7 @@
</n:table>
<n:table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<n:tr>
<n:td background="${contextPath}/common/img/flechitas.gif"></n:td>
<n:td background="${contextPath}/common/img/flechitas.gif"/>
</n:tr>
</n:table>

View file

@ -26,7 +26,7 @@
<vbox apply="org.libreplan.web.error.PageForErrorOnEvent" sclass="warningbox">
<i18n id="message" value="Your session has expired because of inactivity. Please log in again." />
<hbox style="margin-left:auto; margin-right:auto">
<button id="quitSession" label="${i18n:_('Back to log in')}"></button>
<button id="quitSession" label="${i18n:_('Back to log in')}"/>
</hbox>
</vbox>
</window>

View file

@ -37,7 +37,7 @@
]]>
</zscript>
<div id="idContextMenuTaskAssignment">
<div></div>
<div/>
</div>
<tabSwitcher self="@{define(content)}" apply="${multipleTabsPlanner}">
</tabSwitcher>

View file

@ -71,15 +71,13 @@ import org.springframework.transaction.annotation.Transactional;
WEBAPP_SPRING_SECURITY_CONFIG_TEST_FILE })
public class ExportTimesheetsToTimTest {
private Properties properties = null;
@Autowired
IExportTimesheetsToTim exportTimesheetsToTim;
@Before
public void loadProperties() throws IOException {
String filename = System.getProperty("user.dir") + "/../scripts/tim-connector/tim-conn.properties";
properties = new Properties();
Properties properties = new Properties();
properties.load(new FileInputStream(filename));
}
@ -114,6 +112,7 @@ public class ExportTimesheetsToTimTest {
defaultAdvanceTypesBootstrapListener.loadRequiredData();
configurationBootstrap.loadRequiredData();
scenariosBootstrap.loadRequiredData();
return null;
}
};
@ -123,11 +122,11 @@ public class ExportTimesheetsToTimTest {
private Order givenOrder() {
return transactionService.runOnAnotherTransaction(new IOnTransaction<Order>() {
@Override
public Order execute() {
return givenValidOrderAlreadyStored();
}
});
@Override
public Order execute() {
return givenValidOrderAlreadyStored();
}
});
}
private Order givenValidOrderAlreadyStored() {
@ -152,6 +151,7 @@ public class ExportTimesheetsToTimTest {
Scenario current = scenarioManager.getCurrent();
OrderVersion result = OrderVersion.createInitialVersion(current);
order.setVersionForScenario(current, result);
return result;
}

View file

@ -1,11 +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"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-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

@ -12,7 +12,7 @@
<bean id="saltSource"
class="org.springframework.security.authentication.dao.ReflectionSaltSource"
p:userPropertyToUse="username" />
<!-- <bean id="dbUserDetailsService" class="org.libreplan.web.users.services.DBUserDetailsService"/> -->
<bean id="dbPasswordEncoderService"
class="org.libreplan.web.users.services.DBPasswordEncoderService"
p:passwordEncoder-ref="passwordEncoder" p:saltSource-ref="saltSource" />
@ -21,31 +21,33 @@
class="org.libreplan.web.users.bootstrap.UsersBootstrapInDB"
p:dbPasswordEncoderService-ref="dbPasswordEncoderService" />
<!-- Beans used by the LibrePlan Web Application when users are registerd
in LDAP. At this moment users MUST be also in database with same username.
This will be changed in the near future. the url, base, userDN and password
properties must be set with the proper values -->
<!--
Beans used by the LibrePlan Web Application when users are registerd in LDAP.
At this moment users MUST be also in database with same username.
This will be changed in the near future.
The url, base, userDN and password properties must be set with the proper values -->
<bean id="contextSource"
class="org.springframework.ldap.core.support.LdapContextSource" p:url="ldap://localhost:389" p:base="dc=example,dc=org"
p:userDn="cn=admin,dc=example,dc=org" p:password="admin">
class="org.springframework.ldap.core.support.LdapContextSource" p:url="ldap://localhost:389"
p:base="dc=example,dc=org" p:userDn="cn=admin,dc=example,dc=org" p:password="admin">
</bean>
<bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate"
p:contextSource-ref="contextSource">
</bean>
<!-- This authentication provider will make possible all the login process
when an LDAP is used. Also will allow authenticate users in database. The
property strUserId must be set with the proper value. It represents the property
of the user in LDAP which will be used to check the username. -->
<!--
This authentication provider will make possible all the login process when an LDAP is used.
Also will allow authenticate users in database.
The property strUserId must be set with the proper value.
It represents the property of the user in LDAP which will be used to check the username.
-->
<bean id="authenticationProvider"
class="org.libreplan.web.users.services.LDAPCustomAuthenticationProvider"
p:userDetailsService-ref="ldapUserDetailsService"
p:ldapTemplate-ref="ldapTemplate">
</bean>
<!-- This bean is used to implement UserDetailsService with LDAP authentication
Provider. -->
<!-- This bean is used to implement UserDetailsService with LDAP authentication Provider -->
<bean id="ldapUserDetailsService"
class="org.libreplan.web.users.services.LDAPUserDetailsService" />
</beans>

96
pom.xml
View file

@ -223,13 +223,6 @@
Define this if you need ORM (org.springframework.orm.*)
-->
<!-- Spring ORM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<!-- Hibernate -->
<!-- TODO Hibernate 5.1.0.FINAL for Spring 4.2+ -->
<dependency>
@ -283,11 +276,57 @@
</exclusions>
</dependency>
<!-- Spring ORM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- Spring Web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.3.RELEASE</version>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- Spring context support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.2.6.RELEASE</version>
</dependency>
<!-- Spring security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<!-- Spring Dependency LDAP -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>4.1.0.RELEASE</version>
</dependency>
<!-- Spring test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.2.6.RELEASE</version>
<scope>test</scope>
</dependency>
<!--
@ -302,45 +341,6 @@
<version>1.8.9</version>
</dependency>
<!-- Spring context support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.0.3.RELEASE</version>
</dependency>
<!-- Spring security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<!-- Spring Dependency LDAP -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<!-- Spring test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.0.3.RELEASE</version>
<scope>test</scope>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
@ -645,7 +645,7 @@
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>1.8.6</version>
<version>2.2.3</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>