User Creation Using Java API( With Specific Quota)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2011 01:13 AM
I successfully created user using web service client. But i cant specify the user quota. Is it possible in web service client?.Please help me.
This is my code.
import java.rmi.RemoteException;import java.util.logging.Level;import java.util.logging.Logger;import org.alfresco.webservice.administration.NewUserDetails;import org.alfresco.webservice.administration.AdministrationServiceSoapBindingStub;import org.alfresco.webservice.types.NamedValue;import org.alfresco.webservice.types.Store;import org.alfresco.webservice.util.AuthenticationUtils;import org.alfresco.webservice.util.Constants;import org.alfresco.webservice.util.WebServiceFactory;import org.alfresco.webservice.types.Query;import org.alfresco.webservice.repository.QueryResult;/** * * @author sundar */public class CreateUserCommand { public CreateUserCommand() { } public static void main(String a[]) { try { CreateUserCommand c = new CreateUserCommand(); AuthenticationUtils.startSession("admin", "admin"); // WebServiceFactory.getAdministrationService().changePassword("", "", ""); Store s = new Store(Constants.WORKSPACE_STORE, "Spacesstore"); AdministrationServiceSoapBindingStub ad = WebServiceFactory.getAdministrationService(); String username="sundarpx"; String password="sundarpx"; String firstname="sundar"; String midlename="p"; String lastname="rajan"; String email="sundar.p@demo.com"; String regid="1"; // check the user boolean existUser = false; try { // test before the user Query query = new Query("lucene", "+TYPE:\"cm:person\" AND +@cm\\:userName:\"" + username + "\""); QueryResult results = WebServiceFactory.getRepositoryService().query(s, query, true); if (results != null&&results.getResultSet()!=null) { if (results.getResultSet().getRows().length > 0) { existUser = true; } else { existUser = false; } } else { existUser = false; } } catch (Exception e) { existUser = false; } if(existUser){ System.out.println("This user already exists"); }else{ NamedValue[] properties = c.createUserProperties(s.getScheme() + "://" + s.getAddress() + "/", firstname, midlename, lastname, email, regid); NewUserDetails dc[] = new NewUserDetails[]{new NewUserDetails(username, password, properties)}; ad.createUsers(dc); } AuthenticationUtils.endSession(); } catch (RemoteException ex) { Logger.getLogger(CreateUserCommand.class.getName()).log(Level.SEVERE, null, ex); } } public NamedValue[] createUserProperties(String homefolder, String firstname, String midlename, String lastname, String email, String orgid) { return new NamedValue[]{ new NamedValue(Constants.PROP_USER_HOMEFOLDER, false, homefolder, null), new NamedValue(Constants.PROP_USER_FIRSTNAME, false, firstname, null), new NamedValue(Constants.PROP_USER_MIDDLENAME, false, midlename, null), new NamedValue(Constants.PROP_USER_LASTNAME, false, lastname, null), new NamedValue(Constants.PROP_USER_EMAIL, false, email, null), new NamedValue(Constants.PROP_USER_ORGID, false, orgid, null) }; }}
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2011 05:25 AM
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2011 05:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2011 06:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2011 07:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2011 08:16 AM
I don't think it is possible out-of-the box. As I could see the data type for sizeQuota is long and the properties taken up by NewUserDetails is NameValued[], which supports string as value.
Hope this helps.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 02:59 AM
I directly change the alfresco source. And one more clarification, is it possible enable open office in alfresco community edition 3.d?. And enable jodconverter for previewing office documents. I tried many ways but i couldn't enable the features.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 03:36 AM
I am sure you must have done the required configuration for openoffice in alfresco-global.properties file. Are you getting any error?
I have not tried running openoffice. However, I found below links, hope you may find any useful information for you from it.
http://forums.alfresco.com/en/viewtopic.php?f=8&t=37944
https://issues.alfresco.com/jira/browse/ALF-8270
http://issues.alfresco.com/jira/browse/ALF-7570
Hope this helps.
Thanks,
[size=85]if you find any of the post as useful to you, do give a point[/size]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 07:33 AM
net.sf.jooreports.openoffice.connection.OpenOfficeException - conversion failed; com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2011 08:05 AM
