@Override
public boolean canHandle(ActionContext context) {
actionContext = (ActionContextImpl) context;
AbstractComponent targetComponent = actionContext.getTargetComponent();
ExternalComponentRegistryImpl extCompRegistry = ExternalComponentRegistryImpl.getInstance();
Collection<ExtendedComponentTypeInfo> componentInfos = extCompRegistry.getComponentInfos();
List<Action> subActions = new ArrayList<Action>(componentInfos.size());
for (ExtendedComponentTypeInfo info : componentInfos) {
if (info.isCreatable()) {
PolicyContext policyContext = new PolicyContext();
policyContext.setProperty(PolicyContext.PropertyName.TARGET_COMPONENT.getName(), targetComponent);
policyContext.setProperty(PolicyContext.PropertyName.ACTION.getName(), 'w');
String compositionKey = PolicyInfo.CategoryType.COMPOSITION_POLICY_CATEGORY.getKey();
AbstractComponent tempComponent = extCompRegistry.newInstance(info);
policyContext.setProperty(PolicyContext.PropertyName.SOURCE_COMPONENTS.getName(), Collections.singleton(tempComponent));
if (PolicyManagerImpl.getInstance().execute(compositionKey, policyContext).getStatus()) {
subActions.add(new NewTypeAction(info, targetComponent));
}
}