getId() public method

The resources Id. Must be both unique within all the resources of this book and a valid identifier.
public getId ( ) : string
return string
		/// <summary>
		/// The id of the reference referred to.  null of the reference is null or has a
		/// null id itself.
		/// </summary>
		public string getResourceId(){

            if (resource != null)
            {
                return resource.getId();
            }
            return null;
		}
示例#2
0
 /// <summary>
 /// Adds the resource to the table of contents of the book as a child section of
 /// the given parentSection
 /// </summary>
 /// <param name="parentSection"></param>
 /// <param name="sectionTitle"></param>
 /// <param name="resource"></param>
 public TOCReference addSection(TOCReference parentSection, string sectionTitle, Resource resource)
 {
     getResources().add(resource);
     if (spine.findFirstResourceById(resource.getId()) < 0)
     {
         spine.addSpineReference(new SpineReference(resource));
     }
     return parentSection.addChildSection(new TOCReference(sectionTitle, resource));
 }
示例#3
0
 /// <summary>
 /// Adds the resource to the table of contents of the book as a child section of
 /// the given parentSection
 /// </summary>
 /// <param name="parentSection"></param>
 /// <param name="sectionTitle"></param>
 /// <param name="resource"></param>
 public TOCReference addSection(TOCReference parentSection, string sectionTitle, Resource resource)
 {
     getResources().add(resource);
     if (spine.findFirstResourceById(resource.getId()) < 0)
     {
         spine.addSpineReference(new SpineReference(resource));
     }
     return parentSection.addChildSection(new TOCReference(sectionTitle, resource));
 }
示例#4
0
        /// <summary>
        /// Checks the id of the given resource and changes to a unique identifier if it
        /// isn't one already.
        /// </summary>
        /// <param name="resource">resource</param>
        public void fixResourceId(Resource resource)
        {

            string resourceId = resource.getId();
            if (StringUtil.isBlank(resource.getId()))
            {
                resourceId = StringUtil.substringBeforeLast(resource.getHref(), '.');
                resourceId = StringUtil.substringAfterLast(resourceId, '/');
            }

            resourceId = makeValidId(resourceId, resource);

            // check if the id is unique. if not: create one from scratch
            if (StringUtil.isBlank(resourceId) || containsId(resourceId))
            {
                resourceId = createUniqueResourceId(resource);
            }
            resource.setId(resourceId);
        }
示例#5
0
 /// <summary>
 /// Adds a resource to the book's set of resources, table of contents and if there
 /// is no resource with the id in the spine also adds it to the spine.
 /// </summary>
 /// <param name="title"></param>
 /// <param name="resource"></param>
 public TOCReference addSection(string title, Resource resource)
 {
     getResources().add(resource);
     TOCReference tocReference = tableOfContents.addTOCReference(new TOCReference(title, resource));
     if (spine.findFirstResourceById(resource.getId()) < 0)
     {
         spine.addSpineReference(new SpineReference(resource));
     }
     return tocReference;
 }
示例#6
0
 /// <summary>
 /// Adds a resource to the book's set of resources, table of contents and if there
 /// is no resource with the id in the spine also adds it to the spine.
 /// </summary>
 /// <param name="title"></param>
 /// <param name="resource"></param>
 public TOCReference addSection(string title, Resource resource)
 {
     getResources().add(resource);
     TOCReference tocReference = tableOfContents.addTOCReference(new TOCReference(title, resource));
     if (spine.findFirstResourceById(resource.getId()) < 0)
     {
         spine.addSpineReference(new SpineReference(resource));
     }
     return tocReference;
 }
示例#7
0
        /// <summary>
        /// Checks the id of the given resource and changes to a unique identifier if it
        /// isn't one already.
        /// </summary>
        /// <param name="resource">resource</param>
        public void fixResourceId(Resource resource)
        {
            string resourceId = resource.getId();
            if (StringUtil.isBlank(resource.getId()))
            {
                resourceId = StringUtil.substringBeforeLast(resource.getHref(), '.');
                resourceId = StringUtil.substringAfterLast(resourceId, '/');
            }

            resourceId = makeValidId(resourceId, resource);

            // check if the id is unique. if not: create one from scratch
            if (StringUtil.isBlank(resourceId) || containsId(resourceId))
            {
                resourceId = createUniqueResourceId(resource);
            }
            resource.setId(resourceId);
        }