Package org.alfresco.repo.dictionary

Examples of org.alfresco.repo.dictionary.M2Model


  protected List<M2ModelResource> createModels() throws IOException {
    final List<M2ModelResource> models = new ArrayList<M2ModelResource>();
    for (final Resource resource : getResourcePatternResolver().getResources(modelLocationPattern)) {
      try {
        final M2Model model = createM2Model(resource);
        models.add(new M2ModelResource(resource, model));
      } catch (final Exception e) {
        if (logger.isWarnEnabled()) {
          logger.warn("Could not create model from {}: {}", resource, e.getMessage());
        }
View Full Code Here


   * Tests {@link ModelRegistrar#registerModels()}.
   */
  @Test
  public void testRegisterDependantModels() {
    // test regular dependant models
    final M2Model user = M2Model.createModel("user");
    final M2Model provider = M2Model.createModel("provider");
    final M2Model superProvider = M2Model.createModel("superprovider");
    daoModelRegistrar.setModels(asList(
        new M2ModelResource(null, user),
        new M2ModelResource(null, provider),
        new M2ModelResource(null, superProvider)
    ));

    user.createImport("http://www.alfresco.org/model/provider/1.0", "provider");
    provider.createNamespace("http://www.alfresco.org/model/provider/1.0", "provider");
    provider.createImport("http://www.alfresco.org/model/superprovider/1.0", "superprovider");

    superProvider.createNamespace("http://www.alfresco.org/model/superprovider/1.0", "superprovider");

    final ArgumentCaptor<M2Model> modelParameter = ArgumentCaptor.forClass(M2Model.class);

    daoModelRegistrar.registerModels();

View Full Code Here

  /**
   * Tests {@link ModelRegistrar#registerModels()}.
   */
  @Test(expected = IllegalArgumentException.class)
  public void testCircularReferenceModels() {
    final M2Model user = M2Model.createModel("user");
    final M2Model provider = M2Model.createModel("provider");
    daoModelRegistrar.setModels(asList(
        new M2ModelResource(null, user),
        new M2ModelResource(null, provider)
    ));

    // create bidirectional dependency between provider and user
    user.createNamespace("http://www.alfresco.org/model/user/1.0", "provider");
    user.createImport("http://www.alfresco.org/model/provider/1.0", "provider");
    provider.createNamespace("http://www.alfresco.org/model/provider/1.0", "provider");
    provider.createImport("http://www.alfresco.org/model/user/1.0", "user");

    daoModelRegistrar.registerModels();
  }
View Full Code Here

TOP

Related Classes of org.alfresco.repo.dictionary.M2Model

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.