本文整理了Java中org.sakaiproject.entity.cover.EntityManager.newReference()
方法的一些代码示例,展示了EntityManager.newReference()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityManager.newReference()
方法的具体详情如下:
包路径:org.sakaiproject.entity.cover.EntityManager
类名称:EntityManager
方法名:newReference
暂无
代码示例来源:origin: sakaiproject/sakai
/**
* 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();
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-api
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
String ref = (String) in.readObject();
setBase(EntityManager.newReference(ref));
}
代码示例来源:origin: sakaiproject/sakai
@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;
}
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib
/**
* @param id string
* @return ref
*/
protected Reference convertToRef(String id) {
return EntityManager.newReference(getContentHostingService().getReference(id));
}
代码示例来源:origin: org.sakaiproject.mailarchive/sakai-mailarchive-impl
/**
* @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;
}
代码示例来源:origin: org.sakaiproject.mailarchive/sakai-mailarchive-impl
@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();
}
代码示例来源:origin: org.sakaiproject.mailarchive/sakai-mailarchive-impl
Reference ref = EntityManager.newReference(event.getResource());
MailArchiveMessage msg = (MailArchiveMessage) ref.getEntity();
MailArchiveMessageHeader hdr = (MailArchiveMessageHeader) msg.getMailArchiveHeader();
代码示例来源:origin: sakaiproject/sakai
Reference ref = EntityManager.newReference(event.getResource());
String title = (getSite() != null) ? getSite() : ref.getContext();
try
代码示例来源:origin: sakaiproject/sakai
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;
}
代码示例来源:origin: org.sakaiproject.portal/sakai-portal-impl
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;
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib
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());
}
代码示例来源:origin: sakaiproject/sakai
Reference ref = EntityManager.newReference(event.getResource());
EntityManager.newReference(channel);
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib
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();
}
代码示例来源:origin: org.sakaiproject.content/content-types
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());
}
}
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-tool-lib
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);
}
代码示例来源:origin: org.sakaiproject.sitemanage/sakai-site-manage-util
Reference reference = EntityManager.newReference(referenceName);
if (reference == null) return false;
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl
StructuredArtifact art = (StructuredArtifact) i.next();
Reference ref = EntityManager.newReference(art.getBaseResource().getReference());
String context = ref.getContext();
代码示例来源:origin: sakaiproject/sakai
/**
* 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()) + ">";
}
代码示例来源:origin: sakaiproject/sakai
Reference ref = EntityManager.newReference(event.getResource());
代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-api
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);
}
}
内容来源于网络,如有侵权,请联系作者删除!