WorkItemAdapterFactory.java
2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.granite.workflow.exec.WorkItem
* com.day.cq.workflow.exec.WorkItem
* org.apache.felix.scr.annotations.Component
* org.apache.felix.scr.annotations.Properties
* org.apache.felix.scr.annotations.Property
* org.apache.felix.scr.annotations.Service
* org.apache.sling.api.adapter.AdapterFactory
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.day.cq.workflow.compatibility;
import com.adobe.granite.workflow.exec.WorkItem;
import com.day.cq.workflow.impl.exec.CQWorkItemWrapper;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.adapter.AdapterFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component(metatype=1, label="WorkItem Adapter Factory", description="Adapts different types of workitems")
@Properties(value={@Property(name="service.description", value={"Adapts different types of workitemsn"}), @Property(name="adapter.condition", value={"All Granite WorkItems can be adapted to CQ WorkItems"})})
@Service(value={AdapterFactory.class, WorkItemAdapterFactory.class})
public class WorkItemAdapterFactory
implements AdapterFactory {
private static Logger log = LoggerFactory.getLogger(WorkItemAdapterFactory.class);
@Property(name="adapters", propertyPrivate=1)
private static final String[] ADAPTER_CLASSES = new String[]{com.day.cq.workflow.exec.WorkItem.class.getName()};
@Property(name="adaptables", propertyPrivate=1)
private static final String[] ADAPTABLE_CLASSES = new String[]{WorkItem.class.getName()};
public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType> type) {
if (com.day.cq.workflow.exec.WorkItem.class == type && adaptable instanceof WorkItem) {
return (AdapterType)new CQWorkItemWrapper((WorkItem)adaptable);
}
return null;
}
}