Criteria c = CategoryMapper.buildBasicCriteria(data.getID());
UserCredentials uc = (UserCredentials) registry.lookup(LookupNames.USER_CREDENTIALS); Criteria c = CategoryMapper.buildBasicCriteria(data.getID(), uc.getUserID());
    public void updateCategory(CategoryData data, List imgsToRemove,                                 List imgsToAdd)        throws DSOutOfServiceException, DSAccessException    {        Criteria c = CategoryMapper.buildBasicCriteria(data.getID());        Category category =             (Category) gateway.retrieveSTSData("Category", c);        category.setName(data.getName());        category.setDescription(data.getDescription());        List toUpdate = new ArrayList(), newAttributes = new ArrayList();        toUpdate.add(category);        //Map classifications = data.getClassifications();            Map classifications = data.getImageClassifications();        ClassificationData cData;        Classification classification;        //Images to declassify        if (imgsToRemove != null) {            Iterator i = imgsToRemove.iterator();            List l;            Iterator k;            ImageSummary is;            while (i.hasNext()) {                is = (ImageSummary) i.next();                l = (List) classifications.get(new Integer(is.getID()));                if (l != null) {                    k = l.iterator();                    while(k.hasNext()) {                        cData = (ClassificationData) k.next();                        c = CategoryMapper.buildBasicClassificationCriteria(                                cData.getID());                        classification = (Classification)                             gateway.retrieveSTSData("Classification", c);                        classification.setValid(Boolean.FALSE);                        toUpdate.add(classification);                    }                }              }             }                //Images to classify        if (imgsToAdd != null) {            Iterator j = imgsToAdd.iterator();            Object[] results;            while (j.hasNext()) {                results = buildClassification(category,                         ((ImageSummary) j.next()).getID());                classification = (Classification) results[1];                if (((Boolean) results[0]).booleanValue()) {                    newAttributes.add(classification);                    gateway.annotateAttributesData(newAttributes);                    newAttributes.removeAll(newAttributes);                }                else toUpdate.add(classification);            }          }        if (newAttributes.size() != 0) //to have a mex            gateway.annotateAttributesData(newAttributes);        gateway.updateAttributes(toUpdate);    }