Examples of AdvanceType


Examples of org.libreplan.business.advance.entities.AdvanceType

    private IAdvanceTypeDAO advanceDAO;

    @Test
    @Ignore
    public void percentageInsertedInDB() {
        AdvanceType advance = advanceDAO.findByName("percentage");
        assertEquals("percentage",advance.getUnitName());
    }
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

    @Transactional(readOnly=true)
    public AdvanceType findByNameCaseInsensitive(String name)
            throws InstanceNotFoundException {
        Criteria c = getSession().createCriteria(AdvanceType.class);
        c.add(Restrictions.ilike("unitName", name, MatchMode.EXACT));
        AdvanceType result = (AdvanceType) c.uniqueResult();

        if (result == null) {
            throw new InstanceNotFoundException(name,
                    getEntityClass().getName());
        }
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

    public DirectAdvanceAssignment getDirectAdvanceAssignmentOfTypeSubcontractor() {
        if (StringUtils.isBlank(getExternalCode())) {
            return null;
        }

        AdvanceType advanceType = PredefinedAdvancedTypes.SUBCONTRACTOR
                .getType();

        return getAdvanceAssignmentByType(advanceType);
    }
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

     */
    private void updateOrCreateProgressAssignmentAndMeasurement(
            OrderElement orderElement, BigDecimal percentage,
            LocalDate latestWorkLogDate) {

        AdvanceType advanceType = PredefinedAdvancedTypes.PERCENTAGE.getType();

        DirectAdvanceAssignment directAdvanceAssignment = orderElement
                .getDirectAdvanceAssignmentByType(advanceType);
        if (directAdvanceAssignment == null) {
            directAdvanceAssignment = DirectAdvanceAssignment.create(false,
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

                    }, new Util.Setter<Comboitem>() {
                @Override
            public void set(Comboitem comboItem) {
                            if(((comboItem!=null))&&(comboItem.getValue() != null)&&
                                    (comboItem.getValue() instanceof AdvanceType)){
                                AdvanceType advanceType = (AdvanceType)comboItem.getValue();
                                advance.setAdvanceType(advanceType);
                    advance.setMaxValue(manageOrderElementAdvancesModel
                            .getMaxValue(advanceType));
                            }
                        }
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

    private void setMaxValue(final Listitem item,Combobox comboAdvanceTypes) {
        Listcell listCell = (Listcell)item.getChildren().get(1);
        Decimalbox miBox = ((Decimalbox) listCell.getFirstChild());
        Comboitem selectedItem = comboAdvanceTypes.getSelectedItem();
        if(selectedItem != null){
            AdvanceType advanceType = ((AdvanceType) selectedItem.getValue());
            if(advanceType != null){
                DirectAdvanceAssignment advance = (DirectAdvanceAssignment) item
                        .getValue();
                advance.setMaxValue(manageOrderElementAdvancesModel
                        .getMaxValue(advanceType));
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

                .toDateTimeAtStartOfDay().toDate());
    }

    private void addTimesheetsProgress(OrderElement orderElement,
            Date progressDate) {
        AdvanceType timesheetsAdvanceType = getTimesheetsAdvanceType();

        DirectAdvanceAssignment timesheetsAdvanceAssignment = orderElement
                .getDirectAdvanceAssignmentByType(timesheetsAdvanceType);

        if (timesheetsAdvanceAssignment == null) {
            timesheetsAdvanceAssignment = DirectAdvanceAssignment.create(false,
                    timesheetsAdvanceType.getDefaultMaxValue());
            timesheetsAdvanceAssignment.setAdvanceType(timesheetsAdvanceType);
            try {
                orderElement.addAdvanceAssignment(timesheetsAdvanceAssignment);
            } catch (DuplicateValueTrueReportGlobalAdvanceException e) {
                // This shouldn't happen as the new advanceAssignment is not
                // marked as spread yet
                throw new RuntimeException(e);
            } catch (DuplicateAdvanceAssignmentForOrderElementException e) {
                // If the same type already exists in other element we don't do
                // anything
                return;
            }
        }

        DirectAdvanceAssignment spreadAdvanceAssignment = orderElement
                .getReportGlobalAdvanceAssignment();
        if (spreadAdvanceAssignment != null) {
            spreadAdvanceAssignment.setReportGlobalAdvance(false);
        }

        timesheetsAdvanceAssignment.setReportGlobalAdvance(true);
        timesheetsAdvanceAssignment.resetAdvanceMeasurements(AdvanceMeasurement
                .create(LocalDate.fromDateFields(progressDate),
                        timesheetsAdvanceType.getDefaultMaxValue()));
    }
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

    public RowRenderer getAdvanceTypeRenderer() {
        return new RowRenderer() {

            @Override
            public void render(Row row, Object data) {
                final AdvanceType advanceType = (AdvanceType) data;
                appendLabelName(row, advanceType);
                appendCheckboxEnabled(row, advanceType);
                appendCheckboxPredefined(row, advanceType);
                appendOperations(row, advanceType);
                row.addEventListener(Events.ON_CLICK, new EventListener() {
                    @Override
                    public void onEvent(Event event) {
                        goToEditForm(advanceType);
                    }
                });
            }

            private void appendLabelName(Row row, AdvanceType advanceType) {
                row.appendChild(new Label(advanceType.getUnitName()));
            }

            private void appendCheckboxEnabled(Row row, AdvanceType advanceType) {
                Checkbox checkbox = new Checkbox();
                checkbox.setChecked(advanceType.getActive());
                checkbox.setDisabled(true);
                row.appendChild(checkbox);
            }

            private void appendCheckboxPredefined(Row row,
                    AdvanceType advanceType) {
                Checkbox checkbox = new Checkbox();
                checkbox.setChecked(advanceType.isImmutable());
                checkbox.setDisabled(true);
                row.appendChild(checkbox);
            }

            private void appendOperations(Row row, final AdvanceType advanceType) {
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

    @Override
    public void save(QualityForm entity) throws ValidationException {
        if (entity.isReportAdvance()) {
            String name = QualityForm.ADVANCE_TYPE_PREFIX + entity.getName();

            AdvanceType advanceType = entity.getAdvanceType();
            if (advanceType != null) {
                advanceTypeDAO.save(advanceType);
                advanceType.setUnitName(name);
            } else {
                advanceType = AdvanceType.create(name, new BigDecimal(100),
                        false, new BigDecimal(0.01), true, true, true);
                advanceTypeDAO.save(advanceType);
View Full Code Here

Examples of org.libreplan.business.advance.entities.AdvanceType

            orderElement.removeTaskQualityForm(taskQualityForm);
    }

    private AdvanceAssignment getAdvanceAssignment(
            TaskQualityForm taskQualityForm) {
        AdvanceType advanceType = taskQualityForm.getQualityForm()
                .getAdvanceType();
        if (advanceType == null) {
            return null;
        }
        else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.