Package uk.ac.osswatch.simal.model

Examples of uk.ac.osswatch.simal.model.IDocument


    com.hp.hpl.jena.rdf.model.Resource r = model.createResource(uri);
    Statement s = model.createStatement(r, RDF.type, FOAF.Document);
    model.add(s);

    IDocument page = new Document(r);
    return page;
  }
View Full Code Here


    IDocument page = new Document(r);
    return page;
  }

  public IDocument get(String uri) throws SimalRepositoryException, IncompatibleTypeException {
    IDocument document = null;

    if (getRepository().containsResource(uri)) {
      Resource docResource = getModel().getResource(uri);
      document = new Document(docResource).ensureDocumentType();
    }
View Full Code Here

          }
        }
      }
      if (uri != null && !uri.equals("")) {
        try {
          IDocument doc = SimalRepositoryFactory.getHomepageService()
              .getOrCreate(uri);
          String label = document.getAttributeNS(RDFUtils.RDFS_NS, RDFS.label.getLocalName());
          if (label.length() == 0 && generateLabel) {
            label = HomepageLabelGenerator.getHomepageLabel(uri);
          } else {
            document.removeAttributeNS(RDFUtils.RDFS_NS, RDFS.label.getLocalName());
          }
          doc.setDefaultName(label);
        } catch (IncompatibleTypeException e) {
          LOGGER.warn("URI " + uri
              + " already known as another type, removing from project.");
          document.removeAttributeNS(RDFUtils.RDF_NS, "resource");
        }
View Full Code Here

          repo.setAnonRoots(allAnonRoots);
        }
        String devAccess = inputModel.getDevAccess();
        if (!StringUtils.isEmpty(devAccess)) {
          Set<IDocument> allDevAccesses = new HashSet<IDocument>();
          IDocument devAccessDocument = SimalRepositoryFactory
              .getHomepageService().getOrCreate(devAccess);
          allDevAccesses.add(devAccessDocument);
          repo.setLocations(allDevAccesses);
        }
View Full Code Here

  @Override
  protected void processAddSubmit() {
    inputModel.setName(nameField.getValue());
    inputModel.setUrl(urlField.getValue());
    try {
      IDocument homepage = SimalRepositoryFactory.getHomepageService()
      .getOrCreate(inputModel.getUrl());
      homepage.setDefaultName(inputModel.getName());
     
      getUpdatePanel().addToDisplayList(homepage);
      getUpdatePanel().addToModel(homepage);
    } catch (SimalException e) {
      UserReportableException error = new UserReportableException(
View Full Code Here

  @Override
  public void populateItem(Item<ICellPopulator<IResource>> item,
      String componentId, IModel<IResource> model) {
    IResource targetResource = model.getObject();
    if (targetResource instanceof IDocument) {
      IDocument page = (IDocument)targetResource;
      item.add(new LinkPanel(componentId, page.getURI(), page.getLabel()));
    } else {
      item.add(new LinkPanel(componentId, targetResource, createLabelModel(model)));
    }
  }
View Full Code Here

    Iterator<IDocument> homepages = project1.getHomepages().iterator();
    boolean hasHomepageOne = false;
    boolean hasHomepageTwo = false;

    while (homepages.hasNext()) {
      IDocument homepage = homepages.next();
      if (homepage.getURI().toString().equals(
          TEST_SIMAL_PROJECT_HOMEPAGE_URL_ONE)) {
        hasHomepageOne = true;
      } else if (homepage.getURI().toString().equals(
          TEST_SIMAL_PROJECT_HOMEPAGE_URL_TWO)) {
        hasHomepageTwo = true;
      }
    }
View Full Code Here

    boolean hasHomepageOne = false;
    boolean hasHomepageTwo = false;
    Iterator<IDocument> homepages = project1.getHomepages().iterator();
    String label;
    while (homepages.hasNext()) {
      IDocument homepage = homepages.next();
      label = homepage.getLabel();
      if (label.equals(TEST_SIMAL_PROJECT_HOMEPAGE_NAME_ONE)) {
        hasHomepageOne = true;
      } else if (label.equals(TEST_SIMAL_PROJECT_HOMEPAGE_NAME_TWO)) {
        hasHomepageTwo = true;
      }
View Full Code Here

  @Test
  public void testAddandRemoveHomepage() throws SimalRepositoryException, DuplicateURIException {
      Set<IDocument> prePages = project1.getHomepages();

      String uri = "http://www.foo.org/homepageTest";
      IDocument page = SimalRepositoryFactory.getHomepageService().create(uri);

      project1.addHomepage(page);
      Set<IDocument> postPages = project1.getHomepages();
      assertTrue("Failed to add a homepage to the project",
          prePages.size() < postPages.size());

      project1.removeHomepage(page);
      postPages = project1.getHomepages();
      assertTrue("Failed to remove a homepage from the project", prePages
          .size() == postPages.size());

      page.delete();
  }
View Full Code Here

  /**
   * @see ListView#populateItem(ListItem)
   */
  protected void populateItem(ListItem<IDocument> listItem) {
    final IDocument page = listItem.getModelObject();
    ExternalLink externalLink = new ExternalLink("linkURL", page.getURI());
    externalLink.add(new Label("linkText", page.getLabel()));
    listItem.add(externalLink);
  }
View Full Code Here

TOP

Related Classes of uk.ac.osswatch.simal.model.IDocument

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.