/// <summary> /// Maps the current <see cref="TcmUri" /> instance to the given publication <see cref="TcmUri" />. /// </summary> /// <param name="publicationUri">The publication URI.</param> /// <returns></returns> public void MapUri(TcmUri publicationUri) { if (this.IsNull || (publicationUri == null || publicationUri.IsNull)) return; else this.PublicationId = publicationUri.ItemId; }
/// <summary> /// Initializes a new instance of the <see cref="Group"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Group(Client client, TcmUri uri) : this(client, client.Read<GroupData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="Activity"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Activity(Client client, TcmUri uri) : this(client, client.Read<ActivityData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="Process"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Process(Client client, TcmUri uri) : this(client, client.Read<ProcessData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="PublishingTarget"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal PublishingTarget(Client client, TcmUri uri) : this(client, client.Read<PublishingTargetData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="IdentifiableObject"/> class. /// </summary> /// <param name="session"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal IdentifiableObject(Client client, TcmUri uri) : this(client, client.Read<IdentifiableObjectData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="TargetType"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal TargetType(Client client, TcmUri uri) : this(client, client.Read<TargetTypeData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="VersionedItem" /> class. /// </summary> /// <param name="session"><see cref="T:TcmCoreService.Session" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal VersionedItem(Session session, TcmUri uri) : this(session, session.Read<VersionedItemData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="Template"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Template(Client client, TcmUri uri) : this(client, client.Read<TemplateData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="Schema"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Schema(Client client, TcmUri uri) : this(client, client.Read<SchemaData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="User"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal User(Client client, TcmUri uri) : this(client, client.Read<UserData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="ApprovalStatus"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal ApprovalStatus(Client client, TcmUri uri) : this(client, client.Read<ApprovalStatusData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="BluePrintNode"/> class. /// </summary> /// <param name="session"><see cref="T:TcmCoreService.Session" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal BluePrintNode(Session session, TcmUri uri) : this(session, session.Read<BluePrintNodeData>(uri)) { }
/// <summary> /// Maps the current <see cref="TcmUri" /> instance to the given publication URI. /// </summary> /// <param name="publicationUri">The publication URI.</param> /// <returns></returns> public void MapUri(String publicationUri) { if (this.IsNull) return; if (String.IsNullOrEmpty(publicationUri)) return; else { TcmUri pub = new TcmUri(publicationUri); MapUri(pub); } }
/// <summary> /// Initializes a new instance of the <see cref="Repository"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Repository(Client client, TcmUri uri) : this(client, client.Read<RepositoryData>(uri)) { }
/// <summary> /// Upload a file to Tridion from a Tridion multimedia component or binary TBB /// </summary> /// <param name="item"><see cref="T:EGIT.CCIT.Tridion.CoreService.TcmUri"/> of the binary Tridion item.</param> /// <returns><see cref="T:System.IO.Stream" /> containing the binary data from Tridion</returns> public Stream DownloadFile(TcmUri item) { StreamDownloadClient client = null; try { client = DownloadClient; return client.DownloadBinaryContent(item); } finally { if (client != null) if (client.State == CommunicationState.Faulted) client.Abort(); else client.Close(); } }
/// <summary> /// Initializes a new instance of the <see cref="Component"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Component(Client client, TcmUri uri) : this(client, client.Read<ComponentData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="VirtualFolder"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal VirtualFolder(Client client, TcmUri uri) : this(client, client.Read<VirtualFolderData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="SystemWideObject"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal SystemWideObject(Client client, TcmUri uri) : this(client, client.Read<SystemWideObjectData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="ActivityDefinition"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal ActivityDefinition(Client client, TcmUri uri) : this(client, client.Read<ActivityDefinitionData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="Publication"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Publication(Client client, TcmUri uri) : this(client, client.Read<PublicationData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="ProcessDefinitionAssociation"/> class. /// </summary> /// <param name="session"><see cref="T:TcmCoreService.Session" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal ProcessDefinitionAssociation(Session session, TcmUri uri) : this(session, session.Read<ProcessDefinitionAssociationData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="WorkItem"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal WorkItem(Client client, TcmUri uri) : this(client, client.Read<WorkItemData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="OrganizationalItem" /> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal OrganizationalItem(Client client, TcmUri uri) : this(client, client.Read<OrganizationalItemData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="Trustee"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal Trustee(Client client, TcmUri uri) : this(client, client.Read<TrusteeData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="RepositoryLocalObject"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal RepositoryLocalObject(Client client, TcmUri uri) : this(client, client.Read<RepositoryLocalObjectData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="ComponentTemplate"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal ComponentTemplate(Client client, TcmUri uri) : this(client, client.Read<ComponentTemplateData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="ProcessDefinition"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal ProcessDefinition(Client client, TcmUri uri) : this(client, client.Read<ProcessDefinitionData>(uri)) { }
/// <summary> /// Initializes a new instance of the <see cref="MultimediaType"/> class. /// </summary> /// <param name="client"><see cref="T:TcmCoreService.Client" /></param> /// <param name="uri"><see cref="T:TcmCoreService.Misc.TcmUri" /></param> internal MultimediaType(Client client, TcmUri uri) : this(client, client.Read<MultimediaTypeData>(uri)) { }
/// <summary> /// Maps the given item uri to the passed publication uri /// </summary> /// <param name="uri">The URI.</param> /// <param name="publicationUri">The publication URI.</param> /// <returns></returns> public static String MapUri(String uri, String publicationUri) { if (String.IsNullOrEmpty(publicationUri)) return uri; else { TcmUri res = new TcmUri(uri); if (res.IsNull) return uri; res.MapUri(publicationUri); return res.ToString(); } }