I have created a rule programmatically in Java and attached with a space, its working fine whenever a new document is inserted into that space. But what if I already have some documents uploaded in the space and I want to run the Rule. I know i can do this via Explorer as defined in the following article.
http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Ftasks%2Flibrary-folder-rules-run.html
But I want to achieve the same using Java code.
Does any one please suggest some solution.
:: I am using Alfresco enterprise 4.0.2
I would recommend you to bind behaviours to policies instead if you are into java:
http://wiki.alfresco.com/wiki/Policy_Component#Binding_Behaviour_to_a_Policy
My personal experience is that you as a developer get much more control over events in the repository using behaviours (opposed to rules). But maybe thats just me :)
Related
I need to write a script able to print a list of all the engines existing on an Archestra platform.
I've tried to create a script at the platform level, but haven't found anywhere information about how to obtain the engines list, the same way for instance IDE is doing it.
Anybody has idea of this?
AFAIK, the IDE uses SQL to populate the tree. There is a table with all the properties of the object, including where the object is running.
It is not possible to use the exact same mechanism as the ArchestrA IDE, but there are several options:
Externally build and save the Galaxy hierarchy using GRAccess. This
is the recommended technique.
Connect directly to the Galaxy database and build the hierarchy. This not an officially supported technique, but it is very fast.
Build the list of Engines through scripting, either using MXAccess or possibly from an ArchestrA script.
For #3 MXAccess/Scripting, it is possible to add relative tags to find the engines:
MyPlatform._Engines[-1] -> iterate through to get the engines
${EngineName}.Objects[-1] -> if needed, lists the objects in the engine
MyPlatform.Tagname -> name of Platform
MyPlatform.Host -> host name of Platform
If you try the ArchestrA scripting route, you will need to use the Indirect type and BindTo, but realize the asynchronous nature of the responses so it will require delays and polling to see if the data is available. Usually communication in the same engine is fairly quick though.
Currently i am generating a report (we are getting files are uploaded within a time stamp).
I am getting all files and folders.Iterating the result and checking created date one by one.That is taking too much time approx 8 min to revert with resuls.Can anyone tell me is there any alfresco report api that i can use? or using solr how to fetch the result?
I like to follow an approach which is maybe not really orthodox. Usually, you don't want to report on all documents, only document using a specific type or aspect. So, what I do is to create a Java behaviour on onCreate, onUpdate and onDelete that updates a custom database with only the metadata that I'm interested in. Then, I can connect any OOTB reporting tools such as Pentaho, Jasper or Tableau. You have of couse some other traditional alternatives, such as:
Using this module developed by a community member: http://fcorti.com/alfresco-audit-analysis-reporting/
Or using the module provided by Alfresco: http://docs.alfresco.com/analytics/concepts/analytics-using.html
SOLR/Lucene is not an option, querying DB directly is not an option either (performance wise).
I would suggest using one of the options available (AAAR for instance) or developing something on your own following the same principles.
I did little bit investigation on this and found below link.
http://docs.alfresco.com/4.0/tasks/audit-recording-values.html
I think you can user auditService in alfresco and get your things done.There are few alfresco webservices(related to audit) already available which will allow you to filter response.In case if you need to customize it , than you can create webscript and use auditService in it.
You can use below url for browsing all your alfresco webservice.
http://localhost:8080/alfresco/service/index
I have an Alfresco module that I would like to have do some cleanup when a new version of it is installed.
In the current situation, an older version of the module created a folder node with custom properties at the root of the repository. We've since decided to have multiple such nodes, and none of them at that location. I'd like to put into the next version of the module code that would run at Alfresco startup, check for the existence of the old node, copy its properties into the appropriate new nodes, and delete the old node.
Is such a thing possible? I've looked at the Bootstrap configuration file, but that appears to only allow one to add things to the repository, not modify or delete them.
My suggestion is that you write a patch. That is a class that implements
org.alfresco.repo.admin.patch.AbstractPatch
Then you can do pretty much anything you want on bootstrap (except executing searches against solr since it wont be available).
Add some spring configuration, take a look at the file patch-services-context.xml for inspiration.
Yes you can do that, probably you missed the correct place in the documentation about that:
If you open Import Strategy you'll find a section Per BootstrapView, you should be using something like REPLACE_EXISTING or UPDATE_EXISTING for your ACP packaged content (if you're using ACPs as your bootstrap importing strategy).
Here is a more detailed description of the UUID Bindings values.
Hope that helps.
You can use patches.
When alfresco server starts it applies patches and executes database updates etc.
Definition :
A patch is a piece of Java code that executes once when Alfresco
Content Services starts. Custom patches can be implemented.
Documentation Link
I need to be able to perform all of the available functions that the Package Manager Console performs for code first DB migrations. Does anyone know how I could accomplish these commands strictly through user defined code? I am trying to automate this whole migration process and my team has hit the dreaded issue of getting the migrations out of sync due to the number of developers on this project. I want to write a project that the developer can interact with that will create and if need be rescaffold their migrations for them automatically.
PM is invoking through PowerShell and PS cmdlets (like for active directory etc.)
http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference
The Package Manager Console is a PowerShell console within Visual
Studio
...there is essentially very little info about this - I've tried that before on couple occasions and it gets down to doing some 'dirty work' if you really need it (not really sure, it might not be that difficult - providing you have some PS experience)
Here are similar questions / answers - working out the PS comdlets is pretty involving - in this case it has some additional steps involved. And PS tends to get very version dependent - so you need to check this for the specific EF/CF you're using.
Run entityframework cmdlets from my code
Possible to add migration using EF DbMigrator
And you may want to look at the source code for EF that does Add-Migration
(correction: this is the link to official repository - thanks to #Brice for that)
http://entityframework.codeplex.com/SourceControl/changeset/view/f986cb32d0a3#src/EntityFramework.PowerShell/Migrations/AddMigrationCommand.cs
http://entityframework.codeplex.com/SourceControl/BrowseLatest
(PM errors also suggest the origins of the code doing the Add-Migrations to be the 'System.Data.Entity.Migrations.Design.ToolingFacade')
If you need 'just' an Update - you could try using the DbMigrator.Update (this guy gave it a try http://joshmouch.wordpress.com/2012/04/22/entity-framework-code-first-migrations-executing-migrations-using-code-not-powershell-commands/) - but I'm not sure how relevant is that to you, I doubt it.
The scaffolding is the real problem (Add-Migration) which to my knowledge isn't accessible from C# directly via EF/CF framework.
Note: - based on the code in (http://entityframework.codeplex.com/SourceControl/changeset/view/f986cb32d0a3#src/EntityFramework.PowerShell/Migrations/AddMigrationCommand.cs) - and as the EF guru mentioned himself - that part of the code is calling into the System.Data.Entity.Migrations.Design library - which does most of the stuff. If it's possible to reference that one and actually repeat what AddMigrationCommand is doing - then there might not be a need for PowerShell at all. But I'm suspecting it's not that straight-forward, with possible 'internal' calls invisible to outside callers etc.
At least as of this post, you can directly access the System.Data.Entity.Migrations.Design.MigrationScaffolder class and directly call the Scaffold() methods on it, which will return you an object that contains the contents of the "regular" .cs file, the "Designer.cs" file and the .resx file.
What you do with those files is up to you!
Personally, I'm attempting to turn this into a tool that will be able to create EF6 migrations on a new ASPNET5/DNX project, which is not supported by the powershell commands.
I know there're powerful TFS command line tools from TFS Power tools that provide much more that can be achieved through Visual Studio integrated capabilities.
I have several changesets that aren't associated with any workitem. I would like to create a new workitem and associate these existing changesets with it.
Is this possible? I don't see any particular reason why not, but it depends whether command line tools provide such functionality.
Sure you can associate a work item to an existing changeset. You can do that directly in the Visual Studio IDE. Here's how:
First open the work item - and select the All Links tab:
Then click on Link to and select the changeset and click Ok:
Yes, read bellow.
This can be achieved from workitems links section, in your definition i don't see reason why you would want to use something else.
If you are interested in some bulk solution, then Tfs has full-fledged API any tool will likely using it as well.
Following covers your case in api:
http://social.technet.microsoft.com/wiki/contents/articles/3280.tfs-2010-api-create-workitems-bugs.aspx
TFS2010: How to link a WorkItem to a ChangeSet, you can use VersionControlServer.QueryHistory method to get changesets you need
For powershell this covers item creation:
http://programmaticponderings.wordpress.com/2012/07/18/automating-work-item-creation-in-tfs-2010-with-powershell-continued/