jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rencana Tarigan <rencana_tari...@yahoo.co.id>
Subject Re: Add property to a folder
Date Tue, 13 Jul 2010 09:43:06 GMT
Halo,
I already add mixin to folder but it's still can't add property to the 
folder ?
any other suggestion or sample for code ?

here is my code for add mixin :
if (!selectednode.isNodeType("mix:versionable")){
                 selectednode.addMixin("mix:versionable");
                 session.save();
             }
             selectednode.addMixin(propKey);
             selectednode.setProperty(propKey, propValue);
             session.save();
             session.logout();

On 7/10/2010 10:00 AM, Justin Edelson wrote:
> You should not be able to add arbitrary properties to nodes of either type
> nt:file or nt:folder without adding mixins.
>
> See http://wiki.apache.org/jackrabbit/nt%3Afile and
> http://wiki.apache.org/jackrabbit/nt%3Afolder (and
> http://wiki.apache.org/jackrabbit/nt%3AhierarchyNode)
>
> Personally, I found WebDAV client code basically unreadable. Why not use the
> JCR API over DavEx?
>
> Justin
>
> On Fri, Jul 9, 2010 at 4:34 PM, Rencana Tarigan<rencana_tarigan@yahoo.co.id
>    
>> wrote:
>>      
>    
>> There is no error, when i add the property to a file it's work, but when i
>> add to the property it's not work, and you can see the code at the first
>> post from me..
>>
>> Thanks,
>>
>>
>> On 7/10/2010 3:31 AM, Gonzalo Aguilar Delgado wrote:
>>
>>      
>>> Hi again,
>>>
>>> Did you do something like the code to the end of this page?
>>>
>>> http://jackrabbit.apache.org/node-types.html
>>>
>>> That's how you define nodes... But wait surely I'm complicating things.
>>>
>>> It's better that you post the log of the error first. Can you post the
>>> logs, please?
>>>
>>>
>>>
>>> El sáb, 10-07-2010 a las 03:20 +0700, Rencana Tarigan escribió:
>>>
>>>
>>>        
>>>> What do you mean with node definitions?
>>>>
>>>> On 7/10/2010 3:17 AM, Gonzalo Aguilar Delgado wrote:
>>>>
>>>>
>>>>          
>>>>> Hi Rencana,
>>>>>
>>>>> Can you post node definitions please? Or do you use standard ones?
>>>>>
>>>>> I really didn't went that far. I'm beginner but it should be a node
>>>>> definition problem surely.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> El sáb, 10-07-2010 a las 02:53 +0700, Rencana Tarigan escribió:
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>>> Hi all,
>>>>>> I have code to add property to a folder or file at jackrabbit like
this
>>>>>> :
>>>>>>
>>>>>> DavPropertySet newProps = new DavPropertySet();
>>>>>>            DavPropertyNameSet removeProperties = new
>>>>>> DavPropertyNameSet();
>>>>>>            DavProperty<String>    testProp = new
>>>>>> DefaultDavProperty<String>(propKey.replaceAll(" ","_"), propValue,
>>>>>> DavConstants.NAMESPACE);
>>>>>>            newProps.add(testProp);
>>>>>>            PropPatchMethod proPatch = null;
>>>>>>            boolean b_returnCode = false;
>>>>>>            try {
>>>>>>                proPatch = new
>>>>>> PropPatchMethod(FileShipUtils.getInstance()
>>>>>>                        .getFullPath(remotePath.substring(-1)), newProps,
>>>>>> removeProperties);
>>>>>>                //client.getParams().setAuthenticationPreemptive(false);
>>>>>>
>>>>>>                client.executeMethod(proPatch);
>>>>>>
>>>>>>                //System.out.println(proPatch.getStatusCode() + "
"    +
>>>>>> proPatch.getStatusText());
>>>>>>                //proPatch.checkSuccess();
>>>>>>                b_returnCode = true;// success
>>>>>>                proPatch.releaseConnection();
>>>>>>
>>>>>>            } catch (IOException e) {
>>>>>>                e.printStackTrace();
>>>>>>                b_returnCode = false;
>>>>>>            }
>>>>>>
>>>>>> This code is success to add property to a file but not work to a
>>>>>> folder/collection, any suggestion for this problem ?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>              
>>>>>
>>>>>
>>>>>
>>>>>            
>>>>
>>>>          
>>>
>>>
>>>
>>>        
>> --
>> -----=====*=====-----
>> Rencana Tarigan
>> +6285270567856
>> YM   : rencana_tarigan
>> Skype: rencana.tarigan
>> http://cana.web.id
>>
>>
>>      
>    

-- 
-----=====*=====-----
Rencana Tarigan
+6285270567856
YM   : rencana_tarigan
Skype: rencana.tarigan
http://cana.web.id


Mime
View raw message