| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.extension.distribution.internal.job.step; |
| 21 |
|
|
| 22 |
|
import javax.inject.Inject; |
| 23 |
|
import javax.inject.Named; |
| 24 |
|
|
| 25 |
|
import org.xwiki.component.annotation.Component; |
| 26 |
|
import org.xwiki.component.annotation.InstantiationStrategy; |
| 27 |
|
import org.xwiki.component.descriptor.ComponentInstantiationStrategy; |
| 28 |
|
import org.xwiki.extension.ExtensionId; |
| 29 |
|
import org.xwiki.extension.InstalledExtension; |
| 30 |
|
import org.xwiki.extension.repository.InstalledExtensionRepository; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@version |
| 36 |
|
@since |
| 37 |
|
|
| 38 |
|
@Component |
| 39 |
|
@Named(DefaultUIDistributionStep.ID) |
| 40 |
|
@InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP) |
| |
|
| 82.4% |
Uncovered Elements: 3 (17) |
Complexity: 6 |
Complexity Density: 0.67 |
|
| 41 |
|
public class DefaultUIDistributionStep extends AbstractDistributionStep |
| 42 |
|
{ |
| 43 |
|
public static final String ID = "extension.defaultui"; |
| 44 |
|
|
| 45 |
|
@Inject |
| 46 |
|
private transient InstalledExtensionRepository installedRepository; |
| 47 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 48 |
3 |
public DefaultUIDistributionStep()... |
| 49 |
|
{ |
| 50 |
3 |
super(ID); |
| 51 |
|
} |
| 52 |
|
|
| |
|
| 78.6% |
Uncovered Elements: 3 (14) |
Complexity: 5 |
Complexity Density: 0.62 |
|
| 53 |
4 |
@Override... |
| 54 |
|
public void prepare() |
| 55 |
|
{ |
| 56 |
4 |
if (getState() == null) { |
| 57 |
1 |
setState(State.COMPLETED); |
| 58 |
|
|
| 59 |
1 |
String namespace = getNamespace(); |
| 60 |
|
|
| 61 |
1 |
ExtensionId extensionUI = this.distributionJob.getStatus().getDistributionExtensionUI(); |
| 62 |
|
|
| 63 |
|
|
| 64 |
1 |
if (extensionUI != null) { |
| 65 |
1 |
InstalledExtension installedExtension = |
| 66 |
|
this.installedRepository.getInstalledExtension(extensionUI.getId(), namespace); |
| 67 |
1 |
if (installedExtension == null |
| 68 |
|
|| !installedExtension.getId().getVersion().equals(extensionUI.getVersion())) { |
| 69 |
0 |
setState(null); |
| 70 |
|
} |
| 71 |
|
} |
| 72 |
|
} |
| 73 |
|
} |
| 74 |
|
} |