Skip to content

Commit 25ccdb4

Browse files
committed
Fixed PMD issues
1 parent 312ba7d commit 25ccdb4

File tree

9 files changed

+64
-59
lines changed

9 files changed

+64
-59
lines changed

src/com/magento/idea/magento2plugin/actions/generation/data/QueueCommunicationData.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
package com.magento.idea.magento2plugin.actions.generation.data;
77

88
public class QueueCommunicationData {
9-
private String topicName;
10-
private String handlerName;
11-
private String handlerType;
12-
private String handlerMethod;
13-
private String moduleName;
9+
private final String topicName;
10+
private final String handlerName;
11+
private final String handlerType;
12+
private final String handlerMethod;
13+
private final String moduleName;
1414

1515
/**
1616
* Constructor.
1717
*/
1818
public QueueCommunicationData(
19-
String topicName,
20-
String handlerName,
21-
String handlerType,
22-
String handlerMethod,
23-
String moduleName
19+
final String topicName,
20+
final String handlerName,
21+
final String handlerType,
22+
final String handlerMethod,
23+
final String moduleName
2424
) {
2525
this.topicName = topicName;
2626
this.handlerName = handlerName;

src/com/magento/idea/magento2plugin/actions/generation/data/QueueConsumerData.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
package com.magento.idea.magento2plugin.actions.generation.data;
77

88
public class QueueConsumerData {
9-
private String consumerName;
10-
private String queueName;
11-
private String consumerType;
12-
private String maxMessages;
13-
private String connectionName;
14-
private String moduleName;
9+
private final String consumerName;
10+
private final String queueName;
11+
private final String consumerType;
12+
private final String maxMessages;
13+
private final String connectionName;
14+
private final String moduleName;
1515

1616
/**
1717
* Constructor.
1818
*/
1919
public QueueConsumerData(
20-
String consumerName,
21-
String queueName,
22-
String consumerType,
23-
String maxMessages,
24-
String connectionName,
25-
String moduleName
20+
final String consumerName,
21+
final String queueName,
22+
final String consumerType,
23+
final String maxMessages,
24+
final String connectionName,
25+
final String moduleName
2626
) {
2727
this.consumerName = consumerName;
2828
this.queueName = queueName;

src/com/magento/idea/magento2plugin/actions/generation/data/QueuePublisherData.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66
package com.magento.idea.magento2plugin.actions.generation.data;
77

88
public class QueuePublisherData {
9-
private String topicName;
10-
private String connectionName;
11-
private String exchangeName;
12-
private String moduleName;
9+
private final String topicName;
10+
private final String connectionName;
11+
private final String exchangeName;
12+
private final String moduleName;
1313

1414
/**
1515
* Constructor.
1616
*/
1717
public QueuePublisherData(
18-
String topicName,
19-
String connectionName,
20-
String exchangeName,
21-
String moduleName
18+
final String topicName,
19+
final String connectionName,
20+
final String exchangeName,
21+
final String moduleName
2222
) {
2323
this.topicName = topicName;
2424
this.connectionName = connectionName;

src/com/magento/idea/magento2plugin/actions/generation/data/QueueTopologyData.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
package com.magento.idea.magento2plugin.actions.generation.data;
77

88
public class QueueTopologyData {
9-
private String exchangeName;
10-
private String connectionName;
11-
private String bindingId;
12-
private String bindingTopic;
13-
private String bindingQueue;
14-
private String moduleName;
9+
private final String exchangeName;
10+
private final String connectionName;
11+
private final String bindingId;
12+
private final String bindingTopic;
13+
private final String bindingQueue;
14+
private final String moduleName;
1515

1616
/**
1717
* Constructor.
1818
*/
1919
public QueueTopologyData(
20-
String exchangeName,
21-
String connectionName,
22-
String bindingId,
23-
String bindingTopic,
24-
String bindingQueue,
25-
String moduleName
20+
final String exchangeName,
21+
final String connectionName,
22+
final String bindingId,
23+
final String bindingTopic,
24+
final String bindingQueue,
25+
final String moduleName
2626
) {
2727
this.exchangeName = exchangeName;
2828
this.connectionName = connectionName;

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewMessageQueueDialog.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
import javax.swing.JTextField;
3838
import javax.swing.KeyStroke;
3939

40+
@SuppressWarnings({
41+
"PMD.TooManyFields",
42+
"PMD.ExcessiveImports",
43+
})
4044
public class NewMessageQueueDialog extends AbstractDialog {
4145
private static final String TOPIC_NAME = "Topic Name";
4246
private static final String HANDLER_NAME = "Handler Name";
@@ -131,7 +135,7 @@ public class NewMessageQueueDialog extends AbstractDialog {
131135
/**
132136
* Constructor.
133137
*/
134-
public NewMessageQueueDialog(Project project, PsiDirectory directory) {
138+
public NewMessageQueueDialog(final Project project, final PsiDirectory directory) {
135139
super();
136140

137141
this.project = project;

src/com/magento/idea/magento2plugin/actions/generation/generator/QueueCommunicationGenerator.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.jetbrains.annotations.Nullable;
2121

2222
public class QueueCommunicationGenerator extends FileGenerator {
23+
public static final String ATTRIBUTE_NAME = "name";
2324
private final QueueCommunicationData communicationData;
2425
private final Project project;
2526
private final FindOrCreateCommunicationXml findOrCreateCommunicationXml;
@@ -39,7 +40,7 @@ public QueueCommunicationGenerator(
3940
}
4041

4142
@Override
42-
public PsiFile generate(String actionName) {
43+
public PsiFile generate(final String actionName) {
4344
final XmlFile communicationXml = (XmlFile) findOrCreateCommunicationXml.execute(
4445
actionName,
4546
communicationData.getModuleName()
@@ -52,27 +53,27 @@ public PsiFile generate(String actionName) {
5253
if (rootTag == null) {
5354
return;
5455
}
55-
XmlTag[] topicTags = rootTag.findSubTags("topic");
56+
final XmlTag[] topicTags = rootTag.findSubTags("topic");
5657
boolean topicTagIsGenerated = true;
5758
XmlTag topicTag = null;
5859
for (final XmlTag tag: topicTags) {
59-
if (communicationData.getTopicName().equals(tag.getAttribute("name").getValue())) {
60+
if (communicationData.getTopicName().equals(tag.getAttribute(ATTRIBUTE_NAME).getValue())) {
6061
topicTagIsGenerated = false;
6162
topicTag = tag;
6263
break;
6364
}
6465
}
6566
if (topicTagIsGenerated) {
6667
topicTag = rootTag.createChildTag("topic", null, "", false);
67-
topicTag.setAttribute("name", communicationData.getTopicName());
68+
topicTag.setAttribute(ATTRIBUTE_NAME, communicationData.getTopicName());
6869
topicTag.setAttribute("request", "string");
6970
topicTag.setAttribute("response", "string");
7071
}
7172

7273
@NotNull final XmlTag[] handlerTags = topicTag.findSubTags("handler");
7374
boolean isDeclared = false;
7475
for (final XmlTag handlerTag: handlerTags) {
75-
@Nullable final XmlAttribute handlerName = handlerTag.getAttribute("name");
76+
@Nullable final XmlAttribute handlerName = handlerTag.getAttribute(ATTRIBUTE_NAME);
7677
if (communicationData.getHandlerName().equals(handlerName.getValue())) {
7778
isDeclared = true;
7879
}
@@ -81,7 +82,7 @@ public PsiFile generate(String actionName) {
8182
if (!isDeclared) {
8283
final XmlTag handlerTag = topicTag.createChildTag("handler", null, null, false);
8384

84-
handlerTag.setAttribute("name", communicationData.getHandlerName());
85+
handlerTag.setAttribute(ATTRIBUTE_NAME, communicationData.getHandlerName());
8586
handlerTag.setAttribute("type",communicationData.getHandlerType());
8687
handlerTag.setAttribute("method",communicationData.getHandlerMethod());
8788

src/com/magento/idea/magento2plugin/actions/generation/generator/QueueConsumerGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public PsiFile generate(String actionName) {
4646
if (rootTag == null) {
4747
return;
4848
}
49-
XmlTag[] consumerTags = rootTag.findSubTags("consumer");
49+
final XmlTag[] consumerTags = rootTag.findSubTags("consumer");
5050
boolean tagIsGenerated = true;
5151
for (final XmlTag tag: consumerTags) {
5252
if (consumerData.getConsumerName().equals(tag.getAttribute("name").getValue())) {
@@ -55,7 +55,7 @@ public PsiFile generate(String actionName) {
5555
}
5656
}
5757
if (tagIsGenerated) {
58-
XmlTag consumerTag = rootTag.createChildTag("consumer", null, null, false);
58+
final XmlTag consumerTag = rootTag.createChildTag("consumer", null, null, false);
5959
consumerTag.setAttribute("name", consumerData.getConsumerName());
6060
consumerTag.setAttribute("queue", consumerData.getQueueName());
6161
consumerTag.setAttribute("consumerInstance", consumerData.getConsumerType());
@@ -72,5 +72,5 @@ public PsiFile generate(String actionName) {
7272
}
7373

7474
@Override
75-
protected void fillAttributes(Properties attributes) {}
75+
protected void fillAttributes(Properties attributes) {}//NOPMD
7676
}

src/com/magento/idea/magento2plugin/actions/generation/generator/QueuePublisherGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public QueuePublisherGenerator(
3939
}
4040

4141
@Override
42-
public PsiFile generate(String actionName) {
42+
public PsiFile generate(final String actionName) {
4343
final XmlFile publisherXml = (XmlFile) findOrCreateQueuePublisherXml.execute(
4444
actionName,
4545
publisherData.getModuleName()
@@ -52,7 +52,7 @@ public PsiFile generate(String actionName) {
5252
if (rootTag == null) {
5353
return;
5454
}
55-
XmlTag[] publisherTags = rootTag.findSubTags("publisher");
55+
final XmlTag[] publisherTags = rootTag.findSubTags("publisher");
5656
boolean publisherTagIsGenerated = true;
5757
XmlTag publisherTag = null;
5858
for (final XmlTag tag: publisherTags) {
@@ -99,5 +99,5 @@ public PsiFile generate(String actionName) {
9999
}
100100

101101
@Override
102-
protected void fillAttributes(Properties attributes) {}
102+
protected void fillAttributes(final Properties attributes) {}//NOPMD
103103
}

src/com/magento/idea/magento2plugin/actions/generation/generator/QueueTopologyGenerator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class QueueTopologyGenerator extends FileGenerator {
2727
/**
2828
* Constructor.
2929
*/
30-
public QueueTopologyGenerator(Project project, QueueTopologyData topologyData) {
30+
public QueueTopologyGenerator(final Project project, final QueueTopologyData topologyData) {
3131
super(project);
3232

3333
this.topologyData = topologyData;
@@ -36,7 +36,7 @@ public QueueTopologyGenerator(Project project, QueueTopologyData topologyData) {
3636
}
3737

3838
@Override
39-
public PsiFile generate(String actionName) {
39+
public PsiFile generate(final String actionName) {
4040
final XmlFile topologyXml = (XmlFile) findOrCreateQueueTopologyXml.execute(
4141
actionName,
4242
topologyData.getModuleName()
@@ -49,7 +49,7 @@ public PsiFile generate(String actionName) {
4949
if (rootTag == null) {
5050
return;
5151
}
52-
XmlTag[] exchangeTags = rootTag.findSubTags("exchange");
52+
final XmlTag[] exchangeTags = rootTag.findSubTags("exchange");
5353
boolean exchangeTagIsGenerated = true;
5454
XmlTag exchangeTag = null;
5555
for (final XmlTag tag: exchangeTags) {
@@ -98,5 +98,5 @@ public PsiFile generate(String actionName) {
9898
}
9999

100100
@Override
101-
protected void fillAttributes(Properties attributes) {}
101+
protected void fillAttributes(Properties attributes) {}//NOPMD
102102
}

0 commit comments

Comments
 (0)