/** * Add links associated with this item. * */ protected void addLinks() throws DSpaceSWORDException { // if this is a deposit which is no op we can't do anything here if (this.deposit != null && this.deposit.isNoOp()) { return; } // get the things we need out of the service SWORDUrlManager urlManager = swordService.getUrlManager(); String bsurl = urlManager.getBitstreamUrl(this.bitstream); BitstreamFormat bf = this.bitstream.getFormat(); String format = "application/octet-stream"; if (bf != null) { format = bf.getMIMEType(); } Link link = new Link(); link.setType(format); link.setHref(bsurl); link.setRel("alternate"); entry.addLink(link); log.debug("Added link entity to entry for url " + bsurl); }
public String toString() { return "Link -" + " href: " + getHref() + " hreflang: " + getHreflang() + " title: " + getTitle() + " rel: " + getRel() + " content: " + getContent() + " type: " + getType() + " length: " + getLength(); }
public SwordValidationInfo unmarshall(Element link, Properties validationProperties) throws UnmarshallException { if (!isInstanceOf(link, xmlName)) { return handleIncorrectElement(link, validationProperties); href = attribute.getValue(); if (validationProperties != null) { attributeItems.add(createValidAttributeInfo(ATTRIBUTE_HREF, href)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_REL, rel)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_TYPE, type)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_HREF_LANG, hreflang)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_TITLE, title)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_LENGTH, length)); result = validate(validationItems, attributeItems, validationProperties);
Link link = links.next(); linkBuffer.append("href: '"); linkBuffer.append(link.getHref()); linkBuffer.append("', href lang: '"); linkBuffer.append(link.getHreflang()); linkBuffer.append("', rel: '"); linkBuffer.append(link.getRel()); linkBuffer.append("')<br>");
result.addUnmarshallElementInfo(info); } else if (isInstanceOf(element, Link.elementName())) { Link link = new Link(); result.addUnmarshallElementInfo(link.unmarshall(element, validationProperties)); links.add(link); } else if (isInstanceOf(element, Published.elementName())) {
result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_HREF, href)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_REL, rel)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_TYPE, type)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_HREF_LANG, hreflang)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_TITLE, title)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_LENGTH, length));
protected boolean isElementChecked(XmlName elementName) { if( elementName == null ) { return false; } return elementName.equals(Author.elementName()) | elementName.equals(Category.elementName()) | elementName.equals(Content.elementName()) | elementName.equals(Generator.elementName()) | elementName.equals(Contributor.elementName()) | elementName.equals(Id.elementName()) | elementName.equals(Link.elementName()) | elementName.equals(Published.elementName()) | elementName.equals(Rights.elementName()) | elementName.equals(Source.elementName()) | elementName.equals(Summary.elementName()) | elementName.equals(Title.elementName()) | elementName.equals(Updated.elementName()); }
Element element = new Element(getQualifiedName(), xmlName.getNamespace());
result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_HREF, href)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_REL, rel)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_TYPE, type)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_HREF_LANG, hreflang)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_TITLE, title)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_LENGTH, length));
if( ! isInstanceOf(link, xmlName) ) return handleIncorrectElement(link, validationProperties); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_HREF, href)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_REL, rel)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_TYPE, type)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_HREF_LANG, hreflang)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_TITLE, title)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_LENGTH, length)); result = validate(validationItems, attributeItems, validationProperties);
linkBuffer.append(link.getHref()); linkBuffer.append("', href lang: '"); linkBuffer.append(link.getHreflang()); linkBuffer.append("', rel: '"); linkBuffer.append(link.getRel()); linkBuffer.append("')<br>");
else if (isInstanceOf(element, Link.elementName())) Link link = new Link(); result.addUnmarshallElementInfo(link.unmarshall(element, validationProperties)); links.add(link);
result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_HREF, href)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_REL, rel)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_TYPE, type)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_HREF_LANG, hreflang)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_TITLE, title)); result.addAttributeValidationInfo(createValidAttributeInfo(ATTRIBUTE_LENGTH, length));
protected boolean isElementChecked(XmlName elementName) { if( elementName == null ) { return false; } return elementName.equals(Author.elementName()) | elementName.equals(Category.elementName()) | elementName.equals(Content.elementName()) | elementName.equals(Generator.elementName()) | elementName.equals(Contributor.elementName()) | elementName.equals(Id.elementName()) | elementName.equals(Link.elementName()) | elementName.equals(Published.elementName()) | elementName.equals(Rights.elementName()) | elementName.equals(Source.elementName()) | elementName.equals(Summary.elementName()) | elementName.equals(Title.elementName()) | elementName.equals(Updated.elementName()); }
Element element = new Element(getQualifiedName(), xmlName.getNamespace());
public String toString() { return "Link -" + " href: " + getHref() + " hreflang: " + getHreflang() + " title: " + getTitle() + " rel: " + getRel() + " content: " + getContent() + " type: " + getType() + " length: " + getLength(); }
/** * Add links associated with this item. */ protected void addLinks() throws DSpaceSWORDException { // if this is a deposit which is no op we can't do anything here if (this.deposit != null && this.deposit.isNoOp()) { return; } // get the things we need out of the service SWORDUrlManager urlManager = swordService.getUrlManager(); String bsurl = urlManager.getBitstreamUrl(this.bitstream); BitstreamFormat bf; try { bf = this.bitstream.getFormat(swordService.getContext()); } catch (SQLException e) { log.error("Exception caught: ", e); throw new DSpaceSWORDException(e); } String format = "application/octet-stream"; if (bf != null) { format = bf.getMIMEType(); } Link link = new Link(); link.setType(format); link.setHref(bsurl); link.setRel("alternate"); entry.addLink(link); log.debug("Added link entity to entry for url " + bsurl); }
if( ! isInstanceOf(link, xmlName) ) return handleIncorrectElement(link, validationProperties); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_HREF, href)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_REL, rel)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_TYPE, type)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_HREF_LANG, hreflang)); if( validationProperties != null) attributeItems.add(createValidAttributeInfo(ATTRIBUTE_TITLE, title)); attributeItems.add(createValidAttributeInfo(ATTRIBUTE_LENGTH, length)); result = validate(validationItems, attributeItems, validationProperties);