Feature #2124: Template append action in Java OCA

This commit is contained in:
Carlos Martín committed 2013-06-28 19:02:28 +02:00
1 parent 3898f8ba18
commit 517a288df8
9 files changed
+150 -26

No files matched your search

@@ -106,11 +106,13 @@ public class Cluster extends PoolElement{
* @param client XML-RPC Client.
* @param id The id of the target cluster we want to modify.
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the cluster id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -223,7 +225,7 @@ public class Cluster extends PoolElement{
{
return delete(client, id);
}
/**
* Replaces the cluster template.
*
@@ -232,7 +234,19 @@ public class Cluster extends PoolElement{
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the cluster template.
*
* @param new_template New cluster template.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the cluster id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -121,11 +121,13 @@ public class Datastore extends PoolElement
* @param client XML-RPC Client.
* @param id The id of the target datastore we want to modify.
* @param new_template New datastore contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the datastore id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -245,7 +247,19 @@ public class Datastore extends PoolElement
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the datastore template.
*
* @param new_template New datastore template.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the datastore id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -131,7 +131,19 @@ public abstract class Document extends PoolElement
*/
public OneResponse update(String new_document)
{
return client.call(UPDATE, id, new_document);
return update(new_document, false);
}
/**
* Replaces the document template contents.
*
* @param new_document New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the document id.
*/
public OneResponse update(String new_document, boolean append)
{
return client.call(UPDATE, id, new_document, append);
}
/**
@@ -167,11 +167,13 @@ public class Host extends PoolElement{
* @param client XML-RPC Client.
* @param id The image id of the target host we want to modify.
* @param new_template New template contents
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the host id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -252,7 +254,19 @@ public class Host extends PoolElement{
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the template contents.
*
* @param new_template New template contents
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the host id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -125,11 +125,13 @@ public class Image extends PoolElement
* @param client XML-RPC Client.
* @param id The image id of the target image we want to modify.
* @param new_template New template contents
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the image id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -314,7 +316,19 @@ public class Image extends PoolElement
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the template contents.
*
* @param new_template New template contents
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the image id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -105,11 +105,13 @@ public class Template extends PoolElement
* @param client XML-RPC Client.
* @param id The template id of the target template we want to modify.
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the template id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -272,7 +274,19 @@ public class Template extends PoolElement
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the template contents.
*
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the template id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -170,11 +170,13 @@ public class User extends PoolElement{
* @param client XML-RPC Client.
* @param id The user id of the target user we want to modify.
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the user id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -272,7 +274,19 @@ public class User extends PoolElement{
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the user template contents.
*
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the user id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -204,11 +204,13 @@ public class VirtualMachine extends PoolElement{
* @param client XML-RPC Client.
* @param id The id of the target vm.
* @param new_template New template contents
* @param append True to append new attributes instead of replace the whole template
* @return If an error occurs the error message contains the reason.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -779,7 +781,19 @@ public class VirtualMachine extends PoolElement{
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces this VM's user template contents.
*
* @param new_template New template contents
* @param append True to append new attributes instead of replace the whole template
* @return If an error occurs the error message contains the reason.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**
@@ -266,11 +266,13 @@ public class VirtualNetwork extends PoolElement{
* @param client XML-RPC Client.
* @param id The vnet id of the target vnet we want to modify.
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the vnet id.
*/
public static OneResponse update(Client client, int id, String new_template)
public static OneResponse update(Client client, int id, String new_template,
boolean append)
{
return client.call(UPDATE, id, new_template);
return client.call(UPDATE, id, new_template, append ? 1 : 0);
}
/**
@@ -502,7 +504,19 @@ public class VirtualNetwork extends PoolElement{
*/
public OneResponse update(String new_template)
{
return update(client, id, new_template);
return update(new_template, false);
}
/**
* Replaces the VirtualNetwork template contents.
*
* @param new_template New template contents.
* @param append True to append new attributes instead of replace the whole template
* @return If successful the message contains the vnet id.
*/
public OneResponse update(String new_template, boolean append)
{
return update(client, id, new_template, append);
}
/**