cancel
Showing results for 
Search instead for 
Did you mean: 

database access

soeursourire
Champ in-the-making
Champ in-the-making
Hi everybody!

I am writing to you for help about access to users entered in the database. I added an attribute "country" in MyNewUserWizard class (sub-class of NewUserWizard) and added it as aspect and prop and I would like to display this attribute for each user on the page users.jsp. How can I do?

It seems that fullname homeSpace etc.. are obtained from the final class repository:

<a:richList id="users-list" binding="#{UsersBean.usersRichList}" viewMode="details" pageSize="10"
styleClass="recordSet" headerStyleClass="recordSetHeader" rowStyleClass="recordSetRow" altRowStyleClass="recordSetRowAlt" width="100%"value="#{UsersBean.users}" var="r" initialSortColumn="userName" initialSortDescending="true">
[…]
<hSmiley SurprisedutputText value="#{r.fullName}" />

                             
so how can I access the attribute "country" as I cannot create sub class of this final class repository?

Thanks in advance for your help!
15 REPLIES 15

soeursourire
Champ in-the-making
Champ in-the-making
I think I added a entry in webclient.properties..

But now I have other troubles after trying to add a calendar in a jsp page. I removed what I did for that but now I can compile and build my program but when I launch Alfresco I have error such as:

MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM

and I cannot launch Alfresco. How can I find from which bean the problem comes from exactly. Is there a way to debug the program with Eclipse ? (I am more used to VC++).

Thanks for your help.

turgayz
Champ in-the-making
Champ in-the-making
Is there a way to debug the program with Eclipse ?

Yes there is, look here: http://www.alfresco.org/forums/viewtopic.php?p=3669#3669

HTH,

soeursourire
Champ in-the-making
Champ in-the-making
Thanks a lot for your help… I found my error.

But I still cannot see my attribute Country in the properties of people of the system in Node Browser… despite aspect added etc.

soeursourire
Champ in-the-making
Champ in-the-making
Please would you mind telling me how the attributes of a class such as firstName, lastName, OrganizationId… are stored in the database after entered on the jsp page.

Is it, e.g., this code that stores the organizationId in MySQL?
props.put(ContentModel.PROP_ORGID, super.getCompanyId());
this.nodeService.setProperties(nodeRef, props);

Creating an aspect allows us to store an attribute into the database MySQL? What do I do wrong while doing that:
-I add an attribute department in my class MyNewUserWizard
-I add an aspect via extension-context.xml as follow:
<namespaces>
      <namespace uri="custom.model" prefix="custom"/>
   </namespaces>
    
   <!–types–>
  
   <!– Definition of new Content Aspect: Department of the user –>
    <aspects>
      <aspect name="custom:Myperson">
         <title>Department</title>
         <properties>
            <property name="custom:department">
               <type>d:text</type>
            </property>
         </properties>
      </aspect>
   </aspects>
-I add the variables in my sub class of ContentModel:
public interface MyContentModel extends ContentModel
{
    // person
    static final QName PROP_DEPARTMENT = QName.createQName("custom.model", "department");
    static final QName ASPECT_Myperson = QName.createQName("custom.model", "Myperson");
}
-I add this code in the function finish() of MyNewUserWizad:
Map<QName, Serializable> myprops = new HashMap<QName, Serializable>(5);
myprops.put(MyContentModel.PROP_DEPARTMENT, this.department);
this.nodeService.addAspect(nodeRef, MyContentModel.ASPECT_Myperson,myprops);

Is there another way to store attributes values in the database than using aspects?
Thanks in advance for your help

soeursourire
Champ in-the-making
Champ in-the-making
I guess I should do a type instead of an aspect? But how should I use employ it? If I want to add attributes to the type person how should I do, add my own person and repeat the properties firstname, lastname…. and use soemthing like nodeService.setType()?

soeursourire
Champ in-the-making
Champ in-the-making
When I added this type into customModel.xml and I am not using it yet:

   <type name="custom:Myperson">
         <title>MyPerson</title>
         <parent>sys:base</parent>
         <properties>
            <property name="custom:department">
               <type>d:text</type>
            </property>
         </properties>
      </type>
My program compiled but alfresco fails to launch. What is wrong here? I also added the import:
<import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>