[Anthill-pro] How To Store Scripted Changes to Database?

Mark Melvin Mark.Melvin at onsemi.com
Thu Jan 29 11:34:22 CST 2009


Thanks, Emerson!  This appears to work around the issue for us in both
scripts..

Mark.
--------------------------------------------

-----Original Message-----
From: anthill-pro-bounces at lists.urbancode.com
[mailto:anthill-pro-bounces at lists.urbancode.com] On Behalf Of emerson
cargnin
Sent: Thursday, January 29, 2009 11:19 AM
To: AnthillPro user and support list.
Subject: Re: [Anthill-pro] How To Store Scripted Changes to Database?

Because of a current bug you need to call the setDirty.

have a look on a previous answer:


Emerson,
       I have located the bug, and we will be fixing this in a future
release.  In the meantime I have figured out a work-around for it.

While you are correct in that you should not need to call store or
setDirty on any object (unless you are storing a new object), in this
case our remoting is creating an phantom object and becoming a bit
befuddled.  If you invoke setDirty() on the Workflow object prior to
altering any of the WorkflowProperties, then the changes to the
workflow-properties will then be saved i.e.

       for (WorkflowProperty workflowProperty :
workflow.getPropertyArray()) {

               if (workflowProperty.getName().equals("runTest")) {

                       workflow.setDirty(); // THIS CALL MUST BE BEFORE
CHANGING *ANY* OF THE WORKFLOW_PROPERTIES

                       workflowProperty.setValue("false");
                       workflowProperty.setUserMayOverride(false);
               }
       }


Hope this helps,
Regards,
Jeff

2009/1/28 Mark Melvin <Mark.Melvin at onsemi.com>:
> Hi Everyone,
>
> As we approach usability I am trying to script a bunch of maintenance 
> on our Anthillpro server.  In particular, I would like to reset the 
> value of a property present on all projects back to zero, as well as 
> make sure that the "cascade force" flag is set/unset as we see fit on 
> all dependencies.  The problem is I can't seem to get these changes to

> "take".  From the scripts I have seen I thought something like this 
> should work (extra stuff removed for clarity...):
>
> AnthillClient anthill = AnthillClient.connect(serverHost, serverPort,
>                                              userName, password); 
> UnitOfWork uow = anthill.createUnitOfWork(); Project[] projects = 
> ProjectFactory.getInstance().restoreAll();
> for (int i = 0; i < projects.length; i++) {  ProjectProperty buildProp

> = projects[i].getProperty("build.number");
>  if (buildProp != null) {
>    buildProp.setValue("0");
>    // There is no ProjectProperty.store(), so do I just call 
> Project.store()..?
>    projects[i].store();
>  }
> }
> uow.commitAndClose();
>
>
> This doesn't seem to have an effect.  The only way I can get it to 
> work is to clone the property, remove it from the project and re-add
it.
> Similarly, my script that walks dependencies and sets the cascadeForce

> flag does nothing no matter which objects I call .store() on.  What am

> I missing here?
>
> Thanks,
> Mark.
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
>
_______________________________________________
Anthill-pro mailing list
Anthill-pro at lists.urbancode.com
http://lists.urbancode.com/mailman/listinfo/anthill-pro


More information about the Anthill-pro mailing list