本文整理汇总了C#中TcmUri类的典型用法代码示例。如果您正苦于以下问题:C# TcmUri类的具体用法?C# TcmUri怎么用?C# TcmUri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TcmUri类属于命名空间,在下文中一共展示了TcmUri类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Transform
public void Transform(Engine engine, Package package)
{
TemplatingLogger log = TemplatingLogger.GetLogger(GetType());
if (package.GetByName(Package.OutputName) == null)
{
log.Error("Could not find \"Output\" item in Package. This template building block should be the last TBB in your template.");
return;
}
Item output = package.GetByName(Package.OutputName);
string outputText = output.GetAsString();
bool outputchanged = false;
foreach (Match m in TcmUriRegEx.Matches(outputText))
{
log.Debug("Found " + m.Value);
TcmUri uri = new TcmUri(m.Value);
if(uri.GetVersionlessUri().ToString().Equals(m.Value)) continue;
log.Debug("Found version information on uri " + m.Value + ". Removing.");
outputText = outputText.Replace(m.Value, uri.GetVersionlessUri().ToString());
outputchanged = true;
}
if (outputchanged)
{
output.SetAsString(outputText);
package.Remove(output);
package.PushItem(Package.OutputName, output);
}
}
开发者ID:mhassan26,项目名称:SDL-Tridion-Template-Tools,代码行数:29,代码来源:RemoveDynamicVersionFromUri.cs
示例2: Article
public Article(SessionAwareCoreServiceClient client, TcmUri location)
: base(client)
{
ComponentData component = (ComponentData)Client.GetDefaultData(ItemType.Component, location, ReadOptions);
component.Schema = new LinkToSchemaData { IdRef = ContentManager.ResolveUrl(Constants.ArticleSchemaUrl) };
Content = component;
}
开发者ID:NunoLinhares,项目名称:TridionWebData,代码行数:7,代码来源:Article.cs
示例3: ComponentPresentationModel
/// <summary>
/// Constrctor
/// </summary>
/// <param name="engine"></param>
/// <param name="componentID"></param>
/// <param name="templateID"></param>
/// <param name="index"></param>
public ComponentPresentationModel(Engine engine, TcmUri componentID, TcmUri templateID, int index)
{
_engine = engine;
_componentID = componentID;
_templateID = templateID;
Index = index;
}
开发者ID:alex-klock,项目名称:razor-mediator-4-tridion,代码行数:14,代码来源:ComponentPresentationModel.cs
示例4: ContentItem
protected ContentItem(TcmUri itemId, SessionAwareCoreServiceClient client)
{
ReadOptions = new ReadOptions();
Client = client;
Content = (ComponentData) client.Read(itemId, ReadOptions);
ContentManager = new ContentManager(Client);
}
开发者ID:NunoLinhares,项目名称:TridionWebData,代码行数:7,代码来源:ContentItem.cs
示例5: ResolveLink
public string ResolveLink(string componentUri)
{
TcmUri uri = new TcmUri(componentUri);
if (!uri.Equals(emptyTcmUri))
{
Cache cache = HttpContext.Current.Cache;
string cacheKey = String.Format(CACHEKEY_FORMAT, componentUri);
if (cache[cacheKey] != null)
{
return (String)cache[cacheKey];
}
else
{
Link link = componentLink.GetLink(uri.ToString());
if (!link.IsResolved)
{
return null;
}
cache.Insert(cacheKey, link.Url, null, DateTime.Now.AddSeconds(30), TimeSpan.Zero); //TODO should this be configurable?
return link.Url;
}
}
return null;
}
开发者ID:rainmaker2k,项目名称:TridionMVCDotNet,代码行数:26,代码来源:TridionLinkFactory.cs
示例6: GetAssemblyKey
/// <summary>
/// Retrieves the Compound Template invocation XML for a given page or component template Uri
/// </summary>
/// <param name="compoundTemplateWebService"><see cref="T:Tridion.ContentManager.Templating.CompoundTemplates.DomainModel.Proxy.CompoundTemplateWebService" /></param>
/// <param name="templateUri">Tridion template URI.</param>
/// <returns>Compound Template invocation XML as <see cref="T:String.String" /></returns>
/// <exception cref="System.NotSupportedException">Unsupported template type</exception>
public static String GetAssemblyKey(this CompoundTemplateWebService compoundTemplateWebService, String templateUri)
{
if (compoundTemplateWebService != null)
{
XmlElement templateXml = compoundTemplateWebService.ReadItem(templateUri, EnumOpenMode.OpenModeView, 1919);
String templateType = templateXml.SelectSingleNode("/tcm:Data/tcm:Type", namespaceManager).InnerText;
if (!String.Equals(templateType, "CompoundTemplate", StringComparison.OrdinalIgnoreCase))
throw new NotSupportedException("Unsupported template type: " + templateType);
String owningPublication = templateXml.SelectSingleNode("/tcm:Info/tcm:BluePrintInfo/tcm:OwningPublication/@xlink:href", namespaceManager).InnerText;
String version = templateXml.SelectSingleNode("/tcm:Info/tcm:VersionInfo/tcm:Version", namespaceManager).InnerText;
String revision = templateXml.SelectSingleNode("/tcm:Info/tcm:VersionInfo/tcm:Revision", namespaceManager).InnerText;
String content = templateXml.SelectSingleNode("/tcm:Data/tcm:Content/tcm:PublisherScript", namespaceManager).InnerText;
content = content.Replace("\n", "\r\n");
TcmUri tcmPublication = new TcmUri(owningPublication);
TcmUri tcmTemplate = new TcmUri(templateUri);
TcmUri tcmParent = new TcmUri(tcmTemplate.ItemId, tcmTemplate.ItemType, tcmPublication.ItemId);
int hashCode = 0;
if (!String.IsNullOrEmpty(content))
hashCode = content.GetHashCode();
return String.Format("{0}/{1}.{2}/{3:X}", tcmParent, version, revision, hashCode);
}
return String.Empty;
}
开发者ID:mvlasenko,项目名称:TridionVSRazorExtension,代码行数:40,代码来源:CompoundTemplateWebServiceExtensions.cs
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
// get the current logged in user
string user = HttpContext.Current.User.Identity.Name;
if (!String.IsNullOrEmpty(user))
{
// set LogonUser
TridionTreeView.LogonUser = user;
}
// process querystring parameters
string start = Request.QueryString["start"];
string types = Request.QueryString["types"];
string pubid = Request.QueryString["pubid"];
if (!String.IsNullOrEmpty(start))
{
// override StartFromUri
TridionTreeView.StartFromUri = start;
}
else if (!String.IsNullOrEmpty(pubid))
{
// override StartFromUri with current publication id
TcmUri uri = new TcmUri(pubid);
TridionTreeView.StartFromUri = uri.ToString();
}
if (!String.IsNullOrEmpty(types))
{
// override SelectTypes
TridionTreeView.SelectTypes = Convert.ToInt32(types);
}
}
开发者ID:SGAnonymous,项目名称:sdl-tridion-world,代码行数:33,代码来源:ItemSelector.aspx.cs
示例8: GetComponentLink
protected ComponentLink GetComponentLink(TcmUri uri)
{
if (!_componentLinks.ContainsKey(uri.PublicationId))
{
_componentLinks.Add(uri.PublicationId, new ComponentLink(uri.PublicationId));
}
return _componentLinks[uri.PublicationId];
}
开发者ID:flaithbheartaigh,项目名称:dynamic-delivery-4-tridion,代码行数:8,代码来源:TridionLinkProvider.cs
示例9: AddComponent
/// <summary>
/// Add a new <see cref="T:Tridion.ContentManager.TcmUri"/> value to the current <see cref="T:Tridion.ContentManager.Templating.Package" />
/// </summary>
/// <param name="package"><see cref="T:Tridion.ContentManager.Templating.Package" /></param>
/// <param name="name">Name.</param>
/// <param name="value">Value.</param>
public static void AddComponent(this Package package, String name, TcmUri value)
{
if (package != null)
{
Item packageItem = package.CreateTridionItem(ContentType.Component, value != null ? value : TcmUri.UriNull);
package.PushItem(name, packageItem);
}
}
开发者ID:TcmExtensions,项目名称:TcmTemplating,代码行数:14,代码来源:PackageExtensions.cs
示例10: GetLocalUri
public static TcmUri GetLocalUri(TcmUri uriPublication, TcmUri uriItem)
{
TcmUri uriReturn = new TcmUri(uriItem.ItemId, uriItem.ItemType, uriPublication.ItemId);
TemplatingLogger log = TemplatingLogger.GetLogger(typeof(TemplateUtilities));
log.Info("(getLocalUri)Old URI was:" + uriItem.ToString());
log.Info("(getLocalUri)New URI is:" + uriReturn.ToString());
return uriReturn;
}
开发者ID:jhorsman,项目名称:DD4T.TridionTemplates,代码行数:8,代码来源:TridionUtils.cs
示例11: GetContent
public string GetContent(string uri, string templateUri = "")
{
var tcmUri = new TcmUri(uri);
string urlParameters = string.IsNullOrEmpty(templateUri) ?
string.Format("{0}/GetContent/{1}/{2}", controller, tcmUri.PublicationId, tcmUri.ItemId) :
string.Format("{0}/GetContent/{1}/{2}/{3}", controller, tcmUri.PublicationId, tcmUri.ItemId, new TcmUri(templateUri).ItemId);
return Execute<string>(urlParameters);
}
开发者ID:tgfl-tom,项目名称:DD4T.Providers.Rest,代码行数:9,代码来源:TridionComponentPresentationProvider.cs
示例12: ResolveLink
public string ResolveLink(string sourcePageUri, string componentUri, string excludeComponentTemplateUri)
{
var compUri = new TcmUri(componentUri);
var pageUri = new TcmUri(sourcePageUri);
var templateUri = new TcmUri(excludeComponentTemplateUri);
string urlParameters = string.Format("{0}/ResolveLink/{1}/{2}/{3}/{4}", controller, PublicationId, pageUri.ItemId, compUri.ItemId, templateUri.ItemId);
return Execute<string>(urlParameters);
}
开发者ID:Jeej,项目名称:DD4T.Providers.Rest,代码行数:10,代码来源:TridionLinkProvider.cs
示例13: GetContent
public string GetContent(string uri, string templateUri = "")
{
LoggerService.Debug(">>GetContent({0})", LoggingCategory.Performance, uri);
TcmUri tcmUri = new TcmUri(uri);
TcmUri templateTcmUri = new TcmUri(templateUri);
T.ComponentPresentationFactory cpFactory = GetComponentPresentationFactory(tcmUri.PublicationId);
T.ComponentPresentation cp = null;
if (!String.IsNullOrEmpty(templateUri))
{
cp = cpFactory.GetComponentPresentation(tcmUri.ItemId, templateTcmUri.ItemId);
if (cp != null)
return cp.Content;
}
if (!string.IsNullOrEmpty(selectByComponentTemplateId))
{
cp = cpFactory.GetComponentPresentation(tcmUri.ItemId, Convert.ToInt32(selectByComponentTemplateId));
if (cp != null)
{
LoggerService.Debug("<<GetContent({0}) - by ct id", LoggingCategory.Performance, uri);
return cp.Content;
}
}
if (!string.IsNullOrEmpty(selectByOutputFormat))
{
cp = cpFactory.GetComponentPresentationWithOutputFormat(tcmUri.ItemId, selectByOutputFormat);
if (cp != null)
{
LoggerService.Debug("<<GetContent({0}) - by output format", LoggingCategory.Performance, uri);
return cp.Content;
}
}
LoggerService.Debug("GetContent: about to get component presentations with Highst Priority for {0}", LoggingCategory.Performance, tcmUri.ToString());
cp = cpFactory.GetComponentPresentationWithHighestPriority(tcmUri.ItemId);
LoggerService.Debug("GetContent: get component presentations with Highst Priority for {0}", LoggingCategory.Performance, tcmUri.ToString());
if (cp != null)
return cp.Content;
//foreach (Tridion.ContentDelivery.DynamicContent.ComponentPresentation _cp in cps)
//{
// if (_cp != null)
// {
// LoggerService.Debug("<<GetContent({0}) - find all", LoggingCategory.Performance, uri);
// return _cp.Content;
// }
//}
LoggerService.Debug("<<GetContent({0}) - not found", LoggingCategory.Performance, uri);
return string.Empty;
}
开发者ID:dd4t,项目名称:DD4T.Providers.SDLTridion2013,代码行数:55,代码来源:TridionComponentPresentationProvider.cs
示例14: ResolveLink
public string ResolveLink(string componentUri)
{
TcmUri uri = new TcmUri(componentUri);
if (!uri.Equals(emptyTcmUri))
{
Link link = componentLink.GetLink(uri.ToString());
return link.IsResolved ? link.Url : null;
}
return null;
}
开发者ID:flaithbheartaigh,项目名称:dynamic-delivery-4-tridion,代码行数:12,代码来源:TridionLinkProvider.cs
示例15: IsSiteEditEnabled
public bool IsSiteEditEnabled(ITridionItemData item)
{
int publicationId = 0;
try
{
publicationId = new TcmUri(item.TcmUri).PublicationId;
}
catch (Exception)
{
publicationId = 0;
}
return IsSiteEditEnabled(publicationId);
}
开发者ID:kpmrafeeq,项目名称:DVM4T,代码行数:13,代码来源:XpmMarkupService.cs
示例16: CreateBinaryLink
private void CreateBinaryLink(XmlDocument xmlContent, XmlNode node, TcmUri item, Component c)
{
_package.PushItem(_package.CreateMultimediaItem(item));
Binary binary = _engine.PublishingContext.RenderedItem.AddBinary(c, "");
node.Attributes.RemoveAll();
String publishedPath = GetUrlForBinary(binary.Url);
XmlAttribute attr = xmlContent.CreateAttribute("href");
attr.Value = publishedPath;
node.Attributes.SetNamedItem(attr);
attr = xmlContent.CreateAttribute("title");
attr.Value = c.Title;
node.Attributes.SetNamedItem(attr);
}
开发者ID:DavidForster,项目名称:Tridion-Templating-Extensions,代码行数:14,代码来源:RTFUtilities.cs
示例17: GetAllPublishedPageUrls
/// <summary>
/// Get all urls of published pages
/// </summary>
/// <param name="includeExtensions"></param>
/// <param name="pathStarts"></param>
/// <param name="publicationID"></param>
/// <returns></returns>
public string[] GetAllPublishedPageUrls(string[] includeExtensions, string[] pathStarts)
{
Query pageQuery = new Query();
ItemTypeCriteria isPage = new ItemTypeCriteria(64); // TODO There must be an enum of these somewhere
PublicationCriteria currentPublication = new PublicationCriteria(PublicationId); //Todo: add logic to determine site on url
Criteria pageInPublication = CriteriaFactory.And(isPage, currentPublication);
if (includeExtensions.Length > 0)
{
PageURLCriteria[] extensionsCriteria = new PageURLCriteria[includeExtensions.Length];
int criteriaCount = 0;
foreach (string pageExtension in includeExtensions)
{
extensionsCriteria.SetValue(new PageURLCriteria("%" + pageExtension, Criteria.Like), criteriaCount);
criteriaCount++;
}
Criteria allExtensions = CriteriaFactory.Or(extensionsCriteria);
pageInPublication = CriteriaFactory.And(pageInPublication, allExtensions);
}
if (pathStarts.Length > 0)
{
PageURLCriteria[] pathCriteria = new PageURLCriteria[pathStarts.Length];
int criteriaCount = 0;
foreach (string requiredPath in pathStarts)
{
pathCriteria.SetValue(new PageURLCriteria(requiredPath + "%", Criteria.Like), criteriaCount);
criteriaCount++;
}
Criteria allPaths = CriteriaFactory.Or(pathCriteria);
pageInPublication = CriteriaFactory.And(pageInPublication, allPaths);
}
Query findPages = new Query(pageInPublication);
string[] pageUris = findPages.ExecuteQuery();
// Need to get PageMeta data to find all the urls
List<string> pageUrls = new List<string>();
foreach (string uri in pageUris)
{
TcmUri tcmUri = new TcmUri(uri);
PageMetaFactory metaFactory = GetPageMetaFactory(tcmUri.PublicationId);
IPageMeta currentMeta = metaFactory.GetMeta(uri);
pageUrls.Add(currentMeta.UrlPath);
}
return pageUrls.ToArray();
}
开发者ID:dd4t,项目名称:DD4T.Providers.SDLTridion2011sp1,代码行数:57,代码来源:TridionPageProvider.cs
示例18: GetContentMultiple
/// <summary>
/// Returns the Component contents which could be found. Components that couldn't be found don't appear in the list.
/// </summary>
/// <param name="componentUris"></param>
/// <returns></returns>
public List<string> GetContentMultiple(string[] componentUris)
{
TcmUri uri = new TcmUri(componentUris.First());
ComponentPresentationFactory cpFactory = new ComponentPresentationFactory(uri.PublicationId);
var components =
componentUris
.Select(componentUri => (Tridion.ContentDelivery.DynamicContent.ComponentPresentation)cpFactory.FindAllComponentPresentations(componentUri)[0])
.Where(cp => cp != null)
.Select(cp => cp.Content)
.ToList();
return components;
}
开发者ID:Siva-Charan,项目名称:dynamic-delivery-4-tridion,代码行数:19,代码来源:TridionComponentProvider.cs
示例19: GetPublishTransaction
/// <summary>
/// Get 'current' PublishTransaction. It tries to identify a PublishTransaction from the publish queue that is on the
/// given TcmUri, Publication, User, etc.
/// </summary>
/// <param name="engine">Engine object</param>
/// <param name="tcmUri">String representing the tcmuri of the item to check</param>
/// <returns>PublishTransaction if found; or null, otherwise</returns>
public static PublishTransaction GetPublishTransaction(Engine engine, String tcmUri)
{
String binaryPath = engine.PublishingContext.PublishInstruction.RenderInstruction.BinaryStoragePath;
Regex tcmRegex = new Regex(@"tcm_\d+-\d+-66560");
Match match = tcmRegex.Match(binaryPath);
if (match.Success)
{
String transactionId = match.Value.Replace('_', ':');
TcmUri transactionUri = new TcmUri(transactionId);
return new PublishTransaction(transactionUri, engine.GetSession());
}
return FindPublishTransaction(engine, tcmUri);
}
开发者ID:mhassan26,项目名称:SDL-Tridion-Template-Tools,代码行数:21,代码来源:TemplateUtils.cs
示例20: FindComponentMetas
public IDictionary<string, IComponentMeta> FindComponentMetas(string[] schemaUris, DateTime sinceLastPublished)
{
int pubId = new TcmUri(schemaUris.First()).PublicationId;
string[] componentMetas;
using (var client = new TridionBrokerServiceClient())
{
componentMetas = client.FindLatestComponentMetasBySchemas(schemaUris, sinceLastPublished);
}
return
componentMetas
.Select(metaXml => XElement.Parse(metaXml))
.ToDictionary(k => String.Format("tcm:{0}-{1}", pubId, k.Element("Id").Value), v => CreateComponentMeta(v));
}
开发者ID:albertromkes,项目名称:TridionMVCDotNet,代码行数:14,代码来源:WebServiceComponentFactory.cs
注:本文中的TcmUri类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论