01-26-2010 10:13 PM
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);
}
01-27-2010 11:47 AM
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);
Set s = propMap.keySet();
Iterator<String> it = s.iterator();
List<NamedValue> valList = new ArrayList<NamedValue>();
while(it.hasNext()) {
String propName = it.next();
List<String> propValues = propMap.get(propName);
for(int i = 0; i < propValues.size(); i++) {
NamedValue n = Utils.createNamedValue(
Constants.createQNameString(getNameSpace(), propName), propValues.get(i));
valList.add(n);
}
}
NamedValue[] nv = new NamedValue[valList.size()];
nv = valList.toArray(nv);
CMLAddAspect aspects = new CMLAddAspect(Constants.createQNameString(
nameSpace, aspectName), nv, pred, null);
CML cml = new CML();
cml.setAddAspect(new CMLAddAspect[]{aspects});
//cml.setAddAspect(new CMLAddAspect[]{aspects});
WebServiceFactory.getRepositoryService().update(cml);
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.