/** * Given a resourceFilter, get the associated type. See {@link org.sakaiproject.entity.impl.ReferenceComponent#getType} * * @param resourceFilter the resourceFilter to get the type from * @return the resourceFilter's type */ protected String getType(String resourceFilter) { return EntityManager.newReference(resourceFilter).getType(); }
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { String ref = (String) in.readObject(); setBase(EntityManager.newReference(ref)); }
@Transient public Set<Reference> getAttachmentObjectSet() { Set<Reference> rv = new HashSet<Reference>(); Set<AssignmentSupplementItemAttachment> attachmentSet = getAttachmentSet(); for (Iterator<AssignmentSupplementItemAttachment> iAttachmentSet = attachmentSet.iterator(); iAttachmentSet.hasNext(); ) { AssignmentSupplementItemAttachment attachment = iAttachmentSet.next(); rv.add(EntityManager.newReference(attachment.getAttachmentId())); } return rv; } }
/** * @param id string * @return ref */ protected Reference convertToRef(String id) { return EntityManager.newReference(getContentHostingService().getReference(id)); }
/** * @inheritDoc */ protected List getHeaders(Event event) { // send most of the headers from the original message, removing some Reference ref = EntityManager.newReference(event.getResource()); MailArchiveMessage msg = (MailArchiveMessage) ref.getEntity(); MailArchiveMessageHeader hdr = (MailArchiveMessageHeader) msg.getMailArchiveHeader(); List headers = hdr.getMailHeaders(); List filteredHeaders = super.getHeaders(event); for (int i = 0; i < headers.size(); i++) { String headerStr = (String) headers.get(i); if (headerStr.regionMatches(true, 0, MailArchiveService.HEADER_RETURN_PATH, 0, MailArchiveService.HEADER_RETURN_PATH.length())) continue; if (headerStr.regionMatches(true, 0, MailArchiveService.HEADER_CONTENT_TRANSFER_ENCODING, 0, MailArchiveService.HEADER_CONTENT_TRANSFER_ENCODING.length())) continue; if (headerStr.regionMatches(true, 0, MailArchiveService.HEADER_CONTENT_TYPE, 0, MailArchiveService.HEADER_CONTENT_TYPE.length())) continue; filteredHeaders.add(headerStr); } return filteredHeaders; }
@Override protected String htmlContent(Event event) { StringBuilder buf = new StringBuilder(); // get the message Reference ref = EntityManager.newReference(event.getResource()); MailArchiveMessage msg = (MailArchiveMessage) ref.getEntity(); MailArchiveMessageHeader hdr = (MailArchiveMessageHeader) msg.getMailArchiveHeader(); // if html isn't available, convert plain-text into html buf.append( msg.getFormattedBody() ); // add any attachments List attachments = hdr.getAttachments(); if (attachments.size() > 0) { buf.append("<br/>" + "Attachments:<br/>"); for (Iterator iAttachments = attachments.iterator(); iAttachments.hasNext();) { Reference attachment = (Reference) iAttachments.next(); String attachmentTitle = attachment.getProperties().getPropertyFormatted(ResourceProperties.PROP_DISPLAY_NAME); buf.append("<br/><a href=\"" + attachment.getUrl() + "\" >" + attachmentTitle + "</a><br/>"); } } return buf.toString(); }
Reference ref = EntityManager.newReference(event.getResource()); MailArchiveMessage msg = (MailArchiveMessage) ref.getEntity(); MailArchiveMessageHeader hdr = (MailArchiveMessageHeader) msg.getMailArchiveHeader();
Reference ref = EntityManager.newReference(event.getResource()); String title = (getSite() != null) ? getSite() : ref.getContext(); try
public SitePage lookupAliasToPage(String alias, Site site) { //Shortcut if we aren't using page aliases. if (!lookForPageAliases) { return null; } SitePage page = null; if (alias != null && alias.length() > 0) { try { // Use page#{siteId}:{pageAlias} So we can scan for fist colon and alias can contain any character String refString = aliasService.getTarget(buildAlias(alias, site)); String aliasPageId = EntityManager.newReference(refString).getId(); page = (SitePage) site.getPage(aliasPageId); } catch (IdUnusedException e) { log.debug("Alias does not resolve {}", e.getMessage()); } } return page; }
public SitePage lookupAliasToPage(String alias, Site site) { //Shortcut if we aren't using page aliases. if (!lookForPageAliases) { return null; } SitePage page = null; if (alias != null && alias.length() > 0) { try { // Use page#{siteId}:{pageAlias} So we can scan for fist colon and alias can contain any character String refString = aliasService.getTarget(buildAlias(alias, site)); String aliasPageId = EntityManager.newReference(refString).getId(); page = (SitePage) site.getPage(aliasPageId); } catch (IdUnusedException e) { log.debug("Alias does not resolve {}", e.getMessage()); } } return page; }
public static String getImageUrl(String idString) { String refString = getContentHostingService().getReference(idString); Reference ref = EntityManager.newReference(refString); if (ref == null) { return "/library/image/sakai/unknown.gif"; } return "/library/image" + getContentTypeImageService().getContentTypeImage(ref.getType()); }
Reference ref = EntityManager.newReference(event.getResource()); EntityManager.newReference(channel);
public static String getReferenceUrl(String idString, String decoration) { String refString = getContentHostingService().getReference(idString); String contentRef = refString; if (decoration != null && !decoration.equals("")) { refString = decoration + refString; } getSecurityService().pushAdvisor( new LocalSecurityAdvisor(ContentHostingService.EVENT_RESOURCE_READ, contentRef)); Reference ref = EntityManager.newReference(refString); if (ref == null || ref.getEntity() == null) { return ""; } return ref.getUrl(); }
public boolean available(ContentEntity entity) {; return ServerConfigurationService.getBoolean("content.make.site.page",true) // Not in a dropbox && !ContentHostingService.isInDropbox(entity.getId()) // Not in a user site. && !SiteService.isUserSite(EntityManager.newReference(entity.getReference()).getContext()); } }
public static String getReferenceName(String idString, String decoration) { String refString = getContentHostingService().getReference(idString); String contentRef = refString; if (decoration != null && !decoration.equals("")) { refString = decoration + refString; } Reference ref = EntityManager.newReference(refString); getSecurityService().pushAdvisor( new LocalSecurityAdvisor(ContentHostingService.EVENT_RESOURCE_READ, contentRef)); if (ref == null || ref.getEntity() == null) { return ""; } ResourceProperties props = ref.getEntity().getProperties(); String prop = props.getNamePropDisplayName(); return props.getProperty(prop); }
Reference reference = EntityManager.newReference(referenceName); if (reference == null) return false;
StructuredArtifact art = (StructuredArtifact) i.next(); Reference ref = EntityManager.newReference(art.getBaseResource().getReference()); String context = ref.getContext();
/** * Format a to address, to the related site, but with no reply. * * @param event * The event that matched criteria to cause the notification. * @return a to address, to the related site, but with no reply. */ protected String getToSiteNoReply(Event event) { Reference ref = EntityManager.newReference(event.getResource()); // use either the configured site, or if not configured, the site (context) of the resource String siteId = (getSite() != null) ? getSite() : ref.getContext(); // get a site title String title = siteId; try { Site site = SiteService.getSite(siteId); title = site.getTitle(); } catch (Exception ignore) { } return "\"" + title + "\" <"+ ServerConfigurationService.getString("setup.request","no-reply@" + ServerConfigurationService.getServerName()) + ">"; }
Reference ref = EntityManager.newReference(event.getResource());
public void handleAccess(HttpServletRequest req, HttpServletResponse res, Reference ref, Collection copyrightAcceptedRefs) throws EntityPermissionException, EntityNotDefinedException, EntityAccessOverloadException, EntityCopyrightException { ReferenceParser parser = createParser(ref); checkSource(ref, parser); ContentEntityWrapper wrapper = (ContentEntityWrapper) ref.getEntity(); if (wrapper == null || wrapper.getBase() == null) { throw new EntityNotDefinedException(ref.getReference()); } else { Reference realRef = EntityManager.newReference(wrapper.getBase().getReference()); EntityProducer producer = realRef.getEntityProducer(); producer.getHttpAccess().handleAccess(req, res, realRef, copyrightAcceptedRefs); } }