File AnnotationServiceImpl.java
has 463 lines of code (exceeds 250 allowed). Consider refactoring. Open
package com.groupdocs.ui.annotation.service;
import com.groupdocs.annotation.license.License;
import com.groupdocs.annotation.models.annotationmodels.AnnotationBase;
import com.groupdocs.annotation.Annotator;
Method annotate
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public AnnotatedDocumentEntity annotate(AnnotationPostedDataEntity annotateDocumentRequest) {
AnnotatedDocumentEntity annotatedDocument = new AnnotatedDocumentEntity();
try {
// get/set parameters
Method annotate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
@Override
public AnnotatedDocumentEntity annotate(AnnotationPostedDataEntity annotateDocumentRequest) {
AnnotatedDocumentEntity annotatedDocument = new AnnotatedDocumentEntity();
try {
// get/set parameters
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method loadDocument
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public final AnnotatedDocumentEntity loadDocument(LoadDocumentRequest loadDocumentRequest, boolean loadAllPages) {
Annotator annotator = null;
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
String guid = loadDocumentRequest.getGuid();
String password = loadDocumentRequest.getPassword();
Method getDocumentPage
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public PageDataDescriptionEntity getDocumentPage(LoadDocumentPageRequest loadDocumentPageRequest) {
String password = "";
try {
// get/set parameters
Method loadDocument
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public final AnnotatedDocumentEntity loadDocument(LoadDocumentRequest loadDocumentRequest, boolean loadAllPages) {
Annotator annotator = null;
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
String guid = loadDocumentRequest.getGuid();
String password = loadDocumentRequest.getPassword();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method renderPageToMemoryStream
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static OutputStream renderPageToMemoryStream(int pageNumberToRender, String documentGuid, String password) {
try {
OutputStream result = new ByteArrayOutputStream(); // MemoryStream => OutputStream
InputStream inputStream = new FileInputStream(documentGuid); //final FileStream outputStream = File.openRead(documentGuid);
try {
Method removeAnnotations
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static void removeAnnotations(String documentGuid, String password) {
String tempPath = getTempPath(documentGuid);
try {
final InputStream inputStream = new FileInputStream(documentGuid);
Method getAnnotatedPagesForPrint
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private List<PageDataDescriptionEntity> getAnnotatedPagesForPrint(String password, String documentGuid) {
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
try {
InputStream outputStream = new FileInputStream(documentGuid);
try {
Method getAnnotatedPagesForPrint
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private List<PageDataDescriptionEntity> getAnnotatedPagesForPrint(String password, String documentGuid) {
AnnotatedDocumentEntity description = new AnnotatedDocumentEntity();
try {
InputStream outputStream = new FileInputStream(documentGuid);
try {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"