accessChecks = new ArrayList<AccessCheck>();
if (!DeploymentUtils.isDomainTarget(target)) {
ApplicationRef applicationRef = domain.getApplicationRefInTarget(name(), target);
if (applicationRef != null && ! Boolean.getBoolean(applicationRef.getEnabled())) {
accessChecks.add(new AccessCheck(applicationRef, ENABLE_ACTION, true));
}
} else {
/*
* The target is "domain" so expand that to all places where the
* app is assigned.
*/
for (String t : domain.getAllReferencedTargetsForApplication(target)) {
final ApplicationRef applicationRef = domain.getApplicationRefInTarget(name(), t);
if (applicationRef != null && ! Boolean.getBoolean(applicationRef.getEnabled())) {
accessChecks.add(new AccessCheck(applicationRef, ENABLE_ACTION, true));
}
}
}
/*
* Add an access check for enabling the app itself.
*/
final String resourceForApp = DeploymentCommandUtils.getResourceNameForExistingApp(domain, name());
if (resourceForApp != null) {
accessChecks.add(new AccessCheck(resourceForApp, ENABLE_ACTION));
}
return accessChecks;
}