public PropertyEntry(OntologyProperty property) { this.property = property; if (StringUtils.isNotEmpty(property.getDescription())) { label = property.getDescription(); } else { label = property.getName() + "_of_" + getIndividualPatternRoleName(); } }
@Override public boolean isValid() { if (getFocusedObject() == null) { return false; } switch (primaryChoice) { case CHOOSE_EXISTING_EDITION_PATTERN: return getEditionPattern() != null && getPatternRole() != null; case CREATES_EDITION_PATTERN: switch (patternChoice) { case MAP_SINGLE_INDIVIDUAL: return StringUtils.isNotEmpty(getEditionPatternName()) && concept != null && StringUtils.isNotEmpty(getIndividualPatternRoleName()) && StringUtils.isNotEmpty(getConnectorPatternRoleName()) && fromEditionPattern != null && toEditionPattern != null && StringUtils.isNotEmpty(getLinkSchemeName()); case BLANK_EDITION_PATTERN: return StringUtils.isNotEmpty(getEditionPatternName()) && StringUtils.isNotEmpty(getConnectorPatternRoleName()) && fromEditionPattern != null && toEditionPattern != null && StringUtils.isNotEmpty(getLinkSchemeName()); default: break; } default: return false; } }
public String getLinkSchemeName() { if (StringUtils.isEmpty(linkSchemeName)) { return "link" + (fromEditionPattern != null ? fromEditionPattern.getName() : "") + "To" + (toEditionPattern != null ? toEditionPattern.getName() : ""); } return linkSchemeName; }
private CGTemplateFolder retrieveFolder(String folderPath) { if (StringUtils.isEmpty(folderPath)) { return getRootFolder(); } StringTokenizer st = new StringTokenizer(folderPath, "/" + File.separator); CGTemplateFolder current = getRootFolder(); while (st.hasMoreElements()) { String next = st.nextToken(); if (current.getFolder(next) == null) { CGTemplateFolder newFolder = new CGTemplateFolder(this, next); current.dirs.add(newFolder); current = newFolder; } else { current = current.getFolder(next); } } return current; }
@Override public ValidationIssue<FIBModelObjectShouldHaveAUniqueName, FIBModelObject> applyValidation( FIBModelObject object) { if (StringUtils.isNotEmpty(object.getName())) { List<FIBModelObject> allObjectsWithThatName = object.getObjectsWithName(object.getName()); if (allObjectsWithThatName.size() > 1) { allObjectsWithThatName.remove(object); GenerateUniqueName fixProposal = new GenerateUniqueName(); ProblemIssue<FIBModelObjectShouldHaveAUniqueName, FIBModelObject> returned; if (object instanceof FIBWidget && ((FIBWidget) object).getManageDynamicModel()) { returned = new ValidationError<FIBModelObjectShouldHaveAUniqueName, FIBModelObject>( this, object, "object_($object.toString)_has_duplicated_name", fixProposal); } else { returned = new ValidationWarning<FIBModelObjectShouldHaveAUniqueName, FIBModelObject>( this, object, "object_($object.toString)_has_duplicated_name", fixProposal); } returned.addToRelatedValidableObjects(allObjectsWithThatName); return returned; } } return null; }
public String getLabel() { if (label == null || StringUtils.isEmpty(label)) { return getName(); } return label; }
public String getConnectorPatternRoleName() { if (StringUtils.isEmpty(connectorPatternRoleName)) { return "connector"; } return connectorPatternRoleName; }
public String getIndividualPatternRoleName() { if (StringUtils.isEmpty(individualPatternRoleName) && concept != null) { return JavaUtils.getVariableName(concept.getName()); } return individualPatternRoleName; }
public String getEditionPatternName() { if (StringUtils.isEmpty(editionPatternName) && concept != null) { return concept.getName(); } return editionPatternName; }
protected void updateDependancies() { if (getOwner() instanceof FIBComponent) { if (binding == null) { return; } Vector<Expression> primitives; try { primitives = Expression.extractPrimitives(binding.getStringRepresentation()); FIBComponent component = (FIBComponent) getOwner(); FIBComponent rootComponent = component.getRootComponent(); Iterator<FIBComponent> subComponents = rootComponent.subComponentIterator(); while (subComponents.hasNext()) { FIBComponent next = subComponents.next(); if (next != getOwner()) { if (next instanceof FIBWidget && ((FIBWidget) next).getData() != null && ((FIBWidget) next).getData().isSet()) { String data = ((FIBWidget) next).getData().toString(); if (data != null) { for (Expression p : primitives) { String primitiveValue = null; if (p instanceof Variable) { primitiveValue = ((Variable) p).getName(); } if (p instanceof Function) { primitiveValue = ((Function) p).getName(); } if (primitiveValue != null && primitiveValue.startsWith(data)) { try { component.declareDependantOf(next); } catch (DependancyLoopException e) { logger.warning( "DependancyLoopException raised while declaring dependancy (data lookup)" + "in the context of binding: " + binding.getStringRepresentation() + " primitive: " + primitiveValue + " component: " + component + " dependancy: " + next + " data: " + data + " message: " + e.getMessage()); } } } } } if (next.getName() != null) { for (Expression p : primitives) { String primitiveValue = null; if (p instanceof Variable) { primitiveValue = ((Variable) p).getName(); } if (p instanceof Function) { primitiveValue = ((Function) p).getName(); } if (primitiveValue != null && StringUtils.isNotEmpty(next.getName()) && primitiveValue.startsWith(next.getName())) { try { component.declareDependantOf(next); } catch (DependancyLoopException e) { logger.warning( "DependancyLoopException raised while declaring dependancy (name lookup)" + "in the context of binding: " + binding.getStringRepresentation() + " primitive: " + primitiveValue + " component: " + component + " dependancy: " + next + " message: " + e.getMessage()); } } } } } } } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TypeMismatchException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }