Package org.zeroexchange.model.resource

Examples of org.zeroexchange.model.resource.Resource


        }
        return true;
    }
   
    private IModel<String> getTabTitleModel(ResourceAction action) {
        Resource resource = getResourceModel().getObject();
        if(action == ResourceAction.TENDERS_NEED || action == ResourceAction.TENDERS_SUPPLY) {
            long newTendersCount = 0;
            User user = authorizedUserService.getCurrentUser();
            if(action == ResourceAction.TENDERS_NEED) {
                newTendersCount = tenderVisitService.getNewTendersCount(user, resource, TenderType.NEED);
View Full Code Here


     * Creates resource action panel.
     */
    private WebMarkupContainer getResourceActionPanel(String componentId, ResourceAction action) {
        switch (action) {
        case RESOURCE_EDIT:
            Resource resource = getResourceModel().getObject();
            if(GoodResource.class.isAssignableFrom(resource.getClass())) {
                return new GoodEditPanel(componentId, this.<GoodResource>getResourceModel());
            } else if(ServiceResource.class.isAssignableFrom(resource.getClass())) {
                return new ResourceEditPanel<ServiceResource, ResourceFormData>(componentId, this.<ServiceResource>getResourceModel());
            } else if(MoneyResource.class.isAssignableFrom(resource.getClass())) {
                return new MoneyEditPanel(componentId, this.<MoneyResource>getResourceModel());
            } else {
                throw new BusinessLogicException("Unknown resource type:" + (resource == null ? "NULL" : resource.getClass().getName()));
            }
        case CONFIRM_SUPPLY:
            return new ConfirmSupplyPanel(componentId, getResourceModel());
        case TENDERS_NEED:
            return new NeedsManagementPanel(componentId, getResourceModel());
View Full Code Here

   
    /**
     * Returns true if any of user actions are enabled
     */
    private List<ResourceAction> getResourceActions() {
        Resource resource = getResourceModel().getObject();
       
        List<ResourceAction> userActions = new ArrayList<ResourceAction>();
        if(resource.getId() != null) {
            Contract contract = resource.getContract();
            if(contractStatusInformant.getContractStatus(contract, null) == ContractStatus.EXECUTED) {
                ResourceTender resourceTender = resourceInformant.getUserTender(resource, authorizedUserService.getCurrentUserId());
                if(resourceTender != null && resourceTender instanceof Need &&
                        ((Need)resourceTender).getCompletionDate() == null) {
                    //Is resource is on the 'delivery' state?
View Full Code Here

     */
    @Override
    protected List<ToolbarItem> getToolbarItems() {
        List<ToolbarItem> items = super.getToolbarItems();

        final Resource resource = getResourceModel().getObject();

        //'Unbound' action
        if(resource.getId() != null && isResourceEditAllowed()) {
            items.add(new ToolbarItem()  {
                private static final long serialVersionUID = 1L;
   
                @Override
                public Component getComponent(String componentId) {
                    return new AjaxLinkPanel(componentId, new ResourceModel(MKEY_RESOURCE_UNBOUND)) {
                        private static final long serialVersionUID = 1L;
   
                        @Override
                        protected void onClick(AjaxRequestTarget target) {
                            resourceRemover.remove(resource.getId());
                           
                            goBack();
                        }
                    };
                }
View Full Code Here

    /**
     * Returns true if the resource edit is allowed.
     */
    private boolean isResourceEditAllowed() {
        Resource resource = getResourceModel().getObject();
        if (!authorizedUserService.isUserLogged() || !authorizedUserService.getCurrentUser().equals(resource.getOwner())) {
            return false;
        }
        return contractStatusInformant.isContractModificationAllowed(resource.getContract());
    }
View Full Code Here

    }


    @Override
    protected String getPageTitle() {
        Resource resource = getResourceModel().getObject();
        Contract contract = resource.getContract();
       
        if(resource.getId() != null) {
            return getString(MKEY_PAGE_TITLE, new Model(
                    new PipedMap().putObject(KEY_RESOURCE_TITLE, resource.getTitle()).
                    putObject(KEY_CONTRACT_TITLE, contract.getTitle())));
        } else {
            return getString(MKEY_NEW_PAGE_TITLE, new Model(
                    new PipedMap().putObject(KEY_CONTRACT_TITLE, contract.getTitle())));
        }
View Full Code Here

            @Override
            public void onClick() {
                reconciliator.reconcile(getResourceModel().getObject(), authorizedUserService.getCurrentUser());

                Resource resource = getResourceModel().getObject();
                eventsDispatcher.publishEvent(new ResourceReconciled(
                        resource.getContract(), resource));

                forward();
            }
           
        });
View Full Code Here

       
        User evaluator = userReader.getUser(authorizedUserService.getCurrentUserId());

        //Create the assessment and remember it in the workflow data

        Resource resource = getResourceModel().getObject();
        resourceAssessor.confirmResourceProvided(
                resource,
                evaluator,
                BasicAssessmentTypes.BUSINESS_QUALITY,
                confirmationData.getBusinessQuality(),
                confirmationData.getBusinessQualityComment());//TODO: send this information in event (below);Use 'Assessment' structures?
       
        eventsDispatcher.publishEvent(new ResourceSupplyConfirmed(
                resource.getContract(), resource));
       
        //Reload the page
        forward();
    }
View Full Code Here

        //Reload the page
        forward();
    }
   
    private void forward() {
        Resource resource = getResourceModel().getObject();
        setResponsePage(EditContract.class,
                new PageParameters().add(EditContract.PARAM_CONTRACT_ID, resource.getContract().getId()));
    }
View Full Code Here

        return new AbstractDataSetProvider<Supply, Serializable>() {
            private static final long serialVersionUID = 1L;

            @Override
            protected SlicingDataSet<Supply> getDataSet(Serializable filter) {
                Resource resource = getResourceModel().getObject();
                return supplyManager.getSupplies(resource, authorizedUserService.getCurrentUserId());
            }

        };
    }
View Full Code Here

TOP

Related Classes of org.zeroexchange.model.resource.Resource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.