Fisheye Report
Asked by kumar sam:

Hi

I am looking for sample Fisheye report created using plugin SDK. Please let me know.

Thanks

Kumar


Answers:
author: Marek Parfianowicz
body: Could you elaborate please? I don't know what kind of report would you like to see. And what plugin SDK do you use?

comments: author: AbrahamA
body: Hello Marek

I am just looking for a sample report to query data from fisheye.

Ex: Lines of code written by a particular user.

I know that there are existing reports for this, but I would like to know how to write my own reports so that I can build custom reports as required.

I have experience developing add-ons for Jira and Confluence. I would like to learn writing the same for Fisheye.

Here is the plugin sdk version.

ATLAS Version: 6.2.14  
ATLAS Home: C:\\atlassian-plugin-sdk-6.2.14  
ATLAS Scripts: C:\\atlassian-plugin-sdk-6.2.14\\bin  
ATLAS Maven Home: C:\\atlassian-plugin-sdk-6.2.14\\apache-maven-3.2.1  
AMPS Version: 6.2.11

Thanks


author: Marek Parfianowicz
body: Have you seen [https://developer.atlassian.com/fecrudev?](https://developer.atlassian.com/fecrudev??)


author: AbrahamA
body: Thanks

This is the closet I can find

<https://developer.atlassian.com/fecrudev/tutorials/fisheye-twitter-integration-plugin-tutorial>

I will try writing a sample report and take it from there..


author: AbrahamA
body: Hello

Can you please let me know what to use as fecru.version when I run the plugin using atlas-run

I am using Atlassian [FishEye analysis](http://www.atlassian.com/software/fisheye/)(Version:4.4.1 Build:20170515065843 2017-05-15)

Here is what I tried:

* Put fecru version as 4.4.1 but when I run atlas-run it failed to dowload the fisheye-api
* Kept fecru same as version plugin generated, sal-api failed

```
[INFO] >>> maven-amps-dispatcher-plugin:6.2.11:run (default-cli) @ fecruplug >>>
Downloading: https://maven.atlassian.com/repository/public/com/atlassian/fisheye/atlassian-fisheye-api/2.3.3-493/atlassian-fisheye-api-2.3.3-493.pom
Downloading: file://C:\atlassian-plugin-sdk-6.2.14/repository/com/atlassian/fisheye/atlassian-fisheye-api/2.3.3-493/atlassian-fisheye-api-2.3.3-493.pom
Downloading: http://repo.maven.apache.org/maven2/com/atlassian/fisheye/atlassian-fisheye-api/2.3.3-493/atlassian-fisheye-api-2.3.3-493.pom
Downloading: https://maven.atlassian.com/repository/public/com/atlassian/crucible/atlassian-crucible-scmutils/2.3.3-493/atlassian-crucible-scmutils-2.3.3-493.pom
Downloading: file://C:\atlassian-plugin-sdk-6.2.14/repository/com/atlassian/crucible/atlassian-crucible-scmutils/2.3.3-493/atlassian-crucible-scmutils-2.3.3-493.pom
Downloading: http://repo.maven.apache.org/maven2/com/atlassian/crucible/atlassian-crucible-scmutils/2.3.3-493/atlassian-crucible-scmutils-2.3.3-493.pom
Downloading: https://maven.atlassian.com/repository/public/com/atlassian/sal/sal-api/2.7.1/sal-api-2.7.1.pom
Downloading: http://repo.maven.apache.org/maven2/com/atlassian/sal/sal-api/2.7.1/sal-api-2.7.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:15 min
[INFO] Finished at: 2017-11-29T04:52:55-08:00
[INFO] Final Memory: 18M/309M
```

and also what sal-api version should I use

Here is my pom.xml

```
?<project xmlns="http://maven.apache.org/POM/4.0.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

 <modelVersion>4.0.0</modelVersion>
 <groupId>com.samsung.fecruplugin</groupId>
 <artifactId>fecruplug</artifactId>
 <version>1.0.0-SNAPSHOT</version>

 <organization>
 <name>Example Company</name>
 <url>http://www.example.com/</url>
 </organization>

 <name>fecruplug</name>
 <description>This is the com.samsung.fecruplugin:fecruplug plugin for Atlassian FishEye/Crucible.</description>
 <packaging>atlassian-plugin</packaging>

 <dependencies>
 <dependency>
 <groupId>junit</groupId>
 <artifactId>junit</artifactId>
 <version>4.10</version>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>javax.servlet</groupId>
 <artifactId>servlet-api</artifactId>
 <version>2.4</version>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>com.atlassian.fisheye</groupId>
 <artifactId>atlassian-fisheye-api</artifactId>
 <version>${fecru.version}</version>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>com.atlassian.crucible</groupId>
 <artifactId>atlassian-crucible-scmutils</artifactId>
 <version>${fecru.version}</version>
 <scope>provided</scope>
 </dependency>

 <dependency>
 <groupId>com.atlassian.sal</groupId>
 <artifactId>sal-api</artifactId>
 <version>2.7.1</version>
 <scope>provided</scope>
 </dependency>

 <dependency>
 <groupId>com.atlassian.plugin</groupId>
 <artifactId>atlassian-spring-scanner-annotation</artifactId>
 <version>${atlassian.spring.scanner.version}</version>
 <scope>compile</scope>
 </dependency>

 <dependency>
 <groupId>com.atlassian.plugin</groupId>
 <artifactId>atlassian-spring-scanner-runtime</artifactId>
 <version>${atlassian.spring.scanner.version}</version>
 <scope>runtime</scope>
 </dependency>

 <dependency>
 <groupId>javax.inject</groupId>
 <artifactId>javax.inject</artifactId>
 <version>1</version>
 <scope>provided</scope>
 </dependency>

 <dependency>
 <groupId>org.slf4j</groupId>
 <artifactId>slf4j-api</artifactId>
 <version>1.5.8</version>
 </dependency>

 <!-- WIRED TEST RUNNER DEPENDENCIES -->
 <dependency>
 <groupId>com.atlassian.plugins</groupId>
 <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
 <version>${plugin.testrunner.version}</version>
 <scope>test</scope>
 </dependency>
 <dependency>
 <groupId>javax.ws.rs</groupId>
 <artifactId>jsr311-api</artifactId>
 <version>1.1.1</version>
 <scope>provided</scope>
 </dependency>
 <dependency>
 <groupId>com.google.code.gson</groupId>
 <artifactId>gson</artifactId>
 <version>2.2.2-atlassian-1</version>
 </dependency>
 </dependencies>

 <build>
 <plugins>
 <plugin>
 <groupId>com.atlassian.maven.plugins</groupId>
 <artifactId>maven-fecru-plugin</artifactId>
 <version>${amps.version}</version>
 <extensions>true</extensions>
 <configuration>
 <productVersion>${fecru.version}</productVersion>
 <productDataVersion>${fecru.data.version}</productDataVersion>
 <enableFastdev>false</enableFastdev>
 <enableQuickReload>true</enableQuickReload>

 <!-- See here for an explanation of default instructions: -->
 <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
 <instructions>
 <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>

 <!-- Add package to export here -->
 <Export-Package>
 com.samsung.fecruplugin.api,
 </Export-Package>

 <!-- Add package import here -->
 <Import-Package>
 org.springframework.osgi.*;resolution:="optional",
 org.eclipse.gemini.blueprint.*;resolution:="optional",
 *
 </Import-Package>

 <!-- Ensure plugin is spring powered -->
 <Spring-Context>*</Spring-Context>
 </instructions>
 </configuration>
 </plugin>

 <plugin>
 <groupId>com.atlassian.plugin</groupId>
 <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
 <version>${atlassian.spring.scanner.version}</version>
 <executions>
 <execution>
 <goals>
 <goal>atlassian-spring-scanner</goal>
 </goals>
 <phase>process-classes</phase>
 </execution>
 </executions>
 <configuration>
 <scannedDependencies>
 <dependency>
 <groupId>com.atlassian.plugin</groupId>
 <artifactId>atlassian-spring-scanner-external-jar</artifactId>
 </dependency>
 </scannedDependencies>
 <verbose>false</verbose>
 </configuration>
 </plugin>
 
 <plugin>
 <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
 <source>1.8</source>
 <target>1.8</target>
 </configuration>
 </plugin>

 </plugins>
 </build>

 <properties>
 <fecru.version>2.3.3-493</fecru.version>
 <fecru.data.version>2.3.3-493</fecru.data.version>
 <amps.version>6.2.11</amps.version>
 <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
 <atlassian.spring.scanner.version>1.2.13</atlassian.spring.scanner.version>
 <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
 <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
 </properties>

</proje?
```


author: Marek Parfianowicz
body: Check the [https://maven.atlassian.com/repository/public/com/atlassian/fisheye/atlassian-fisheye-api/](https://maven.atlassian.com/repository/public/com/atlassian/fisheye/atlassian-fisheye-api/?)

In case of Fisheye 4.4.1 the artifact version is **4.4.1-20170515065843**


author: AbrahamA
body: Hello Marek

Now I have created plugin, looked at the sample using atlas-run.

Now when I run "atlas-create-fecru-plugin-module" I get following options:

Choose Plugin Module:  
1: Component Import  
2: Component  
3: Downloadable Plugin Resource  
4: Gadget Plugin Module  
5: Licensing API Support  
6: Module Type  
7: REST Plugin Module  
8: Servlet  
9: Template Context Item  
10: Web Item  
11: Web Resource  
12: Web Resource Transformer  
Choose a number (1/2/3/4/5/6/7/8/9/10/11/12):

I am not sure which option to take and figure out how to pass data to template.

All I would like to do is display in a report how many lines were committed by a particular user.

I appreciate your help, i have to ask again because I could not find a tutorial anywhere which will help me do it (unlike that jira where there are many samples)

If you can please point me to a sample it will help me a lot.

Thanks


author: Marek Parfianowicz
body: I don't know how do you want to integrate your plugin, but probably you want to use the '8: Servlet' and/or '10: Web item'.  
We don't have code examples for your particular case, sorry.

The only hints I can give you are as follows:

1. Create a web-item to add an additional tab on the repository page and link it to a servlet, e.g.:

\<web-item key="loc-report-tab" section="repository.report.tab"\>  
\<link\>/plugins/servlet/loc/$helper.urlEncode(${helper.repository.path})\</link\>  
...  
\</web-item\>

2. Create a servlet responsible for generating the HTML page, e.g.:

\<servlet key="loc-servlet" name="LOC Servlet" class="com.acme.LocServlet"\>  
\<url-pattern\>/loc/\*\</url-pattern\>  
... add \<resource\> here ...  
\</servlet\>

<br />

3. In the servlet try to use some of the following services to get data required by you:

<br />

com.atlassian.fisheye.spi.services.ChangesetMetricsService  
com.atlassian.fisheye.spi.services.LocMetricsService  
com.atlassian.fisheye.spi.services.RepositoryService  
com.atlassian.fisheye.spi.services.RevisionDataService  
com.atlassian.fisheye.spi.services.ServerInfoService