String expression = attr.getValue(SELECT_ATTR);
if (expression == null) {
throw new ProcessingException("Attribute "+SELECT_ATTR+" must be spcified.");
}
ProfileManager profileManager = null;
try {
profileManager = (ProfileManager)this.manager.lookup(ProfileManager.ROLE);
// determine coplet id
String copletId = null;
Map context = (Map)objectModel.get(ObjectModelHelper.PARENT_CONTEXT);
if (context != null) {
copletId = (String)context.get(Constants.COPLET_ID_KEY);
if (copletId == null) {
throw new ProcessingException("copletId must be passed as parameter or in the object model within the parent context.");
}
} else {
try {
copletId = this.parameters.getParameter(COPLET_ID_PARAM);
// set portal name
PortalService portalService = null;
try {
portalService = (PortalService)this.manager.lookup(PortalService.ROLE);
portalService.setPortalName(this.parameters.getParameter(PORTAL_NAME_PARAM));
} finally {
this.manager.release(portalService);
}
} catch (ParameterException e) {
throw new ProcessingException("copletId and portalName must be passed as parameter or in the object model within the parent context.");
}
}
JXPathContext jxpathContext = JXPathContext.newContext(profileManager.getCopletInstanceData(copletId));
Object object = jxpathContext.getValue(expression);
if (object == null) {
throw new ProcessingException("Could not find value for expression "+expression);
}