jira-integration: Add checkings to prevent remove or disable type of work hours for JIRA connector
FEA: ItEr77S16JiraAndTimConnectorContributionIntegration
This commit is contained in:
parent
ae3b7610f1
commit
cbc7c3c169
2 changed files with 26 additions and 0 deletions
|
|
@ -149,6 +149,7 @@ public class TypeOfWorkHoursDAO extends IntegrationEntityDAO<TypeOfWorkHours>
|
|||
checkHasHourCost(type);
|
||||
checkHasWorkReportLine(type);
|
||||
checkIsPersonalTimesheetsTypeOfWorkHours(type);
|
||||
checkIsJiraConnectorTypeOfWorkHours(type);
|
||||
}
|
||||
|
||||
private void checkHasWorkReportLine(TypeOfWorkHours type) {
|
||||
|
|
@ -192,4 +193,15 @@ public class TypeOfWorkHoursDAO extends IntegrationEntityDAO<TypeOfWorkHours>
|
|||
return c.uniqueResult() != null;
|
||||
}
|
||||
|
||||
private void checkIsJiraConnectorTypeOfWorkHours(TypeOfWorkHours type) {
|
||||
Configuration configuration = configurationDAO.getConfiguration();
|
||||
if (configuration.getJiraConfiguration()
|
||||
.getJiraConnectorTypeOfWorkHours().getId().equals(type.getId())) {
|
||||
throw ValidationException
|
||||
.invalidValue(
|
||||
"Cannot delete the type of work hours. It is configured as type of work hours for JIRA connector.",
|
||||
type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,4 +165,18 @@ public class TypeOfWorkHours extends IntegrationEntity implements IHumanIdentifi
|
|||
return name;
|
||||
}
|
||||
|
||||
@AssertTrue(message = "type of work hours for JIRA connector cannot be disabled")
|
||||
public boolean checkJiraConnectorTypeOfWorkHoursNotDisabled() {
|
||||
if (!isNewObject() && !getEnabled()) {
|
||||
TypeOfWorkHours typeOfWorkHours = Registry.getConfigurationDAO()
|
||||
.getConfiguration().getJiraConfiguration()
|
||||
.getJiraConnectorTypeOfWorkHours();
|
||||
if (typeOfWorkHours.getId().equals(getId())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue