* @return the copy
*/
public IntegrationEntity createAndInsertCopy(IntegrationEntity original) {
IntegrationProjectLock.acquire();
try {
IntegrationEntity parent = original.getParent();
if (parent == null) {
throw new IllegalStateException("The entity to be copied has no parent.");
}
IntegrationProject project = getProject(parent);
if (project == null) {
throw new IllegalStateException("The entity does not belong to a project.");
}
IntegrationEntity copy = original.cloneWithNewID();
copy.setParent(parent);
setNewName(copy);
copyPermissions(original, copy, project);
copyPluginSettings(original, copy, project);
doSpecialHandling(original, copy, project);
project.insertEntity(copy, parent);