@Override public boolean canEdit(IAccounterServerCore clientObject, boolean goingToBeEdit) throws AccounterException { Session session = HibernateUtil.getCurrentSession(); if (!UserUtils.canDoThis(BrandingTheme.class)) { throw new AccounterException(AccounterException.ERROR_DONT_HAVE_PERMISSION); } Query query = session .getNamedQuery("getBrandingTheme") .setParameter("companyId", ((BrandingTheme) clientObject).getCompany().getID()) .setParameter("themeName", this.themeName, EncryptedStringType.INSTANCE) .setLong("id", this.getID()); List list = query.list(); if (list != null || list.size() > 0 || list.get(0) != null) { Iterator iterator = list.iterator(); while (iterator.hasNext()) { String object = (String) iterator.next(); if (this.getThemeName().equals(object)) { throw new AccounterException(AccounterException.ERROR_NAME_CONFLICT); // "Branding Theme already exist with this Name"); } } } return true; }
@Override public boolean canEdit(IAccounterServerCore clientObject, boolean goingToBeEdit) throws AccounterException { if (!UserUtils.canDoThis(JournalEntry.class)) { throw new AccounterException(AccounterException.ERROR_DONT_HAVE_PERMISSION); } if (this.isVoidBefore) { throw new AccounterException(AccounterException.ERROR_NO_SUCH_OBJECT); } return true; }