@Override protected void saveEntry(short position, String licenceId) throws ServiceException { try { Relation relation = getDirectoryRelation(); relation.addOrUpdate( Condition.eq("position", position), new Serializable[]{position, licenceId}); } catch (BrowseException e) { throw new ServiceException(e); } }
@Override public void setReference(String sourceId, int position, String targetId) throws AnalysisException { log.debug("Relation manager: Setting a reference: " + sourceId + ", " + position+ ", " + targetId); Relation refsRelation = getRefsRelation(); Relation dirtyRelation = getDirtyRelation(); try { waitForSource(sourceId); } catch (InterruptedException ex) { throw new AnalysisException(ex); } try { refsRelation.addOrUpdate(getRefsSourcePosCondition(sourceId, position), new Serializable[]{sourceId, position, targetId}); dirtyRelation.addOrUpdate(getDirtySourceCondition(sourceId), new Serializable[]{sourceId}); } catch (NoSuchFieldInRelationException ex) { notifyForSource(sourceId); throw new AnalysisException(ex); } catch (NoSuchRelationException ex) { notifyForSource(sourceId); throw new AnalysisException(ex); } notifyForSource(sourceId); }
@Override public void removeReference(String sourceId, int position) throws AnalysisException { log.debug("Relation manager: Removing a reference: " + sourceId + ", " + position); Relation refsRelation = getRefsRelation(); Relation dirtyRelation = getDirtyRelation(); try { waitForSource(sourceId); } catch (InterruptedException ex) { throw new AnalysisException(ex); } try { refsRelation.delete(getRefsSourcePosCondition(sourceId, position)); dirtyRelation.addOrUpdate(getDirtySourceCondition(sourceId), new Serializable[]{sourceId}); } catch (NoSuchFieldInRelationException ex) { notifyForSource(sourceId); throw new AnalysisException(ex); } catch (NoSuchRelationException ex) { notifyForSource(sourceId); throw new AnalysisException(ex); } notifyForSource(sourceId); }