Package org.zeroexchange.model.collaboration

Examples of org.zeroexchange.model.collaboration.Contract


            @Override
            public void populateItem(Item<ICellPopulator<Resource>> cellItem,
                    String componentId, IModel<Resource> rowModel) {
                Resource resource = rowModel.getObject();
                Contract contract = resource.getContract();
                cellItem.add(new PageLinkPanel(componentId, EditContract.class,
                        new Model<String>(contract.getTitle()),
                        new PageParameters().add(EditContract.PARAM_CONTRACT_ID, contract.getId())));
            }
        });
        return columns;
    }
View Full Code Here


    protected List<ToolbarItem> getToolbarItems() {
       
        //Toolbar actions
        final List<ToolbarItem> toolbarActions = super.getToolbarItems();
       
        Contract contract = (Contract) getDefaultModelObject();
       
        //'Add resource' link
        if(authorizedUserService.isUserLogged() &&
                contractStatusInformant.isContractModificationAllowed(contract)) {
            toolbarActions.add(new ToolbarItem() {
                private static final long serialVersionUID = 1L;

                @Override
                public Component getComponent(String componentId) {
                    return new LinkPanel(componentId, new ResourceModel(MKEY_ADD_RESOURCE)) {
                        private static final long serialVersionUID = 1L;
           
                        @Override
                        protected void onClick() {
                            Contract contract = getContract();
                            setResponsePage(CreateResource.class,
                                    new PageParameters().
                                        add(CreateResource.PARAM_CONTRACT_ID, contract.getId()));
                        }
       
                    };
                }
            });
View Full Code Here

            SortDescriptor sortDescriptor = null;
            if(getSort() != null) {
                sortDescriptor = new SortDescriptor(
                        getSort().getProperty(), getSort().isAscending(), localeService.getCurrentLanguage());
            }
            Contract contract = (Contract) getDefaultModelObject();
            String searchQuery = filter != null  ? filter.getSearchQuery() : null;
            ResourcesCriteria resCrit = new ResourcesCriteria();
            resCrit.setQuery(searchQuery);
            if(filter != null && filter.isUserResourcesOnly()) {
                Integer currentUserId = authorizedUserService.getCurrentUserId();
                resCrit.setResourceOwnerId(currentUserId);
                resCrit.setResourcesParticipantId(currentUserId);
            }
            SlicingDataSet<Resource> dataSet =  resourceReader.getContractResources(
                    contract.getId(), sortDescriptor, resCrit);
            return dataSet;
        }
View Full Code Here

  @Autowired
  private UncompletedStep uncompletedStep;
 
  @Test
  public void testUncompletedStep() {
    Contract contract = new Contract();
    User contractOwner = new User();
    contractOwner.setId(1);
    contract.setOwner(contractOwner);
   
    //Empty contract
    ContractStatus nextStatus = uncompletedStep.nextStep(contract);
    Assert.assertEquals(nextStatus, ContractStatus.UNCOMPLETED);

    //Need only
    Resource resource = new Resource();
    resource.setOwner(contractOwner);
    Need need = new Need();
    need.setAmount(BigDecimal.ONE);
    need.setAcceptDate(new Date());
    User needOwner = new User();
    needOwner.setId(2);
    need.setUser(needOwner);
    resource.getNeeds().add(need);
    contract.getResources().add(resource);
    nextStatus = uncompletedStep.nextStep(contract);
    Assert.assertEquals(nextStatus, ContractStatus.UNCOMPLETED);

    //+Supply
    Supply offer = new Supply();
View Full Code Here

        ResourceTender resourceTender = event.getResourceTender();
        if(!(resourceTender instanceof Supply)) {
            return;
        }
       
        Contract contract = event.getContract();
        User tenderOwner = resourceTender.getUser();
        if(tenderOwner != null && contract != null) {
            if(internalIsUserEffective(contract, tenderOwner.getId(), new HashSet<Integer>())) {
                contractWriter.markUserEffective(contract.getId(), tenderOwner);
            } else {
                contractWriter.markUserIneffective(contract.getId(), tenderOwner);
            }
        }
    }
View Full Code Here

    @Transactional
    @Override
    public void onEvent(UsersInvited event) {
        User currentUser = authorizedUserService.getCurrentUser();
        for(User invitee: event.getUsers()) {
            Contract contract = event.getContract();
            Invitation invitation = invitationDAO.getInvitation(currentUser.getId(), invitee.getId(), contract.getId());
            if(invitation == null) {
                invitation = new Invitation();
                invitation.setContract(contract);
                invitation.setInvitee(invitee);
                invitation.setInviter(currentUser);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void onEvent(UsersInvited event) {
        Contract contract = event.getContract();
        sendTemplate(event.getUsers(), authorizedUserService.getCurrentUser(),
                getDefaultSubject(),
                new PipedMap<String, Object>().
                putObject(TKEY_CONTRACT_TITLE, contract.getTitle()).
                putObject(TKEY_CONTRACT_ID, contract.getId()));
       
    }
View Full Code Here

                if(supply.getAcceptDate() != null) {
                    stockManager.freeAmount(supply, resource);
                }
            }
        }
        Contract contract = resource.getContract();
        if(contract != null) {
            contract.getResources().remove(resource);
            contractDAO.save(contract);
            eventDispatcher.publishEvent(new ResourceDeleted(resource.getContract(), resource));
        }
    }
View Full Code Here

            log.error("Cannot instantiate the resource", e);
            throw new BusinessLogicException("Cannot instantiate the resource of class " + resourceSubclass, e);
        }
           
        //Contract identity
        Contract contract = contractReader.getContract(contractId);
        resource.setContract(contract);
       
        //User
        User owner = userReader.getUser(ownerId);
        resource.setOwner(owner);
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public void onEvent(ContractStatusChanged event) {
        if(event.getNewStatus() == ContractStatus.COMPLETED) {
            Contract persistedContract = contractReader.getContract(event.getContract().getId());
            reconciliator.reconcileContract(persistedContract);
        }
    }
View Full Code Here

TOP

Related Classes of org.zeroexchange.model.collaboration.Contract

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.