CPD Results

The following document contains the results of PMD's CPD 5.6.1.

Duplications

File Project Line
org/universAAL/utilities/api/ui/low/Dialog.java universAAL Utilities APIs 178
org/universAAL/utilities/api/ui/low/SubDialog.java universAAL Utilities APIs 139
		props.put(PROP_DIALOG_FORM, Form.newDialog(title, root));
		props.put(PROP_DIALOG_PRIORITY, priority);
		props.put(PROP_DIALOG_LANGUAGE, Locale.getDefault());
		props.put(PROP_DIALOG_PRIVACY_LEVEL, privacy);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.universAAL.utilities.api.ui.IContainer#add(org.universAAL.samples.ui.
	 * utils.SimpleControl)
	 */
	public String[] add(Control ctrl) {
		return ctrl.create(getDialogForm().getIOControls());
	}

	/**
	 * Add a Submit Form Control to the Submit group of the Dialog. Submit group
	 * is for Submits that end the dialog or lead to new dialogs.
	 *
	 * @param ctrl
	 *            The Submit to add
	 * @return The String representing the ID to be used to identify the Submit
	 *         in the response.
	 */
	public String addSubmit(SubmitCmd ctrl) {
		String[] ref = ctrl.create(getDialogForm().getSubmits());
		return ref[ref.length - 1];
	}

	/**
	 * Add a hidden object so it is sent within the UI request, but not shown to
	 * the user. When the UI response is being handled by the UI caller, this
	 * hidden input can be retrieved by calling
	 * <code>uiresponse.getUserInput(new String[]{ref});</code> , being
	 * <code>ref</code> the one you used in this method.
	 *
	 * @param ref
	 *            The reference you will use to access the hidden object later
	 *            from the response
	 * @param hidden
	 *            The object you want to hide
	 */
	public void addHidden(String ref, Object hidden) {
		this.getDialogForm().getData().setPropertyPath(new String[] { ref }, hidden);
	}

	/**
	 * Add an extra property to the form used in this UI request. Extra
	 * properties may be used by I/O Handlers to allow the developer to
	 * fine-tune things like the layout. The equivalent in native API is to call
	 * setProperty() on a Form object. Use this only as recommended by the
	 * Handler you intend to use, since it is the Handler the one who will
	 * interpret the property.
	 *
	 * @param property
	 *            The property of a Form that a certain Handler will inspect for
	 *            its own purposes.
	 * @param extra
	 *            The value to be set into the property.
	 */
	public void addExtra(String property, Object extra) {
		this.getDialogForm().setProperty(property, extra);
	}

}
File Project Line
org/universAAL/utilities/api/ui/low/Dialog.java universAAL Utilities APIs 178
org/universAAL/utilities/api/ui/low/Message.java universAAL Utilities APIs 125
org/universAAL/utilities/api/ui/low/SubDialog.java universAAL Utilities APIs 139
		props.put(PROP_DIALOG_FORM, Form.newDialog(title, root));
		props.put(PROP_DIALOG_PRIORITY, priority);
		props.put(PROP_DIALOG_LANGUAGE, Locale.getDefault());
		props.put(PROP_DIALOG_PRIVACY_LEVEL, privacy);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see
	 * org.universAAL.utilities.api.ui.IContainer#add(org.universAAL.samples.ui.
	 * utils.SimpleControl)
	 */
	public String[] add(Control ctrl) {
		return ctrl.create(getDialogForm().getIOControls());
	}

	/**
	 * Add a Submit Form Control to the Submit group of the Dialog. Submit group
	 * is for Submits that end the dialog or lead to new dialogs.
	 *
	 * @param ctrl
	 *            The Submit to add
	 * @return The String representing the ID to be used to identify the Submit
	 *         in the response.
	 */
	public String addSubmit(SubmitCmd ctrl) {
		String[] ref = ctrl.create(getDialogForm().getSubmits());
		return ref[ref.length - 1];
	}

	/**
	 * Add a hidden object so it is sent within the UI request, but not shown to
	 * the user. When the UI response is being handled by the UI caller, this
	 * hidden input can be retrieved by calling
	 * <code>uiresponse.getUserInput(new String[]{ref});</code> , being
	 * <code>ref</code> the one you used in this method.
	 *
	 * @param ref
	 *            The reference you will use to access the hidden object later
	 *            from the response
	 * @param hidden
	 *            The object you want to hide
	 */
	public void addHidden(String ref, Object hidden) {
		this.getDialogForm().getData().setPropertyPath(new String[] { ref }, hidden);
	}
File Project Line
org/universAAL/utilities/api/context/Pattern.java universAAL Utilities APIs 154
org/universAAL/utilities/api/context/Pattern.java universAAL Utilities APIs 196
	public Pattern(ManagedIndividual subj, String predicate, String objTypeURI) {
		super();
		if (subj != null) {
			String uri = ManagedIndividual.getTypeURI(subj);
			if (uri != null && Resource.isQualifiedName(uri)) {
				this.addRestriction(MergedRestriction.getFixedValueRestriction(ContextEvent.PROP_RDF_SUBJECT, subj));
			} else {
				System.out.println(MSG_INST);
			}
		}
		if (predicate != null) {
			if (Resource.isQualifiedName(predicate)) {
				this.addRestriction(
						MergedRestriction.getFixedValueRestriction(ContextEvent.PROP_RDF_PREDICATE, predicate));
			} else {
				System.out.println(MSG_PRED);
			}
		}
		if (objTypeURI != null) {
File Project Line
org/universAAL/utilities/api/context/Pattern.java universAAL Utilities APIs 120
org/universAAL/utilities/api/context/Pattern.java universAAL Utilities APIs 203
				System.out.println(MSG_STR);
			}
		}
		if (predicate != null) {
			if (Resource.isQualifiedName(predicate)) {
				this.addRestriction(
						MergedRestriction.getFixedValueRestriction(ContextEvent.PROP_RDF_PREDICATE, predicate));
			} else {
				System.out.println(MSG_PRED);
			}
		}
		if (obj != null) {
			String uri = ManagedIndividual.getTypeURI(obj);
			if (uri != null && Resource.isQualifiedName(uri)) {
				this.addRestriction(MergedRestriction.getFixedValueRestriction(ContextEvent.PROP_RDF_OBJECT, obj));
			} else {
				System.out.println(MSG_INST);
			}
		}
	}
File Project Line
org/universAAL/utilities/api/service/Add.java universAAL Utilities APIs 71
org/universAAL/utilities/api/service/Change.java universAAL Utilities APIs 70
org/universAAL/utilities/api/service/Remove.java universAAL Utilities APIs 70
org/universAAL/utilities/api/service/Variable.java universAAL Utilities APIs 73
	public Add(String byTypeURI) {
		this.isByURI = true;
		this.uri = byTypeURI;
		this.value = Resource.getResource(byTypeURI, Resource.generateAnonURI());
		if (this.value == null) {
			if (TypeMapper.isRegisteredDatatypeURI(byTypeURI)) {
				this.value = createEmptyInstance(byTypeURI);
			} else {
				// An arbitrary String, not an URI, intended use is like byValue
				this.isByURI = false;
				this.uri = TypeMapper.getDatatypeURI(String.class);
				this.value = byTypeURI;
			}
		}
	}

	/**
	 * This is only supposed to be used internally.
	 *
	 * @return The actual value of the value to add
	 */
	public Object getObject() {
		return value;
	}

	/**
	 * This is only supposed to be used internally.
	 *
	 * @return The type URI of the value to add
	 */
	public String getURI() {
		return uri;
	}

}
File Project Line
org/universAAL/utilities/api/service/mid/UtilActuator.java universAAL Utilities APIs 129
org/universAAL/utilities/api/service/mid/UtilSensor.java universAAL Utilities APIs 117
		MergedRestriction r = MergedRestriction.getFixedValueRestriction(DeviceService.PROP_CONTROLS, actuator);

		Service getOnOff = (Service) OntologyManagement.getInstance().getResource(ontologyURI,
				namespace + SERVICE_GET_ON_OFF);
		profiles[0] = getOnOff.getProfile();
		ProcessOutput output = new ProcessOutput(namespace + OUT_GET_ON_OFF);
		output.setCardinality(1, 1);
		profiles[0].addOutput(output);
		profiles[0].addSimpleOutputBinding(output, ppath.getThePath());
		profiles[0].addInput(input);
		profiles[0].getTheService().addInstanceLevelRestriction(r, new String[] { DeviceService.PROP_CONTROLS });
File Project Line
org/universAAL/utilities/api/ui/SubmitCmd.java universAAL Utilities APIs 119
org/universAAL/utilities/api/ui/TriggerCmd.java universAAL Utilities APIs 95
		Submit sub = new Submit(group, label, ref.getLastPathElement());
		if (confirmMessage != null) {
			switch (confirmType) {
			case Submit.CONFIRMATION_TYPE_OK_CANCEL:
				sub.setConfirmationOkCancel(confirmMessage);
				break;
			case Submit.CONFIRMATION_TYPE_YES_NO:
				sub.setConfirmationYesNo(confirmMessage);
				break;
			default:
				sub.setConfirmationOkCancel(confirmMessage);
				break;
			}
		}
		if (!l.isEmpty()) {
			Iterator iter = l.iterator();
			while (iter.hasNext()) {
				sub.addMandatoryInput((Input) iter.next());
			}
		}
		if (h != null) {