Hi,I am having no problem adding aspects to content at the time I create it. However, I have a method that should allow aspects to be added to types after the type has been created. But, it's not. Please help me understand what I'm doing wrong:
public void setAspect(String uuid, Aspecter aspect) throws Exception{
String aspectName = aspect.getAspectName();
Map<String, List<String>> propMap = aspect.getAspectMap();
Reference ref = new Reference(new Store(Constants.WORKSPACE_STORE, "SpacesStore"), uuid,
getFilePath());
Predicate pred = new Predicate(new Reference[]{ref}, null, null);
NamedValue[] nv = new NamedValue[propMap.size()];
Set s = propMap.keySet();
Iterator<String> it = s.iterator();
int pos = 0;
while(it.hasNext()) {
String propName = it.next();
List<String> propValues = propMap.get(propName);
NamedValue named = new NamedValue();
String[] values = new String[propValues.size()];
for(int i = 0; i < propValues.size(); i++) {
values[i] = propValues.get(i);
}
named.setName(Constants.createQNameString(nameSpace, propName));
named.setValues(values);
nv[pos] = named;
pos = pos + 1;
}
CMLAddAspect aspects = new CMLAddAspect(Constants.createQNameString(
nameSpace, aspectName), nv, pred, null);
CML cml = new CML();
cml.setAddAspect(new CMLAddAspect[]{aspects});
WebServiceFactory.getRepositoryService().update(cml);
}
When I run this method, I get no complaints from the compiler… but I also don't get any aspects added.Thanks for your help.