package org.ligoj.app.plugin.prov;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.ligoj.app.api.SubscriptionStatusWithData;
import org.ligoj.app.model.Node;
import org.ligoj.app.plugin.prov.model.ProvInstancePrice;
import org.ligoj.app.plugin.prov.model.ProvInstancePriceTerm;
import org.ligoj.app.plugin.prov.model.ProvInstanceType;
import org.ligoj.app.plugin.prov.model.ProvStorageType;
import org.ligoj.app.resource.plugin.AbstractToolPluginResource;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * The base class for provisioning tool. There is complete quote configuration
 * along the subscription.
 */
public abstract class AbstractProvResource extends AbstractToolPluginResource implements ProvisioningService {

	@Autowired
	protected ProvResource provResource;

	@Override
	public SubscriptionStatusWithData checkSubscriptionStatus(final int subscription, final String node,
			final Map<String, String> parameters) throws Exception {
		final SubscriptionStatusWithData status = super.checkSubscriptionStatus(subscription, node, parameters);

		// Complete the tool status with the generic quote data
		status.put("quote", provResource.getSusbcriptionStatus(subscription));
		return status;
	}

	@Override
	public List<Class<?>> getInstalledEntities() {
		return Arrays.asList(Node.class, ProvInstancePriceTerm.class, ProvInstanceType.class, ProvInstancePrice.class,
				ProvStorageType.class);
	}
}

@@ -33,56 +33,8 @@
 v;%0A%0A
-import java.util.Arrays;%0Aimport java.util.List;%0A
 impo
@@ -130,250 +130,33 @@
 app.
-model.Node;%0Aimport org.ligoj.app.plugin.prov.model.ProvInstancePrice;%0Aimport org.ligoj.app.plugin.prov.model.ProvInstancePriceTerm;%0Aimport org.ligoj.app.plugin.prov.model.ProvInstanceType;%0Aimport org.ligoj.app.plugin.prov.model.ProvStorageTyp
+resource.node.NodeResourc
 e;%0Ai
@@ -365,19 +365,16 @@
 guration
-%0A *
  along t
@@ -557,16 +557,67 @@
 ource;%0A%0A
+%09@Autowired%0A%09protected NodeResource nodeResource;%0A%0A
 %09@Overri
@@ -765,25 +765,8 @@
 ers)
- throws Exception
  %7B%0A%09
@@ -812,19 +812,12 @@
 s = 
-super.check
+new 
 Subs
@@ -834,39 +834,17 @@
 atus
-(subscription, node, parameters
+WithData(
 );%0A%0A
@@ -997,211 +997,7 @@
 ;%0A%09%7D
-%0A%0A%09@Override%0A%09public List%3CClass%3C?%3E%3E getInstalledEntities() %7B%0A%09%09return Arrays.asList(Node.class, ProvInstancePriceTerm.class, ProvInstanceType.class, ProvInstancePrice.class,%0A%09%09%09%09ProvStorageType.class);%0A%09%7D
 %0A%7D%0A

Add "nodeResource" to base Provisioning plugin