Examples of CAttr


Examples of org.allcolor.xml.parser.dom.CAttr

   * @throws DOMException DOCUMENT ME!
   */
  public Attr setAttributeNode(final Attr anewAttr)
    throws DOMException {
    isReadOnly();
    CAttr newAttr = (CAttr)anewAttr;
    if (newAttr == null) {
      return null;
    } // end if
    if (newAttr.parentNode != null &&
      newAttr.parentNode != this) {
      throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR,newAttr.getOwnerElement().toString());
    }
   
    if (newAttr.ownerDocument != ownerDocument && newAttr.ownerDocument != null)
      throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,"Invalid parent document.");
    Attr oldAttr = null;
    if (newAttr.localName != null)
      oldAttr = (Attr) (listAttributes == null ? null : listAttributes.getNamedItemNS(newAttr.getNamespaceURI(),newAttr.localName));
    else
      oldAttr = (Attr) getAttributeNode(newAttr.name);

    if (oldAttr == null && newAttr.localName == null)
      oldAttr = (Attr)(listAttributes == null ? null : listAttributes.getNamedItem(newAttr.name));
View Full Code Here

Examples of org.allcolor.xml.parser.dom.CAttr

    isReadOnly();
    if (oldAttr == null) {
      throw new DOMException(DOMException.NOT_FOUND_ERR,"Attribute is null.");
    } // end if

    CAttr attri = null;
    if (oldAttr.getLocalName() == null) {
      attri = (CAttr)getAttributeNode(oldAttr.getName());
    } else {
      attri = (CAttr)getAttributeNodeNS(oldAttr.getNamespaceURI(),oldAttr.getLocalName());
    }
View Full Code Here

Examples of org.allcolor.xml.parser.dom.CAttr

      if (listAttributes.getLength() > 0) {
        result.append(" ");
      } // end if
 
      for (int i=0;i<listAttributes.getLength();i++) {
        CAttr attr = (CAttr) listAttributes.item(i);
        result.append(attr.toString());
 
        if (i < listAttributes.getLength()-1) {
          result.append(" ");
        } // end if
      } // end while
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

                LOG.error("While loading job instance for task " + task.getId(), e);
            }
        }

        // 2. NotificationJob
        CAttr notificationJobCronExp = confDAO.find("notificationjob.cronExpression", NotificationJob.DEFAULT_CRON_EXP);
        if (StringUtils.isBlank(notificationJobCronExp.getValuesAsStrings().get(0))) {
            LOG.debug("Empty value provided for NotificationJob's cron, not registering anything on Quartz");
        } else {
            LOG.debug("NotificationJob's cron expression: {} - registering Quartz job and trigger",
                    notificationJobCronExp);

            try {
                registerJob(null, NotificationJob.class.getName(), notificationJobCronExp.getValuesAsStrings().get(0));
            } catch (Exception e) {
                LOG.error("While loading NotificationJob instance", e);
            }
        }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

        userTO.getMemberships().add(membershipTO);

        userController.create(userTO, true);

        // 3. Set number of retries
        CAttr maxRetries = confDAO.find("notification.maxRetries", "5");
        maxRetries.getValues().clear();
        maxRetries.addValue("5", AttributableUtil.getInstance(AttributableType.CONFIGURATION));
        confDAO.save(maxRetries);
        confDAO.flush();

        // 4. Stop mail server to force error sending mail
        stopGreenMail();

        // 5. force Quartz job execution multiple times
        for (int i = 0; i < 10; i++) {
            notificationJob.execute(null);
        }

        // 6. get NotificationTask, count number of executions
        NotificationTask foundTask = null;
        for (NotificationTask task : taskDAO.findAll(NotificationTask.class)) {
            if (sender.equals(task.getSender())) {
                foundTask = task;
            }
        }
        assertNotNull(foundTask);
        assertEquals(6, notificationManager.countExecutionsWithStatus(foundTask.getId(),
                NotificationJob.Status.NOT_SENT.name()));

        // 7. start mail server again
        startGreenMail();

        // 8. reset number of retries
        maxRetries = confDAO.find("notification.maxRetries", "5");
        maxRetries.getValues().clear();
        maxRetries.addValue("0", AttributableUtil.getInstance(AttributableType.CONFIGURATION));
        confDAO.save(maxRetries);
        confDAO.flush();
    }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

    @Autowired
    private SchemaDAO schemaDAO;

    @Test
    public void read() {
        CAttr conf = confDAO.find("selfRegistration.allowed");
        assertNotNull(conf);
        assertTrue(conf.getValues().get(0).getBooleanValue());

        conf = confDAO.find("authentication.statuses");
        assertNotNull(conf);
        assertEquals(2, conf.getValues().size());

        conf = confDAO.find("non.existing");
        assertNull(conf);
    }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

        useless.setType(AttributeSchemaType.Date);
        useless.setConversionPattern("yyyy-MM-dd");
        useless = schemaDAO.save(useless);

        // 2. create conf
        CAttr newConf = new CAttr();
        newConf.setSchema(useless);
        newConf.addValue("2014-06-20", AttributableUtil.getInstance(AttributableType.CONFIGURATION));
        confDAO.save(newConf);

        CAttr actual = confDAO.find("useless");
        assertEquals(actual.getValuesAsStrings(), newConf.getValuesAsStrings());

        // 3. update conf
        newConf.getValues().clear();
        newConf.addValue("2014-06-20", AttributableUtil.getInstance(AttributableType.CONFIGURATION));
        confDAO.save(newConf);

        actual = confDAO.find("useless");
        assertEquals(actual.getValuesAsStrings(), newConf.getValuesAsStrings());

        // 4. delete conf
        confDAO.delete("useless");
        assertNull(confDAO.find("useless"));
    }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

        if (schema == null) {
            throw new NotFoundException("Conf schema " + attributeTO.getSchema());
        } else {
            SyncopeClientException invalidValues = SyncopeClientException.build(ClientExceptionType.InvalidValues);

            CAttr attr = new CAttr();
            attr.setSchema(schema);
            fillAttribute(attributeTO.getValues(), AttributableUtil.getInstance(AttributableType.CONFIGURATION),
                    schema, attr, invalidValues);

            if (!invalidValues.isEmpty()) {
                throw invalidValues;
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

    }

    @Transactional(readOnly = true)
    @Override
    public CAttr find(final String key, final String defaultValue) {
        CAttr result = find(key);
        if (result == null) {
            result = new CAttr();
            result.setSchema(schemaDAO.find(key, CSchema.class));

            result.addValue(defaultValue, AttributableUtil.getInstance(AttributableType.CONFIGURATION));
        }

        return result;
    }
View Full Code Here

Examples of org.apache.syncope.core.persistence.beans.conf.CAttr

    }

    @Override
    public SyncopeConf delete(final String key) {
        SyncopeConf instance = get();
        CAttr attr = instance.getAttr(key);
        if (attr != null) {
            instance.removeAttr(attr);
            instance = entityManager.merge(instance);
        }
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.