コード例 #1
0
    @Override
    @Transactional(readOnly = true)
    public void addSpecific(Collection<? extends Resource> resources) {

        if (!areAllLimitingResources(resources)) {
            getMessagesForUser().showMessage(Level.ERROR,
                    _("All resources must be queue-based"));
            return;
        }

        if (resources.size() >= 1) {
            if (planningState != null) {
                planningState.reassociateResourcesWithSession();
            }
            List<Resource> reloaded = reloadResources(
                    Collections.singleton(getFirstChild(resources)));
            addSpecificResourceAllocation(getFirstChild(reloaded));
        }
    }
コード例 #2
0
    @Override
    @Transactional(readOnly = true)
    public void addGeneric(ResourceEnum resourceType,
            Collection<? extends Criterion> criteria,
            Collection<? extends Resource> resources) {

        if (resources.isEmpty()) {
            getMessagesForUser()
                    .showMessage(Level.ERROR,
                            _("there are no resources for required criteria: {0}. " +
                                    "So the generic allocation can't be added",
                            Criterion.getCaptionFor(resourceType, criteria)));
        }

        if (resources.size() >= 1) {
            if (planningState != null) {
                planningState.reassociateResourcesWithSession();
            }
            addGenericResourceAllocation(resourceType, criteria,
                    reloadResources(resources));
        }
    }