/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.manifoldcf.crawler.connectors.confluence.util;

/**
 * <p>Utility class for Confluence connectors</p>
 * 
 * @author Antonio David Perez Morales <adperezmorales@gmail.com>
 *
 */
public class ConfluenceUtil {

	private static final String ATTACHMENT_ID_PREFIX = "att";
	
	/**
	 * <p>Generates a repository document identifier for the specific attachment and page to be used for Repository Documents for attachment pages</p>
	 * @param attachmentId
	 * @param pageId
	 * @return a generated 
	 */
	public static String generateRepositoryDocumentIdentifier(String attachmentId, String pageId) {
		StringBuilder sb = new StringBuilder();
		sb.append(attachmentId).append("-").append(pageId);
		return sb.toString();
	}
	
	/**
	 * <p>Checks if the given id is an attachment or not</p>
	 * @param id
	 * @return a {@code Boolean} indicating if the id is related to an attachment or not 
	 */
	public static Boolean isAttachment(String id) {
		return id.startsWith(ATTACHMENT_ID_PREFIX);
	}
	
	/**
	 * <p>Gets the attachment id and page id from a repository document id</p>
	 * @param id the repository document id
	 * @return an Array containing the attachment and page ids where index 0 is the attachment id and index 1 is the page id
	 */
	public static String[] getAttachmentAndPageId(String id) {
		return id.split("-");
	}
}

@@ -1005,17 +1005,18 @@
 Util %7B%0A%0A
-%09
+  
 private 
@@ -1065,24 +1065,27 @@
  %22att%22;%0A
-%09%0A%09
+  %0A  
 /**%0A
-%09
+  
  * %3Cp%3EGe
@@ -1219,25 +1219,26 @@
 t pages%3C/p%3E%0A
-%09
+  
  * @param at
@@ -1248,17 +1248,18 @@
 hmentId%0A
-%09
+  
  * @para
@@ -1267,17 +1267,18 @@
  pageId%0A
-%09
+  
  * @retu
@@ -1293,22 +1293,24 @@
 erated %0A
-%09
+  
  */%0A
-%09
+  
 public s
@@ -1397,18 +1397,20 @@
 geId) %7B%0A
-%09%09
+    
 StringBu
@@ -1441,18 +1441,20 @@
 lder();%0A
-%09%09
+    
 sb.appen
@@ -1497,18 +1497,20 @@
 ageId);%0A
-%09%09
+    
 return s
@@ -1523,27 +1523,31 @@
 ring();%0A
-%09%7D%0A%09%0A%09
+  %7D%0A  %0A  
 /**%0A
-%09
+  
  * %3Cp%3ECh
@@ -1591,25 +1591,26 @@
  or not%3C/p%3E%0A
-%09
+  
  * @param id
@@ -1606,25 +1606,26 @@
 * @param id%0A
-%09
+  
  * @return a
@@ -1698,22 +1698,24 @@
 or not %0A
-%09
+  
  */%0A
-%09
+  
 public s
@@ -1746,34 +1746,36 @@
 nt(String id) %7B%0A
-%09%09
+    
 return id.starts
@@ -1806,19 +1806,23 @@
 X);%0A
-%09%7D%0A%09%0A%09
+  %7D%0A  %0A  
 /**%0A
-%09
+  
  * %3C
@@ -1892,17 +1892,18 @@
  id%3C/p%3E%0A
-%09
+  
  * @para
@@ -1934,17 +1934,18 @@
 ment id%0A
-%09
+  
  * @retu
@@ -2061,14 +2061,16 @@
  id%0A
-%09
+  
  */%0A
-%09
+  
 publ
@@ -2128,10 +2128,12 @@
 ) %7B%0A
-%09%09
+    
 retu
@@ -2154,9 +2154,10 @@
 %22);%0A
-%09
+  
 %7D%0A%7D%0A

Reformat as per MCF standards