Package org.zanata.webtrans.shared.model

Examples of org.zanata.webtrans.shared.model.ValidationAction


     * @param isEnabled
     * @param fireRequestValidationEvent
     */
    public void updateStatus(ValidationId key, boolean isEnabled,
            boolean fireRequestValidationEvent) {
        ValidationAction action = validationMap.get(key);
        action.getRules().setEnabled(isEnabled);

        updateConfigHolder();

        if (fireRequestValidationEvent) {
            // request re-run validation with new options
View Full Code Here


     */
    public void setValidationRules(Map<ValidationId, State> validationStates) {
        validationMap.clear();
        for (Map.Entry<ValidationId, State> entry : validationStates.entrySet()) {
            if (!validationMap.containsKey(entry.getKey())) {
                ValidationAction action =
                        validationFactory.getValidationAction(entry.getKey());
                action.setState(entry.getValue());
                validationMap.put(entry.getKey(), action);

                // if this rule is locked, then lock it's mutual exclusive rule
                // as well.
                if (action.getRules().isLocked()) {
                    for (ValidationAction exclusiveAction : action
                            .getExclusiveValidations()) {
                        exclusiveAction.getRules().setEnabled(false);
                        exclusiveAction.getRules().setLocked(true);
                        validationMap.put(exclusiveAction.getId(),
                                exclusiveAction);
View Full Code Here

    @Test
    public void canUpdateValidatorStatus() {
        service.updateStatus(VAL_KEY, false, true);

        ValidationAction validationAction =
                service.getValidationMap().get(VAL_KEY);

        assertThat(validationAction.getRules().isEnabled(),
                Matchers.equalTo(false));
        verify(eventBus).fireEvent(RequestValidationEvent.EVENT);
    }
View Full Code Here

    private Boolean loadTargetValidation(Long textFlowTargetId,
            ValidationId validationId) {
        HTextFlowTarget tft =
                getTextFlowTargetDAO().findById(textFlowTargetId, false);
        if (tft != null) {
            ValidationAction action =
                    ValidationFactoryProvider.getFactoryInstance()
                            .getValidationAction(validationId);
            List<String> errorList =
                    action.validate(tft.getTextFlow().getContents().get(0), tft
                            .getContents().get(0));
            return !errorList.isEmpty();
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.model.ValidationAction

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.