cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Users using JAVA API

yvinodh
Champ in-the-making
Champ in-the-making
Hi all,

         I am using Alfresco 2.9.In my application i need to create users using JAVA API. Can anyone help me in this.
         Thanks in Advance

Regards,
Yvinodh.
41 REPLIES 41

rivetlogic
Champ on-the-rise
Champ on-the-rise

charlesbronson
Champ in-the-making
Champ in-the-making
Hi Praveen,
I've successfully downloaded the project, tested and all have worked properly.
That's good. Just another question for you:
Do you have any idea of where can I find additional information about the raar project? I've found API of some previous versions, but nothing else.
Maybe additional examples, or something else.
I think it would be easy to request information to Alfresco trough this API instead start researching of how to use  web scripts.

Thanks,

Guido.

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi Guido,

RAAR's JavaDocs are located at: http://docs.rivetlogic.com/projects/cma/1.7.1/javadocs/

We'll be posting the code to a real project that uses RAAR this week. Stay tuned Smiley Happy

–Sumer

charlesbronson
Champ in-the-making
Champ in-the-making
Hi,

First of all thanks for the response.
I would be glad to know if there is a possibility to show me how to get all the content from a specific space throw this API. I'm not sure if this functionality is actually provided by it.
Maybe some workaround could be to make a search in a specific space and retrieve the content from it, but I do not know if this is possible also, I couldn't find the way to do this type of search.

If you have any idea, please let me know.

Thanks,

Guido.-

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

The way to do that would be through the search service. You'd basically need to craft a lucene query, pass it as an argument to the search service's query() method and get a list of nodes back.

For example, if you want to get all the files and folders inside of an Alfresco folder under 'Company Home' called 'My Folder' you could do something like this:

Create a list of properties that you want to retrieve for each node:

public static final List<QName> QUERY_PROPERTIES = new Vector<QName>(6, 1) {
   private static final long serialVersionUID = 5649490531607878780L;
   {
      add(ContentModel.PROP_NAME);
      add(ContentModel.PROP_CREATOR);
      add(ContentModel.PROP_CREATED);
      add(ContentModel.PROP_MODIFIED);
      add(ContentModel.PROP_CONTENT);
      add(ContentModel.PROP_AUTHOR);
   }
};

Create a format string to hold your lucene query:

/**
* Produces a Lucene query that would get all content and folder nodes, except system folders, within the supplied path
* non-recursively.
*/
public static final String FORMAT_QUERY = "+PATH:\"%s/*\" +(TYPE:\"" + ContentModel.TYPE_FOLDER
      + "\" OR TYPE:\"" + ContentModel.TYPE_CONTENT + "\") -TYPE:\"" + ContentModel.TYPE_SYSTEM_FOLDER + "\"";

Plug the path into the query string:

String queryStr = String.format(FORMAT_QUERY, "/app:company_home/cm:My Folder");

Then execute the query method:

/**
* Return a maximum of 100 nodes inside the given folder path
*/
List<Node> results = searchService.query(ticket, new StoreRef("workspace://SpacesStore"),
      SearchService.QueryLanguage.lucene, queryStr,
      new Vector<QName>(QUERY_PROPERTIES), false, false, false, false,
      null, 100, null);

That's it. The variable "results" will contain all the nodes inside of 'My Folder'. You would also be able to extract the values of the meta data you requested using the Node.getProperties() method.

Hope this helps,

–Alaaeldin

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hello,

You can now find a dedicated thread for RAAr here:
http://forums.alfresco.com/en/viewtopic.php?f=32&t=15360

And a homepage for RAAr here:
http://wiki.rivetlogic.org/display/RAAR/

There is also an OSS sample application using Alfresco and RAAr here:
http://wiki.rivetlogic.org/display/SCAr/

And a forum thread to discuss it, here:
http://forums.alfresco.com/en/viewtopic.php?f=32&t=15361

Cheers.

–Sumer

lrjava
Champ in-the-making
Champ in-the-making
hello.

i have tried using the raar-demo app. I encountered a problem. Smiley Sad
please tell me if I need to configure something in Alfresco.

[SETUP]
alfresco 3.0.C
localhost:8080/alfresco is ok. i can access using admin/admin account (specified in the sample app).
localhost:8080/alfresco/service is ok. it says "Web Script Home" and "258 Web Scripts".

[RESULT] running the raar-demo mainClass…
com.rivetlogic.core.cma.exception.AuthenticationFailure: com.rivetlogic.core.cma.exception.CmaRuntimeException

<title>Web Script Status 404 - Not Found</title>

regards,
lr

Guido,

The sample demo file for RAAr is available here:

http://docs.rivetlogic.com/projects/cma/1.7.1/samples/raar-sample-1.zip

http://docs.rivetlogic.com/projects/cma/1.7.1/samples/raar-sample-1.tar.gz

- Praveen C Elineni

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

We've seen a problem with Alfresco's 3.0 Community version (downloaded from the Alfresco website). Check your logs to make sure this is not the problem you're facing.

Basically the Alfresco 3.0 Community download is missing the following method:

org.alfresco.service.cmr.security.AccessPermission.getPosition()

This method is available in the Enterprise version which is what we test RAAr against.

Therefore your options are to:

- Use a free trial Alfresco Enterprise 3.0 version

OR

- Checkout the HEAD of the Alfresco Community source from SVN and verify that this method is there, then compile/build alfresco.war

Hope this helps,

–Alaaeldin

deardooley
Champ in-the-making
Champ in-the-making
Hey all, thanks in advance for the help.  I'm writing a file movement utility using the RAAR 1.5 api and Alf 2.1.  I'm noticing that when a node is copied in the same folder, the paths of the two nodes remain identical.  How does one change the path of the new node once it's created.  Also, is there a way to copy a node and specify the new name?

Rion

jmluy
Champ in-the-making
Champ in-the-making
How do you change the password for the users programatically?