List of usage examples for org.w3c.dom Element getTextContent
public String getTextContent() throws DOMException;
From source file:org.opendatakit.aggregate.externalservice.REDCapServer.java
private void submitPost(String actionType, HttpEntity postentity, List<NameValuePair> qparam, CallingContext cc) {// w w w . java 2s . co m try { HttpResponse response = this.sendHttpRequest(POST, getUrl(), postentity, qparam, cc); int statusCode = response.getStatusLine().getStatusCode(); String responseString = WebUtils.readResponse(response); if (responseString.length() != 0) { DocumentBuilderFactory xmlFactory = DocumentBuilderFactory.newInstance(); xmlFactory.setNamespaceAware(true); xmlFactory.setIgnoringComments(true); xmlFactory.setCoalescing(true); DocumentBuilder builder = xmlFactory.newDocumentBuilder(); InputStream is = new ByteArrayInputStream(responseString.getBytes(UTF_CHARSET)); Document doc; try { doc = builder.parse(is); } finally { is.close(); } Element root = doc.getDocumentElement(); NodeList errorNodes = root.getElementsByTagName("error"); StringBuilder b = new StringBuilder(); if (errorNodes != null) { for (int i = 0; i < errorNodes.getLength(); ++i) { if (i != 0) { b.append("\n"); } Element e = (Element) errorNodes.item(i); b.append(e.getTextContent()); } String error = b.toString(); if (error.length() != 0) { throw new IllegalArgumentException(actionType + " to REDCap server failed. statusCode: " + statusCode + " error: " + error); } } } else { // this seems to be the common case??? logger.info(actionType + " to REDCap server returned no body"); } if (statusCode != HttpStatus.SC_OK) { throw new IllegalArgumentException( actionType + " to REDCap server failed - but no error content. Reason: " + response.getStatusLine().getReasonPhrase() + " status code: " + statusCode); } } catch (IOException e) { e.printStackTrace(); throw new IllegalArgumentException(actionType + " to REDCap server failed - " + e.toString()); } catch (ParserConfigurationException e) { e.printStackTrace(); throw new IllegalArgumentException(actionType + " to REDCap server failed - " + e.toString()); } catch (SAXException e) { e.printStackTrace(); throw new IllegalArgumentException(actionType + " to REDCap server failed - " + e.toString()); } }
From source file:com.concursive.connect.web.modules.profile.portlets.ProjectActionsPortlet.java
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException { try {//from w w w .j av a 2 s . co m // Define the current view String defaultView = VIEW_PAGE; // Get preferences request.setAttribute(TITLE, request.getPreferences().getValue(PREF_TITLE, null)); // Check for which project to use Project project = null; // This portlet can consume data from other portlets for (String event : PortalUtils.getDashboardPortlet(request).getConsumeDataEvents()) { if ("project".equals(event)) { project = (Project) PortalUtils.getGeneratedData(request, event); } } // Object from the portal if (project == null) { project = PortalUtils.findProject(request); } // The applicationPrefs //ApplicationPrefs applicationPrefs = PortalUtils.getApplicationPrefs(request); // The user performing the action User thisUser = PortalUtils.getUser(request); TeamMember member = project.getTeam().getTeamMember(thisUser.getId()); // Get the urls to display ArrayList<HashMap> urlList = new ArrayList<HashMap>(); String[] urls = request.getPreferences().getValues(PREF_URLS, new String[0]); for (String urlPreference : urls) { XMLUtils xml = new XMLUtils("<values>" + urlPreference + "</values>", true); ArrayList<Element> items = new ArrayList<Element>(); XMLUtils.getAllChildren(xml.getDocumentElement(), items); HashMap<String, String> url = new HashMap<String, String>(); for (Element thisItem : items) { String name = thisItem.getTagName(); String value = thisItem.getTextContent(); if (value.contains("${")) { Template template = new Template(value); for (String templateVariable : template.getVariables()) { String[] variable = templateVariable.split("\\."); template.addParseElement("${" + templateVariable + "}", ObjectUtils .getParam(PortalUtils.getGeneratedData(request, variable[0]), variable[1])); } value = template.getParsedText(); } url.put(name, value); } // Determine if the url can be shown boolean valid = true; // See if the user has permission if (url.containsKey("permission")) { boolean hasPermission = ProjectUtils.hasAccess(project.getId(), thisUser, url.get("permission")); if (!hasPermission) { valid = false; } } // See if the project has a particular service available if (url.containsKey("service")) { boolean hasService = project.getServices().hasService(url.get("service")); if (!hasService) { valid = false; } } // See if any conditions fail if (url.containsKey("projectCondition")) { boolean test = true; String condition = url.get("projectCondition"); // Check to see if a false condition is being checked if (condition.startsWith("!")) { test = false; condition = condition.substring(1); } boolean meetsCondition = Boolean.parseBoolean(ObjectUtils.getParam(project, condition)); if (test && !meetsCondition) { // Expecting a true condition valid = false; } else if (!test && meetsCondition) { // Expecting a false condition valid = false; } } // See if there are any special rules if (url.containsKey("rule")) { String rule = url.get("rule"); if ("userHasToolsEnabled".equals(rule)) { if (member == null || !member.getTools() || !StringUtils.hasText(project.getConcursiveCRMUrl())) { valid = false; } } else if ("userHasCRMAccess".equals(rule)) { if (!thisUser.isConnectCRMAdmin() && !thisUser.isConnectCRMManager()) { LOG.debug("Does not have ConnectCRM access"); valid = false; } } else if ("userCanRequestToJoin".equals(rule)) { boolean canRequestToJoin = TeamMemberUtils.userCanRequestToJoin(thisUser, project); if (!canRequestToJoin) { valid = false; } } else if ("userCanJoin".equals(rule)) { // TODO: Update the code that adds the user, and set the team member status to pending, then remove the membership required part boolean canJoin = TeamMemberUtils.userCanJoin(thisUser, project); if (!canJoin) { valid = false; } } else if ("projectAllowsGuests".equals(rule)) { if (!project.getFeatures().getAllowGuests()) { valid = false; } } else if ("projectHasTools".equals(rule)) { if (!StringUtils.hasText(project.getConcursiveCRMUrl())) { valid = false; } } else if ("canClaim".equals(rule)) { // not logged in boolean isUser = thisUser != null && thisUser.getId() > 0; if (!isUser) { valid = false; } // already owned if (project.getOwner() > -1) { valid = false; } } else if ("isThisUsersProfile".equals(rule)) { boolean isThisUsersProfile = thisUser != null && thisUser.isLoggedIn() && project.getProfile() && project.getOwner() == thisUser.getId(); if (!isThisUsersProfile) { valid = false; } } else if ("isNotThisUsersProfile".equals(rule)) { boolean isUser = thisUser != null && thisUser.getId() > 0; if (!isUser) { valid = false; } boolean isThisUsersProfile = thisUser != null && thisUser.isLoggedIn() && project.getProfile() && project.getOwner() == thisUser.getId(); if (isThisUsersProfile) { valid = false; } } else if ("isAdmin".equals(rule)) { boolean isAdmin = thisUser != null && thisUser.getAccessAdmin(); if (!isAdmin) { valid = false; } } else if ("isUser".equals(rule)) { boolean isUser = thisUser != null && thisUser.getId() > 0; if (!isUser) { valid = false; } } else if ("isNotUser".equals(rule)) { boolean isUser = thisUser != null && thisUser.getId() > 0; if (isUser) { valid = false; } } else if ("userCanReview".equals(rule)) { // Users cannot review themself, and must be logged in boolean isUserCanReview = thisUser != null && thisUser.isLoggedIn() && project.getOwner() != thisUser.getId(); if (!isUserCanReview) { valid = false; } // If the tab isn't visible, can't add a review if (!project.getFeatures().getShowReviews()) { valid = false; } } else { LOG.error("Rule not found: " + rule); valid = false; } } // Global disable if (url.containsKey("enabled")) { if ("false".equals(url.get("enabled"))) { valid = false; } } // If valid if (valid) { // Append any special parameters to the url if (url.containsKey("parameter")) { String parameter = url.get("parameter"); // This parameter takes the current url and appends to the link if ("returnURL".equals(parameter)) { String requestedURL = (String) request.getAttribute("requestedURL"); if (requestedURL != null) { String value = URLEncoder.encode(requestedURL, "UTF-8"); LOG.debug("Parameter: " + parameter + "=" + value); String link = url.get("href"); if (link.contains("&")) { link += "&" + parameter + "=" + value; } else { link += "?" + parameter + "=" + value; } LOG.debug("Setting href to " + link); url.put("href", link); } } } // Add to the list urlList.add(url); } } request.setAttribute(URL_LIST, urlList); // Only output the portlet if there are any urls to show if (urlList.size() > 0) { // JSP view PortletContext context = getPortletContext(); PortletRequestDispatcher requestDispatcher = context.getRequestDispatcher(defaultView); requestDispatcher.include(request, response); } } catch (Exception e) { LOG.error("doView", e); throw new PortletException(e.getMessage()); } }
From source file:de.eorganization.hoopla.server.servlets.TemplateImportServlet.java
private void parseGoals(NodeList goalNodes, Decision newDecision) { newDecision.getGoals().clear();/* ww w .j a v a2 s. c o m*/ for (int i = 0; i < goalNodes.getLength(); i++) { Node node = goalNodes.item(i); if (node instanceof Element) { Goal newGoal = new Goal(); Element child = (Element) node; NodeList goalTagNodes = child.getChildNodes(); for (int x = 0; x < goalTagNodes.getLength(); x++) { if (goalTagNodes.item(x) instanceof Element) { Element goalTagElement = (Element) goalTagNodes.item(x); if (goalTagElement.getNodeName().equals("name")) { newGoal.setName(goalTagElement.getTextContent()); } if (goalTagElement.getNodeName().equals("description")) { newGoal.setDescription(goalTagElement.getTextContent()); } if (goalTagElement.getNodeName().equals("goalType")) { newGoal.setGoalType(GoalType.valueOf(goalTagElement.getTextContent())); } if (goalTagElement.getNodeName().equals("children")) { newGoal.setChildren(parseCriteria(goalTagElement.getChildNodes())); } if (goalTagElement.getNodeName().equals("importanceChildren")) { if (goalTagElement.hasChildNodes()) { parseImportanceChildren(goalTagElement.getChildNodes(), newGoal); } } } } newDecision.addGoal(newGoal); log.info("Parsed gaol: " + newGoal.getName() + ", " + newGoal.getDescription() + ", " + newGoal.getGoalType()); } } }
From source file:de.eorganization.hoopla.server.servlets.TemplateImportServlet.java
private Criterion createCriterion(Element criterionElement) { NodeList criterionTags = criterionElement.getChildNodes(); Criterion newCriterion = new Criterion(); for (int i = 0; i < criterionTags.getLength(); i++) { Node criterionTagNode = criterionTags.item(i); if (criterionTagNode instanceof Element) { Element criterionTagElement = (Element) criterionTagNode; if (criterionTagElement.getNodeName().equals("name")) { newCriterion.setName(criterionTagElement.getTextContent()); }/*www. j av a 2s . co m*/ if (criterionTagElement.getNodeName().equals("description")) { newCriterion.setDescription(criterionTagElement.getTextContent()); } if (criterionTagElement.getNodeName().equals("type")) { if (criterionTagElement.getTextContent().equals("quantitative")) { newCriterion.setType(CriterionType.QUANTITATIVE); } else if (criterionTagElement.getTextContent().equals("qualitative")) { newCriterion.setType(CriterionType.QUALITATIVE); } else if (criterionTagElement.getTextContent().equals("benchmark")) { newCriterion.setType(CriterionType.BENCHMARK); } } if (criterionTagElement.getNodeName().equals("weight") && !criterionTagElement.getTextContent().equals("")) { try { newCriterion.setWeight(Double.valueOf(criterionTagElement.getTextContent())); } catch (Exception ex) { ex.printStackTrace(); } } if (criterionTagElement.getNodeName().equals("children")) { if (criterionTagElement.hasChildNodes()) { NodeList criterionChildNodes = criterionTagElement.getChildNodes(); for (int x = 0; x < criterionChildNodes.getLength(); x++) { Node criterionChildNode = criterionChildNodes.item(x); if (criterionChildNode instanceof Element) { newCriterion.addChild(createCriterion((Element) criterionChildNode)); } } } } if (criterionTagElement.getNodeName().equals("importanceChildren")) { if (criterionTagElement.hasChildNodes()) { parseImportanceChildren(criterionTagElement.getChildNodes(), newCriterion); } } } } log.info("Parsed Criterion: " + newCriterion.toString()); return newCriterion; }
From source file:at.ac.tuwien.big.testsuite.impl.validator.WaiValidator.java
@Override public ValidationResult validate(File fileToValidate, String exerciseId) throws Exception { CookieStore cookieStore = new BasicCookieStore(); HttpContext httpContext = new BasicHttpContext(); httpContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); HttpPost request = new HttpPost("http://localhost:8080/" + contextPath + "/checker/index.php"); List<ValidationResultEntry> validationResultEntries = new ArrayList<>(); try {//ww w. j av a2 s . co m MultipartEntity multipartEntity = new MultipartEntity(); multipartEntity.addPart("uri", new StringBody("")); multipartEntity.addPart("MAX_FILE_SIZE", new StringBody("52428800")); multipartEntity.addPart("uploadfile", new FileBody(fileToValidate, "text/html")); multipartEntity.addPart("validate_file", new StringBody("Check It")); multipartEntity.addPart("pastehtml", new StringBody("")); multipartEntity.addPart("radio_gid[]", new StringBody("8")); multipartEntity.addPart("checkbox_gid[]", new StringBody("8")); multipartEntity.addPart("rpt_format", new StringBody("1")); request.setEntity(multipartEntity); Document doc = httpClient.execute(request, new DomResponseHandler(httpClient, request), httpContext); Element errorsContainer = DomUtils.byId(doc.getDocumentElement(), "AC_errors"); String title = ""; StringBuilder descriptionSb = new StringBuilder(); boolean descriptionStarted = false; for (Element e : DomUtils.asList(errorsContainer.getChildNodes())) { if ("h3".equals(e.getTagName())) { if (descriptionStarted) { validationResultEntries.add(new DefaultValidationResultEntry(title, descriptionSb.toString(), ValidationResultEntryType.ERROR)); } title = e.getTextContent(); descriptionSb.setLength(0); descriptionStarted = false; } else if ("div".equals(e.getTagName()) && e.getAttribute("class").contains("gd_one_check")) { if (descriptionStarted) { descriptionSb.append('\n'); } if (extractDescription(e, descriptionSb)) { descriptionStarted = true; } } } if (descriptionStarted) { validationResultEntries.add(new DefaultValidationResultEntry(title, descriptionSb.toString(), ValidationResultEntryType.ERROR)); } } finally { request.releaseConnection(); } return new DefaultValidationResult("WAI Validation", fileToValidate.getName(), new DefaultValidationResultType("WAI"), validationResultEntries); }
From source file:com.bluexml.xforms.controller.mapping.MappingToolClassFormsToAlfresco.java
/** * Interprets an association field tag from the form's XML instance and builds the appropriate * elements of the generic class object being built. * /*from w w w . jav a 2s . co m*/ * @param children * the first-level nodes in the form instance. Each node is a field. * @param associations * the associations being built in the generic class object * @param associationType * the mapping entry for the association field */ private void xformsAssociationToAlfresco(List<Element> children, GenericAssociations associations, AssociationType associationType) { // find the node that stores the info for this association field Element associationElement = DOMUtil.getOneElementByTagName(children, associationType.getName()); if (associationElement != null) { // simple precaution; should always turn true. Element item = DOMUtil.getChild(associationElement, MsgId.INT_INSTANCE_ASSOCIATION_ITEM.getText()); String textContent = item.getTextContent(); String[] ids = StringUtils.split(textContent, " "); for (String targetId : ids) { GenericAssociation association = alfrescoObjectFactory.createGenericAssociation(); association.setQualifiedName(associationType.getAlfrescoName()); association.setAction(AssociationActions.ADD); GenericClassReference target = alfrescoObjectFactory.createGenericClassReference(); target.setQualifiedName(associationType.getType().getAlfrescoName()); target.setValue(targetId); association.setTarget(target); associations.getAssociation().add(association); } } // This section is deprecated since the widget was changed to a plain select list. Inline // associations are no longer supported in these default forms since "simplifyClasses" was // forced to true. // // List<Element> associationElements = DOMUtil.getAllChildren(associationElement); // for (int i = 0; i < associationElements.size(); i++) { // if (!isMultiple(associationType) || i != (associationElements.size() - 1)) { // processAssociation(transaction, associations, associationType, // associationElements.get(i), initParams); // } // } }
From source file:com.bluexml.xforms.controller.mapping.MappingToolSearch.java
/** * Builds a JSON string for the search options provided by the XForms engine * in the node./*from w w w . j ava 2 s . c o m*/ * * @param formName * @param instance * @return * @throws ServletException */ public String transformSearchForm(String formName, Node instance, boolean shortPropertyNames, Map<String, String> initParams) throws ServletException { SearchFormType sfType = getSearchFormType(formName); if (sfType == null) { if (logger.isErrorEnabled()) { logger.error("No search form found with id '" + formName + "'"); } throw new ServletException("The search form '" + formName + "' was not found in the mapping.xml file."); } Element rootElt = getRootElement(formName, instance); StringBuffer buf = new StringBuffer(1024); String propName = ""; String typeName = ""; ClassType classType = resolveClassType(sfType); String packageName = classType.getPackage(); String namespaceClassType = MappingToolCommon.getNameSpaceFromPrefix(getRootPackage(packageName)); buf.append("{"); // open JSON string // the title buf.append("type:\""); typeName = "{" + namespaceClassType + "}" + classType.getAlfrescoName(); buf.append(typeName); buf.append("\""); // the combination operator buf.append(",operator:\""); buf.append(sfType.getOperator()); buf.append("\""); // the properties buf.append(",fields:{"); // open fields boolean first = true; for (SearchFieldType fieldType : sfType.getField()) { // find the corresponding attribute AttributeType refAttribute = null; String fieldName = fieldType.getName(); for (AttributeType attribute : getAllAttibutes(classType)) { if (attribute.getName().equals(fieldName)) { refAttribute = attribute; break; } } if (refAttribute == null) { logger.error("The attribute for search field '" + fieldName + "' was not found! Since this should never happen, the mapping file is most obviously not correct."); throw new ServletException("The processing of this search form could not complete."); } Element fieldElt = DOMUtil.getChild(rootElt, fieldName); Element opElt = DOMUtil.getChild(fieldElt, MsgId.INT_INSTANCE_SEARCH_OPCODE.getText()); String operator = opElt.getTextContent(); if (StringUtils.trimToNull(operator) == null) { continue; } if (operator.equals(MsgId.INT_SEARCH_OPERATOR_IGNORE.getText()) == false) { if (first == false) { buf.append(","); } String att_package = ""; if (refAttribute.getAspectType() != null) { att_package = refAttribute.getAspectType().getPackage(); } else if (refAttribute.getClassType() != null) { att_package = refAttribute.getClassType().getPackage(); } String namespaceAttribute = MappingToolCommon.getNameSpaceFromPrefix(getRootPackage(att_package)); propName = "{"; propName += namespaceAttribute; propName += "}"; propName += refAttribute.getAlfrescoName(); if (shortPropertyNames) { propName = StringUtils.replace(propName, typeName, ""); } buf.append("\""); buf.append(propName); buf.append("\":"); buf.append("{"); // open field buf.append("type:\""); String type; if (isEnumerated(fieldType)) { type = MsgId.INT_SEARCH_JSON_TYPE_ENUMS.getText(); } else if (refAttribute.getType().equalsIgnoreCase("object")) { type = "String"; } else { type = refAttribute.getType(); } buf.append(type); buf.append("\""); buf.append(",operator:\""); buf.append(operator); buf.append("\""); buf.append(",values:["); // open values if (hasSingleInput(fieldType)) { Element valElt = DOMUtil.getChild(fieldElt, MsgId.INT_INSTANCE_SEARCH_VALUE.getText()); String value = valElt.getTextContent(); if (isEnumerated(fieldType)) { value = convertSelectInputValuesToSearchFormat(value, fieldType.getEnum(), initParams); } buf.append("\""); buf.append(value); buf.append("\""); } else { Element valEltLo = DOMUtil.getChild(fieldElt, MsgId.INT_INSTANCE_SEARCH_VALUE_LO.getText()); String valueLo = valEltLo.getTextContent(); buf.append("\""); buf.append(valueLo); buf.append("\""); Element valEltHi = DOMUtil.getChild(fieldElt, MsgId.INT_INSTANCE_SEARCH_VALUE_HI.getText()); String valueHi = valEltHi.getTextContent(); buf.append(",\""); buf.append(valueHi); buf.append("\""); } buf.append("]"); // close values buf.append("}"); // close field first = false; } } buf.append("}"); // close fields buf.append("}"); // close the JSON string return buf.toString(); }
From source file:de.betterform.xml.xforms.action.SetFocusAction.java
/** * Performs element init./*from w w w. j ava2 s .c om*/ */ public void init() throws XFormsException { super.init(); // check if setfocus elem has NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (NamespaceConstants.XFORMS_NS.equals(node.getNamespaceURI()) && node.getLocalName().equals("control") && node.getNodeType() == Node.ELEMENT_NODE) { Element elementImpl = (Element) node; XFormsElement xfElem = (XFormsElement) this.element.getUserData(""); if (elementImpl.hasAttributeNS(null, "value")) { String xpath = elementImpl.getAttributeNS(null, "value"); this.referencedControl = XPathCache.getInstance().evaluateAsString( xfElem.getModel().getDefaultInstance().getRootContext(), "string(" + xpath + ")"); } else { this.referencedControl = elementImpl.getTextContent(); } } } if (this.referencedControl == null) { this.referencedControl = getXFormsAttribute(CONTROL_ATTRIBUTE); } if (this.referencedControl == null) { throw new XFormsBindingException( "missing control attribute at " + DOMUtil.getCanonicalPath(this.getElement()), this.target, null); } }
From source file:com.github.sardine.DavResource.java
/** * Creates a simple complex Map from the given custom properties of a response. * This implementation does take namespaces into account. * * @param response The response complex type of the multistatus * @return Custom properties/*from w w w .j a v a 2 s . com*/ */ private Map<QName, String> getCustomProps(Response response) { List<Propstat> list = response.getPropstat(); if (list.isEmpty()) { return Collections.emptyMap(); } Map<QName, String> customPropsMap = new HashMap<QName, String>(); for (Propstat propstat : list) { if (propstat.getProp() != null) { List<Element> props = propstat.getProp().getAny(); for (Element element : props) { customPropsMap.put(SardineUtil.toQName(element), element.getTextContent()); } } } return customPropsMap; }
From source file:com.evolveum.midpoint.schema.processor.MidPointSchemaDefinitionFactory.java
private ComplexTypeDefinition createObjectClassDefinition(XSComplexType complexType, PrismContext prismContext, XSAnnotation annotation) throws SchemaException { QName typeName = new QName(complexType.getTargetNamespace(), complexType.getName()); ObjectClassComplexTypeDefinition ocDef = new ObjectClassComplexTypeDefinition(typeName, prismContext); // nativeObjectClass Element nativeAttrElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_NATIVE_OBJECT_CLASS); String nativeObjectClass = nativeAttrElement == null ? null : nativeAttrElement.getTextContent(); ocDef.setNativeObjectClass(nativeObjectClass); ShadowKindType kind = null;/*from ww w. j a va2 s . co m*/ Element kindElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_KIND); if (kindElement != null) { String kindString = kindElement.getTextContent(); if (StringUtils.isEmpty(kindString)) { throw new SchemaException( "The definition of kind is empty in the annotation of object class " + typeName); } try { kind = ShadowKindType.fromValue(kindString); } catch (IllegalArgumentException e) { throw new SchemaException("Definition of unknown kind '" + kindString + "' in the annotation of object class " + typeName); } ocDef.setKind(kind); } Boolean defaultInAKind = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, MidPointConstants.RA_DEFAULT); if (defaultInAKind == null) { ocDef.setDefaultInAKind(false); } else { ocDef.setDefaultInAKind(defaultInAKind); } Boolean auxiliary = SchemaProcessorUtil.getAnnotationBooleanMarker(annotation, MidPointConstants.RA_AUXILIARY); if (auxiliary == null) { ocDef.setAuxiliary(false); } else { ocDef.setAuxiliary(auxiliary); } String intent = null; Element intentElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_INTENT); if (intentElement != null) { intent = intentElement.getTextContent(); if (StringUtils.isEmpty(intent)) { throw new SchemaException( "The definition of intent is empty in the annotation of object class " + typeName); } ocDef.setIntent(intent); } // accountType: DEPRECATED if (isAccountObject(annotation)) { if (kind != null && kind != ShadowKindType.ACCOUNT) { throw new SchemaException( "Conflicting definition of kind and legacy account annotation in the annotation of object class " + typeName); } ocDef.setKind(ShadowKindType.ACCOUNT); Element account = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT); if (account != null && !defaultInAKind) { String defaultValue = account.getAttribute("default"); // Compatibility (DEPRECATED) if (defaultValue != null) { ocDef.setDefaultInAKind(Boolean.parseBoolean(defaultValue)); } } Element accountTypeElement = SchemaProcessorUtil.getAnnotationElement(annotation, MidPointConstants.RA_ACCOUNT_TYPE); if (accountTypeElement != null) { String accountType = accountTypeElement.getTextContent(); if (intent != null && !intent.equals(accountType)) { throw new SchemaException( "Conflicting definition of intent and legacy accountType annotation in the annotation of object class " + typeName); } ocDef.setIntent(accountType); } } return ocDef; }