Skip to content

Commit

Permalink
Code cleanup, some new "name" query parameters, OAuth in /metadata
Browse files Browse the repository at this point in the history
* Removed some duplicate code from query parameter classes.
* Implemented a few new "name" query parameters.
* Added security OAuth entry to CapabilityStatement (/metadata) if OAuth
is enabled.
* Simplified some lambda expressions and switched to methods handles
where possible.
* Removed not needed casts.
* Removed explicit generic types, where types can be inferred.
* Combined some if/else-if statements.
* Added missing @OverRide annotations.
* Added final to class fields where applicable.
* Introduced switch-expressions where possible, remove default case in
switch-expressions if all cases covered.
* Regenerated equals and hashCode implementation based on Objects...
methods.
* Other minor code cleanup.
  • Loading branch information
hhund committed Dec 18, 2023
1 parent 7d8e34a commit 8e9106c
Show file tree
Hide file tree
Showing 227 changed files with 2,052 additions and 3,223 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,8 @@ private Log4jAppender(Session session, MimeMessage message, String subject, int
super("SmtpMailService.Log4jAppender", ThresholdFilter.createFilter(null, null, null),
new Layout(debugLogLocation), false, null);

MailManagerFactory factory = (name, data) ->
MailManagerFactory factory = (name, data) -> new SmtpManager(name, session, message, data)
{
return new SmtpManager(name, session, message, data)
{
};
};
FactoryData data = new FactoryData(null, null, null, null, null, null, event -> subject, null, null, 0,
null, null, false, messageBufferSize, null, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,23 +803,19 @@ private boolean beanAvailable(ModelElementInstance parent, Process process, Appl

// user tasks: task listeners
boolean userTasksTaskListenersOk = parent.getChildElementsByType(UserTask.class).stream()
.filter(Objects::nonNull).allMatch(t ->
{
return t.getChildElementsByType(ExtensionElements.class).stream().filter(Objects::nonNull)
.flatMap(e -> e.getChildElementsByType(CamundaTaskListener.class).stream())
.filter(Objects::nonNull).allMatch(l -> beanAvailable(process, t.getId(),
l.getCamundaClass(), TaskListener.class, applicationContext));
});
.filter(Objects::nonNull)
.allMatch(t -> t.getChildElementsByType(ExtensionElements.class).stream().filter(Objects::nonNull)
.flatMap(e -> e.getChildElementsByType(CamundaTaskListener.class).stream())
.filter(Objects::nonNull).allMatch(l -> beanAvailable(process, t.getId(), l.getCamundaClass(),
TaskListener.class, applicationContext)));

// all elements: execution listeners
boolean allElementsExecutionListenersOk = parent.getChildElementsByType(FlowNode.class).stream()
.filter(Objects::nonNull).allMatch(n ->
{
return n.getChildElementsByType(ExtensionElements.class).stream().filter(Objects::nonNull)
.flatMap(e -> e.getChildElementsByType(CamundaExecutionListener.class).stream())
.filter(Objects::nonNull).allMatch(l -> beanAvailable(process, n.getId(),
l.getCamundaClass(), ExecutionListener.class, applicationContext));
});
.filter(Objects::nonNull)
.allMatch(n -> n.getChildElementsByType(ExtensionElements.class).stream().filter(Objects::nonNull)
.flatMap(e -> e.getChildElementsByType(CamundaExecutionListener.class).stream())
.filter(Objects::nonNull).allMatch(l -> beanAvailable(process, n.getId(), l.getCamundaClass(),
ExecutionListener.class, applicationContext)));

// intermediate message throw events
boolean intermediateMessageThrowEventsOk = parent.getChildElementsByType(IntermediateThrowEvent.class).stream()
Expand All @@ -835,16 +831,12 @@ && taskFieldsAvailable(process, "IntermediateThrowEvent", def.getId(),

// message end events
boolean endEventsOk = parent.getChildElementsByType(EndEvent.class).stream().filter(Objects::nonNull)
.allMatch(e ->
{
return e.getEventDefinitions().stream().filter(Objects::nonNull)
.filter(def -> def instanceof MessageEventDefinition)
.map(def -> (MessageEventDefinition) def)
.allMatch(def -> beanAvailable(process, def.getId(), def.getCamundaClass(),
JavaDelegate.class, applicationContext)
&& taskFieldsAvailable(process, "MessageEndEvent", e.getId(),
def.getExtensionElements()));
});
.allMatch(e -> e.getEventDefinitions().stream().filter(Objects::nonNull)
.filter(def -> def instanceof MessageEventDefinition).map(def -> (MessageEventDefinition) def)
.allMatch(def -> beanAvailable(process, def.getId(), def.getCamundaClass(), JavaDelegate.class,
applicationContext)
&& taskFieldsAvailable(process, "MessageEndEvent", e.getId(),
def.getExtensionElements())));

// sub processes
boolean subProcessesOk = parent.getChildElementsByType(SubProcess.class).stream().filter(Objects::nonNull)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,38 +67,18 @@ public String getVersion()
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((version == null) ? 0 : version.hashCode());
return result;
return Objects.hash(id, version);
}

@Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
if (obj == null || getClass() != obj.getClass())
return false;
ProcessIdAndVersion other = (ProcessIdAndVersion) obj;
if (id == null)
{
if (other.id != null)
return false;
}
else if (!id.equals(other.id))
return false;
if (version == null)
{
if (other.version != null)
return false;
}
else if (!version.equals(other.version))
return false;
return true;
return Objects.equals(id, other.id) && Objects.equals(version, other.version);
}

@Override
Expand Down
Loading

0 comments on commit 8e9106c

Please sign in to comment.