Search in sources :

Example 96 with ConstraintViolationException

use of jakarta.validation.ConstraintViolationException in project Clownfish by rawdog71.

the class UserList method onCreateUser.

public void onCreateUser(ActionEvent actionEvent) {
    try {
        CfUser newuser = new CfUser();
        newuser.setEmail(email);
        newuser.setVorname(vorname);
        newuser.setNachname(nachname);
        newuser.setAssetref(avatar);
        newuser.setPasswort(passwort);
        String salt = PasswordUtil.getSalt(30);
        String secure = PasswordUtil.generateSecurePassword(passwort, salt);
        newuser.setSalt(salt);
        newuser.setPasswort(secure);
        cfuserService.create(newuser);
        userlist = cfuserService.findAll();
    } catch (ConstraintViolationException ex) {
        LOGGER.error(ex.getMessage());
    }
}
Also used : CfUser(io.clownfish.clownfish.dbentities.CfUser) ConstraintViolationException(jakarta.validation.ConstraintViolationException)

Example 97 with ConstraintViolationException

use of jakarta.validation.ConstraintViolationException in project Clownfish by rawdog71.

the class KeywordContentList method onCreate.

public void onCreate(ActionEvent actionEvent) {
    try {
        keywordlistname = keywordlistname.trim().replaceAll("\\s+", "_");
        cfkeywordlistService.findByName(keywordlistname);
    } catch (NoResultException ex) {
        CfKeywordlist newkeywordlist = new CfKeywordlist();
        newkeywordlist.setName(keywordlistname);
        cfkeywordlistService.create(newkeywordlist);
        keywordlist = cfkeywordlistService.findAll();
        keywords = cfkeywordService.findAll();
    } catch (ConstraintViolationException ex) {
        LOGGER.error(ex.getMessage());
    }
}
Also used : CfKeywordlist(io.clownfish.clownfish.dbentities.CfKeywordlist) ConstraintViolationException(jakarta.validation.ConstraintViolationException) NoResultException(javax.persistence.NoResultException)

Example 98 with ConstraintViolationException

use of jakarta.validation.ConstraintViolationException in project Clownfish by rawdog71.

the class KeywordList method onCreate.

public void onCreate(ActionEvent actionEvent) {
    try {
        items.stream().forEach((keyword) -> {
            try {
                cfkeywordService.findByName(keyword);
            } catch (NoResultException ex) {
                CfKeyword newkeyword = new CfKeyword();
                newkeyword.setName(keyword);
                cfkeywordService.create(newkeyword);
            }
        });
        globalmessage.displayMessage("Added Keywords");
        keywordlist = cfkeywordService.findAll();
        assetlist.init();
        contentlist.init();
    } catch (ConstraintViolationException ex) {
        LOGGER.error(ex.getMessage());
    }
}
Also used : CfKeyword(io.clownfish.clownfish.dbentities.CfKeyword) ConstraintViolationException(jakarta.validation.ConstraintViolationException) NoResultException(javax.persistence.NoResultException)

Example 99 with ConstraintViolationException

use of jakarta.validation.ConstraintViolationException in project Clownfish by rawdog71.

the class PropertyList method onCreateProperty.

public void onCreateProperty(ActionEvent actionEvent) {
    try {
        CfProperty newproperty = new CfProperty();
        propertykey = propertykey.replaceAll("\\s+", "_");
        propertykey = propertykey.replace(".", "_");
        newproperty.setHashkey(propertykey);
        newproperty.setValue(propertyvalue);
        newproperty.setNodelete(false);
        cfpropertyService.create(newproperty);
        fillPropertyMap();
        clownfish.setInitmessage(false);
        clownfish.init();
    } catch (ConstraintViolationException ex) {
        LOGGER.error(ex.getMessage());
    }
}
Also used : ConstraintViolationException(jakarta.validation.ConstraintViolationException) CfProperty(io.clownfish.clownfish.dbentities.CfProperty)

Example 100 with ConstraintViolationException

use of jakarta.validation.ConstraintViolationException in project Clownfish by rawdog71.

the class QuartzList method onCreateJob.

public void onCreateJob(ActionEvent actionEvent) {
    try {
        CfQuartz newquartz = new CfQuartz();
        newquartz.setName(jobname);
        newquartz.setSchedule(jobvalue);
        newquartz.setActive(active);
        newquartz.setSiteRef(BigInteger.valueOf(siteref.getId()));
        cfquartzService.create(newquartz);
        quartzlist = cfquartzService.findAll();
        clownfish.setInitmessage(false);
        clownfish.init();
    // fillPropertyMap();
    } catch (ConstraintViolationException ex) {
        LOGGER.error(ex.getMessage());
    }
}
Also used : ConstraintViolationException(jakarta.validation.ConstraintViolationException) CfQuartz(io.clownfish.clownfish.dbentities.CfQuartz)

Aggregations

ConstraintViolationException (jakarta.validation.ConstraintViolationException)114 Test (org.testng.annotations.Test)55 ConstraintMapping (org.hibernate.validator.cfg.ConstraintMapping)35 ConstraintViolation (jakarta.validation.ConstraintViolation)32 Validator (jakarta.validation.Validator)29 TestForIssue (org.hibernate.validator.testutil.TestForIssue)26 HibernateValidator (org.hibernate.validator.HibernateValidator)19 Size (jakarta.validation.constraints.Size)16 SizeDef (org.hibernate.validator.cfg.defs.SizeDef)15 Test (org.junit.Test)14 Session (org.hibernate.Session)10 Transaction (org.hibernate.Transaction)10 NotNullDef (org.hibernate.validator.cfg.defs.NotNullDef)10 CustomerRepositoryImpl (org.hibernate.validator.test.internal.engine.methodvalidation.service.CustomerRepositoryImpl)10 Customer (org.hibernate.validator.test.internal.engine.methodvalidation.model.Customer)9 FacesMessage (javax.faces.application.FacesMessage)8 NotNull (jakarta.validation.constraints.NotNull)7 BigDecimal (java.math.BigDecimal)7 Set (java.util.Set)7 EntityManager (jakarta.persistence.EntityManager)6