Package pl.net.bluesoft.rnd.processtool.model

Examples of pl.net.bluesoft.rnd.processtool.model.UserSubstitution


        });
        return button;
    }

    private Form createSubstitutionForm(final BeanItem<UserSubstitution> item, final boolean add) {
        UserSubstitution subst = item.getBean();
        if (subst.getUser() != null) {
            subst.setUser(usersByLogin.get(subst.getUser().getLogin()));
        }
        if (subst.getUserSubstitute() != null) {
            subst.setUserSubstitute(usersByLogin.get(subst.getUserSubstitute().getLogin()));
        }
        final Form form = new Form() {
            @Override
            protected void attachField(Object propertyId, Field field) {
                if (field.getValue() == null && field.getType() == String.class) {
View Full Code Here


        if (detailsWindow != null) {
            return;
        }
        boolean isNew = item == null;
        if (item == null) {
            item = new BeanItem<UserSubstitution>(new UserSubstitution());
        }
        wrapWithModalWindow(createSubstitutionForm(item, isNew));
        application.getMainWindow().addWindow(detailsWindow);
    }
View Full Code Here

            public Component generateCell(Table source, final Object itemId, Object columnId) {
                Button b = smallButton(getMessage("pagedtable.delete"));
                b.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        final UserSubstitution item = (UserSubstitution)container.getItem(itemId).getBean();
                        container.removeItem(itemId);
                        transactionProvider.withTransaction(new ProcessToolGuiCallback() {
                            @Override
                            public void callback(ProcessToolContext ctx, ProcessToolBpmSession session) {
                ctx.getUserSubstitutionDAO().deleteById(item.getId());                               
                            }
                        });
                    }
                });
                return b;
View Full Code Here

    @Override
    public String invoke(BpmStep step, Map params) throws Exception {
        ProcessInstance processInstance = step.getProcessInstance();
        try {
            ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
            UserSubstitution userSubstitution = new UserSubstitution();
            userSubstitution.setUser(processInstance.getCreator());
            userSubstitution.setDateFrom(Formats.parseShortDate(processInstance.getSimpleAttributeValue("dateFrom")));
            userSubstitution.setDateTo(Formats.parseShortDate(processInstance.getSimpleAttributeValue("dateTo")));
            String substituteUserLogin = processInstance.getSimpleAttributeValue("userSubstitute");
            UserData substituteUser = ctx.getUserDataDAO().loadUserByLogin(substituteUserLogin);
            if (substituteUser == null) {
                substituteUser = LiferayBridge.getLiferayUser(substituteUserLogin,
                        processInstance.getCreator().getCompanyId());
                ctx.getUserDataDAO().saveOrUpdate(substituteUser);
                if (substituteUser == null) {
                    logger.warning("Unable to determine application user by login: " + substituteUserLogin);
                    return STATUS_ERROR;
                }
            }
            userSubstitution.setUserSubstitute(substituteUser);
            ctx.getUserSubstitutionDAO().saveOrUpdate(userSubstitution);
            logger.warning("Added substitution for user " + userSubstitution.getUser().getLogin());
            return STATUS_OK;
        }
        catch (Exception e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            return STATUS_ERROR;
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.model.UserSubstitution

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.