Merge pull request #30 from Chitach/master
RiskLog and IssueLog functionality added
This commit is contained in:
commit
28492b477a
44 changed files with 3638 additions and 44 deletions
|
|
@ -40,6 +40,8 @@ import org.libreplan.business.expensesheet.daos.IExpenseSheetLineDAO;
|
|||
import org.libreplan.business.externalcompanies.daos.IExternalCompanyDAO;
|
||||
import org.libreplan.business.labels.daos.ILabelDAO;
|
||||
import org.libreplan.business.labels.daos.ILabelTypeDAO;
|
||||
import org.libreplan.business.logs.daos.IIssueLogDAO;
|
||||
import org.libreplan.business.logs.daos.IRiskLogDAO;
|
||||
import org.libreplan.business.materials.daos.IMaterialCategoryDAO;
|
||||
import org.libreplan.business.materials.daos.IMaterialDAO;
|
||||
import org.libreplan.business.materials.daos.IUnitTypeDAO;
|
||||
|
|
@ -200,6 +202,12 @@ public class Registry {
|
|||
@Autowired
|
||||
private IExpenseSheetDAO expenseSheetDAO;
|
||||
|
||||
@Autowired
|
||||
private IIssueLogDAO issueLogDAO;
|
||||
|
||||
@Autowired
|
||||
private IRiskLogDAO riskLogDAO;
|
||||
|
||||
@Autowired
|
||||
private IExpenseSheetLineDAO expenseSheetLineDAO;
|
||||
|
||||
|
|
@ -383,6 +391,12 @@ public class Registry {
|
|||
return getInstance().expenseSheetDAO;
|
||||
}
|
||||
|
||||
public static IIssueLogDAO getIssueLogDAO() {
|
||||
return getInstance().issueLogDAO;
|
||||
}
|
||||
|
||||
public static IRiskLogDAO getRiskLogDAO() {return getInstance().riskLogDAO;}
|
||||
|
||||
public static IExpenseSheetLineDAO getExpenseSheetLineDAO() {
|
||||
return getInstance().expenseSheetLineDAO;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ public class Configuration extends BaseEntity {
|
|||
|
||||
private String companyCode;
|
||||
|
||||
private Boolean generateCodeForProjectLog = true;
|
||||
|
||||
private Boolean generateCodeForCriterion = true;
|
||||
|
||||
private Boolean generateCodeForLabel = true;
|
||||
|
|
@ -202,6 +204,12 @@ public class Configuration extends BaseEntity {
|
|||
return true;
|
||||
}
|
||||
|
||||
//TODO 2 added methods follow below
|
||||
public void setGeneratedCodeForProjectLog(Boolean generateCodeForProjectLog) {
|
||||
this.generateCodeForProjectLog = generateCodeForProjectLog;
|
||||
}
|
||||
public Boolean getGenerateCodeForProjectLog(){ return generateCodeForProjectLog;}
|
||||
|
||||
public void setGenerateCodeForCriterion(Boolean generateCodeForCriterion) {
|
||||
this.generateCodeForCriterion = generateCodeForCriterion;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@ import org.libreplan.business.costcategories.entities.ResourcesCostCategoryAssig
|
|||
import org.libreplan.business.costcategories.entities.TypeOfWorkHours;
|
||||
import org.libreplan.business.expensesheet.entities.ExpenseSheet;
|
||||
import org.libreplan.business.labels.entities.LabelType;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
import org.libreplan.business.materials.entities.MaterialCategory;
|
||||
import org.libreplan.business.materials.entities.UnitType;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
|
|
@ -56,7 +58,7 @@ public enum EntityNameEnum {
|
|||
"Calendar exception day", true), COST_CATEGORY("Cost category",
|
||||
true), RESOURCE_CALENDAR("Resource calendar", true), CRITERION_SATISFACTION(
|
||||
"Criterion satisfaction", true), RESOURCE_COST_CATEGORY_ASSIGNMENT(
|
||||
"Resource cost category assignment", true), EXPENSE_SHEET("Expense sheet", true);
|
||||
"Resource cost category assignment", true), EXPENSE_SHEET("Expense sheet", true), ISSUE_LOG("Issue log", true), RISK_LOG("Risk log", true);
|
||||
|
||||
private String description;
|
||||
|
||||
|
|
@ -121,6 +123,13 @@ public enum EntityNameEnum {
|
|||
.getResourcesCostCategoryAssignmentDAO();
|
||||
case EXPENSE_SHEET:
|
||||
return (IIntegrationEntityDAO<ExpenseSheet>) Registry.getExpenseSheetDAO();
|
||||
|
||||
case ISSUE_LOG:
|
||||
return (IIntegrationEntityDAO<IssueLog>) Registry.getIssueLogDAO();
|
||||
|
||||
case RISK_LOG:
|
||||
return (IIntegrationEntityDAO<RiskLog>) Registry.getRiskLogDAO();
|
||||
|
||||
default:
|
||||
throw new RuntimeException("can't handle the code sequence of the "
|
||||
+ description);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.daos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
|
||||
/**
|
||||
* Contract for {@link IssueLogDAO}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public interface IIssueLogDAO extends IIntegrationEntityDAO<IssueLog> {
|
||||
|
||||
/**
|
||||
* Gets all the issue-logs
|
||||
*
|
||||
* @return a list of {@link IssueLog} objects
|
||||
*/
|
||||
List<IssueLog> getIssueLogs();
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.daos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.libreplan.business.logs.entities.ProjectLog;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
|
||||
/**
|
||||
* Contract for {@link ProjectLogDAO}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public interface IProjectLogDAO extends IIntegrationEntityDAO<ProjectLog> {
|
||||
|
||||
/**
|
||||
* Gets all the issue-logs
|
||||
*
|
||||
* @return a list of {@link IssueLog} objects
|
||||
*/
|
||||
List<IssueLog> getIssueLogs();
|
||||
|
||||
/**
|
||||
* Gets all the risk logs
|
||||
*
|
||||
* @return a list of {@link RiskLog} objects
|
||||
*/
|
||||
List<RiskLog> getRiskLogs();
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.daos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
|
||||
public interface IRiskLogDAO extends IIntegrationEntityDAO<RiskLog> {
|
||||
|
||||
/**
|
||||
* Gets all the risk-logs
|
||||
*
|
||||
* @return a list of {@link RiskLog} objects
|
||||
*/
|
||||
List<RiskLog> getRiskLogs();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.daos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* DAO for {@link IssueLog}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class IssueLogDAO extends IntegrationEntityDAO<IssueLog> implements
|
||||
IIssueLogDAO {
|
||||
|
||||
@Override
|
||||
public List<IssueLog> getIssueLogs() {
|
||||
return list(IssueLog.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.daos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.libreplan.business.logs.entities.ProjectLog;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* DAO for {@link ProjectLog}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
@Transactional
|
||||
public class ProjectLogDAO extends IntegrationEntityDAO<ProjectLog> implements
|
||||
IProjectLogDAO {
|
||||
|
||||
@Override
|
||||
public List<IssueLog> getIssueLogs() {
|
||||
return list(IssueLog.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RiskLog> getRiskLogs() {
|
||||
return list(RiskLog.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.daos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.daos.IntegrationEntityDAO;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* DAO for {@link RiskLog}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
@Repository
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
public class RiskLogDAO extends IntegrationEntityDAO<RiskLog> implements
|
||||
IRiskLogDAO {
|
||||
|
||||
|
||||
@Override
|
||||
public List<RiskLog> getRiskLogs() {
|
||||
return list(RiskLog.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.entities;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
import org.libreplan.business.common.IntegrationEntity;
|
||||
import org.libreplan.business.common.Registry;
|
||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
|
||||
/**
|
||||
* IssueLog entity, represents parameters to be able to administrate issues that
|
||||
* come up in the project
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public class IssueLog extends ProjectLog {
|
||||
|
||||
private IssueTypeEnum type = IssueTypeEnum.getDefault();
|
||||
private String status = "LOW";
|
||||
private LowMediumHighEnum priority = LowMediumHighEnum.getDefault();
|
||||
private LowMediumHighEnum severity = LowMediumHighEnum.getDefault();
|
||||
private Date dateRaised;
|
||||
private User createdBy;
|
||||
private String assignedTo;
|
||||
private Date dateResolved;
|
||||
private Date deadline;
|
||||
private String notes;
|
||||
|
||||
|
||||
public static IssueLog create() {
|
||||
return create(new IssueLog(new Date()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for Hibernate. Do not use!
|
||||
*/
|
||||
protected IssueLog() {
|
||||
|
||||
}
|
||||
|
||||
private IssueLog(Date date) {
|
||||
this.dateRaised = date;
|
||||
}
|
||||
|
||||
public IssueTypeEnum getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(IssueTypeEnum type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public LowMediumHighEnum getPriority() {
|
||||
return priority;
|
||||
}
|
||||
|
||||
public void setPriority(LowMediumHighEnum priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public LowMediumHighEnum getSeverity() {
|
||||
return severity;
|
||||
}
|
||||
|
||||
public void setSeverity(LowMediumHighEnum severity) {
|
||||
this.severity = severity;
|
||||
}
|
||||
|
||||
@NotNull(message = "date raised is not specified")
|
||||
public Date getDateRaised() {
|
||||
return dateRaised;
|
||||
}
|
||||
|
||||
public void setDateRaised(Date dateEntered) {
|
||||
this.dateRaised = dateEntered;
|
||||
}
|
||||
|
||||
public User getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(User user) {
|
||||
this.createdBy = user;
|
||||
}
|
||||
|
||||
public String getAssignedTo() {
|
||||
return assignedTo;
|
||||
}
|
||||
|
||||
public void setAssignedTo(String assignedTo) {
|
||||
this.assignedTo = assignedTo;
|
||||
}
|
||||
|
||||
public Date getDateResolved() {
|
||||
return dateResolved;
|
||||
}
|
||||
|
||||
public void setDateResolved(Date dateResolved) {
|
||||
this.dateResolved = dateResolved;
|
||||
}
|
||||
|
||||
|
||||
public Date getDeadline() {
|
||||
return deadline;
|
||||
}
|
||||
|
||||
public void setDeadline(Date decisionDate) {
|
||||
this.deadline = decisionDate;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getHumanId() {
|
||||
return getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIntegrationEntityDAO<? extends IntegrationEntity> getIntegrationEntityDAO() {
|
||||
return (IIntegrationEntityDAO<? extends IntegrationEntity>) Registry
|
||||
.getIssueLogDAO();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package org.libreplan.business.logs.entities;
|
||||
|
||||
import static org.libreplan.business.i18n.I18nHelper._;
|
||||
|
||||
/**
|
||||
* Defines PROBLEM_OR_CONCERN, REQUEST_FOR_CHANGE, OFF_SPECIFICATION enums
|
||||
* to be used as data type in
|
||||
* {@link IssueLog}
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public enum IssueTypeEnum {
|
||||
PROBLEM_OR_CONCERN(_("Problem or concern")), REQUEST_FOR_CHANGE(_("Request for change")), OFF_SPECIFICATION(_("Off specification"));
|
||||
|
||||
private final String issueTypeEnum;
|
||||
|
||||
IssueTypeEnum(String issueTypeEnum) {
|
||||
this.issueTypeEnum = issueTypeEnum;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return issueTypeEnum;
|
||||
}
|
||||
|
||||
public static IssueTypeEnum getDefault() {
|
||||
return IssueTypeEnum.OFF_SPECIFICATION;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.libreplan.business.logs.entities;
|
||||
|
||||
import static org.libreplan.business.i18n.I18nHelper._;
|
||||
|
||||
|
||||
/**
|
||||
* Defines the low, medium and high enums to be used as data type in
|
||||
* {@link IssueLog} and {@link RiskLog}
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public enum LowMediumHighEnum {
|
||||
|
||||
LOW(_("Low")), MEDIUM(_("Medium")), HIGH(_("High"));
|
||||
|
||||
private final String lowMediumHighEnum;
|
||||
|
||||
LowMediumHighEnum(String lowMediumHighEnum) {
|
||||
this.lowMediumHighEnum = lowMediumHighEnum;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return lowMediumHighEnum;
|
||||
}
|
||||
|
||||
public static LowMediumHighEnum getDefault() {
|
||||
return LowMediumHighEnum.LOW;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.entities;
|
||||
|
||||
import org.libreplan.business.common.IHumanIdentifiable;
|
||||
import org.libreplan.business.common.IntegrationEntity;
|
||||
import org.libreplan.business.common.Registry;
|
||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
|
||||
/**
|
||||
* This class is the base class for all logs like issue-log, risk-log etc.
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public abstract class ProjectLog extends IntegrationEntity implements
|
||||
IHumanIdentifiable {
|
||||
|
||||
protected Order project;
|
||||
protected String description;
|
||||
|
||||
public Order getOrder() {
|
||||
return project;
|
||||
}
|
||||
|
||||
public void setOrder(Order order) {
|
||||
this.project = order;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.business.logs.entities;
|
||||
|
||||
import org.libreplan.business.common.IntegrationEntity;
|
||||
import org.libreplan.business.common.Registry;
|
||||
import org.libreplan.business.common.daos.IIntegrationEntityDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* RiskLog entity, represents parameters to be able to administrate risks that
|
||||
* come up in the project
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public class RiskLog extends ProjectLog {
|
||||
|
||||
private String projectName;
|
||||
private String status;
|
||||
private LowMediumHighEnum probability = LowMediumHighEnum.getDefault();
|
||||
private LowMediumHighEnum impact = LowMediumHighEnum.getDefault();
|
||||
private Date dateCreated;
|
||||
private User createdBy;
|
||||
private String counterMeasures;
|
||||
private String contingency;
|
||||
private String responsible;
|
||||
private Date actionWhen;
|
||||
private String notes;
|
||||
private RiskScoreStatesEnum score = RiskScoreStatesEnum.getDefault();
|
||||
|
||||
public static RiskLog create() {
|
||||
return create(new RiskLog(new Date()));
|
||||
}
|
||||
|
||||
private RiskLog(Date date) {
|
||||
this.dateCreated = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for Hibernate. Do not use!
|
||||
*/
|
||||
protected RiskLog() {
|
||||
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public void setProjectName (String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public LowMediumHighEnum getProbability() {
|
||||
return probability;
|
||||
}
|
||||
|
||||
public void setProbability(LowMediumHighEnum probability) {
|
||||
this.probability = probability;
|
||||
}
|
||||
|
||||
public LowMediumHighEnum getImpact() {
|
||||
return impact;
|
||||
}
|
||||
|
||||
public void setImpact(LowMediumHighEnum impact) {
|
||||
this.impact = impact;
|
||||
}
|
||||
|
||||
public Date getDateCreated() {
|
||||
return dateCreated;
|
||||
}
|
||||
|
||||
public void setDateCreated(Date dateCreated) {
|
||||
this.dateCreated = dateCreated;
|
||||
}
|
||||
|
||||
public User getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(User createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCounterMeasures() {
|
||||
return counterMeasures;
|
||||
}
|
||||
|
||||
public void setCounterMeasures(String counterMeasures) {
|
||||
this.counterMeasures = counterMeasures;
|
||||
}
|
||||
|
||||
public String getContingency() {
|
||||
return contingency;
|
||||
}
|
||||
|
||||
public void setContingency(String contingency) {
|
||||
this.contingency = contingency;
|
||||
}
|
||||
|
||||
public void setResponsible(String responsible) {
|
||||
this.responsible = responsible;
|
||||
}
|
||||
|
||||
public String getResponsible() {
|
||||
return responsible;
|
||||
}
|
||||
|
||||
public Date getActionWhen() {
|
||||
return actionWhen;
|
||||
}
|
||||
|
||||
public void setActionWhen(Date actionWhen) {
|
||||
this.actionWhen = actionWhen;
|
||||
}
|
||||
|
||||
public String getNotes() {
|
||||
return notes;
|
||||
}
|
||||
|
||||
public void setNotes(String notes) {
|
||||
this.notes = notes;
|
||||
}
|
||||
|
||||
public void setScoreAfterCM(RiskScoreStatesEnum scoreAfterCM) {
|
||||
this.score = scoreAfterCM;
|
||||
}
|
||||
|
||||
public RiskScoreStatesEnum getScoreAfterCM() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public int getRiskScore() {
|
||||
return (probability.ordinal() + 1) * (impact.ordinal() + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHumanId() {
|
||||
return getCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IIntegrationEntityDAO<? extends IntegrationEntity> getIntegrationEntityDAO() {
|
||||
return (IIntegrationEntityDAO<? extends IntegrationEntity>) Registry
|
||||
.getRiskLogDAO();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package org.libreplan.business.logs.entities;
|
||||
import static org.libreplan.business.i18n.I18nHelper._;
|
||||
/**
|
||||
* Defines ZERO, ONE, TWO, THREE, FOUR, SIX, NINE
|
||||
* to be used as data type in
|
||||
* {@link RiskLog}
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public enum RiskScoreStatesEnum {
|
||||
ZERO(_("0")), ONE(_("1")), TWO(_("2")), THREE(_("3")), FOUR(_("4")), SIX(_("6")), NINE(_("9")) ;
|
||||
|
||||
private final String riskScoreStateEnum;
|
||||
|
||||
RiskScoreStatesEnum(String riskScoreStateEnum) {
|
||||
this.riskScoreStateEnum = riskScoreStateEnum;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return riskScoreStateEnum;
|
||||
}
|
||||
|
||||
public static RiskScoreStatesEnum getDefault() {
|
||||
return RiskScoreStatesEnum.ZERO;
|
||||
}
|
||||
}
|
||||
|
|
@ -51,4 +51,79 @@
|
|||
initiallyDeferred="false"/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="adding-issue_log_table" author="misha">
|
||||
<createTable tableName="issue_log">
|
||||
<column name="id" type="BIGINT" autoIncrement="true">
|
||||
<constraints primaryKey="true" nullable="false" primaryKeyName="issue_log_pkey"/>
|
||||
</column>
|
||||
<column name="code" type="varchar(25)"/>
|
||||
<column name="project" type="BIGINT"/>
|
||||
<column name="type" type="integer"/>
|
||||
<column name="description" type="varchar"/>
|
||||
<column name="priority" type="integer"/>
|
||||
<column name="severity" type="integer"/>
|
||||
<column name="created_by" type="BIGINT"/>
|
||||
<column name="assigned_to" type="varchar(50)"/>
|
||||
<column name="status" type="varchar(50)"/>
|
||||
<column name="date_raised" type="timestamp with time zone"/>
|
||||
<column name="deadline" type="timestamp with time zone"/>
|
||||
<column name="date_resolved" type="timestamp with time zone"/>
|
||||
<column name="notes" type="varchar"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="issue_log" baseColumnNames="project"
|
||||
constraintName="issue_log_project_order_element_table"
|
||||
referencedTableName="order_element"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="issue_log" baseColumnNames="created_by"
|
||||
constraintName="issue_log_user_user_table"
|
||||
referencedTableName="user_table"
|
||||
referencedColumnNames="id"/>
|
||||
<addUniqueConstraint
|
||||
constraintName="issue_log_unique_code"
|
||||
columnNames="code"
|
||||
deferrable="false"
|
||||
disabled="false"
|
||||
initiallyDeferred="false"
|
||||
tableName="issue_log"
|
||||
/>
|
||||
</changeSet>
|
||||
|
||||
<changeSet id="adding-risk_log_table" author="misha">
|
||||
<createTable tableName="risk_log">
|
||||
<column name="id" type="BIGINT" autoIncrement="true">
|
||||
<constraints primaryKey="true" nullable="false" primaryKeyName="risk_log_pkey"/>
|
||||
</column>
|
||||
<column name="code" type="varchar(25)"/>
|
||||
<column name="project" type="BIGINT"/>
|
||||
<column name="description" type="varchar"/>
|
||||
<column name="probability" type="integer"/>
|
||||
<column name="impact" type="integer"/>
|
||||
<column name="score" type="integer"/>
|
||||
<column name="created_by" type="BIGINT"/>
|
||||
<column name="responsible" type="varchar(25)"/>
|
||||
<column name="status" type="varchar(25)"/>
|
||||
<column name="contingency" type="varchar(50)"/>
|
||||
<column name="counter_measures" type="varchar(50)"/>
|
||||
<column name="action_when" type="timestamp with time zone"/>
|
||||
<column name="date_created" type="timestamp with time zone"/>
|
||||
<column name="notes" type="varchar"/>
|
||||
</createTable>
|
||||
<addForeignKeyConstraint baseTableName="risk_log" baseColumnNames="project"
|
||||
constraintName="project_order_element_table"
|
||||
referencedTableName="order_element"
|
||||
referencedColumnNames="id"/>
|
||||
<addForeignKeyConstraint baseTableName="risk_log" baseColumnNames="created_by"
|
||||
constraintName="risk_log_user_user_table"
|
||||
referencedTableName="user_table"
|
||||
referencedColumnNames="id"/>
|
||||
<addUniqueConstraint
|
||||
constraintName="risk_log_unique_code"
|
||||
columnNames="code"
|
||||
deferrable="false"
|
||||
disabled="false"
|
||||
initiallyDeferred="false"
|
||||
tableName="risk_log"
|
||||
/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
|
@ -97,6 +97,9 @@
|
|||
<value>
|
||||
org/libreplan/business/email/entities/Email.hbm.xml
|
||||
</value>
|
||||
<value>
|
||||
org/libreplan/business/logs/entities/Logs.hbm.xml
|
||||
</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
|
||||
<hibernate-mapping package="org.libreplan.business.logs.entities" default-access="field">
|
||||
<class name="IssueLog" table="issue_log">
|
||||
<id name="id" column="id" type="long" access="property">
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
|
||||
<property name="code" access="property" not-null="true" unique="true"/>
|
||||
|
||||
<many-to-one name="project" class="org.libreplan.business.orders.entities.Order" lazy="false">
|
||||
<column name="project" not-null="true"/>
|
||||
</many-to-one>
|
||||
|
||||
<property name="type" access="field" not-null="true" >
|
||||
<type name="org.hibernate.type.EnumType" >
|
||||
<param name="enumClass">org.libreplan.business.logs.entities.IssueTypeEnum</param>
|
||||
</type>
|
||||
</property>
|
||||
|
||||
<property name="description" column="description" access="field"/>
|
||||
|
||||
<property name="priority" access="field" not-null="true">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.libreplan.business.logs.entities.LowMediumHighEnum</param>
|
||||
</type>
|
||||
</property>
|
||||
|
||||
<property name="severity" access="field" not-null="true">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.libreplan.business.logs.entities.LowMediumHighEnum</param>
|
||||
</type>
|
||||
</property>
|
||||
|
||||
<property name="dateRaised" column="date_raised" access="field" not-null="true">
|
||||
|
||||
</property>
|
||||
|
||||
<property name="assignedTo" column="assigned_to" access="field"/>
|
||||
|
||||
<many-to-one name="createdBy" class="org.libreplan.business.users.entities.User" lazy="false">
|
||||
<column name="created_by" not-null="true"/>
|
||||
</many-to-one>
|
||||
|
||||
<property name="deadline" column="deadline" />
|
||||
|
||||
<property name="dateResolved" column="date_resolved"/>
|
||||
|
||||
<property name="notes" column="notes" access="field"/>
|
||||
|
||||
<property name="status" column="status" access="field"/>
|
||||
|
||||
</class>
|
||||
|
||||
<class name="RiskLog" table="risk_log">
|
||||
<id name="id" column="id" type="long" access="property">
|
||||
<generator class="hilo">
|
||||
<param name="max_lo">100</param>
|
||||
</generator>
|
||||
</id>
|
||||
|
||||
<property name="code" access="property" not-null="true" unique="true"/>
|
||||
|
||||
<many-to-one name="project" class="org.libreplan.business.orders.entities.Order" lazy="false">
|
||||
<column name="project" not-null="true"/>
|
||||
</many-to-one>
|
||||
|
||||
<property name="probability" access="field" not-null="true">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.libreplan.business.logs.entities.LowMediumHighEnum</param>
|
||||
</type>
|
||||
</property>
|
||||
|
||||
<property name="impact" access="field" not-null="true">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.libreplan.business.logs.entities.LowMediumHighEnum</param>
|
||||
</type>
|
||||
</property>
|
||||
|
||||
<property name="dateCreated" column="date_created" access="field" not-null="true"/>
|
||||
|
||||
<many-to-one name="createdBy" class="org.libreplan.business.users.entities.User" lazy="false">
|
||||
<column name="created_by" />
|
||||
</many-to-one>
|
||||
|
||||
<property name="counterMeasures" column="counter_measures" access="field"/>
|
||||
|
||||
<property name="contingency" column="contingency" access="field"/>
|
||||
|
||||
<property name="responsible" column="responsible" access="field"/>
|
||||
|
||||
<property name="actionWhen" column="action_when" access="field"/>
|
||||
|
||||
<property name="notes" column="notes" access="field"/>
|
||||
|
||||
<property name="description" column="description" access="field"/>
|
||||
|
||||
<property name="status" column="status" access="field"/>
|
||||
|
||||
<property name="score" access="field" not-null="true">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.libreplan.business.logs.entities.RiskScoreStatesEnum</param>
|
||||
</type>
|
||||
</property>
|
||||
|
||||
</class>
|
||||
|
||||
</hibernate-mapping>
|
||||
|
|
@ -275,6 +275,7 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
|
|||
}
|
||||
}, "01-introducion.html#id2"));
|
||||
}
|
||||
|
||||
if (SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
|
||||
planningItems.add(subItem(_("Resources Load"), new ICapture() {
|
||||
@Override
|
||||
|
|
@ -298,6 +299,16 @@ public class CustomMenuController extends Div implements IMenuItemsRegister {
|
|||
planningItems.add(subItem(_("Import project"),
|
||||
"/orders/imports/projectImport.zul", ""));
|
||||
}
|
||||
|
||||
|
||||
//TODO There is some problem here!
|
||||
/*planningItems.add(subItem(_("Logs"), new ICapture() {
|
||||
@Override
|
||||
public void capture() {
|
||||
globalView.goToLogs();
|
||||
}
|
||||
}, "01-asd"));*/
|
||||
|
||||
if (!planningItems.isEmpty()) {
|
||||
topItem(_("Planning"), "/planner/index.zul", "", planningItems);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
|
||||
/**
|
||||
* Contract for {@link IssueLogModel}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public interface IIssueLogModel {
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link IssueLog}
|
||||
*/
|
||||
List<IssueLog> getIssueLogs();
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link Order}
|
||||
*/
|
||||
List<Order> getOrders();
|
||||
|
||||
/**
|
||||
* Returns current {@link Order}
|
||||
*/
|
||||
Order getOrder();
|
||||
|
||||
/**
|
||||
* Sets the order
|
||||
*
|
||||
* @param order
|
||||
* the order to be set
|
||||
*/
|
||||
void setOrder(Order order);
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link User}
|
||||
*/
|
||||
List<User> getUsers();
|
||||
|
||||
/**
|
||||
* Returns the {@link User}
|
||||
*/
|
||||
User getCreatedBy();
|
||||
|
||||
/**
|
||||
* Sets the user
|
||||
*
|
||||
* @param user
|
||||
* the user to be set
|
||||
*/
|
||||
void setCreatedBy(User user);
|
||||
|
||||
/**
|
||||
* Prepares for create a new {@link IssueLog}.
|
||||
*/
|
||||
void initCreate();
|
||||
|
||||
/**
|
||||
* Prepares for edit {@link IssueLog}
|
||||
*
|
||||
* @param issueLog
|
||||
* an object to be edited
|
||||
*/
|
||||
void initEdit(IssueLog issueLog);
|
||||
|
||||
/**
|
||||
* Gets the current {@link IssueLog}.
|
||||
*
|
||||
* @return A {@link IssueLog}
|
||||
*/
|
||||
IssueLog getIssueLog();
|
||||
|
||||
/**
|
||||
* Saves the current {@link IssueLog}
|
||||
*
|
||||
* @throws ValidationException
|
||||
* if validation fails
|
||||
*/
|
||||
void confirmSave() throws ValidationException;
|
||||
|
||||
/**
|
||||
* Cancels the current {@link IssueLog}
|
||||
*/
|
||||
void cancel();
|
||||
|
||||
/**
|
||||
* Removes the current {@link IssueLog}
|
||||
*
|
||||
* @param issueLog
|
||||
* an object to be removed
|
||||
*/
|
||||
void remove(IssueLog issueLog);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
|
||||
/**
|
||||
* Contract for {@link RiskLogModel}
|
||||
*
|
||||
* @author Miciele Ghiorghis <m.ghiorghis@antoniusziekenhuis.nl>
|
||||
*/
|
||||
public interface IRiskLogModel {
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link RiskLog}
|
||||
*/
|
||||
List<RiskLog> getRiskLogs();
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link Order}
|
||||
*/
|
||||
List<Order> getOrders();
|
||||
|
||||
/**
|
||||
* Returns current {@link Order}
|
||||
*/
|
||||
Order getOrder();
|
||||
|
||||
/**
|
||||
* Sets the order
|
||||
*
|
||||
* @param order
|
||||
* the order to set
|
||||
*/
|
||||
void setOrder(Order order);
|
||||
|
||||
/**
|
||||
* Returns a list of all {@link User}
|
||||
*/
|
||||
List<User> getUsers();
|
||||
|
||||
/**
|
||||
* Returns {@link User}
|
||||
*/
|
||||
User getCreatedBy();
|
||||
|
||||
/**
|
||||
* Sets the user
|
||||
*
|
||||
* @param user
|
||||
* the user to be set
|
||||
*/
|
||||
void setCreatedBy(User user);
|
||||
|
||||
/**
|
||||
* Prepares for create a new {@link RiskLog}.
|
||||
*/
|
||||
void initCreate();
|
||||
|
||||
/**
|
||||
* Prepares for edit {@link RiskLog}
|
||||
*
|
||||
* @param riskLog
|
||||
* an object to be edited
|
||||
*/
|
||||
void initEdit(RiskLog riskLog);
|
||||
|
||||
/**
|
||||
* Gets the current {@link RiskLog}.
|
||||
*
|
||||
* @return A {@link RiskLog}
|
||||
*/
|
||||
RiskLog getRiskLog();
|
||||
|
||||
/**
|
||||
* Saves the current {@link RiskLog}
|
||||
*
|
||||
* @throws ValidationException
|
||||
* if validation fails
|
||||
*/
|
||||
void confirmSave() throws ValidationException;
|
||||
|
||||
/**
|
||||
* Cancels the current {@link RiskLog}
|
||||
*/
|
||||
void cancel();
|
||||
|
||||
/**
|
||||
* Removes the current {@link RiskLog}
|
||||
*
|
||||
* @param riskLog
|
||||
* an object to be removed
|
||||
*/
|
||||
void remove(RiskLog riskLog);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,484 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
|
||||
import static org.libreplan.web.I18nHelper._;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.libreplan.business.logs.entities.IssueTypeEnum;
|
||||
import org.libreplan.business.logs.entities.LowMediumHighEnum;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.web.common.BaseCRUDController;
|
||||
import org.libreplan.web.common.Util;
|
||||
import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableCellEditor;
|
||||
|
||||
/**
|
||||
* Controller for IssueLog CRUD actions
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@org.springframework.stereotype.Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class IssueLogCRUDController extends BaseCRUDController<IssueLog> {
|
||||
|
||||
private static final org.apache.commons.logging.Log LOG = LogFactory
|
||||
.getLog(IssueLogCRUDController.class);
|
||||
|
||||
@Autowired
|
||||
private IIssueLogModel issueLogModel;
|
||||
|
||||
private BandboxSearch bdProjectIssueLog;
|
||||
|
||||
private BandboxSearch bdUserIssueLog;
|
||||
|
||||
private Listbox status;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
status = (Listbox)comp.getFellow("editWindow").getFellow("listIssueLogStatus");
|
||||
comp.setVariable("issueLogController", this, true);
|
||||
showListWindow();
|
||||
initializeOrderComponent();
|
||||
initializeUserComponent();
|
||||
bdProjectIssueLog.setDisabled(!LogsController.getProjectNameVisibility());
|
||||
bdUserIssueLog.setDisabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes order component
|
||||
*/
|
||||
private void initializeOrderComponent() {
|
||||
bdProjectIssueLog = (BandboxSearch) editWindow
|
||||
.getFellow("bdProjectIssueLog");
|
||||
Util.createBindingsFor(bdProjectIssueLog);
|
||||
bdProjectIssueLog.setListboxEventListener(Events.ON_SELECT,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdProjectIssueLog
|
||||
.getSelectedElement();
|
||||
issueLogModel.setOrder((Order) object);
|
||||
}
|
||||
});
|
||||
bdProjectIssueLog.setListboxEventListener(Events.ON_OK,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdProjectIssueLog
|
||||
.getSelectedElement();
|
||||
issueLogModel.setOrder((Order) object);
|
||||
bdProjectIssueLog.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes user component
|
||||
*/
|
||||
private void initializeUserComponent() {
|
||||
bdUserIssueLog = (BandboxSearch) editWindow.getFellow("bdUserIssueLog");
|
||||
Util.createBindingsFor(bdUserIssueLog);
|
||||
|
||||
bdUserIssueLog.setListboxEventListener(Events.ON_SELECT, new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdUserIssueLog.getSelectedElement();
|
||||
issueLogModel.setCreatedBy((User) object);
|
||||
}
|
||||
});
|
||||
bdUserIssueLog.setListboxEventListener(Events.ON_OK, new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdUserIssueLog.getSelectedElement();
|
||||
issueLogModel.setCreatedBy((User) object);
|
||||
bdUserIssueLog.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Enumerations rendering
|
||||
*/
|
||||
public static ListitemRenderer issueTypeRenderer = new ListitemRenderer() {
|
||||
@Override
|
||||
public void render(org.zkoss.zul.Listitem item, Object data)
|
||||
throws Exception {
|
||||
IssueTypeEnum issueTypeEnum = (IssueTypeEnum) data;
|
||||
String displayName = issueTypeEnum.getDisplayName();
|
||||
item.setLabel(displayName);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
public static ListitemRenderer lowMediumHighEnumRenderer = new ListitemRenderer() {
|
||||
@Override
|
||||
public void render(org.zkoss.zul.Listitem item, Object data)
|
||||
throws Exception {
|
||||
LowMediumHighEnum lowMediumHighEnum = (LowMediumHighEnum) data;
|
||||
String displayName = lowMediumHighEnum.getDisplayName();
|
||||
item.setLabel(displayName);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders issue logs
|
||||
*
|
||||
* @return {@link RowRenderer}
|
||||
*/
|
||||
public RowRenderer getIssueLogsRowRenderer() {
|
||||
return new RowRenderer() {
|
||||
|
||||
@Override
|
||||
public void render(Row row, Object data) throws Exception {
|
||||
final IssueLog issueLog = (IssueLog) data;
|
||||
row.setValue(issueLog);
|
||||
appendObject(row, issueLog.getCode());
|
||||
appendLabel(row, issueLog.getOrder().getName());
|
||||
appendObject(row, issueLog.getType());
|
||||
appendObject(row, issueLog.getStatus());
|
||||
appendLabel(row, issueLog.getDescription());
|
||||
appendLabel(row, issueLog.getPriority().getDisplayName());
|
||||
appendLabel(row, issueLog.getSeverity().getDisplayName());
|
||||
appendDate(row, issueLog.getDateRaised());
|
||||
appendLabel(row, issueLog.getCreatedBy().getLoginName());
|
||||
appendLabel(row, issueLog.getAssignedTo());
|
||||
appendDate(row, issueLog.getDeadline());
|
||||
appendDate(row, issueLog.getDateResolved());
|
||||
appendLabel(row, issueLog.getNotes());
|
||||
appendOperations(row, issueLog);
|
||||
setPriorityCellColor(row, issueLog.getPriority());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void setPriorityCellColor(Row row, LowMediumHighEnum priority) {
|
||||
Cell cell = (Cell) row.getChildren().get(5);
|
||||
if (priority == LowMediumHighEnum.LOW) {
|
||||
cell.setClass("issueLog-priority-color-green");
|
||||
}
|
||||
|
||||
if (priority == LowMediumHighEnum.MEDIUM) {
|
||||
cell.setClass("issueLog-priority-color-yellow");
|
||||
}
|
||||
|
||||
if (priority == LowMediumHighEnum.HIGH) {
|
||||
cell.setClass("issueLog-priority-color-red");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified <code>object</code> to the specified
|
||||
* <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param object
|
||||
*/
|
||||
private void appendObject(final Row row, Object object) {
|
||||
String text = new String("");
|
||||
if (object != null) {
|
||||
text = object.toString();
|
||||
}
|
||||
appendLabel(row, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link Label} bases on the specified <code>value</code> and
|
||||
* appends to the specified <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param value
|
||||
*/
|
||||
private void appendLabel(final Row row, String value) {
|
||||
Label label = new Label(value);
|
||||
Cell cell = new Cell();
|
||||
cell.appendChild(label);
|
||||
row.appendChild(cell);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified <code>date</code> to the specified <code>row</code>
|
||||
* @param row
|
||||
* @param date*/
|
||||
private void appendDate(final Row row, Date date) {
|
||||
String labelDate = new String("");
|
||||
if (date != null) {
|
||||
labelDate = Util.formatDate(date);
|
||||
}
|
||||
appendLabel(row, labelDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends operation(edit and remove) to the specified <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param issueLog
|
||||
*/
|
||||
private void appendOperations(final Row row, final IssueLog issueLog) {
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.appendChild(Util.createEditButton(new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
goToEditForm(issueLog);
|
||||
}
|
||||
}));
|
||||
hbox.appendChild(Util.createRemoveButton(new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
confirmDelete(issueLog);
|
||||
}
|
||||
}));
|
||||
row.appendChild(hbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link LowMediumHighEnum} values
|
||||
*/
|
||||
public LowMediumHighEnum[] getLowMediumHighEnum() {
|
||||
return LowMediumHighEnum.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link IssueTypeEnum} values
|
||||
*/
|
||||
public IssueTypeEnum[] getIssueTypeEnum() {
|
||||
return IssueTypeEnum.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link ArrayList} values
|
||||
*/
|
||||
public ArrayList<String> getIssueStatusEnum() {
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
if (getIssueLog().getType() == IssueTypeEnum.REQUEST_FOR_CHANGE){
|
||||
result.add(_("Must have"));
|
||||
result.add(_("Should have"));
|
||||
result.add(_("Could have"));
|
||||
result.add(_("Won't have"));
|
||||
return result;
|
||||
}
|
||||
if (getIssueLog().getType() == IssueTypeEnum.PROBLEM_OR_CONCERN) {
|
||||
result.add(_("Minor"));
|
||||
result.add(_("Significant"));
|
||||
result.add(_("Major"));
|
||||
result.add(_("Critical"));
|
||||
return result;
|
||||
}
|
||||
|
||||
result.add(_("Low"));
|
||||
result.add(_("Medium"));
|
||||
result.add(_("High"));
|
||||
return result;
|
||||
}
|
||||
|
||||
public void updateStatusList(boolean ifNew) {
|
||||
ListModelList model = new ListModelList(getIssueStatusEnum());
|
||||
status.setModel(model);
|
||||
if(ifNew)
|
||||
status.setSelectedItem(status.getItemAtIndex(0));
|
||||
else {
|
||||
for(int i = 0; i < status.getItems().size(); i++) {
|
||||
if (status.getModel().getElementAt(i).toString().equals(getIssueLog().getStatus())) {
|
||||
status.setSelectedItem(status.getItemAtIndex(i));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of {@link Order} objects
|
||||
*/
|
||||
public List<Order> getOrders() {
|
||||
return issueLogModel.getOrders();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of {@link User} objects
|
||||
*/
|
||||
public List<User> getUsers() {
|
||||
return issueLogModel.getUsers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Date}
|
||||
*/
|
||||
public Date getDateRaised() {
|
||||
if (issueLogModel.getIssueLog() == null) {
|
||||
return null;
|
||||
}
|
||||
return (issueLogModel.getIssueLog().getDateRaised() != null) ? issueLogModel
|
||||
.getIssueLog().getDateRaised()
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the date raised
|
||||
*
|
||||
* @param date
|
||||
* date raised
|
||||
*/
|
||||
public void setDateRaised(Date date) {
|
||||
issueLogModel.getIssueLog().setDateRaised(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Date}
|
||||
*/
|
||||
public Date getDateResolved() {
|
||||
if (issueLogModel.getIssueLog() == null) {
|
||||
return null;
|
||||
}
|
||||
return (issueLogModel.getIssueLog().getDateResolved() != null) ? issueLogModel
|
||||
.getIssueLog().getDateResolved()
|
||||
: null;
|
||||
}
|
||||
/**
|
||||
* Sets the date resolved
|
||||
*
|
||||
* @param date
|
||||
* the date resolved
|
||||
*/
|
||||
public void setDateResolved(Date date) {
|
||||
issueLogModel.getIssueLog().setDateResolved(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Date}
|
||||
*/
|
||||
public Date getDeadline() {
|
||||
if (issueLogModel.getIssueLog() == null) {
|
||||
return null;
|
||||
}
|
||||
return (issueLogModel.getIssueLog().getDeadline() != null) ? issueLogModel
|
||||
.getIssueLog().getDeadline() // this is a getIntegrationEntityDAO method
|
||||
: null;
|
||||
}
|
||||
|
||||
public void setDeadline(Date date) {
|
||||
issueLogModel.getIssueLog().setDeadline(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link IssueLog} object
|
||||
*/
|
||||
public IssueLog getIssueLog() {
|
||||
return issueLogModel.getIssueLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of {@link IssueLog} objects
|
||||
*/
|
||||
public List<IssueLog> getIssueLogs() {
|
||||
if (LogsController.getProjectNameVisibility() == true)
|
||||
return issueLogModel.getIssueLogs();
|
||||
else{
|
||||
List<IssueLog> issueLogs = new ArrayList<IssueLog>();
|
||||
Order order = LogsController.getOrder();
|
||||
for (IssueLog issueLog : issueLogModel.getIssueLogs()) {
|
||||
if (issueLog.getOrder().equals(order))
|
||||
issueLogs.add(issueLog);
|
||||
}
|
||||
return issueLogs;
|
||||
}
|
||||
}
|
||||
|
||||
public Order getOrder() {
|
||||
if (LogsController.getProjectNameVisibility() == false){
|
||||
this.getIssueLog().setOrder(LogsController.getOrder());
|
||||
return getIssueLog().getOrder();
|
||||
}
|
||||
else
|
||||
return getIssueLog().getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityType() {
|
||||
return _("issuelog-number");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPluralEntityType() {
|
||||
return _("Issue logs");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initCreate() {
|
||||
issueLogModel.initCreate();
|
||||
updateStatusList(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEdit(IssueLog entity) {
|
||||
issueLogModel.initEdit(entity);
|
||||
updateStatusList(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void save() throws ValidationException {
|
||||
if (getIssueLog().getOrder() == null) {
|
||||
throw new WrongValueException(bdProjectIssueLog,
|
||||
_("please select a project"));
|
||||
}
|
||||
|
||||
if (getIssueLog().getCreatedBy() == null) {
|
||||
throw new WrongValueException(bdUserIssueLog,
|
||||
_("please select an author"));
|
||||
}
|
||||
getIssueLog().setStatus(status.getSelectedItem().getLabel());
|
||||
issueLogModel.confirmSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IssueLog getEntityBeingEdited() {
|
||||
return issueLogModel.getIssueLog();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void delete(IssueLog entity) throws InstanceNotFoundException {
|
||||
issueLogModel.remove(entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.libreplan.business.common.IntegrationEntity;
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.entities.EntityNameEnum;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.logs.daos.IIssueLogDAO;
|
||||
import org.libreplan.business.logs.daos.IProjectLogDAO;
|
||||
import org.libreplan.business.logs.entities.IssueLog;
|
||||
import org.libreplan.business.orders.daos.IOrderDAO;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.scenarios.IScenarioManager;
|
||||
import org.libreplan.business.users.daos.IUserDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.web.common.IntegrationEntityModel;
|
||||
import org.libreplan.web.common.concurrentdetection.OnConcurrentModification;
|
||||
import org.libreplan.web.security.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Model for UI operations related to {@link IssueLog}
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
@Service
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
@OnConcurrentModification(goToPage = "/logs/_logs.zul")
|
||||
public class IssueLogModel extends IntegrationEntityModel implements
|
||||
IIssueLogModel {
|
||||
|
||||
private IssueLog issueLog;
|
||||
|
||||
@Autowired
|
||||
private IIssueLogDAO issueLogDAO;
|
||||
|
||||
@Autowired
|
||||
private IProjectLogDAO projectLogDAO;
|
||||
|
||||
@Autowired
|
||||
private IUserDAO userDAO;
|
||||
|
||||
@Autowired
|
||||
private IOrderDAO orderDAO;
|
||||
|
||||
@Autowired
|
||||
private IConfigurationDAO configurationDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<IssueLog> getIssueLogs() {
|
||||
return projectLogDAO.getIssueLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<Order> getOrders() {
|
||||
return orderDAO.getOrders();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<User> getUsers() {
|
||||
List<User> users = new ArrayList<User>();
|
||||
users.addAll(userDAO.findAll());
|
||||
return users;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void initCreate() {
|
||||
boolean codeGenerated = configurationDAO.getConfiguration()
|
||||
.getGenerateCodeForProjectLog();
|
||||
this.issueLog = IssueLog.create();
|
||||
if (codeGenerated) {
|
||||
issueLog.setCodeAutogenerated(codeGenerated);
|
||||
setDefaultCode();
|
||||
try {
|
||||
issueLog.setCreatedBy(userDAO.findByLoginName(SecurityUtils.getSessionUserLoginName()));
|
||||
} catch (InstanceNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initEdit(IssueLog issueLog) {
|
||||
this.issueLog = issueLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IssueLog getIssueLog() {
|
||||
return this.issueLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirmSave() throws ValidationException {
|
||||
issueLogDAO.save(issueLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
issueLog = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void remove(IssueLog issueLog) {
|
||||
try {
|
||||
issueLogDAO.remove(issueLog.getId());
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityNameEnum getEntityName() {
|
||||
return EntityNameEnum.ISSUE_LOG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegrationEntity getCurrentEntity() {
|
||||
return this.issueLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<IntegrationEntity> getChildren() {
|
||||
return new HashSet<IntegrationEntity>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrder() {
|
||||
return issueLog.getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrder(Order order) {
|
||||
if (this.issueLog != null) {
|
||||
IssueLog issueLog = getIssueLog();
|
||||
issueLog.setOrder(order);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getCreatedBy() {
|
||||
return issueLog.getCreatedBy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreatedBy(User user) {
|
||||
if (this.issueLog != null) {
|
||||
IssueLog issueLog = getIssueLog();
|
||||
issueLog.setCreatedBy(user);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.web.common.Util;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.util.GenericForwardComposer;
|
||||
import org.zkoss.zul.api.Window;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
|
||||
/**
|
||||
* Controller for Logs(issue and risk logs)
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
@org.springframework.stereotype.Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class LogsController extends GenericForwardComposer {
|
||||
|
||||
|
||||
private Window issueLogWindow;
|
||||
private Window riskLogWindow;
|
||||
private Window logWindow;
|
||||
|
||||
private IssueLogCRUDController issueLogController;
|
||||
private RiskLogCRUDController riskLogController;
|
||||
private static boolean projectNameVisibility = true;
|
||||
private static Order order = null;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
comp.setVariable("logsController", this, true);
|
||||
logWindow = (Window) comp.getFellowIfAny("logWindow");
|
||||
Util.createBindingsFor(logWindow);
|
||||
setupIssueLogController();
|
||||
}
|
||||
|
||||
public void setupIssueLogController() {
|
||||
issueLogWindow = (Window) self.getFellowIfAny("issueLogWindow");
|
||||
|
||||
if (issueLogController == null) {
|
||||
issueLogController = new IssueLogCRUDController();
|
||||
}
|
||||
try {
|
||||
issueLogController.doAfterCompose(issueLogWindow);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setupRiskLogController() {
|
||||
riskLogWindow = (Window) self.getFellowIfAny("riskLogWindow");
|
||||
|
||||
if (riskLogController == null) {
|
||||
riskLogController = new RiskLogCRUDController();
|
||||
}
|
||||
try {
|
||||
riskLogController.doAfterCompose(riskLogWindow);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void goToOrderMode(Order order) {
|
||||
LogsController.projectNameVisibility =false;
|
||||
LogsController.order = order;
|
||||
}
|
||||
|
||||
public static void goToGlobalMode(){
|
||||
projectNameVisibility = true;
|
||||
order = null;
|
||||
}
|
||||
|
||||
public static boolean getProjectNameVisibility() {
|
||||
return projectNameVisibility;
|
||||
}
|
||||
|
||||
public static Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,449 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
|
||||
import static org.libreplan.web.I18nHelper._;
|
||||
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.logs.entities.LowMediumHighEnum;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
import org.libreplan.business.logs.entities.RiskScoreStatesEnum;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.web.common.BaseCRUDController;
|
||||
import org.libreplan.web.common.Util;
|
||||
import org.libreplan.web.common.components.bandboxsearch.BandboxSearch;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.WrongValueException;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.*;
|
||||
|
||||
/**
|
||||
* Controller for RiskLog CRUD actions
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@org.springframework.stereotype.Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class RiskLogCRUDController extends BaseCRUDController<RiskLog> {
|
||||
|
||||
private static final org.apache.commons.logging.Log LOG = LogFactory
|
||||
.getLog(RiskLogCRUDController.class);
|
||||
|
||||
@Autowired
|
||||
private IRiskLogModel riskLogModel;
|
||||
|
||||
private BandboxSearch bdProjectRiskLog;
|
||||
|
||||
private BandboxSearch bdUserRiskLog;
|
||||
|
||||
private Textbox riskScore;
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
riskScore = (Textbox)comp.getFellow("editWindow").getFellow("riskScore");
|
||||
comp.setVariable("riskLogController", this, true);
|
||||
showListWindow();
|
||||
initializeOrderComponent();
|
||||
initializeUserComponent();
|
||||
bdProjectRiskLog.setDisabled(!LogsController.getProjectNameVisibility());
|
||||
bdUserRiskLog.setDisabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes order component
|
||||
*/
|
||||
private void initializeOrderComponent() {
|
||||
bdProjectRiskLog = (BandboxSearch) editWindow
|
||||
.getFellow("bdProjectRiskLog");
|
||||
Util.createBindingsFor(bdProjectRiskLog);
|
||||
bdProjectRiskLog.setListboxEventListener(Events.ON_SELECT,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdProjectRiskLog.getSelectedElement();
|
||||
riskLogModel.setOrder((Order) object);
|
||||
}
|
||||
});
|
||||
bdProjectRiskLog.setListboxEventListener(Events.ON_OK, new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdProjectRiskLog.getSelectedElement();
|
||||
riskLogModel.setOrder((Order) object);
|
||||
bdProjectRiskLog.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes user component
|
||||
*/
|
||||
private void initializeUserComponent() {
|
||||
bdUserRiskLog = (BandboxSearch) editWindow.getFellow("bdUserRiskLog");
|
||||
Util.createBindingsFor(bdUserRiskLog);
|
||||
bdUserRiskLog.setListboxEventListener(Events.ON_SELECT,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdUserRiskLog
|
||||
.getSelectedElement();
|
||||
riskLogModel.setCreatedBy((User) object);
|
||||
}
|
||||
});
|
||||
bdUserRiskLog.setListboxEventListener(Events.ON_OK,
|
||||
new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
final Object object = bdUserRiskLog
|
||||
.getSelectedElement();
|
||||
riskLogModel.setCreatedBy((User) object);
|
||||
bdUserRiskLog.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders risk logs
|
||||
*
|
||||
* @return {@link RowRenderer}
|
||||
*/
|
||||
public RowRenderer getRiskLogsRowRenderer() {
|
||||
return new RowRenderer() {
|
||||
|
||||
@Override
|
||||
public void render(Row row, Object data) throws Exception {
|
||||
final RiskLog riskLog = (RiskLog) data;
|
||||
row.setValue(riskLog);
|
||||
appendObject(row, riskLog.getCode());
|
||||
appendLabel(row, riskLog.getOrder().getName());
|
||||
appendObject(row, riskLog.getProbability());
|
||||
appendObject(row, riskLog.getImpact());
|
||||
appendObject(row, riskLog.getRiskScore());
|
||||
appendLabel(row, riskLog.getStatus());
|
||||
appendLabel(row, riskLog.getDescription());
|
||||
appendDate(row, riskLog.getDateCreated());
|
||||
appendLabel(row, riskLog.getCreatedBy().getFullName() + riskLog.getCreatedBy().getLoginName());
|
||||
appendLabel(row, riskLog.getCounterMeasures());
|
||||
appendLabel(row, riskLog.getScoreAfterCM().getDisplayName());
|
||||
appendLabel(row, riskLog.getContingency());
|
||||
appendLabel(row, riskLog.getResponsible());
|
||||
appendDate(row, riskLog.getActionWhen());
|
||||
appendLabel(row, riskLog.getNotes());
|
||||
appendOperations(row, riskLog);
|
||||
setScoreCellColor(row, riskLog.getRiskScore());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void setScoreCellColor(Row row, int riskScore) {
|
||||
Cell cell = (Cell) row.getChildren().get(4);
|
||||
switch (riskScore) {
|
||||
case 1: cell.setClass("riskLog-score-color-1");
|
||||
break;
|
||||
case 2: cell.setClass("riskLog-score-color-2");
|
||||
break;
|
||||
case 3: cell.setClass("riskLog-score-color-3");
|
||||
break;
|
||||
case 4: cell.setClass("riskLog-score-color-4");
|
||||
break;
|
||||
case 6: cell.setClass("riskLog-score-color-6");
|
||||
break;
|
||||
case 9: cell.setClass("riskLog-score-color-9");
|
||||
break;
|
||||
default: throw new UnsupportedCharsetException("Unsupported risk score");
|
||||
}
|
||||
}
|
||||
|
||||
public ListitemRenderer lowMediumHighEnumRenderer = new ListitemRenderer() {
|
||||
@Override
|
||||
public void render(org.zkoss.zul.Listitem item, Object data)
|
||||
throws Exception {
|
||||
LowMediumHighEnum lowMediumHighEnum = (LowMediumHighEnum) data;
|
||||
String displayName = lowMediumHighEnum.getDisplayName();
|
||||
item.setLabel(displayName);
|
||||
}
|
||||
};
|
||||
public ListitemRenderer riskScoreStatesEnumRenderer = new ListitemRenderer() {
|
||||
@Override
|
||||
public void render(org.zkoss.zul.Listitem item, Object data)
|
||||
throws Exception {
|
||||
RiskScoreStatesEnum riskScoreStatesEnum = (RiskScoreStatesEnum) data;
|
||||
String displayName = riskScoreStatesEnum.getDisplayName();
|
||||
item.setLabel(displayName);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders LOW, MEDIUM, HIGH enums
|
||||
*
|
||||
* @return {@link ListitemRenderer}
|
||||
*/
|
||||
public ListitemRenderer getLowMediumHighEnumRenderer() {
|
||||
return lowMediumHighEnumRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders riskScoreState enums
|
||||
*
|
||||
* @return {@link ListitemRenderer}
|
||||
*/
|
||||
public ListitemRenderer getRiskScoreStatesEnumRenderer() {
|
||||
return riskScoreStatesEnumRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified <code>object</code> to the specified
|
||||
* <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param object
|
||||
*/
|
||||
private void appendObject(final Row row, Object object) {
|
||||
String text = new String("");
|
||||
if (object != null) {
|
||||
text = object.toString();
|
||||
}
|
||||
appendLabel(row, text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates {@link Label} bases on the specified <code>value</code> and
|
||||
* appends to the specified <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param value
|
||||
*/
|
||||
private void appendLabel(final Row row, String value) {
|
||||
Label label = new Label(value);
|
||||
Cell cell = new Cell();
|
||||
cell.appendChild(label);
|
||||
row.appendChild(cell);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified <code>date</code> to the specified <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param date
|
||||
*/
|
||||
private void appendDate(final Row row, Date date) {
|
||||
String labelDate = new String("");
|
||||
if (date != null) {
|
||||
labelDate = Util.formatDate(date);
|
||||
}
|
||||
appendLabel(row, labelDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends operation(edit and remove) to the specified <code>row</code>
|
||||
*
|
||||
* @param row
|
||||
* @param riskLog
|
||||
*/
|
||||
private void appendOperations(final Row row, final RiskLog riskLog) {
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.appendChild(Util.createEditButton(new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
goToEditForm(riskLog);
|
||||
}
|
||||
}));
|
||||
hbox.appendChild(Util.createRemoveButton(new EventListener() {
|
||||
@Override
|
||||
public void onEvent(Event event) {
|
||||
confirmDelete(riskLog);
|
||||
}
|
||||
}));
|
||||
row.appendChild(hbox);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link LowMediumHighEnum} values
|
||||
*/
|
||||
public LowMediumHighEnum[] getLowMediumHighEnums() {
|
||||
return LowMediumHighEnum.values();
|
||||
}
|
||||
/**
|
||||
* Returns {@link org.libreplan.business.logs.entities.RiskScoreStatesEnum} values
|
||||
*/
|
||||
public RiskScoreStatesEnum[] getRiskScoreStatesEnums() {
|
||||
return RiskScoreStatesEnum.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of {@link Order} objects
|
||||
*/
|
||||
public List<Order> getOrders() {
|
||||
return riskLogModel.getOrders();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of {@link User} objects
|
||||
*/
|
||||
public List<User> getUsers() {
|
||||
return riskLogModel.getUsers();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Date} value
|
||||
*/
|
||||
public Date getDateCreated() {
|
||||
if (riskLogModel.getRiskLog() == null) {
|
||||
return null;
|
||||
}
|
||||
return (riskLogModel.getRiskLog().getDateCreated() != null) ? riskLogModel
|
||||
.getRiskLog().getDateCreated()
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the date created
|
||||
*
|
||||
* @param date
|
||||
* date created
|
||||
*/
|
||||
public void setDateCreated(Date date) {
|
||||
riskLogModel.getRiskLog().setDateCreated(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Action When
|
||||
*
|
||||
* @param date
|
||||
* date created
|
||||
*/
|
||||
public void setActionWhen(Date date) {
|
||||
riskLogModel.getRiskLog().setActionWhen(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@link Date} value
|
||||
*/
|
||||
public Date getActionWhen() {
|
||||
if (riskLogModel.getRiskLog() == null) {
|
||||
return null;
|
||||
}
|
||||
return (riskLogModel.getRiskLog().getActionWhen() != null) ? riskLogModel
|
||||
.getRiskLog().getActionWhen()
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Score for risk
|
||||
*
|
||||
*/
|
||||
public void setUpdateScore() {
|
||||
riskScore.setValue(String.valueOf(getRiskLog().getRiskScore()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link RiskLog} object
|
||||
*/
|
||||
public RiskLog getRiskLog() {
|
||||
return riskLogModel.getRiskLog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of {@link RiskLog} objects
|
||||
*/
|
||||
public List<RiskLog> getRiskLogs() {
|
||||
if (LogsController.getProjectNameVisibility() == true)
|
||||
return riskLogModel.getRiskLogs();
|
||||
else{
|
||||
List<RiskLog> riskLogs = new ArrayList<RiskLog>();
|
||||
Order order = LogsController.getOrder();
|
||||
for (RiskLog issueLog : riskLogModel.getRiskLogs()) {
|
||||
if (issueLog.getOrder().equals(order))
|
||||
riskLogs.add(issueLog);
|
||||
}
|
||||
return riskLogs;
|
||||
}
|
||||
}
|
||||
|
||||
public Order getOrder() {
|
||||
if (LogsController.getProjectNameVisibility() == false) {
|
||||
getRiskLog().setOrder(LogsController.getOrder());
|
||||
return getRiskLog().getOrder();
|
||||
}
|
||||
else
|
||||
return riskLogModel.getRiskLog().getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEntityType() {
|
||||
return _("Issue log");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getPluralEntityType() {
|
||||
return _("Issue logs");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initCreate() {
|
||||
riskLogModel.initCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEdit(RiskLog entity) {
|
||||
riskLogModel.initEdit(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void save() throws ValidationException {
|
||||
if (getRiskLog().getOrder() == null) {
|
||||
throw new WrongValueException(bdProjectRiskLog,
|
||||
_("please select a project"));
|
||||
}
|
||||
|
||||
if (getRiskLog().getCreatedBy() == null) {
|
||||
throw new WrongValueException(bdUserRiskLog,
|
||||
_("please select an author"));
|
||||
}
|
||||
|
||||
riskLogModel.confirmSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RiskLog getEntityBeingEdited() {
|
||||
return riskLogModel.getRiskLog();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void delete(RiskLog entity) throws InstanceNotFoundException {
|
||||
riskLogModel.remove(entity);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.libreplan.web.logs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.libreplan.business.common.IntegrationEntity;
|
||||
import org.libreplan.business.common.daos.IConfigurationDAO;
|
||||
import org.libreplan.business.common.entities.EntityNameEnum;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.common.exceptions.ValidationException;
|
||||
import org.libreplan.business.logs.daos.IProjectLogDAO;
|
||||
import org.libreplan.business.logs.daos.IRiskLogDAO;
|
||||
import org.libreplan.business.logs.entities.RiskLog;
|
||||
import org.libreplan.business.orders.daos.IOrderDAO;
|
||||
import org.libreplan.business.orders.entities.Order;
|
||||
import org.libreplan.business.users.daos.IUserDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.web.common.IntegrationEntityModel;
|
||||
import org.libreplan.web.common.concurrentdetection.OnConcurrentModification;
|
||||
import org.libreplan.web.security.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* Model for UI operations related to {@link RiskLog}
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
@Service
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
@OnConcurrentModification(goToPage = "/logs/_logs.zul")
|
||||
public class RiskLogModel extends IntegrationEntityModel implements
|
||||
IRiskLogModel {
|
||||
|
||||
private RiskLog riskLog;
|
||||
|
||||
@Autowired
|
||||
private IRiskLogDAO riskLogDAO;
|
||||
|
||||
@Autowired
|
||||
private IProjectLogDAO projectLogDAO;
|
||||
|
||||
@Autowired
|
||||
private IUserDAO userDAO;
|
||||
|
||||
@Autowired
|
||||
private IOrderDAO orderDAO;
|
||||
|
||||
@Autowired
|
||||
private IConfigurationDAO configurationDAO;
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<RiskLog> getRiskLogs() {
|
||||
return projectLogDAO.getRiskLogs();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<Order> getOrders() {
|
||||
return orderDAO.getOrders();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public List<User> getUsers() {
|
||||
List<User> users = new ArrayList<User>();
|
||||
users.addAll(userDAO.findAll());
|
||||
return users;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void initCreate() {
|
||||
boolean codeGenerated = configurationDAO.getConfiguration()
|
||||
.getGenerateCodeForProjectLog();
|
||||
this.riskLog = RiskLog.create();
|
||||
if (codeGenerated) {
|
||||
riskLog.setCodeAutogenerated(codeGenerated);
|
||||
setDefaultCode();
|
||||
try {
|
||||
riskLog.setCreatedBy(userDAO.findByLoginName(SecurityUtils.getSessionUserLoginName()));
|
||||
} catch (InstanceNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initEdit(RiskLog riskLog) {
|
||||
this.riskLog = riskLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RiskLog getRiskLog() {
|
||||
return this.riskLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void confirmSave() throws ValidationException {
|
||||
riskLogDAO.save(riskLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
riskLog = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void remove(RiskLog riskLog) {
|
||||
try {
|
||||
riskLogDAO.remove(riskLog.getId());
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityNameEnum getEntityName() {
|
||||
return EntityNameEnum.RISK_LOG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IntegrationEntity getCurrentEntity() {
|
||||
return this.riskLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<IntegrationEntity> getChildren() {
|
||||
return new HashSet<IntegrationEntity>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrder() {
|
||||
return riskLog.getOrder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrder(Order order) {
|
||||
if (this.riskLog != null) {
|
||||
RiskLog riskLog = getRiskLog();
|
||||
riskLog.setOrder(order);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getCreatedBy() {
|
||||
return riskLog.getCreatedBy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreatedBy(User user) {
|
||||
if (this.riskLog != null) {
|
||||
RiskLog riskLog = getRiskLog();
|
||||
riskLog.setCreatedBy(user);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -47,6 +47,9 @@ public interface IGlobalViewEntryPoints {
|
|||
@EntryPoint("limiting_resources")
|
||||
public void goToLimitingResources();
|
||||
|
||||
/* @EntryPoint("logs")
|
||||
public void goToLogs();*/
|
||||
|
||||
@EntryPoint("orders_list")
|
||||
public void goToOrdersList();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.libreplan.web.planner.tabs;
|
||||
|
||||
import static org.libreplan.web.I18nHelper._;
|
||||
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR;
|
||||
import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.libreplan.web.common.Util;
|
||||
import org.libreplan.web.logs.LogsController;
|
||||
import org.libreplan.web.planner.order.IOrderPlanningGate;
|
||||
import org.libreplan.web.planner.tabs.CreatedOnDemandTab.IComponentCreator;
|
||||
import org.libreplan.web.security.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.zkoss.ganttz.extensions.ITab;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zul.Image;
|
||||
import org.zkoss.zul.Label;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Creates global Tab for Logs(issue and risk logs)
|
||||
*
|
||||
* @author Misha Gozhda <misha@libreplan-enterprise.com>
|
||||
*/
|
||||
public class LogsTabCreator {
|
||||
|
||||
public static ITab create(Mode mode, LogsController logsController, LogsController logsControllerGlobal,
|
||||
Component breadcrumbs, IOrderPlanningGate orderPlanningGate,
|
||||
Map<String, String[]> parameters) {
|
||||
return new LogsTabCreator(mode, logsController, logsControllerGlobal, breadcrumbs,
|
||||
orderPlanningGate, parameters)
|
||||
.build();
|
||||
}
|
||||
|
||||
private final Mode mode;
|
||||
|
||||
private final LogsController logsControllerGlobal;
|
||||
|
||||
private final LogsController logsController;
|
||||
|
||||
private final Component breadcrumbs;
|
||||
|
||||
private final IOrderPlanningGate orderPlanningGate;
|
||||
|
||||
private LogsTabCreator(Mode mode, LogsController logsController, LogsController logsControllerGlobal,
|
||||
Component breadcrumbs, IOrderPlanningGate orderPlanningGate,
|
||||
Map<String, String[]> parameters) {
|
||||
this.mode = mode;
|
||||
this.logsController = logsController;
|
||||
this.logsControllerGlobal = logsControllerGlobal;
|
||||
this.breadcrumbs = breadcrumbs;
|
||||
this.orderPlanningGate = orderPlanningGate;
|
||||
}
|
||||
|
||||
private ITab build() {
|
||||
return TabOnModeType.forMode(mode)
|
||||
.forType(ModeType.GLOBAL, createGlobalLogsTab())
|
||||
.forType(ModeType.ORDER, createOrderLogsTab())
|
||||
.create();
|
||||
}
|
||||
|
||||
|
||||
private ITab createGlobalLogsTab() {
|
||||
IComponentCreator componentCreator = new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
arguments.put("logsController", logsControllerGlobal);
|
||||
return Executions.createComponents("/logs/_logs.zul",
|
||||
parent, arguments);
|
||||
}
|
||||
|
||||
};
|
||||
return new CreatedOnDemandTab(_("Logs"), "logs-global",
|
||||
componentCreator) {
|
||||
@Override
|
||||
protected void beforeShowAction() {
|
||||
if (!SecurityUtils
|
||||
.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
|
||||
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
if (breadcrumbs.getChildren() != null) {
|
||||
breadcrumbs.getChildren().clear();
|
||||
}
|
||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
|
||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
breadcrumbs.appendChild(new Label(_("Logs")));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private ITab createOrderLogsTab() {
|
||||
IComponentCreator componentCreator = new IComponentCreator() {
|
||||
|
||||
@Override
|
||||
public org.zkoss.zk.ui.Component create(
|
||||
org.zkoss.zk.ui.Component parent) {
|
||||
Map<String, Object> arguments = new HashMap<String, Object>();
|
||||
arguments.put("logsController", logsController);
|
||||
return Executions.createComponents("/logs/_logs.zul",
|
||||
parent, arguments);
|
||||
}
|
||||
|
||||
};
|
||||
return new CreatedOnDemandTab(_("Logs"), "logs-order",
|
||||
componentCreator) {
|
||||
@Override
|
||||
protected void beforeShowAction() {
|
||||
if (!SecurityUtils
|
||||
.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) {
|
||||
Util.sendForbiddenStatusCodeInHttpServletResponse();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void afterShowAction() {
|
||||
if (breadcrumbs.getChildren() != null) {
|
||||
breadcrumbs.getChildren().clear();
|
||||
}
|
||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
breadcrumbs.appendChild(new Label(getSchedulingLabel()));
|
||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
breadcrumbs.appendChild(new Label(_("Logs")));
|
||||
breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR));
|
||||
breadcrumbs.appendChild(new Label(mode.getOrder().getName()));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,6 +42,7 @@ import org.libreplan.web.common.entrypoints.URLHandlerRegistry;
|
|||
import org.libreplan.web.dashboard.DashboardController;
|
||||
import org.libreplan.web.dashboard.DashboardControllerGlobal;
|
||||
import org.libreplan.web.limitingresources.LimitingResourcesController;
|
||||
import org.libreplan.web.logs.LogsController;
|
||||
import org.libreplan.web.montecarlo.MonteCarloController;
|
||||
import org.libreplan.web.orders.OrderCRUDController;
|
||||
import org.libreplan.web.planner.allocation.AdvancedAllocationController.IBack;
|
||||
|
|
@ -75,6 +76,8 @@ import org.zkoss.zk.ui.event.EventListener;
|
|||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zk.ui.util.Composer;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Creates and handles several tabs
|
||||
*
|
||||
|
|
@ -83,7 +86,8 @@ import org.zkoss.zk.ui.util.Composer;
|
|||
*/
|
||||
@Component
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
public class MultipleTabsPlannerController implements Composer,
|
||||
public class
|
||||
MultipleTabsPlannerController implements Composer,
|
||||
IGlobalViewEntryPoints {
|
||||
|
||||
public static String WELCOME_URL = "-- no URL provided --";
|
||||
|
|
@ -164,6 +168,8 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
|
||||
private ITab dashboardTab;
|
||||
|
||||
private ITab logsTab;
|
||||
|
||||
private TabSwitcher tabsSwitcher;
|
||||
|
||||
@Autowired
|
||||
|
|
@ -190,6 +196,12 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
@Autowired
|
||||
private DashboardControllerGlobal dashboardControllerGlobal;
|
||||
|
||||
@Autowired
|
||||
private LogsController logsController;
|
||||
|
||||
@Autowired
|
||||
private LogsController logsControllerGlobal;
|
||||
|
||||
private org.zkoss.zk.ui.Component breadcrumbs;
|
||||
|
||||
@Autowired
|
||||
|
|
@ -254,7 +266,7 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
|
||||
@Override
|
||||
public void goToTaskResourceAllocation(Order order,
|
||||
TaskElement task) {
|
||||
TaskElement task) {
|
||||
orderPlanningController.setShowedTask(task);
|
||||
orderPlanningController.setCurrentControllerToShow(orderPlanningController.getEditTaskController());
|
||||
getTabsRegistry()
|
||||
|
|
@ -303,6 +315,32 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
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,
|
||||
|
|
@ -334,6 +372,8 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
tabsConfiguration.add(visibleOnlyAtOrderMode(monteCarloTab));
|
||||
}
|
||||
|
||||
tabsConfiguration.add(tabWithNameReloading(logsTab, typeChanged));
|
||||
|
||||
return tabsConfiguration;
|
||||
}
|
||||
|
||||
|
|
@ -467,6 +507,7 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
|
||||
@Override
|
||||
public void goToCompanyScheduling() {
|
||||
LogsController.goToGlobalMode();
|
||||
getTabsRegistry().show(planningTab);
|
||||
}
|
||||
|
||||
|
|
@ -475,6 +516,11 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
getTabsRegistry().show(resourceLoadTab);
|
||||
}
|
||||
|
||||
/*@Override
|
||||
public void goToLogs() {
|
||||
getTabsRegistry().show(logsTab);
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void goToCompanyLimitingResources() {
|
||||
getTabsRegistry().show(limitingResourcesTab);
|
||||
|
|
@ -541,6 +587,7 @@ public class MultipleTabsPlannerController implements Composer,
|
|||
}
|
||||
|
||||
private IBeforeShowAction changeModeTo(final Order order) {
|
||||
logsController.goToOrderMode(order);
|
||||
return new IBeforeShowAction() {
|
||||
@Override
|
||||
public void doAction() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* This file is part of LibrePlan
|
||||
*
|
||||
* Copyright (C) 2012 Igalia, S.L.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*//*
|
||||
|
||||
|
||||
package org.libreplan.web.users.services;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.libreplan.business.common.IAdHocTransactionService;
|
||||
import org.libreplan.business.common.IOnTransaction;
|
||||
import org.libreplan.business.common.exceptions.InstanceNotFoundException;
|
||||
import org.libreplan.business.users.daos.IOrderAuthorizationDAO;
|
||||
import org.libreplan.business.users.daos.IUserDAO;
|
||||
import org.libreplan.business.users.entities.User;
|
||||
import org.libreplan.business.users.entities.UserRole;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.Authentication;
|
||||
import org.springframework.security.ui.TargetUrlResolverImpl;
|
||||
import org.springframework.security.ui.savedrequest.SavedRequest;
|
||||
import org.springframework.security.userdetails.UserDetails;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Determines the URL for authenticated users depending on if user is bound or
|
||||
* not to any resource.<br />
|
||||
*
|
||||
* If the user is bound to a resource then the target URL will be the user
|
||||
* dashboard.
|
||||
*
|
||||
* @author Manuel Rego Casasnovas <mrego@igalia.com>
|
||||
*//*
|
||||
|
||||
public class CustomTargetUrlResolver extends TargetUrlResolverImpl {
|
||||
|
||||
public final static String USER_DASHBOARD_URL = "/myaccount/userDashboard.zul";
|
||||
|
||||
public static final String PLANNING_URL = "/planner/index.zul";
|
||||
|
||||
public static final String SETTINGS_URL = "/myaccount/settings.zul";
|
||||
|
||||
@Autowired
|
||||
private IUserDAO userDAO;
|
||||
|
||||
@Autowired
|
||||
private IOrderAuthorizationDAO orderAuthorizationDAO;
|
||||
|
||||
@Autowired
|
||||
private IAdHocTransactionService transactionServiceDAO;
|
||||
|
||||
@Override
|
||||
public String determineTargetUrl(SavedRequest savedRequest,
|
||||
HttpServletRequest currentRequest, final Authentication auth) {
|
||||
if (isUserInRole(auth, UserRole.ROLE_SUPERUSER.name())) {
|
||||
return super.determineTargetUrl(savedRequest, currentRequest, auth);
|
||||
}
|
||||
|
||||
if (isUserInRole(auth, UserRole.ROLE_BOUND_USER.name())) {
|
||||
return USER_DASHBOARD_URL;
|
||||
}
|
||||
|
||||
if (isUserInRole(auth, UserRole.ROLE_PLANNING.name())) {
|
||||
return PLANNING_URL;
|
||||
}
|
||||
|
||||
boolean userOrItsProfilesHaveAnyAuthorization = transactionServiceDAO
|
||||
.runOnReadOnlyTransaction(new IOnTransaction<Boolean>() {
|
||||
@Override
|
||||
public Boolean execute() {
|
||||
try {
|
||||
UserDetails userDetails = (UserDetails) auth.getPrincipal();
|
||||
User user = userDAO.findByLoginName(userDetails.getUsername());
|
||||
user.getProfiles().size();
|
||||
return orderAuthorizationDAO
|
||||
.userOrItsProfilesHaveAnyAuthorization(user);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
if (userOrItsProfilesHaveAnyAuthorization) {
|
||||
return PLANNING_URL;
|
||||
}
|
||||
|
||||
return SETTINGS_URL;
|
||||
}
|
||||
|
||||
private boolean isUserInRole(Authentication auth, String role) {
|
||||
if ((auth == null) || (auth.getPrincipal() == null)
|
||||
|| (auth.getAuthorities() == null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < auth.getAuthorities().length; i++) {
|
||||
if (role.equals(auth.getAuthorities()[i].getAuthority())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -6,18 +6,18 @@
|
|||
* to integrate the custom appearance of the web application.
|
||||
*/
|
||||
|
||||
/* ----- Predefined Height dependent styles ----- */
|
||||
.scheduling-graphics {
|
||||
height:200px;
|
||||
}
|
||||
/* ----- Predefined Height dependent styles ----- */
|
||||
.scheduling-graphics {
|
||||
height:200px;
|
||||
}
|
||||
|
||||
.main-layout {
|
||||
height: 560px;
|
||||
}
|
||||
.main-layout {
|
||||
height: 560px;
|
||||
}
|
||||
|
||||
.taskheaders-border {
|
||||
width: 300px;
|
||||
}
|
||||
.taskheaders-border {
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.plannerlayout #watermark {
|
||||
height: 99999px !important;
|
||||
|
|
@ -108,12 +108,12 @@ body .advancedallocationlayout .icono .z-button-cm {
|
|||
}
|
||||
|
||||
.toolbar-box .z-button {
|
||||
padding: 1px 2px 2px 2px;
|
||||
padding: 1px 2px 2px 2px;
|
||||
}
|
||||
|
||||
.planner-command .z-button-cm,
|
||||
.planner-icon .z-button-cm {
|
||||
padding: 2px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
.toolbar-box .z-button .z-button-cm,
|
||||
|
|
@ -159,7 +159,7 @@ body .advancedallocationlayout .icono .z-button-cm {
|
|||
}
|
||||
|
||||
.global-action.z-button .z-button-cm {
|
||||
padding: 4px 25px;
|
||||
padding: 4px 25px !important;
|
||||
background-position: 5px;
|
||||
background-repeat: no-repeat;
|
||||
margin-right: 1px;
|
||||
|
|
@ -172,11 +172,11 @@ body .advancedallocationlayout .icono .z-button-cm {
|
|||
}
|
||||
|
||||
.save-button.z-button .z-button-cm {
|
||||
background-image: url(../img/bt_ok.png);
|
||||
background-image: url(../img/bt_ok.png) !important;
|
||||
}
|
||||
|
||||
.create-button.z-button .z-button-cm {
|
||||
background-image: url(../img/bt_create.png);
|
||||
background-image: url(../img/bt_create.png) !important;
|
||||
}
|
||||
|
||||
.saveandcontinue-button.z-button .z-button-cm {
|
||||
|
|
@ -184,7 +184,7 @@ body .advancedallocationlayout .icono .z-button-cm {
|
|||
}
|
||||
|
||||
.cancel-button.z-button .z-button-cm {
|
||||
background-image: url(../img/bt_cancel.png);
|
||||
background-image: url(../img/bt_cancel.png) !important;
|
||||
}
|
||||
|
||||
.back-button.z-button .z-button-cm {
|
||||
|
|
@ -400,7 +400,7 @@ div.z-row-cnt {
|
|||
}
|
||||
|
||||
.z-window-embedded-tr,.z-window-highlighted-tr,.z-window-overlapped-tr,.z-window-popup-tr
|
||||
{
|
||||
{
|
||||
background: none;
|
||||
}
|
||||
|
||||
|
|
@ -581,7 +581,7 @@ div.z-grid {
|
|||
}
|
||||
|
||||
.listdetails .z-tree .z-datebox-inp {
|
||||
padding-top: 3px;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
.listdetails input {
|
||||
|
|
@ -722,7 +722,7 @@ padding-top: 3px;
|
|||
border: 0;
|
||||
}
|
||||
.perspectives-column {
|
||||
/* border-right: solid 1px; */
|
||||
/* border-right: solid 1px; */
|
||||
}
|
||||
|
||||
/* Legend colors:
|
||||
|
|
@ -893,19 +893,19 @@ span.z-dottree-line {
|
|||
}
|
||||
|
||||
.z-menu-body {
|
||||
background-color: #d4e1ef;
|
||||
border-radius: 10px 10px 0 0;
|
||||
background-color: #d4e1ef;
|
||||
border-radius: 10px 10px 0 0;
|
||||
}
|
||||
|
||||
.z-menu-inner-m .z-menu-btn {
|
||||
font-weight: normal;
|
||||
color: #005782;
|
||||
font-weight: normal;
|
||||
color: #005782;
|
||||
}
|
||||
|
||||
.z-menu-body-over .z-menu-inner-m .z-menu-btn,
|
||||
.z-menu-body-seld .z-menu-inner-m .z-menu-btn,
|
||||
.current-section .z-menu-body .z-menu-inner-m .z-menu-btn {
|
||||
color: #FFFFFF;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.z-menu-body-over, .z-menu-body-seld, .current-section .z-menu-body {
|
||||
|
|
@ -916,7 +916,7 @@ span.z-dottree-line {
|
|||
.z-menu-body-over .z-menu-inner-l,
|
||||
.z-menu-body-over .z-menu-inner-m,
|
||||
.z-menu-body-over .z-menu-inner-r {
|
||||
background-image:none;
|
||||
background-image:none;
|
||||
}
|
||||
|
||||
.z-menu-body-seld .z-menu-inner-l,
|
||||
|
|
@ -1077,6 +1077,19 @@ span.perspective, span.perspective-active {
|
|||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.perspective.logs-global .z-button-cm {
|
||||
background-image: url(../img/ico_logs-global.png);
|
||||
}
|
||||
.perspective-active.logs-global .z-button-cm {
|
||||
background-image: url(../img/ico_logs-global.png);
|
||||
}
|
||||
|
||||
.perspective.logs-order .z-button-cm {
|
||||
background-image: url(../img/ico_logs-order.png);
|
||||
}
|
||||
.perspective-active.logs-order .z-button-cm {
|
||||
background-image: url(../img/ico_logs-order.png);
|
||||
}
|
||||
|
||||
.perspectives-column {
|
||||
display:none;
|
||||
|
|
@ -1137,7 +1150,7 @@ span.perspective, span.perspective-active {
|
|||
}
|
||||
|
||||
.main-area > .z-center-body:first-child {
|
||||
/* height: auto !important; */
|
||||
/* height: auto !important; */
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
|
|
@ -1175,18 +1188,18 @@ tr.z-treerow-seld input {
|
|||
|
||||
tr.z-treerow-over input {
|
||||
background-color: #eff2f6; /* Soft blue */
|
||||
background-image: none;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
tr.z-treerow-over input {
|
||||
background-color: #eff2f6; /* Soft blue */
|
||||
background-image: none;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.timeplot-canvas {
|
||||
position:relative;
|
||||
overflow:hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.resourcesload .timetracker-secondlevel {
|
||||
height: 2000px;
|
||||
|
|
@ -1268,15 +1281,15 @@ tr.z-treerow-over input {
|
|||
}
|
||||
|
||||
.timeTrackedTableWithLeftPane input[value="0"] {
|
||||
color: #DDDDDD;
|
||||
color: #DDDDDD;
|
||||
}
|
||||
|
||||
/* for horizontal scrolling */
|
||||
.timeTrackedTableWithLeftPane .z-grid-body table {
|
||||
position:relative;
|
||||
position:relative;
|
||||
}
|
||||
.timeTrackedTableWithLeftPane div.z-grid-body {
|
||||
overflow: visible;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.advancedallocationlayout #timeTracker .z-vbox {
|
||||
|
|
@ -1323,7 +1336,7 @@ overflow: visible;
|
|||
}
|
||||
|
||||
.advancedallocationlayout .timetrackergap {
|
||||
overflow: visible;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.timeTrackedTableWithLeftPane .z-grid-body .z-row-inner {
|
||||
|
|
@ -1412,7 +1425,7 @@ tr.z-tree-row-seld .z-row-cnt {
|
|||
}
|
||||
|
||||
.edit-task-window .z-tab-accordion {
|
||||
display:none;
|
||||
display:none;
|
||||
}
|
||||
|
||||
.edit-task-window .z-tabpanel-accordion {
|
||||
|
|
@ -1485,7 +1498,7 @@ display:none;
|
|||
}
|
||||
|
||||
#ganttpanel .second_level_ #watermark .bankHoliday {
|
||||
border-right: solid 1px #F2D8D8 !important;
|
||||
border-right: solid 1px #F2D8D8 !important;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1584,7 +1597,7 @@ border-right: solid 1px #F2D8D8 !important;
|
|||
.advanced-assignment-area td .limiting.z-textbox {
|
||||
height: 20px;
|
||||
background: #61B598; // LIMITING_ASSIGNED
|
||||
color: #555555;
|
||||
color: #555555;
|
||||
border-right: solid 1px white;
|
||||
opacity: 1;
|
||||
-moz-opacity: 1;
|
||||
|
|
@ -1594,7 +1607,7 @@ border-right: solid 1px #F2D8D8 !important;
|
|||
.advanced-assignment-area td .limiting.z-intbox[value="0"],
|
||||
.advanced-assignment-area td .limiting.z-textbox[value="0"] {
|
||||
background: #C1D9D1; // LIMITING_UNNASSIGNED
|
||||
color: #555555;
|
||||
color: #555555;
|
||||
}
|
||||
|
||||
.advanced-assignment-area > .z-center-body {
|
||||
|
|
@ -1888,7 +1901,7 @@ select {
|
|||
}
|
||||
|
||||
.scheduling-graphics {
|
||||
width: auto !important;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
.scheduling-graphics .z-tabs-ver-space {
|
||||
|
|
@ -1927,3 +1940,41 @@ select {
|
|||
.z-menu-popup a:focus {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.issueLog-priority-color-red {
|
||||
background: #FF4000 !important;
|
||||
}
|
||||
|
||||
.issueLog-priority-color-yellow {
|
||||
background: #FFA500 !important;
|
||||
}
|
||||
|
||||
.issueLog-priority-color-green {
|
||||
background: #AAFFAA !important;
|
||||
}
|
||||
|
||||
.riskLog-score-color-1 {
|
||||
background: #BAF109 !important;
|
||||
}
|
||||
|
||||
.riskLog-score-color-2 {
|
||||
background: #A3D307 !important;
|
||||
}
|
||||
|
||||
.riskLog-score-color-3 {
|
||||
background: #FFAF04 !important;
|
||||
}
|
||||
|
||||
.riskLog-score-color-4 {
|
||||
background: #FF9000 !important;
|
||||
}
|
||||
|
||||
.riskLog-score-color-6 {
|
||||
background: #FF4B00 !important;
|
||||
}
|
||||
|
||||
.riskLog-score-color-9 {
|
||||
background: #EA0024 !important;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
BIN
libreplan-webapp/src/main/webapp/common/img/cabecera.jpg
Normal file
BIN
libreplan-webapp/src/main/webapp/common/img/cabecera.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
BIN
libreplan-webapp/src/main/webapp/common/img/ico_logs-global.png
Normal file
BIN
libreplan-webapp/src/main/webapp/common/img/ico_logs-global.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
BIN
libreplan-webapp/src/main/webapp/common/img/ico_logs-order.png
Normal file
BIN
libreplan-webapp/src/main/webapp/common/img/ico_logs-order.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.2 KiB |
BIN
libreplan-webapp/src/main/webapp/common/img/logo.gif
Normal file
BIN
libreplan-webapp/src/main/webapp/common/img/logo.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
BIN
libreplan-webapp/src/main/webapp/common/img/logo2.gif
Normal file
BIN
libreplan-webapp/src/main/webapp/common/img/logo2.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
169
libreplan-webapp/src/main/webapp/logs/_editIssueLog.zul
Normal file
169
libreplan-webapp/src/main/webapp/logs/_editIssueLog.zul
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<window id="editWindow">
|
||||
<caption id="caption" sclass="caption-title" />
|
||||
<grid id="issueLogGrid">
|
||||
<columns>
|
||||
<column width="160px" />
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Issue number')}" />
|
||||
<textbox id="issueNumberTextBox" width="605px"
|
||||
value="@{issueLogController.issueLog.code}" disabled="true"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Project')}" />
|
||||
<bandboxSearch id="bdProjectIssueLog" widthBandbox="610px" widthListbox="610px"
|
||||
constraint="no empty:${i18n:_('cannot be empty')}"
|
||||
finder="OrderBandboxFinder"
|
||||
model="@{issueLogController.orders}"
|
||||
selectedElement="@{issueLogController.order}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Type and status')}" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="80px"/>
|
||||
<column width="235px"/>
|
||||
<column width="60px"/>
|
||||
<column width="235px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Type')}" />
|
||||
<listbox id="listIssueLogType" mold="select" rows="1" width="225px"
|
||||
model="@{issueLogController.issueTypeEnum}"
|
||||
selectedItem="@{issueLogController.issueLog.type}"
|
||||
itemRenderer="@{issueLogController.issueTypeRenderer}"
|
||||
onSelect="issueLogController.updateStatusList(true)"/>
|
||||
|
||||
<label value="${i18n:_('Status')}" />
|
||||
<listbox id="listIssueLogStatus" mold="select" rows="1" width="225px">
|
||||
|
||||
</listbox>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="${i18n:_('Creation info')}" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="80px"/>
|
||||
<column width="120px"/>
|
||||
<column width="80px"/>
|
||||
<column width="330px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Date raised')}" />
|
||||
<datebox id="dateRaisedBox" width="110px"
|
||||
constraint="no empty:${i18n:_('cannot be empty')}"
|
||||
value="@{issueLogController.dateRaised}" />
|
||||
|
||||
<label value="${i18n:_('Created by')}" />
|
||||
<bandboxSearch id="bdUserIssueLog" widthBandbox="320px" widthListbox="340px"
|
||||
finder="UserBandboxFinder"
|
||||
model="@{issueLogController.users}"
|
||||
selectedElement="@{issueLogController.issueLog.createdBy}"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Description')}" />
|
||||
<textbox id="descriptionNameTextBox" width="605px" rows="4"
|
||||
value="@{issueLogController.issueLog.description}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Categories')}" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="150px"/>
|
||||
<column width="155px"/>
|
||||
<column width="150px"/>
|
||||
<column width="155px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Priority')}" />
|
||||
<listbox id="listIssueLogPriority" mold="select" rows="1" width="145px"
|
||||
model="@{issueLogController.lowMediumHighEnum}"
|
||||
selectedItem="@{issueLogController.issueLog.priority}"
|
||||
itemRenderer="@{issueLogController.lowMediumHighEnumRenderer}" />
|
||||
|
||||
<label value="${i18n:_('Severity')}"/>
|
||||
<listbox id="listIssueLogSeverity" mold="select" rows="1" width="145px"
|
||||
model="@{issueLogController.lowMediumHighEnum}"
|
||||
selectedItem="@{issueLogController.issueLog.severity}"
|
||||
itemRenderer="@{issueLogController.lowMediumHighEnumRenderer}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Assigned to')}" />
|
||||
<textbox id="assignedToTextBox" width="605px"
|
||||
value="@{issueLogController.issueLog.assignedTo}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Timing')}" />
|
||||
<hbox>
|
||||
<grid id="timing">
|
||||
<columns>
|
||||
<column width="150px"/>
|
||||
<column width="155px"/>
|
||||
<column width="150px"/>
|
||||
<column width="155px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Deadline')}"/>
|
||||
<datebox id="deadline" width="145px"
|
||||
value="@{issueLogController.deadline}" />
|
||||
|
||||
<label value="${i18n:_('Date resolved')}" />
|
||||
<datebox id="dateResolved" width="145px"
|
||||
value="@{issueLogController.dateResolved}" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</hbox>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Notes')}" />
|
||||
<textbox value="@{issueLogController.issueLog.notes}" width="605px" rows="8" multiline="true" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<!-- Control buttons -->
|
||||
<button onClick="issueLogController.saveAndExit()"
|
||||
label="${i18n:_('Save')}"
|
||||
sclass="save-button global-action" />
|
||||
<button onClick="issueLogController.saveAndContinue()"
|
||||
label="${i18n:_('Save and Continue')}"
|
||||
sclass="save-button global-action" />
|
||||
<button onClick="issueLogController.cancelForm()"
|
||||
label="${i18n:_('Cancel')}"
|
||||
sclass="cancel-button global-action" />
|
||||
</window>
|
||||
168
libreplan-webapp/src/main/webapp/logs/_editRiskLog.zul
Normal file
168
libreplan-webapp/src/main/webapp/logs/_editRiskLog.zul
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<window id="editWindow" height="100%">
|
||||
<caption id="caption" sclass="caption-title" />
|
||||
<grid id="riskLogGrid" >
|
||||
<columns>
|
||||
<column width="160px" />
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Code')}" />
|
||||
<textbox id="riskNumberTextBox" width="605px"
|
||||
value="@{riskLogController.riskLog.code}" disabled="true"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="${i18n:_('Project')}" />
|
||||
<bandboxSearch id="bdProjectRiskLog" widthBandbox="610px" widthListbox="610px"
|
||||
constraint="no empty:${i18n:_('cannot be empty')}"
|
||||
finder="OrderBandboxFinder"
|
||||
model="@{riskLogController.orders}"
|
||||
selectedElement="@{riskLogController.order}"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="${i18n:_('Status')}" />
|
||||
<textbox value="@{riskLogController.riskLog.status}" width="605px" rows="1" multiline="false" />
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<label value="${i18n:_('Estimations')}" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="110px"/>
|
||||
<column width="120px"/>
|
||||
<column width="90px"/>
|
||||
<column width="120px"/>
|
||||
<column width="80px"/>
|
||||
<column width="90px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Probability')}" />
|
||||
<listbox id="listRiskLogProbability" mold="select" rows="1" width="110px"
|
||||
model="@{riskLogController.lowMediumHighEnums}"
|
||||
selectedItem="@{riskLogController.riskLog.probability}"
|
||||
itemRenderer="@{riskLogController.lowMediumHighEnumRenderer}"
|
||||
onSelect="riskLogController.setUpdateScore()"/>
|
||||
|
||||
<label value="${i18n:_('Impact')}" />
|
||||
<listbox id="listRiskLogImpact" mold="select" rows="1" width="110px"
|
||||
model="@{riskLogController.lowMediumHighEnums}"
|
||||
selectedItem="@{riskLogController.riskLog.impact}"
|
||||
itemRenderer="@{riskLogController.lowMediumHighEnumRenderer}"
|
||||
onSelect="riskLogController.setUpdateScore()" />
|
||||
|
||||
<label value="${i18n:_('Risk score')}" />
|
||||
<textbox id="riskScore" value="@{riskLogController.riskLog.riskScore}" width="75px" rows="1" disabled="true" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Creation info')}" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="80px"/>
|
||||
<column width="120px"/>
|
||||
<column width="80px"/>
|
||||
<column width="330px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
<label value="${i18n:_('Date created')}" />
|
||||
<datebox id="dateCreatedBox" width="110px"
|
||||
constraint="no empty:${i18n:_('cannot be empty')}"
|
||||
value="@{riskLogController.dateCreated}" />
|
||||
|
||||
<label value="${i18n:_('Created by')}" />
|
||||
<bandboxSearch id="bdUserRiskLog" widthBandbox="320px" widthListbox="340px"
|
||||
finder="UserBandboxFinder"
|
||||
model="@{riskLogController.users}"
|
||||
selectedElement="@{riskLogController.riskLog.createdBy}"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Description')}" />
|
||||
<textbox id="descriptionNameTextBox" width="605px" rows="3"
|
||||
value="@{riskLogController.riskLog.description}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Counter measures (CM)')}" />
|
||||
<textbox id="counterMeasuresTextbox" width="605px" rows="3"
|
||||
value="@{riskLogController.riskLog.counterMeasures}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Risk Score After CM')}" />
|
||||
<listbox id="listRiskScores" mold="select" rows="1" width="135px"
|
||||
model="@{riskLogController.riskScoreStatesEnums}"
|
||||
selectedItem="@{riskLogController.riskLog.scoreAfterCM}"
|
||||
itemRenderer="@{riskLogController.riskScoreStatesEnumRenderer}" />/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Contingency')}" />
|
||||
<textbox id="contingencyBox" width="605px" rows="3"
|
||||
value="@{riskLogController.riskLog.contingency}"/>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Prevention')}" />
|
||||
<grid>
|
||||
<columns>
|
||||
<column width="80px"/>
|
||||
<column width="120px"/>
|
||||
<column width="80px"/>
|
||||
<column width="330px"/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
|
||||
<label value="${i18n:_('Action When')}" />
|
||||
<datebox id="actionWhenDateBox" width="110px"
|
||||
constraint="no empty:${i18n:_('cannot be empty')}"
|
||||
value="@{riskLogController.actionWhen}" />
|
||||
|
||||
<label value="${i18n:_('Responsible')}" />
|
||||
<textbox id="responsibleBox" width="315px" rows="1"
|
||||
value="@{riskLogController.riskLog.responsible}"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</row>
|
||||
<row>
|
||||
<label value="${i18n:_('Notes')}" />
|
||||
<textbox value="@{riskLogController.riskLog.notes}" width="605px" rows="5" multiline="true" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
<!-- Control buttons -->
|
||||
<button onClick="riskLogController.saveAndExit()"
|
||||
label="${i18n:_('Save')}"
|
||||
sclass="save-button global-action" />
|
||||
<button onClick="riskLogController.saveAndContinue()"
|
||||
label="${i18n:_('Save and Continue')}"
|
||||
sclass="save-button global-action" />
|
||||
<button onClick="riskLogController.cancelForm()"
|
||||
label="${i18n:_('Cancel')}"
|
||||
sclass="cancel-button global-action" />
|
||||
</window>
|
||||
42
libreplan-webapp/src/main/webapp/logs/_listIssueLog.zul
Normal file
42
libreplan-webapp/src/main/webapp/logs/_listIssueLog.zul
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<window id="listWindow">
|
||||
<grid id="listIssueLog" model="@{issueLogController.issueLogs}" mold="paging"
|
||||
pageSize="15" span="0" sizedByContent="false"
|
||||
rowRenderer="@{issueLogController.issueLogsRowRenderer}">
|
||||
<columns sizable="true">
|
||||
<column label="${i18n:_('Code')}" sort="auto(lower(code))" id="code"/>
|
||||
<column label="${i18n:_('Projectname')}" visible="@{logsController.projectNameVisibility}" sort="auto(lower(order))" />
|
||||
<column label="${i18n:_('Type')}" sort="auto(lower(type))" width="9%"/>
|
||||
<column label="${i18n:_('Status')}" sort="auto(lower(status))"/>
|
||||
<column label="${i18n:_('Description')}" sort="auto(lower(description))"/>
|
||||
<column label="${i18n:_('Priority')}" sort="auto(lower(priority))"/>
|
||||
<column label="${i18n:_('Severity')}" sort="auto(lower(severity))"/>
|
||||
<column label="${i18n:_('Date raised')}" sort="auto(lower(dateRaised))"/>
|
||||
<column label="${i18n:_('Created By')}" sort="auto(lower(createdBy.loginName))" hflex="min" />
|
||||
<column label="${i18n:_('Assigned To')}" sort="auto(lower(assignedTo))"/>
|
||||
<column label="${i18n:_('Deadline')}" sort="auto(lower(deadline))"/>
|
||||
<column label="${i18n:_('Date Resolved')}" sort="auto(lower(dateResolved))"/>
|
||||
<column label="${i18n:_('Notes')}" sort="auto(lower(notes))"/>
|
||||
<column label="${i18n:_('Operations')}" sclass="operations" hflex="min"/>
|
||||
</columns>
|
||||
</grid>
|
||||
<button id="show_create_form" onClick='issueLogController.goToCreateForm()'
|
||||
label="${i18n:_('Create')}" sclass="create-button global-action"/>
|
||||
</window>
|
||||
44
libreplan-webapp/src/main/webapp/logs/_listRiskLog.zul
Normal file
44
libreplan-webapp/src/main/webapp/logs/_listRiskLog.zul
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<window id="listWindow">
|
||||
<grid id="listRiskLog" model="@{riskLogController.riskLogs}" mold="paging"
|
||||
pageSize="15" span="0" sizedByContent="false"
|
||||
rowRenderer="@{riskLogController.riskLogsRowRenderer}">
|
||||
<columns sizable="true">
|
||||
<column label="${i18n:_('Code')}" sort="auto(lower(code))" />
|
||||
<column label="${i18n:_('Projectname')}" visible="@{logsController.projectNameVisibility}" sort="auto(lower(order))" />
|
||||
<column label="${i18n:_('Probability')}" sort="auto(lower(probability))"/>
|
||||
<column label="${i18n:_('Impact')}" sort="auto(lower(impact))"/>
|
||||
<column label="${i18n:_('Risk score')}" sort="auto(lower(riskScore))"/>
|
||||
<column label="${i18n:_('Status')}" sort="auto(lower(status))"/>
|
||||
<column label="${i18n:_('Description')}" sort="auto(lower(code))"/>
|
||||
<column label="${i18n:_('Date created')}" sclass="date" hflex="min" sort="auto(lower(dateCreated))"/>
|
||||
<column label="${i18n:_('CreatedBy')}" sort="auto(createdBy.loginName)" />
|
||||
<column label="${i18n:_('Counter measures')}" sort="auto(counterMeasures)"/>
|
||||
<column label="${i18n:_('New risk score')}" sort="auto(scoreAfterCM)"/>
|
||||
<column label="${i18n:_('Contingency')}" sort="auto(contingency)"/>
|
||||
<column label="${i18n:_('Responsible')}" sort="auto(responsible)"/>
|
||||
<column label="${i18n:_('ActionWhen')}" sclass="date" hflex="min" sort="auto(lower(actionWhen))"/>
|
||||
<column label="${i18n:_('Notes')}" hflex="min" sort="auto(notes)"/>
|
||||
<column label="${i18n:_('Operations')}" sclass="operations" hflex="min"/>
|
||||
</columns>
|
||||
</grid>
|
||||
<button id="show_create_form" onClick='riskLogController.goToCreateForm()'
|
||||
label="${i18n:_('Create')}" sclass="create-button global-action"/>
|
||||
</window>
|
||||
62
libreplan-webapp/src/main/webapp/logs/_logs.zul
Normal file
62
libreplan-webapp/src/main/webapp/logs/_logs.zul
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
|
||||
<?component name="listIssueLogs" inline="true" macroURI="issue_log.zul"?>
|
||||
<?component name="listRiskLogs" inline="true" macroURI="risk_log.zul"?>
|
||||
|
||||
<zk>
|
||||
<zscript><![CDATA[
|
||||
logsController = arg.get("logsController");
|
||||
]]>
|
||||
</zscript>
|
||||
|
||||
<div self="@{define(content)}" height="100%" style="overflow:visible">
|
||||
<style src="/dashboard/css/dashboard.css" dynamic="true" />
|
||||
|
||||
<div height="30px" sclass="toolbar-box">
|
||||
<hbox id="logsFilter" visible="false" />
|
||||
</div>
|
||||
|
||||
<window self="@{define(content)}" id="logWindow" apply="${logsController}" vflex="1">
|
||||
<borderlayout sclass="orderslayout" height="100%">
|
||||
<center border="0" sclass="orderslayout-area">
|
||||
<tabbox id="tabboxLog">
|
||||
<tabs>
|
||||
<tab id="tabIssueLogs" label="${i18n:_('Issue logs')}" selected="true"
|
||||
onClick = "logsController.setupIssueLogController();"/>
|
||||
<tab id="tabRiskLogs" label="${i18n:_('Risk logs')}"
|
||||
onClick = "logsController.setupRiskLogController();"/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel sclass="orderelements-tab" id="tabpanelLog">
|
||||
<listIssueLogs id="issueLogs" fulfill="tabIssueLogs.onSelect"/>
|
||||
</tabpanel>
|
||||
<tabpanel sclass="orderelements-tab" id="tabpanelLog2">
|
||||
<listRiskLogs id="riskLogs" fulfill="tabRiskLogs.onSelect"/>
|
||||
</tabpanel>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
</center>
|
||||
</borderlayout>
|
||||
</window>
|
||||
|
||||
</div>
|
||||
|
||||
</zk>
|
||||
28
libreplan-webapp/src/main/webapp/logs/_logsFilter.zul
Normal file
28
libreplan-webapp/src/main/webapp/logs/_logsFilter.zul
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<hbox align="center" sclass="filtering-area">
|
||||
<label value="${i18n:_('Name')}"
|
||||
tooltiptext="${i18n:_('Select required issue/risk name and press filter button')}"/>
|
||||
<textbox id="filterName" width="100px" onChange="logsFilterController.onApplyFilter()" />
|
||||
|
||||
<button mold="trendy" image="/common/img/ico_filter.png" style="margin-top: -4px"
|
||||
tooltiptext="${i18n:_('Apply filtering to issues')}"
|
||||
onClick="logsFilterController.onApplyFilter()"/>
|
||||
</hbox>
|
||||
33
libreplan-webapp/src/main/webapp/logs/issue_log.zul
Normal file
33
libreplan-webapp/src/main/webapp/logs/issue_log.zul
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/libreplan.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/libreplan_zk.css"?>
|
||||
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
|
||||
|
||||
<?component name="list" inline="true" macroURI="_listIssueLog.zul"?>
|
||||
<?component name="edit" inline="true" macroURI="_editIssueLog.zul"?>
|
||||
|
||||
<zk>
|
||||
<window self="@{define(content)}" id="issueLogWindow" apply="org.libreplan.web.logs.IssueLogCRUDController">
|
||||
<vbox id="messagesContainer" />
|
||||
<list id="listWindow" />
|
||||
<edit id="editWindow" />
|
||||
</window>
|
||||
</zk>
|
||||
|
||||
33
libreplan-webapp/src/main/webapp/logs/risk_log.zul
Normal file
33
libreplan-webapp/src/main/webapp/logs/risk_log.zul
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!--
|
||||
This file is part of LibrePlan
|
||||
|
||||
Copyright (C) 2013 St. Antoniusziekenhuis
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/libreplan.css"?>
|
||||
<?link rel="stylesheet" type="text/css" href="/common/css/libreplan_zk.css"?>
|
||||
<?taglib uri="/WEB-INF/tld/i18n.tld" prefix="i18n"?>
|
||||
|
||||
<?component name="list" inline="true" macroURI="_listRiskLog.zul"?>
|
||||
<?component name="edit" inline="true" macroURI="_editRiskLog.zul"?>
|
||||
|
||||
<zk>
|
||||
<window self="@{define(content)}" id="riskLogWindow" apply="${org.libreplan.web.logs.riskLogCRUDController}" >
|
||||
<vbox id="messagesContainer" />
|
||||
<list id="listWindow" />
|
||||
<edit id="editWindow" />
|
||||
</window>
|
||||
</zk>
|
||||
|
||||
Loading…
Add table
Reference in a new issue