mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
- In CMIS methods that allow setting of node properties, the <cmis:properties> element may carry an <alf:setAspects> extension that lists - aspectsToRemove - aspectsToAdd - properties (properties to set belonging to aspects rather than the node type) - In CMIS methods that allow retrieval of node properties, the <cmis:properties> carries an <alf:getAspects> extension that lists - appliedAspects - properties (properties belonging to aspects rather than the node type) - Added extension types to Alfresco-Core.xsd and referenced in extended WSDL - Plumbed in to Web Service and REST APIs git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19037 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
121 lines
3.4 KiB
Java
121 lines
3.4 KiB
Java
/*
|
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
|
*
|
|
* This file is part of Alfresco
|
|
*
|
|
* Alfresco is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Alfresco is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
package org.alfresco.repo.cmis.rest;
|
|
|
|
import java.util.Set;
|
|
import java.util.TreeSet;
|
|
|
|
import javax.xml.namespace.QName;
|
|
|
|
import org.apache.abdera.factory.Factory;
|
|
import org.apache.abdera.model.Element;
|
|
import org.apache.abdera.model.ExtensibleElementWrapper;
|
|
import org.apache.chemistry.abdera.ext.CMISConstants;
|
|
import org.apache.chemistry.abdera.ext.CMISProperties;
|
|
|
|
/**
|
|
* Alfresco CMIS extension for controlling aspects and their properties.
|
|
*
|
|
* @author dward
|
|
*/
|
|
public class SetAspectsExtension extends ExtensibleElementWrapper
|
|
{
|
|
/** The Alfresco extension namespace. */
|
|
private static final String NAMESPACE = "http://www.alfresco.org";
|
|
|
|
/** The name of this element. */
|
|
public static final QName QNAME = new QName(NAMESPACE, "setAspects");
|
|
|
|
/** The name of the element containing the aspect properties. */
|
|
public static final QName PROPERTIES = new QName(NAMESPACE, "properties");
|
|
|
|
/** The name of the element containing the aspects to add. */
|
|
private static final QName ASPECTS_TO_ADD = new QName(NAMESPACE, "aspectsToAdd");
|
|
|
|
/** The name of the element containing the aspects to remove. */
|
|
private static final QName ASPECTS_TO_REMOVE = new QName(NAMESPACE, "aspectsToRemove");
|
|
|
|
|
|
/**
|
|
* The Constructor.
|
|
*
|
|
* @param internal
|
|
* the internal element
|
|
*/
|
|
public SetAspectsExtension(Element internal)
|
|
{
|
|
super(internal);
|
|
}
|
|
|
|
/**
|
|
* The Constructor.
|
|
*
|
|
* @param factory
|
|
* the factory
|
|
*/
|
|
public SetAspectsExtension(Factory factory)
|
|
{
|
|
super(factory, CMISConstants.OBJECT);
|
|
}
|
|
|
|
/**
|
|
* Gets the aspects to add.
|
|
*
|
|
* @return the aspects to add
|
|
*/
|
|
public Set<String> getAspectsToAdd()
|
|
{
|
|
Set<String> aspects = new TreeSet<String>();
|
|
for (Element aspect = getFirstChild(ASPECTS_TO_ADD); aspect != null; aspect = aspect
|
|
.getNextSibling(ASPECTS_TO_ADD))
|
|
{
|
|
aspects.add(aspect.getText());
|
|
|
|
}
|
|
return aspects;
|
|
}
|
|
|
|
/**
|
|
* Gets the aspects to remove.
|
|
*
|
|
* @return the aspects to remove
|
|
*/
|
|
public Set<String> getAspectsToRemove()
|
|
{
|
|
Set<String> aspects = new TreeSet<String>();
|
|
for (Element aspect = getFirstChild(ASPECTS_TO_REMOVE); aspect != null; aspect = aspect
|
|
.getNextSibling(ASPECTS_TO_REMOVE))
|
|
{
|
|
aspects.add(aspect.getText());
|
|
|
|
}
|
|
return aspects;
|
|
}
|
|
|
|
/**
|
|
* Gets all aspect properties
|
|
*
|
|
* @return aspect properties
|
|
*/
|
|
public CMISProperties getProperties()
|
|
{
|
|
return (CMISProperties) getFirstChild(PROPERTIES);
|
|
}
|
|
}
|