Package org.eurekastreams.commons.exceptions

Examples of org.eurekastreams.commons.exceptions.ValidationException.addError()


        String groupName = (String) vHelper
                .getAndCheckStringFieldExist(fields, DomainGroupModelView.NAME_KEY, true, ve);
        if (groupName == null || groupName.isEmpty())
        {
            ve.addError(DomainGroupModelView.NAME_KEY, DomainGroup.NAME_REQUIRED);
        }
        else
        {
            vHelper.stringMeetsRequirments(DomainGroupModelView.NAME_KEY, groupName, ve,
                    DomainGroup.NAME_LENGTH_MESSAGE, DomainGroup.MAX_NAME_LENGTH, DomainGroup.NAME_LENGTH_MESSAGE,
View Full Code Here


        String groupShortName = (String) vHelper.getAndCheckStringFieldExist(fields,
                DomainGroupModelView.SHORT_NAME_KEY, true, ve);
        if (groupShortName == null || groupShortName.isEmpty())
        {
            ve.addError(DomainGroupModelView.SHORT_NAME_KEY, DomainGroup.SHORTNAME_REQUIRED);
        }
        else if (vHelper.stringMeetsRequirments(DomainGroupModelView.SHORT_NAME_KEY, groupShortName, ve,
                DomainGroup.SHORT_NAME_LENGTH_MESSAGE, DomainGroup.MAX_SHORT_NAME_LENGTH,
                DomainGroup.SHORT_NAME_LENGTH_MESSAGE, DomainGroup.ALPHA_NUMERIC_PATTERN,
                DomainGroup.SHORT_NAME_CHARACTERS))
View Full Code Here

            // Recommend removing try/catch and evaluating why group creation is broken
            try
            {
                if (groupMapper.findByShortName(groupShortName.toLowerCase()) != null)
                {
                    ve.addError(DomainGroupModelView.SHORT_NAME_KEY, SHORTNAME_TAKEN_MESSAGE);
                }
            }
            catch (Exception ex)
            {
                int x = 0;
View Full Code Here

        String groupDesc = (String) vHelper.getAndCheckStringFieldExist(fields, DomainGroupModelView.DESCRIPTION_KEY,
                true, ve);
        if (groupDesc == null || groupDesc.isEmpty())
        {
            ve.addError(DomainGroupModelView.DESCRIPTION_KEY, DomainGroup.DESCRIPTION_REQUIRED);
        }
        else
        {
            vHelper.stringMeetsRequirments(DomainGroupModelView.DESCRIPTION_KEY, groupDesc, ve,
                    DomainGroup.DESCRIPTION_LENGTH_MESSAGE, DomainGroup.MAX_DESCRIPTION_LENGTH,
View Full Code Here

        Set coordinators = (Set) vHelper.getAndCheckStringFieldExist(fields, DomainGroupModelView.COORDINATORS_KEY,
                true, ve);
        if (coordinators == null || coordinators.isEmpty())
        {
            ve.addError(DomainGroupModelView.COORDINATORS_KEY, DomainGroup.MIN_COORDINATORS_MESSAGE);
        }

        vHelper.getAndCheckStringFieldExist(fields, DomainGroupModelView.PRIVACY_KEY, true, ve);

        if (!ve.getErrors().isEmpty())
View Full Code Here

        ValidationException vex = new ValidationException();

        if (!inRequest.getTargetEntityType().equals(EntityType.PERSON))
        {
            vex.addError("EntityType", "This action only supports following a person.");
        }

        Long followingId = getPersonIdByAccountIdMapper.execute(inRequest.getTargetUniqueId());

        if (followingId == null)
View Full Code Here

        Long followingId = getPersonIdByAccountIdMapper.execute(inRequest.getTargetUniqueId());

        if (followingId == null)
        {
            vex.addError("FollowerAndTarget", "Target unique id for valid users must be supplied.");
        }

        if (vex.getErrors().size() > 0)
        {
            throw vex;
View Full Code Here

        // All activities must have a destination stream.
        if (currentActivity.getDestinationStream() == null
                || currentActivity.getDestinationStream().getUniqueIdentifier() == null
                || currentActivity.getDestinationStream().getUniqueIdentifier().length() <= 0)
        {
            valEx.addError("destination_stream", "Activities require a Destination Stream.");
            throw valEx;
        }

        // All activities must be posted to either a person or group stream.
        if (!((currentActivity.getDestinationStream().getType() == EntityType.PERSON)
View Full Code Here

        // All activities must be posted to either a person or group stream.
        if (!((currentActivity.getDestinationStream().getType() == EntityType.PERSON)
                || (currentActivity.getDestinationStream().getType() == EntityType.GROUP) || currentActivity
                .getDestinationStream().getType() == EntityType.RESOURCE))
        {
            valEx.addError("destination_stream_type",
                    "Activities can only be submitted to Person, Group, or Resource streams.");
            throw valEx;
        }

        // If there are verb and object validator instances available use them
View Full Code Here

            catch (ValidationException vex)
            {
                log.error("ActivityValidators failed for this activity.", vex);
                for (Entry<String, String> validationError : vex.getErrors().entrySet())
                {
                    valEx.addError(validationError.getKey(), validationError.getValue());
                    log.error("Error key: " + validationError.getKey() + " message: " + validationError.getValue());
                }
                throw valEx;
            }
        }
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.