Package org.zeroexchange.model.user

Examples of org.zeroexchange.model.user.User


    public void sendFeedback(String subject, String body, Page targetPage) {
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom(from);
        message.setTo(adminMail);
       
        User currentUser = authorizedUserService.getCurrentUser();
        String resultBody = templateGenerator.generate(template, new PipedMap<String, Object>().
                putObject(KEY_BODY, body).putObject(KEY_PAGE, targetPage.getClass().getName()).
                putObject(KEY_USERNAME, currentUser == null ? "" : currentUser.getDisplayName()),
                localeService.getCurrentLocale());
       
        message.setText(resultBody);
        message.setSubject(subject);
        try {
View Full Code Here


     * Loads profile data for the current user,
     */
    @Override
    protected <T extends ProfileData> T createProfileData() {
        UpdateProfileData profileFormData = new UpdateProfileData();
        User user = authorizedUserService.getCurrentUser();
       
        profileFormData.setEmail(user.getEmail());
        profileFormData.setLocation(user.getLocation());
        profileFormData.setDisplayName(user.getDisplayName());
       
        return (T) profileFormData;
    }
View Full Code Here

            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<Invitation>> cellItem,
                    String componentId, IModel<Invitation> rowModel) {
                User inviter = rowModel.getObject().getInviter();
                cellItem.add(new Label(componentId, new Model<String>(inviter == null ? "" : inviter.getDisplayName())));
            }
        });
       
        columns.add(new AbstractColumn<Invitation, String>(new ResourceModel(MKEY_INVITEE)) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<Invitation>> cellItem,
                    String componentId, IModel<Invitation> rowModel) {
                User invitee = rowModel.getObject().getInvitee();
                cellItem.add(new Label(componentId, new Model<String>(invitee == null ? "" : invitee.getDisplayName())));
            }
        });
       
        columns.add(new AbstractColumn<Invitation, String>(new ResourceModel(MKEY_INVITATION_DATE)) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<Invitation>> cellItem,
                    String componentId, IModel<Invitation> rowModel) {
                Date invitationDate = rowModel.getObject().getInvitationDate();
               
                //TODO: make date format configurable
                cellItem.add(new Label(componentId, new Model<String>(invitationDate == null ? "" : DateFormat.getInstance().format(invitationDate))));
            }
        });
       
        columns.add(new AbstractColumn<Invitation, String>(new Model<String>("")) {
            private static final long serialVersionUID = 1L;

            @Override
            public void populateItem(Item<ICellPopulator<Invitation>> cellItem,
                    String componentId, IModel<Invitation> rowModel) {
                User inviter = rowModel.getObject().getInviter();
                User currentUser = authorizedUserService.getCurrentUser();
                final Integer invitationId = rowModel.getObject().getId();
                if(inviter != null && inviter.equals(currentUser)) {
                    cellItem.add(new AjaxLinkPanel<Void>(componentId, new ResourceModel(MKEY_REJECT)) {
                        private static final long serialVersionUID = 1L;
View Full Code Here

        return (T) profileFormData;
    }


    protected void updateUser(ProfileData userData) throws BusinessLogicException {
        User user = authorizedUserService.getCurrentUser();
        user = userReader.getUser(user.getId());
        if(userData.getPassword() != null) {
            for(Credential credential: user.getCredentials()) {
                if(credential instanceof LocalCredential) {
                    ((LocalCredential)credential).setPassword(userData.getPassword());
                    localCredentialDAO.save((LocalCredential)credential);
                }
            }
        }
        user.setEmail(userData.getEmail());
        user.setLocation(userData.getLocation());
        user.setDisplayName(userData.getDisplayName());
        userWriter.updateUser(user);
    }
View Full Code Here

    /**
     * Returns true if the corresponding tab should be visible.
     */
    private boolean isTabVisible(ResourceAction action) {
        Resource resource = getResourceModel().getObject();
        User user = authorizedUserService.getCurrentUser();
        if(action == ResourceAction.TENDERS_NEED) {
            return tenderVisitService.getTendersCount(user, resource, TenderType.NEED) > 0;
        } else if(action == ResourceAction.TENDERS_SUPPLY) {
            return tenderVisitService.getTendersCount(user, resource, TenderType.SUPPLY) > 0;
        }
View Full Code Here

        //Personal tender status
        add(new Label(CKEY_PERSONAL_TENDER_STATUS, new ResourceModel(MKEY_TENDER_STATUS_PREFIX + getTenderStatus().name())));
       
        Resource resource = getResourceModel().getObject();
        User currentUser = authorizedUserService.getCurrentUser();
        boolean hasConsumers = resourceInformant.hasConsumers(resource, currentUser);
        boolean hasSuppliers = resourceInformant.hasSuppliers(resource, currentUser);
        TendersMultiplicity multiplicity = resource.getTendersMultiplicity();
        boolean newTendersEnabled = multiplicity != TendersMultiplicity.NONE ||
                !hasConsumers || !hasSuppliers;
View Full Code Here

   
    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);
            } else if(action == ResourceAction.TENDERS_SUPPLY) {
                newTendersCount = tenderVisitService.getNewTendersCount(user, resource, TenderType.SUPPLY);
            }
View Full Code Here

    }

    private void createControls(final Form<TenderData> formContainer) {
        IModel<Resource> resourceModel = getResourceModel();
        Resource resource = resourceModel.getObject();
        User currentUser = authorizedUserService.getCurrentUser();
        final IModel<TenderData> formModel = formContainer.getModel();

        boolean hasConsumers = resourceInformant.hasConsumers(resource, currentUser);
        boolean hasSuppliers = resourceInformant.hasSuppliers(resource, currentUser);
        TendersMultiplicity multiplicity = resource.getTendersMultiplicity();
View Full Code Here

        Resource resource = getResourceModel().getObject();
        ResourceTender userTender = resourceInformant.getUserTender(resource,
                authorizedUserService.getCurrentUserId());

        TendersMultiplicity multiplicity = resource.getTendersMultiplicity();
        User currentUser = authorizedUserService.getCurrentUser();
        boolean hasConsumers = resourceInformant.hasConsumers(resource, currentUser);
        boolean hasSuppliers = resourceInformant.hasSuppliers(resource, currentUser);
       
        if (userTender != null) {
            data.setAmount(userTender.getAmount());
            data.setInfo(userTender.getAdditionalInfo());
            data.setTenderType(userTender instanceof Supply ? TenderType.SUPPLY
                    : TenderType.NEED);
            data.setLocation(userTender.getLocation());
            if (userTender instanceof Supply) {
                Supply supply = (Supply) userTender;
                BigDecimal workingHours = supply.getHours();
                data.setWorkingHours(workingHours);
                BigDecimal totalPrice = supply.getTotalPrice();
                PriceType priceType = supply.getPriceType();
                data.setTotalPrice(totalPrice);
                data.setPriceType(priceType);
                data.setSupplyTime(supply.getSupplyTime());
            }
        } else {
            data.setLocation(currentUser.getLocation());
        }

        if(multiplicity == TendersMultiplicity.MULTIPLE_CONSUMERS && hasSuppliers) {
            data.setTenderType(TenderType.NEED);
        } else if(multiplicity == TendersMultiplicity.MULTIPLE_SUPPLIERS && hasConsumers) {
View Full Code Here

            supply.setTotalPrice(totalPrice);
            supply.setSupplyTime(tenderData.getSupplyTime());
        } else {
            tender = new Need();
        }       
        User currentUser = authorizedUserService.getCurrentUser();
        tender.setResource(resource);
        tender.setUser(currentUser);
        tender.setAdditionalInfo(tenderData.getInfo());
        tender.setAmount(tenderData.getAmount());
        tender.setLocation(tenderData.getLocation());

        ResourceTender resourceTender = tenderWriter.save(tender);

        if (currentUser != null && currentUser.equals(resource.getOwner())) {
            if(resourceTender instanceof Need) {
                needWorkflowManager.acceptTender((Need) resourceTender);
            } else {
                supplyWorkflowManager.acceptTender((Supply) resourceTender);
            }
View Full Code Here

TOP

Related Classes of org.zeroexchange.model.user.User

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.