/** * Create a triple for a new node being created. * * @param oMeetingEvent the event whose data to upload. * @param model the model to add the data to. */ private synchronized void addNode( MeetingEvent oMeetingEvent, com.hp.hpl.jena.rdf.model.Model model) { NodeSummary oNode = oMeetingEvent.getNode(); if (oNode == null) { return; } String sNodeID = oNode.getId(); Resource oResNode = model.createResource(oMeetingEvent.getMeetingID() + "-" + sNodeID); // $NON-NLS-1$ Property type = model.createProperty(RDF_NS, "type"); // $NON-NLS-1$ oResNode.addProperty(type, model.createResource(MEMETIC_NS + "Compendium-Node")); // $NON-NLS-1$ int nNodeType = oNode.getType(); String sTripleStoreString = UINodeTypeManager.getTripleStoreDescription(nNodeType); oResNode.addProperty(type, model.createResource(MEMETIC_NS + sTripleStoreString)); if (nNodeType == ICoreConstants.REFERENCE_SHORTCUT) { oResNode.addProperty( model.createProperty(MEMETIC_NS, "has-reference"), oNode.getSource()); // $NON-NLS-1$ } // ADD LABEL oResNode.addProperty( model.createProperty(MEMETIC_NS, "has-label"), oNode.getLabel()); // $NON-NLS-1$ // ADD IF HAS TRIPLESTORE ID String sOriginalID = oNode.getOriginalID(); if (sOriginalID.startsWith("TS:") && !(nNodeType == ICoreConstants.REFERENCE || nNodeType == ICoreConstants.REFERENCE)) { // $NON-NLS-1$ int ind = sOriginalID.indexOf(":"); // $NON-NLS-1$ sOriginalID = sOriginalID.substring(ind + 1); Property has_original_id = model.createProperty(MEMETIC_NS, "has-original-id"); // $NON-NLS-1$ Resource original_id = model.createResource(sOriginalID); oResNode.addProperty(has_original_id, original_id); } }
public void setValueAt(Object o, int row, int col) { String sAuthor = ProjectCompendium.APP.getModel().getUserProfile().getUserName(); NodePosition np = (NodePosition) nodeData.elementAt(row); NodeSummary node = np.getNode(); switch (col) { case ListTableModel.NUMBER_COLUMN: { if (o instanceof Integer) np.setYPos((((Integer) o).intValue() + 1) * 10); break; } case ListTableModel.LABEL_COLUMN: { String oldLabel = node.getLabel(); String newLabel = (String) o; if (!oldLabel.equals(newLabel)) { try { node.setLabel(newLabel, sAuthor); } catch (Exception ex) { ProjectCompendium.APP.displayError( "Error: (ListTableModel.setValueAt)\n\n" + //$NON-NLS-1$ LanguageProperties.getString( LanguageProperties.UI_GENERAL_BUNDLE, "ListTableModel.errorLabel") + //$NON-NLS-1$ ": " + oldLabel + "\n\n" + ex.getMessage()); // $NON-NLS-1$ //$NON-NLS-2$ } } break; } } }
public Object getValueAt(int row, int col) { if (nodeData == null) { return null; } if (row >= nodeData.size()) { return null; } NodePosition np = (NodePosition) nodeData.elementAt(row); if (np != null) { NodeSummary node = np.getNode(); if (node != null) { switch (col) { case ListTableModel.NUMBER_COLUMN: { return new Integer(row); } case ListTableModel.IMAGE_COLUMN: { if (node.getType() == ICoreConstants.REFERENCE) { return UINode.getReferenceImageSmall(node.getSource()); } else { return UINode.getNodeImageSmall(node.getType()); } } case ListTableModel.TAGS_COLUMN: { if (node.getCodeCount() > 0) { return "T"; //$NON-NLS-1$ } else { return ""; //$NON-NLS-1$ } } case ListTableModel.VIEWS_COLUMN: { int count = node.getViewCount(); if (count == 0) { node.updateMultipleViews(); count = node.getViewCount(); } return new Integer(count); } case ListTableModel.DETAIL_COLUMN: { String sDetail = node.getDetail(); sDetail = sDetail.trim(); if (!sDetail.equals("") && !sDetail.equals(ICoreConstants.NODETAIL_STRING)) { // $NON-NLS-1$ return "*"; //$NON-NLS-1$ } else { return ""; //$NON-NLS-1$ } } case ListTableModel.WEIGHT_COLUMN: { if (node instanceof View) { View view = (View) node; int count = 0; try { count = view.getNodeCount(); } catch (Exception e) { } return new Integer(count); } return null; } case ListTableModel.LABEL_COLUMN: { return node.getLabel(); } case ListTableModel.CREATION_DATE_COLUMN: { return node.getCreationDate(); } case ListTableModel.MODIFICATION_DATE_COLUMN: { return node.getModificationDate(); } case ListTableModel.ID_COLUMN: { return node.getId(); } case ListTableModel.AUTHOR_COLUMN: { return node.getAuthor(); } default: return null; } } } return null; }