rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
customize(item, event); | protected ContainerHistoryItem createItem(final AuditEvent event) { final ContainerHistoryItem item = new ContainerHistoryItem(); item.setContainerId(event.getArtifactId()); if(event instanceof AuditVersionEvent) item.setVersionId(((AuditVersionEvent) event).getArtifactVersionId()); return item; } |
|
public void run() { window.open(avatar); } | public void run() { status.clearStatusMessage(area); } | public void run() { window.open(avatar); } |
public void run() { status.clearStatusMessage(area); } | public void run() { invoke(ActionId.PUBLISH_DOCUMENT, data); } | public void run() { status.clearStatusMessage(area); } |
final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { | final UUID uniqueId, final Long versionId) { | public List<DocumentVersion> readArchiveDocumentVersions(final JabberId userId, final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { synchronized (getImplLock()) { return getImpl().readArchiveDocumentVersions(userId, uniqueId, versionId, documentUniqueId); } } |
versionId, documentUniqueId); | versionId); | public List<DocumentVersion> readArchiveDocumentVersions(final JabberId userId, final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { synchronized (getImplLock()) { return getImpl().readArchiveDocumentVersions(userId, uniqueId, versionId, documentUniqueId); } } |
final SystemMessageModel systemMessageModel) { | final SystemMessageModel systemMessageModel, final JabberId loggedInUserId) { | public MainProvider(final ArtifactModel artifactModel, final DocumentModel dModel, final SessionModel sModel, final SystemMessageModel systemMessageModel) { super(); this.documentProvider = new SingleContentProvider() { public Object getElement(final Object input) { final Long documentId = (Long) input; try { final Document document = dModel.get(documentId); return toDisplay(document, artifactModel); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.documentsProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { // sort by: // +> remote update ? later b4 earlier // +> last update ? later b4 earlier final AbstractArtifactComparator sort = new RemoteUpdatedOnComparator(Boolean.FALSE); sort.add(new UpdatedOnComparator(Boolean.FALSE)); return toDisplay(dModel.list(sort), artifactModel); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.historyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { final MainCellDocument mcd = (MainCellDocument) input; try { return toDisplay(sModel, mcd, dModel.readHistory(mcd.getId())); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.systemMessageProvider = new SingleContentProvider() { public Object getElement(final Object input) { final Long systemMessageId = assertNotNullLong( "The main provider's system message provider " + "requires non-null java.lang.Long input.", input); final SystemMessage systemMessage; try { systemMessage = systemMessageModel.read(systemMessageId); } catch(final ParityException px) { throw new RuntimeException(px); } switch(systemMessage.getType()) { case INFO: case CONTACT_INVITATION: case CONTACT_INVITATION_RESPONSE: return systemMessage; case KEY_REQUEST: case KEY_RESPONSE: return null; default: throw Assert.createUnreachable("Unknown message type: " + systemMessage.getType()); } } }; this.systemMessagesProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.readForNonArtifacts(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.flatProviders = new FlatContentProvider[] {documentsProvider, historyProvider, systemMessagesProvider}; this.singleProviders = new SingleContentProvider[] {documentProvider, systemMessageProvider}; } |
try { return toDisplay(sModel, mcd, dModel.readHistory(mcd.getId())); } | try { return toDisplay(sModel, loggedInUserId, mcd, dModel.readHistory(mcd.getId())); } | public MainProvider(final ArtifactModel artifactModel, final DocumentModel dModel, final SessionModel sModel, final SystemMessageModel systemMessageModel) { super(); this.documentProvider = new SingleContentProvider() { public Object getElement(final Object input) { final Long documentId = (Long) input; try { final Document document = dModel.get(documentId); return toDisplay(document, artifactModel); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.documentsProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { // sort by: // +> remote update ? later b4 earlier // +> last update ? later b4 earlier final AbstractArtifactComparator sort = new RemoteUpdatedOnComparator(Boolean.FALSE); sort.add(new UpdatedOnComparator(Boolean.FALSE)); return toDisplay(dModel.list(sort), artifactModel); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.historyProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { final MainCellDocument mcd = (MainCellDocument) input; try { return toDisplay(sModel, mcd, dModel.readHistory(mcd.getId())); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.systemMessageProvider = new SingleContentProvider() { public Object getElement(final Object input) { final Long systemMessageId = assertNotNullLong( "The main provider's system message provider " + "requires non-null java.lang.Long input.", input); final SystemMessage systemMessage; try { systemMessage = systemMessageModel.read(systemMessageId); } catch(final ParityException px) { throw new RuntimeException(px); } switch(systemMessage.getType()) { case INFO: case CONTACT_INVITATION: case CONTACT_INVITATION_RESPONSE: return systemMessage; case KEY_REQUEST: case KEY_RESPONSE: return null; default: throw Assert.createUnreachable("Unknown message type: " + systemMessage.getType()); } } }; this.systemMessagesProvider = new FlatContentProvider() { public Object[] getElements(final Object input) { try { final Collection<SystemMessage> messages = systemMessageModel.readForNonArtifacts(); return messages.toArray(new SystemMessage[] {}); } catch(final ParityException px) { throw new RuntimeException(px); } } }; this.flatProviders = new FlatContentProvider[] {documentsProvider, historyProvider, systemMessagesProvider}; this.singleProviders = new SingleContentProvider[] {documentProvider, systemMessageProvider}; } |
try { return toDisplay(sModel, mcd, dModel.readHistory(mcd.getId())); } | try { return toDisplay(sModel, loggedInUserId, mcd, dModel.readHistory(mcd.getId())); } | public Object[] getElements(final Object input) { final MainCellDocument mcd = (MainCellDocument) input; try { return toDisplay(sModel, mcd, dModel.readHistory(mcd.getId())); } catch(final ParityException px) { throw new RuntimeException(px); } } |
jPopupMenu.add(new DeclineAllKeyRequests(application)); | private void triggerOnline(final Browser application, final JPopupMenu jPopupMenu, final MouseEvent e) { if(document.isUrgent()) { final List<KeyRequest> keyRequests = document.getKeyRequests(); if(keyRequests.size() >= 1) { final Set<JabberId> requestedBySet = new HashSet<JabberId>(); for(final KeyRequest keyRequest : keyRequests) { // if a single user has requested more than once; we only // display one menu item. if(!requestedBySet.contains(keyRequest.getRequestedBy())) { jPopupMenu.add(new AcceptKeyRequest(application, keyRequest.getId(), keyRequest.getRequestedByName())); requestedBySet.add(keyRequest.getRequestedBy()); } } jPopupMenu.addSeparator(); jPopupMenu.add(new DeclineAllKeyRequests(application)); } } jPopupMenu.add(new Open(application)); jPopupMenu.add(new AddNewTeamMember(application)); if(document.isKeyHolder()) { if(!document.isWorkingVersionEqual()) jPopupMenu.add(new Publish(application)); final Set<User> team = document.getTeam(); System.out.println("[LBROWSER] [APPLICATION] [BROWSER] [DISPLAY] [AVATAR] [POPUP DOCUMENT] [TRIGGER ONLINE] [TEAM SIZE] [" + team.size() + "]"); if(0 < team.size()) { final JMenu jMenu = MenuFactory.create(getString("SendKey")); for(final User teamMember : team) jMenu.add(new SendKey(application, teamMember)); jPopupMenu.add(jMenu); } } else { jPopupMenu.add(new RequestKey(application)); } jPopupMenu.add(new Close(application)); jPopupMenu.addSeparator(); jPopupMenu.add(new Delete(application)); // DEBUG Document Menu Options if(e.isShiftDown()) { final Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); final ActionListener debugActionListener = new ActionListener() { public void actionPerformed(final ActionEvent e) { final StringSelection stringSelection = new StringSelection(((JComponent) e.getSource()).getClientProperty("COPY_ME").toString()); systemClipboard.setContents(stringSelection, null); } }; final JMenuItem idJMenuItem = new JMenuItem("Id - " + document.getId()); idJMenuItem.putClientProperty("COPY_ME", document.getId()); idJMenuItem.addActionListener(debugActionListener); final JMenuItem uidJMenuItem = new JMenuItem("Unique id - " + document.getUniqueId()); uidJMenuItem.putClientProperty("COPY_ME", document.getUniqueId()); uidJMenuItem.addActionListener(debugActionListener); jPopupMenu.addSeparator(); jPopupMenu.add(idJMenuItem); jPopupMenu.add(uidJMenuItem); } } |
|
g.setColor(new Color((float) 0.0, (float) 0.0, (float) 0.0, (float) 0.01)); | if (firstFrame) { firstFrame = false; g.setColor(getBackground()); g.fillRect(0, 0, d.width, d.height); } g.setColor(new Color((float) 0.0, (float) 0.0, (float) 0.0, (float) 0.01)); | public void paintComponent(Graphics g) { int earthRadius = 50; Dimension d = getSize(); g.setColor(new Color((float) 0.0, (float) 0.0, (float) 0.0, (float) 0.01)); // g.setColor(Color.black); g.fillRect(0, 0, d.width, d.height); g.setColor(getForeground()); g.drawOval((d.width - earthRadius) / 2, (d.height - earthRadius) / 2, earthRadius, earthRadius); /* for (int i = earthRadius * 2; i < d.width; i += 25) { g.drawOval((d.width - i) / 2, (d.height - i) / 2, i, i); } */ synchronized (particles) { Iterator<Entry<String, Particle>> i = particles.entrySet() .iterator(); while (i.hasNext()) { Entry<String, Particle> e = i.next(); Particle p = e.getValue(); if (!p.crashed()) drawParticle(g, p); } } Iterator<Entry<String, Attractor>> j = attractors.entrySet().iterator(); g.setColor(getForeground()); while (j.hasNext()) { Entry<String, Attractor> e = j.next(); Point2d p = e.getValue().location.toCartesianPoint(); p.add(new Point2d(d.width / 2, d.height / 2)); int x = new Double(p.x).intValue(); int y = new Double(p.y).intValue(); g.drawOval(x - 5, y - 5, 10, 10); g.drawString(e.getKey(), x + 15, y); } g.drawString("Number of particles: " + particles.size(), 15, 15); g.drawString("Frame: " + frame, 15, 30); } |
g.setColor(Color.black); g.fillRect(0, 0, 200, 45); g.setColor(getForeground()); | public void paintComponent(Graphics g) { int earthRadius = 50; Dimension d = getSize(); g.setColor(new Color((float) 0.0, (float) 0.0, (float) 0.0, (float) 0.01)); // g.setColor(Color.black); g.fillRect(0, 0, d.width, d.height); g.setColor(getForeground()); g.drawOval((d.width - earthRadius) / 2, (d.height - earthRadius) / 2, earthRadius, earthRadius); /* for (int i = earthRadius * 2; i < d.width; i += 25) { g.drawOval((d.width - i) / 2, (d.height - i) / 2, i, i); } */ synchronized (particles) { Iterator<Entry<String, Particle>> i = particles.entrySet() .iterator(); while (i.hasNext()) { Entry<String, Particle> e = i.next(); Particle p = e.getValue(); if (!p.crashed()) drawParticle(g, p); } } Iterator<Entry<String, Attractor>> j = attractors.entrySet().iterator(); g.setColor(getForeground()); while (j.hasNext()) { Entry<String, Attractor> e = j.next(); Point2d p = e.getValue().location.toCartesianPoint(); p.add(new Point2d(d.width / 2, d.height / 2)); int x = new Double(p.x).intValue(); int y = new Double(p.y).intValue(); g.drawOval(x - 5, y - 5, 10, 10); g.drawString(e.getKey(), x + 15, y); } g.drawString("Number of particles: " + particles.size(), 15, 15); g.drawString("Frame: " + frame, 15, 30); } |
|
return getProperty(keyIdentifier); | return getStringProperty(keyIdentifier); | public String getID() { return getProperty(keyIdentifier); } |
velocity.r = 40.0 + Math.random(); | public void launch() { velocity.theta = -2.0; velocity.r = 40.0 + Math.random(); accel.theta = 0.5; accel.r = -7.5 - Math.random(); state = STATE_LAUNCH; } |
|
accel.theta = 0.5; | accel.theta = 0.75; | public void launch() { velocity.theta = -2.0; velocity.r = 40.0 + Math.random(); accel.theta = 0.5; accel.r = -7.5 - Math.random(); state = STATE_LAUNCH; } |
setVelocityEngine(velocity); | protected void initVelocity(ServletConfig config) throws ServletException { velocity = new VelocityEngine(); // register this engine to be the default handler of log messages // if the user points commons-logging to the LogSystemCommonsLog LogSystemCommonsLog.setVelocityEngine(velocity); velocity.setApplicationAttribute(SERVLET_CONTEXT_KEY, getServletContext()); // default to servletlogger, which logs to the servlet engines log velocity.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, ServletLogger.class.getName()); // by default, load resources with webapp resource loader velocity.setProperty(RuntimeConstants.RESOURCE_LOADER, "webapp"); velocity.setProperty("webapp.resource.loader.class", WebappLoader.class.getName()); // Try reading an overriding Velocity configuration try { ExtendedProperties p = loadConfiguration(config); velocity.setExtendedProperties(p); } catch(Exception e) { getServletContext().log("VelocityViewServlet: Unable to read Velocity configuration file: "+e); getServletContext().log("VelocityViewServlet: Using default Velocity configuration."); } // now all is ready - init Velocity try { velocity.init(); } catch(Exception e) { getServletContext().log("VelocityViewServlet: PANIC! unable to init() - "+e); throw new ServletException(e); } } |
|
ASSERT_USERNAME_EQUALS_PREFS, | formatAssertUsernameEqualsPreferences(username), | void login(final String username, final String password) throws ParityException { logger.info("login(String,String)"); logger.debug(username); logger.debug(mask(password)); final String host = preferences.getServerHost(); final Integer port = preferences.getServerPort(); synchronized(xmppHelperLock) { try { // check that the preferences username matches the username // supplied if(preferences.isSetUsername()) { Assert.assertTrue( ASSERT_USERNAME_EQUALS_PREFS, username.equals(preferences.getUsername())); } // login xmppHelper.login(host, port, username, password); // set the username@host in the preferences if(!preferences.isSetUsername()) { preferences.setUsername(username); } } catch(SmackException sx) { logger.error("login(String,String)", sx); throw ParityErrorTranslator.translate(sx); } catch(RuntimeException rx) { logger.error("login(String,String)", rx); throw ParityErrorTranslator.translate(rx); } } } |
this.auditor = new ArtifactModelAuditor(getContext()); | ArtifactModelImpl(final Workspace workspace) { super(workspace); this.artifactIO = IOFactory.getDefault().createArtifactHandler(); } |
|
bootstrapLogging(); | bootstrapLog4J(); | public WorkspaceImpl(final File workspace) { super(); this.logger = Logger.getLogger(getClass()); this.mode = Mode.valueOf(System.getProperty("thinkparity.mode")); this.workspace = initRoot(workspace); bootstrapLogging(); } |
private ConfirmDialog() { super("ConfirmDialog"); | public ConfirmDialog() { super("ConfirmDialog", BrowserConstants.DIALOGUE_BACKGROUND); | private ConfirmDialog() { super("ConfirmDialog"); initComponents(); } |
this.logger = new Log4JWrapper(); | this.logger = new Log4JWrapper(StackUtil.getCallerClassName()); | protected AbstractXMPP(final XMPPCore xmppCore) { super(); this.listeners = new ArrayList<T>(); this.logger = new Log4JWrapper(); this.xmppCore = xmppCore; this.xstream = new XStream(); } |
logger.logTraceId(); | protected boolean addListener(final T listener) { synchronized (listeners) { if (listeners.contains(listener)) { return false; } else { return listeners.add(listener); } } } |
|
logger.logApiId(); | protected void clearListeners() { synchronized (listeners) { listeners.clear(); } } |
|
notifier.notifyListener(listener); | try { notifier.notifyListener(listener); } catch (final Throwable t) { logger.logError(t, "Could not handle remote event {0} for listener {1}.", notifier, listener); } | protected void notifyListeners(final EventNotifier<T> notifier) { synchronized (listeners) { for (final T listener : listeners) { notifier.notifyListener(listener); } } } |
logger.logTraceId(); | protected void notifyListeners(final EventNotifier<T> notifier) { synchronized (listeners) { for (final T listener : listeners) { notifier.notifyListener(listener); } } } |
|
logger.logTraceId(); | protected boolean removeListener(final T listener) { synchronized (listeners) { if (listeners.contains(listener)) { return listeners.remove(listener); } else { return false; } } } |
|
public AirBrush(String plugname, String hostname, Integer port) { connect(plugname, hostname, port); | public AirBrush() { | public AirBrush(String plugname, String hostname, Integer port) { connect(plugname, hostname, port); } |
logVariable("teamIds", readTeamIds(readUUID("uniqueId"))); | logger.logVariable("teamIds", readTeamIds(readUUID("uniqueId"))); | public void service() { logApiId(); final List<JabberId> teamIds = logVariable("teamIds", readTeamIds(readUUID("uniqueId"))); writeJabberIds("teamIds", "teamIds", teamIds); } |
if(isTestMode()) { | if(getController().isFilterEnabled()) { infoJLabel.setText(getString("Info.FilterOn")); } else if(isTestMode()) { | private void reloadInfo() { infoJLabel.setText(getString("Info.Empty")); if(isTestMode()) { final Contact contact = getContact(); final Object[] infoParityUserArguments = new Object[] { contact.getFirstName(), contact.getLastName(), contact.getOrganization() }; final StringBuffer buffer = new StringBuffer(getString("Info.Contact", infoParityUserArguments)) .append(infoJLabel.getText()); infoJLabel.setText(buffer.toString()); } } |
session.setCalendar(5, createdOn); | session.setCalendar(6, createdOn); | private Long insertTestDataLibrary(final HypersonicSession session, final Library.Type type, final String groupId, final String artifactId, final String version, final String path, final Calendar createdOn, final byte[] bytes) { session.prepareStatement(INSERT_TEST_DATA_LIBRARY); session.setTypeAsInteger(1, type); session.setString(2, groupId); session.setString(3, artifactId); session.setString(4, version); session.setString(5, path); session.setCalendar(5, createdOn); if(1 != session.executeUpdate()) throw new HypersonicException("[RMIGRATOR] [IO] [UTIL] [HYPERSONIC MIGRATOR] [CANNOT INSERT LIBRARY TEST DATA]"); final Long libraryId = session.getIdentity(); session.prepareStatement(INSERT_TEST_DATA_LIBRARY_BYTES); session.setLong(1, libraryId); session.setBytes(2, bytes); session.setString(3, ChecksumUtil.md5Hex(bytes)); if(1 != session.executeUpdate()) throw new HypersonicException("[RMIGRATOR] [IO] [UTIL] [HYPERSONIC MIGRATOR] [CANNOT INSERT LIBRARY BYTES TEST DATA"); return libraryId; } |
nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); | fillTopJLabel = new javax.swing.JLabel(); fillRightJLabel = new javax.swing.JLabel(); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
|
contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
|
nameJLabel.setFont(Fonts.DefaultFontBold); | fillTopJLabel.setFont(Fonts.DefaultFontBold); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
add(nameJLabel, gridBagConstraints); | add(fillTopJLabel, gridBagConstraints); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); | fillRightJLabel.setFont(Fonts.DefaultFontBold); fillRightJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillRightJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillRightJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
add(fillJLabel, gridBagConstraints); | add(fillRightJLabel, gridBagConstraints); | private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; containerJLabel = createTab(TabId.CONTAINER, Boolean.TRUE).jLabel; contactJLabel = createTab(TabId.CONTACT, Boolean.FALSE).jLabel; nameJLabel = new javax.swing.JLabel(); fillJLabel = new javax.swing.JLabel(); setLayout(new java.awt.GridBagLayout()); setOpaque(false); containerJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_LeftmostTabSelected.png"))); containerJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); containerJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); containerJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; add(containerJLabel, gridBagConstraints); contactJLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/BrowserTitle_Tab.png"))); contactJLabel.setMaximumSize(new java.awt.Dimension(76, 25)); contactJLabel.setMinimumSize(new java.awt.Dimension(76, 25)); contactJLabel.setPreferredSize(new java.awt.Dimension(76, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.insets = new java.awt.Insets(0, 1, 0, 0); add(contactJLabel, gridBagConstraints); nameJLabel.setFont(Fonts.DefaultFontBold); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(0, 6, 2, 0); add(nameJLabel, gridBagConstraints); fillJLabel.setFont(Fonts.DefaultFontBold); fillJLabel.setMaximumSize(new java.awt.Dimension(100, 18)); fillJLabel.setMinimumSize(new java.awt.Dimension(100, 18)); fillJLabel.setPreferredSize(new java.awt.Dimension(100, 18)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; gridBagConstraints.weightx = 1.0; add(fillJLabel, gridBagConstraints); }// </editor-fold>//GEN-END:initComponents |
reloadDisplayTab(); reloadDisplayName(); | for (final Tab tab : pluginTabs.values()) { tab.jLabel.setIcon(getTabIcon(selectedTab.isLeftmost(), Boolean.FALSE, Boolean.FALSE)); } for (final Tab tab : allTabs.values()) { tab.jLabel.setIcon(getTabIcon(selectedTab.isLeftmost(), Boolean.FALSE, Boolean.FALSE)); } selectedTab.jLabel.setIcon(getTabIcon(selectedTab.isLeftmost(), Boolean.TRUE, Boolean.FALSE)); | private void reloadDisplay() { reloadDisplayTab(); reloadDisplayName(); } |
notifyUpdate_objectClosed(d); | void close(final Long documentId) throws ParityException { logger.info("close(Long)"); logger.debug(documentId); assertLoggedInUserIsKeyHolder(documentId); try { // close the document final Document document = get(documentId); assertStateTransition(document.getState(), ArtifactState.CLOSED); documentIO.updateState(document.getId(), ArtifactState.CLOSED); // lock the document lock(documentId); // send the closeure to the server final InternalSessionModel iSModel = getInternalSessionModel(); iSModel.sendClose(documentId); // audit the closeure final Document d = get(documentId); auditor.close(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getUpdatedOn()); } catch(final RuntimeException rx) { logger.error("Cannot close document: " + documentId, rx); throw ParityErrorTranslator.translate(rx); } } |
|
final Calendar now = getTimestamp(); | final Calendar now = currentDateTime(); | Document create(final String name, final String description, final File file) throws ParityException { logger.info("create(Project,String,String,File)"); logger.debug(name); logger.debug(description); logger.debug(file); assertCanCreateArtifacts(); assertIsSessionValid(); Assert.assertTrue( // TODO Centralize business rules about document creation. "File \"" + file.getAbsolutePath() + "\" does not exist.", file.exists()); Assert.assertTrue( "create(Project,String,String,File)", (file.length() <= IParityModelConstants.FILE_SIZE_UPPER_BOUNDS)); try { final Calendar now = getTimestamp(); final Document document = new Document(preferences.getUsername(), now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); document.setState(ArtifactState.ACTIVE); final byte[] contentBytes = FileUtil.readBytes(file); final DocumentContent content = new DocumentContent(); content.setContent(contentBytes); content.setChecksum(MD5Util.md5Hex(contentBytes)); content.setDocumentId(document.getId()); // send a creation packet final InternalSessionModel iSessionModel = SessionModel.getInternalModel(getContext()); iSessionModel.sendCreate(document); // create the document documentIO.create(document, content); // create the local file final LocalFile localFile = getLocalFile(document); localFile.write(contentBytes); // create a version createVersion(document.getId()); // flag the document as having been seen. flagAsSEEN(document); // fire a creation event notifyCreation_objectCreated(document); // audit the creation final Document d = get(document.getId()); auditor.create(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getCreatedOn()); return document; } catch(IOException iox) { logger.error("createDocument(Document)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createDocument(Document)", rx); throw ParityErrorTranslator.translate(rx); } } |
now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); | now, description, Collections.<ArtifactFlag>emptyList(), UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); | Document create(final String name, final String description, final File file) throws ParityException { logger.info("create(Project,String,String,File)"); logger.debug(name); logger.debug(description); logger.debug(file); assertCanCreateArtifacts(); assertIsSessionValid(); Assert.assertTrue( // TODO Centralize business rules about document creation. "File \"" + file.getAbsolutePath() + "\" does not exist.", file.exists()); Assert.assertTrue( "create(Project,String,String,File)", (file.length() <= IParityModelConstants.FILE_SIZE_UPPER_BOUNDS)); try { final Calendar now = getTimestamp(); final Document document = new Document(preferences.getUsername(), now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); document.setState(ArtifactState.ACTIVE); final byte[] contentBytes = FileUtil.readBytes(file); final DocumentContent content = new DocumentContent(); content.setContent(contentBytes); content.setChecksum(MD5Util.md5Hex(contentBytes)); content.setDocumentId(document.getId()); // send a creation packet final InternalSessionModel iSessionModel = SessionModel.getInternalModel(getContext()); iSessionModel.sendCreate(document); // create the document documentIO.create(document, content); // create the local file final LocalFile localFile = getLocalFile(document); localFile.write(contentBytes); // create a version createVersion(document.getId()); // flag the document as having been seen. flagAsSEEN(document); // fire a creation event notifyCreation_objectCreated(document); // audit the creation final Document d = get(document.getId()); auditor.create(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getCreatedOn()); return document; } catch(IOException iox) { logger.error("createDocument(Document)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createDocument(Document)", rx); throw ParityErrorTranslator.translate(rx); } } |
flagAsSEEN(document); | final InternalArtifactModel iAModel = getInternalArtifactModel(); iAModel.applyFlagKey(document.getId()); iAModel.applyFlagSeen(document.getId()); | Document create(final String name, final String description, final File file) throws ParityException { logger.info("create(Project,String,String,File)"); logger.debug(name); logger.debug(description); logger.debug(file); assertCanCreateArtifacts(); assertIsSessionValid(); Assert.assertTrue( // TODO Centralize business rules about document creation. "File \"" + file.getAbsolutePath() + "\" does not exist.", file.exists()); Assert.assertTrue( "create(Project,String,String,File)", (file.length() <= IParityModelConstants.FILE_SIZE_UPPER_BOUNDS)); try { final Calendar now = getTimestamp(); final Document document = new Document(preferences.getUsername(), now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); document.setState(ArtifactState.ACTIVE); final byte[] contentBytes = FileUtil.readBytes(file); final DocumentContent content = new DocumentContent(); content.setContent(contentBytes); content.setChecksum(MD5Util.md5Hex(contentBytes)); content.setDocumentId(document.getId()); // send a creation packet final InternalSessionModel iSessionModel = SessionModel.getInternalModel(getContext()); iSessionModel.sendCreate(document); // create the document documentIO.create(document, content); // create the local file final LocalFile localFile = getLocalFile(document); localFile.write(contentBytes); // create a version createVersion(document.getId()); // flag the document as having been seen. flagAsSEEN(document); // fire a creation event notifyCreation_objectCreated(document); // audit the creation final Document d = get(document.getId()); auditor.create(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getCreatedOn()); return document; } catch(IOException iox) { logger.error("createDocument(Document)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createDocument(Document)", rx); throw ParityErrorTranslator.translate(rx); } } |
notifyCreation_objectCreated(document); | final Document d = get(document.getId()); notifyCreation_objectCreated(d); | Document create(final String name, final String description, final File file) throws ParityException { logger.info("create(Project,String,String,File)"); logger.debug(name); logger.debug(description); logger.debug(file); assertCanCreateArtifacts(); assertIsSessionValid(); Assert.assertTrue( // TODO Centralize business rules about document creation. "File \"" + file.getAbsolutePath() + "\" does not exist.", file.exists()); Assert.assertTrue( "create(Project,String,String,File)", (file.length() <= IParityModelConstants.FILE_SIZE_UPPER_BOUNDS)); try { final Calendar now = getTimestamp(); final Document document = new Document(preferences.getUsername(), now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); document.setState(ArtifactState.ACTIVE); final byte[] contentBytes = FileUtil.readBytes(file); final DocumentContent content = new DocumentContent(); content.setContent(contentBytes); content.setChecksum(MD5Util.md5Hex(contentBytes)); content.setDocumentId(document.getId()); // send a creation packet final InternalSessionModel iSessionModel = SessionModel.getInternalModel(getContext()); iSessionModel.sendCreate(document); // create the document documentIO.create(document, content); // create the local file final LocalFile localFile = getLocalFile(document); localFile.write(contentBytes); // create a version createVersion(document.getId()); // flag the document as having been seen. flagAsSEEN(document); // fire a creation event notifyCreation_objectCreated(document); // audit the creation final Document d = get(document.getId()); auditor.create(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getCreatedOn()); return document; } catch(IOException iox) { logger.error("createDocument(Document)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createDocument(Document)", rx); throw ParityErrorTranslator.translate(rx); } } |
final Document d = get(document.getId()); | Document create(final String name, final String description, final File file) throws ParityException { logger.info("create(Project,String,String,File)"); logger.debug(name); logger.debug(description); logger.debug(file); assertCanCreateArtifacts(); assertIsSessionValid(); Assert.assertTrue( // TODO Centralize business rules about document creation. "File \"" + file.getAbsolutePath() + "\" does not exist.", file.exists()); Assert.assertTrue( "create(Project,String,String,File)", (file.length() <= IParityModelConstants.FILE_SIZE_UPPER_BOUNDS)); try { final Calendar now = getTimestamp(); final Document document = new Document(preferences.getUsername(), now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); document.setState(ArtifactState.ACTIVE); final byte[] contentBytes = FileUtil.readBytes(file); final DocumentContent content = new DocumentContent(); content.setContent(contentBytes); content.setChecksum(MD5Util.md5Hex(contentBytes)); content.setDocumentId(document.getId()); // send a creation packet final InternalSessionModel iSessionModel = SessionModel.getInternalModel(getContext()); iSessionModel.sendCreate(document); // create the document documentIO.create(document, content); // create the local file final LocalFile localFile = getLocalFile(document); localFile.write(contentBytes); // create a version createVersion(document.getId()); // flag the document as having been seen. flagAsSEEN(document); // fire a creation event notifyCreation_objectCreated(document); // audit the creation final Document d = get(document.getId()); auditor.create(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getCreatedOn()); return document; } catch(IOException iox) { logger.error("createDocument(Document)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createDocument(Document)", rx); throw ParityErrorTranslator.translate(rx); } } |
|
return document; | return d; | Document create(final String name, final String description, final File file) throws ParityException { logger.info("create(Project,String,String,File)"); logger.debug(name); logger.debug(description); logger.debug(file); assertCanCreateArtifacts(); assertIsSessionValid(); Assert.assertTrue( // TODO Centralize business rules about document creation. "File \"" + file.getAbsolutePath() + "\" does not exist.", file.exists()); Assert.assertTrue( "create(Project,String,String,File)", (file.length() <= IParityModelConstants.FILE_SIZE_UPPER_BOUNDS)); try { final Calendar now = getTimestamp(); final Document document = new Document(preferences.getUsername(), now, description, NO_FLAGS, UUIDGenerator.nextUUID(), name, preferences.getUsername(), now); document.setState(ArtifactState.ACTIVE); final byte[] contentBytes = FileUtil.readBytes(file); final DocumentContent content = new DocumentContent(); content.setContent(contentBytes); content.setChecksum(MD5Util.md5Hex(contentBytes)); content.setDocumentId(document.getId()); // send a creation packet final InternalSessionModel iSessionModel = SessionModel.getInternalModel(getContext()); iSessionModel.sendCreate(document); // create the document documentIO.create(document, content); // create the local file final LocalFile localFile = getLocalFile(document); localFile.write(contentBytes); // create a version createVersion(document.getId()); // flag the document as having been seen. flagAsSEEN(document); // fire a creation event notifyCreation_objectCreated(document); // audit the creation final Document d = get(document.getId()); auditor.create(d.getId(), JabberIdBuilder.parseUsername(preferences.getUsername()), d.getCreatedOn()); return document; } catch(IOException iox) { logger.error("createDocument(Document)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createDocument(Document)", rx); throw ParityErrorTranslator.translate(rx); } } |
document.setUpdatedOn(getTimestamp()); | document.setUpdatedOn(currentDateTime()); | DocumentVersion createVersion(final Long documentId) throws ParityException { logger.info("createVersion(Long)"); logger.debug(documentId); assertLoggedInUserIsKeyHolder(documentId); try { final Document document = get(documentId); final DocumentContent content = getContent(documentId); // read the document local file final LocalFile localFile = getLocalFile(document); localFile.read(); content.setChecksum(localFile.getFileChecksum()); content.setContent(localFile.getFileBytes()); // create a new version\version content final DocumentVersion version = new DocumentVersion(); version.setArtifactId(documentId); version.setArtifactType(document.getType()); version.setArtifactUniqueId(document.getUniqueId()); version.setCreatedBy(document.getCreatedBy()); version.setCreatedOn(document.getCreatedOn()); version.setName(document.getName()); version.setUpdatedBy(document.getUpdatedBy()); version.setUpdatedOn(document.getUpdatedOn()); final DocumentVersionContent versionContent = new DocumentVersionContent(); versionContent.setDocumentContent(content); versionContent.setDocumentId(documentId); versionContent.setVersionId(version.getVersionId()); documentIO.createVersion(version, versionContent); // create the version local file final LocalFile versionLocalFile = getLocalFile(document, version); versionLocalFile.write(content.getContent()); versionLocalFile.lock(); // update the document updated by\on document.setUpdatedBy(preferences.getUsername()); document.setUpdatedOn(getTimestamp()); documentIO.update(document); // update the content bytes\checksum content.setContent(localFile.getFileBytes()); content.setChecksum(localFile.getFileChecksum()); documentIO.updateContent(content); // fire the object version event notification notifyCreation_objectVersionCreated(version); return version; } catch(IOException iox) { logger.error("createVersion(Document,DocumentAction,DocumentActionData)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("createVersion(Document,DocumentAction,DocumentActionData)", rx); throw ParityErrorTranslator.translate(rx); } } |
logger.info("open(Long)"); | logger.info("[LMODEL] [DOCUMENT] [OPEN]"); | void open(final Long documentId) throws ParityException { logger.info("open(Long)"); logger.debug(documentId); try { final Document document = get(documentId); // open the local file final LocalFile localFile = getLocalFile(document); localFile.open(); // flag it as having been seen flagAsSEEN(document); } catch(IOException iox) { logger.error("open(UUID)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("open(UUID)", rx); throw ParityErrorTranslator.translate(rx); } } |
flagAsSEEN(document); | final InternalArtifactModel iAModel = getInternalArtifactModel(); iAModel.applyFlagSeen(documentId); | void open(final Long documentId) throws ParityException { logger.info("open(Long)"); logger.debug(documentId); try { final Document document = get(documentId); // open the local file final LocalFile localFile = getLocalFile(document); localFile.open(); // flag it as having been seen flagAsSEEN(document); } catch(IOException iox) { logger.error("open(UUID)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("open(UUID)", rx); throw ParityErrorTranslator.translate(rx); } } |
else { receiveUpdate(xmppDocument, document); } | else { final DocumentVersion version = getVersion(document.getId(), xmppDocument.getVersionId()); if(null == version) { receiveUpdate(xmppDocument, document); } } | void receive(final XMPPDocument xmppDocument) throws ParityException { logger.info("receiveDocument(XMPPDocument)"); logger.debug(xmppDocument); try { final JabberId receivedFromJabberId = JabberIdBuilder.parseUsername(xmppDocument.getReceivedFrom()); Document document = get(xmppDocument.getUniqueId()); logger.debug(document); if(null == document) { document = receiveCreate(xmppDocument); } else { receiveUpdate(xmppDocument, document); } // audit the receiving auditor.recieve(document.getId(), xmppDocument.getVersionId(), receivedFromJabberId, JabberIdBuilder.parseUsername(preferences.getUsername()), xmppDocument.getUpdatedOn()); } catch(IOException iox) { logger.error("receiveDocument(XMPPDocument)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("receiveDocument(XMPPDocument)", rx); throw ParityErrorTranslator.translate(rx); } } |
receivedFromJabberId, JabberIdBuilder.parseUsername(preferences.getUsername()), xmppDocument.getUpdatedOn()); | receivedFromJabberId, JabberIdBuilder.parseUsername(preferences.getUsername()), currentDateTime()); | void receive(final XMPPDocument xmppDocument) throws ParityException { logger.info("receiveDocument(XMPPDocument)"); logger.debug(xmppDocument); try { final JabberId receivedFromJabberId = JabberIdBuilder.parseUsername(xmppDocument.getReceivedFrom()); Document document = get(xmppDocument.getUniqueId()); logger.debug(document); if(null == document) { document = receiveCreate(xmppDocument); } else { receiveUpdate(xmppDocument, document); } // audit the receiving auditor.recieve(document.getId(), xmppDocument.getVersionId(), receivedFromJabberId, JabberIdBuilder.parseUsername(preferences.getUsername()), xmppDocument.getUpdatedOn()); } catch(IOException iox) { logger.error("receiveDocument(XMPPDocument)", iox); throw ParityErrorTranslator.translate(iox); } catch(RuntimeException rx) { logger.error("receiveDocument(XMPPDocument)", rx); throw ParityErrorTranslator.translate(rx); } } |
if(!iSModel.isLoggedInUserKeyHolder(document.getId())) lock(document.getId()); | if(iSModel.isLoggedInUserKeyHolder(document.getId())) { final InternalArtifactModel iAModel = getInternalArtifactModel(); iAModel.applyFlagKey(document.getId()); } else { lock(document.getId()); } | private void receiveUpdate(final XMPPDocument xmppDocument, final Document document) throws FileNotFoundException, IOException, ParityException { final DocumentVersion version = new DocumentVersion(); version.setArtifactId(document.getId()); version.setArtifactType(document.getType()); version.setArtifactUniqueId(document.getUniqueId()); version.setCreatedBy(xmppDocument.getCreatedBy()); version.setCreatedOn(xmppDocument.getCreatedOn()); version.setName(document.getName()); version.setUpdatedBy(xmppDocument.getUpdatedBy()); version.setUpdatedOn(xmppDocument.getUpdatedOn()); version.setVersionId(xmppDocument.getVersionId()); final DocumentContent content = new DocumentContent(); content.setChecksum(MD5Util.md5Hex(xmppDocument.getContent())); content.setContent(xmppDocument.getContent()); content.setDocumentId(version.getArtifactId()); final DocumentVersionContent versionContent = new DocumentVersionContent(); versionContent.setDocumentContent(content); versionContent.setDocumentId(version.getArtifactId()); versionContent.setVersionId(version.getVersionId()); insertVersion(version.getArtifactId(), version, versionContent); if(isLatestLocalVersion(version)) { document.setUpdatedBy(xmppDocument.getUpdatedBy()); document.setUpdatedOn(xmppDocument.getUpdatedOn()); // update the db documentIO.update(document); documentIO.updateContent(content); // update the local file final LocalFile localFile = getLocalFile(document); localFile.delete(); localFile.write(content.getContent()); } // if not the key holder lock final InternalSessionModel iSModel = getInternalSessionModel(); if(!iSModel.isLoggedInUserKeyHolder(document.getId())) lock(document.getId()); // flag the document flagAsNotSEEN(document); // notify notifyUpdate_objectReceived(document); } |
flagAsNotSEEN(document); | final InternalArtifactModel iAModel = getInternalArtifactModel(); iAModel.removeFlagSeen(document.getId()); | private void receiveUpdate(final XMPPDocument xmppDocument, final Document document) throws FileNotFoundException, IOException, ParityException { final DocumentVersion version = new DocumentVersion(); version.setArtifactId(document.getId()); version.setArtifactType(document.getType()); version.setArtifactUniqueId(document.getUniqueId()); version.setCreatedBy(xmppDocument.getCreatedBy()); version.setCreatedOn(xmppDocument.getCreatedOn()); version.setName(document.getName()); version.setUpdatedBy(xmppDocument.getUpdatedBy()); version.setUpdatedOn(xmppDocument.getUpdatedOn()); version.setVersionId(xmppDocument.getVersionId()); final DocumentContent content = new DocumentContent(); content.setChecksum(MD5Util.md5Hex(xmppDocument.getContent())); content.setContent(xmppDocument.getContent()); content.setDocumentId(version.getArtifactId()); final DocumentVersionContent versionContent = new DocumentVersionContent(); versionContent.setDocumentContent(content); versionContent.setDocumentId(version.getArtifactId()); versionContent.setVersionId(version.getVersionId()); insertVersion(version.getArtifactId(), version, versionContent); if(isLatestLocalVersion(version)) { document.setUpdatedBy(xmppDocument.getUpdatedBy()); document.setUpdatedOn(xmppDocument.getUpdatedOn()); // update the db documentIO.update(document); documentIO.updateContent(content); // update the local file final LocalFile localFile = getLocalFile(document); localFile.delete(); localFile.write(content.getContent()); } // if not the key holder lock final InternalSessionModel iSModel = getInternalSessionModel(); if(!iSModel.isLoggedInUserKeyHolder(document.getId())) lock(document.getId()); // flag the document flagAsNotSEEN(document); // notify notifyUpdate_objectReceived(document); } |
try { airBrush.startListening(); } catch (Exception e) { e.printStackTrace(); } | public Module(String moduleName) { airBrush = new AirBrush(moduleName, airHostName, airPort); airBrush.setCallbackObject(this); connected = true; } |
|
return new JPopupMenu(); | JPopupMenu jPopupMenu = new JPopupMenu(); jPopupMenu.addPopupMenuListener(new PopupMenuListener() { public void popupMenuCanceled(PopupMenuEvent e) { } public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { final Timer popupTimer = new Timer(PopupMenuInfo.ACTIVATION_DELAY, new ActionListener() { public void actionPerformed(final ActionEvent timerEvent) { popupMenuCount--; } }); popupTimer.setRepeats(false); popupTimer.start(); } public void popupMenuWillBecomeVisible(PopupMenuEvent e) { popupMenuCount++; } }); return jPopupMenu; | private JPopupMenu doCreatePopup() { return new JPopupMenu(); } |
this.logger = Logger.getLogger(getClass()); | XMPPSession(final String serverHost, final Integer serverPort) { super(); try { this.connection = new XMPPConnection(serverHost, serverPort); this.connection.loginAnonymously(); } catch(final org.jivesoftware.smack.XMPPException xmppx) { throw new XMPPException(xmppx); } this.uniqueId = JVMUniqueId.nextId(); } |
|
private void debugLongParameters(final String listName, final String name, final List<Long> values) {} | private final void debugLongParameters(final String listName, final String name, final List<Long> values) {} | private void debugLongParameters(final String listName, final String name, final List<Long> values) {} |
final void setLongParameters(final String listName, final String name, | public final void setLongParameters(final String listName, final String name, | final void setLongParameters(final String listName, final String name, final List<Long> values) { final List<Parameter> parameters = new LinkedList<Parameter>(); for(final Long value : values) parameters.add(new Parameter(name, Long.class, value)); this.parameters.add(new Parameter(listName, List.class, parameters)); } |
setForeground(Swing.LIST_SELECTION_FG); setBackground(Swing.LIST_SELECTION_BG); | setForeground(Colors.Browser.List.LIST_SELECTION_FG); setBackground(Colors.Browser.List.LIST_SELECTION_BG); | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { setText(((Scenario) value).getDisplayName()); if (isSelected) { setForeground(Swing.LIST_SELECTION_FG); setBackground(Swing.LIST_SELECTION_BG); } else { setForeground(Swing.LIST_FG); if (0 == index % 2) { setBackground(Swing.LIST_EVEN_BG); } else { setBackground(Swing.LIST_ODD_BG); } } return this; } |
setForeground(Swing.LIST_FG); | setForeground(Colors.Browser.List.LIST_FG); | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { setText(((Scenario) value).getDisplayName()); if (isSelected) { setForeground(Swing.LIST_SELECTION_FG); setBackground(Swing.LIST_SELECTION_BG); } else { setForeground(Swing.LIST_FG); if (0 == index % 2) { setBackground(Swing.LIST_EVEN_BG); } else { setBackground(Swing.LIST_ODD_BG); } } return this; } |
setBackground(Swing.LIST_EVEN_BG); | setBackground(Colors.Browser.List.LIST_EVEN_BG); | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { setText(((Scenario) value).getDisplayName()); if (isSelected) { setForeground(Swing.LIST_SELECTION_FG); setBackground(Swing.LIST_SELECTION_BG); } else { setForeground(Swing.LIST_FG); if (0 == index % 2) { setBackground(Swing.LIST_EVEN_BG); } else { setBackground(Swing.LIST_ODD_BG); } } return this; } |
setBackground(Swing.LIST_ODD_BG); | setBackground(Colors.Browser.List.LIST_ODD_BG); | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { setText(((Scenario) value).getDisplayName()); if (isSelected) { setForeground(Swing.LIST_SELECTION_FG); setBackground(Swing.LIST_SELECTION_BG); } else { setForeground(Swing.LIST_FG); if (0 == index % 2) { setBackground(Swing.LIST_EVEN_BG); } else { setBackground(Swing.LIST_ODD_BG); } } return this; } |
if (session.getInetAddress().equals(sessionAddress)) { | final InetAddress inetAddress = session.getInetAddress(); if (null == inetAddress) { | StreamSession authenticate(final String sessionId, final InetAddress sessionAddress) { synchronized (SESSIONS) { final ServerSession session = SESSIONS.get(sessionId); if (session.getInetAddress().equals(sessionAddress)) { return session; } else { logger.logWarning("Session address {0} does not match original.", sessionAddress); return null; } } } |
logger.logWarning("Session address {0} does not match original.", sessionAddress); return null; | if (inetAddress.equals(sessionAddress)) { return session; } else { logger.logFatal("Session address {0} does not match original.", sessionAddress); return null; } | StreamSession authenticate(final String sessionId, final InetAddress sessionAddress) { synchronized (SESSIONS) { final ServerSession session = SESSIONS.get(sessionId); if (session.getInetAddress().equals(sessionAddress)) { return session; } else { logger.logWarning("Session address {0} does not match original.", sessionAddress); return null; } } } |
Assert.assertNotNull("Session inet address is null.", session.getInetAddress()); | void initialize(final ServerSession session) { Assert.assertNotNull("Session is null.", session); Assert.assertNotNull("Session buffer size is null.", session.getBufferSize()); Assert.assertNotNull("Session charset is null.", session.getCharset()); Assert.assertNotNull("Session environment is null.", session.getEnvironment()); Assert.assertNotNull("Session id is null.", session.getId()); Assert.assertNotNull("Session inet address is null.", session.getInetAddress()); synchronized (SESSIONS) { SESSIONS.put(session.getId(), session); fileServer.initialize(session); socketServer.initialize(session); } } |
|
this.getSesion().removeAttribute("claveAlumno"); | public void procesarEvento(){ String claveAlumno= (String)this.getSesion().getAttribute("claveAlumno"); ObjetoBean alumnoEdicion= (ObjetoBean)(this.getSesion().getAttribute("beanAlumno")); alumnoEdicion.cambiaValor(Constantes.ID_ISALUMNO_ISUSUARIO_DNI,claveAlumno); this.getSesion().setAttribute("beanAlumno",alumnoEdicion); GestorAlumnos GA= new GestorAlumnos(); ListaObjetoBean camposErroneos= GA.comprobar(alumnoEdicion); if(claveAlumno!=null && camposErroneos.esVacio()){ this.setResuladooperacion("OK"); this.getSesion().removeAttribute("claveAlumno"); } else{ this.getSesion().setAttribute("error",camposErroneos); this.setResuladooperacion("ERROR"); } } |
|
try { return dModel.list().size(); } | try { return sModel.readContact(); } | public Object getElement(final Object input) { // TODO Create a statistics model to obtain and build // reports try { return dModel.list().size(); } catch(final ParityException px) { throw new RuntimeException(px); } } |
public Object getElement(final Object input) { return countProvider.getElement(input); | public Object getElement(final Integer index, final Object input) { return singleProviders[index].getElement(input); | public Object getElement(final Object input) { return countProvider.getElement(input); } |
int touchedIndex; | int visibleIndex; | private void syncDocuments() { // sync the documents with the visible documents visibleDocuments.clear(); visibleDocuments.addAll(documents); ModelFilterManager.filter(visibleDocuments, documentFilter); // sync visible documents with the swing list's model ListItem li; for(int i = 0; i < visibleDocuments.size(); i++) { li = ListItem.create(visibleDocuments.get(i)); if(!jListModel.contains(li)) { jListModel.add(i, li); } } final ListItem[] modelItems = new ListItem[jListModel.size()]; jListModel.copyInto(modelItems); DocumentListItem dli; int touchedIndex; for(int i = 0; i < modelItems.length; i++) { li = modelItems[i]; if(li instanceof DocumentListItem) { dli = (DocumentListItem) li; // remove documents that are no longer visible if(!visibleDocuments.contains(dli.getDisplayDocument())) jListModel.removeElement(li); // re-create the list item of those that have been touched if(touchedDocuments.contains(dli.getDisplayDocument())) { touchedIndex = touchedDocuments.indexOf(dli.getDisplayDocument()); jListModel.remove(i); jListModel.add(i, ListItem.create(touchedDocuments.get(touchedIndex))); } } } touchedDocuments.clear(); if(1 > visibleDocuments.size()) { browser.disableHistory(); } else { browser.enableHistory(); } } |
touchedIndex = touchedDocuments.indexOf(dli.getDisplayDocument()); | visibleIndex = visibleDocuments.indexOf(dli.getDisplayDocument()); | private void syncDocuments() { // sync the documents with the visible documents visibleDocuments.clear(); visibleDocuments.addAll(documents); ModelFilterManager.filter(visibleDocuments, documentFilter); // sync visible documents with the swing list's model ListItem li; for(int i = 0; i < visibleDocuments.size(); i++) { li = ListItem.create(visibleDocuments.get(i)); if(!jListModel.contains(li)) { jListModel.add(i, li); } } final ListItem[] modelItems = new ListItem[jListModel.size()]; jListModel.copyInto(modelItems); DocumentListItem dli; int touchedIndex; for(int i = 0; i < modelItems.length; i++) { li = modelItems[i]; if(li instanceof DocumentListItem) { dli = (DocumentListItem) li; // remove documents that are no longer visible if(!visibleDocuments.contains(dli.getDisplayDocument())) jListModel.removeElement(li); // re-create the list item of those that have been touched if(touchedDocuments.contains(dli.getDisplayDocument())) { touchedIndex = touchedDocuments.indexOf(dli.getDisplayDocument()); jListModel.remove(i); jListModel.add(i, ListItem.create(touchedDocuments.get(touchedIndex))); } } } touchedDocuments.clear(); if(1 > visibleDocuments.size()) { browser.disableHistory(); } else { browser.enableHistory(); } } |
jListModel.add(i, ListItem.create(touchedDocuments.get(touchedIndex))); | jListModel.add(visibleIndex, ListItem.create(visibleDocuments.get(visibleIndex))); | private void syncDocuments() { // sync the documents with the visible documents visibleDocuments.clear(); visibleDocuments.addAll(documents); ModelFilterManager.filter(visibleDocuments, documentFilter); // sync visible documents with the swing list's model ListItem li; for(int i = 0; i < visibleDocuments.size(); i++) { li = ListItem.create(visibleDocuments.get(i)); if(!jListModel.contains(li)) { jListModel.add(i, li); } } final ListItem[] modelItems = new ListItem[jListModel.size()]; jListModel.copyInto(modelItems); DocumentListItem dli; int touchedIndex; for(int i = 0; i < modelItems.length; i++) { li = modelItems[i]; if(li instanceof DocumentListItem) { dli = (DocumentListItem) li; // remove documents that are no longer visible if(!visibleDocuments.contains(dli.getDisplayDocument())) jListModel.removeElement(li); // re-create the list item of those that have been touched if(touchedDocuments.contains(dli.getDisplayDocument())) { touchedIndex = touchedDocuments.indexOf(dli.getDisplayDocument()); jListModel.remove(i); jListModel.add(i, ListItem.create(touchedDocuments.get(touchedIndex))); } } } touchedDocuments.clear(); if(1 > visibleDocuments.size()) { browser.disableHistory(); } else { browser.enableHistory(); } } |
preferences.setUsername(xmppHelper.getUser().getUsername()); | if(!preferences.isSetUsername()) { preferences.setUsername(usernameAtHost); } | void login(final String username, final String password) throws ParityException { final String host = preferences.getServerHost(); final Integer port = preferences.getServerPort(); synchronized(xmppHelperLock) { try { xmppHelper.login(host, port, username, password); preferences.setUsername(xmppHelper.getUser().getUsername()); } catch(SmackException sx) { logger.error("login(String,String)", sx); throw ParityErrorTranslator.translate(sx); } catch(RuntimeException rx) { logger.error("login(String,String)", rx); throw ParityErrorTranslator.translate(rx); } } } |
public static JMenuItem createCheckBox(final String text, final Integer mnemonic) { synchronized(singletonLock) { return singleton.doCreateCheckBox(text, mnemonic); } } | public static JCheckBoxMenuItem createCheckBox(final String text, final Integer mnemonic) { synchronized(singletonLock) { return singleton.doCreateCheckBox(text, mnemonic); } } | public static JMenuItem createCheckBox(final String text, final Integer mnemonic) { synchronized(singletonLock) { return singleton.doCreateCheckBox(text, mnemonic); } } |
private JMenuItem doCreateCheckBox(final String text, final Integer mnemonic) { logger.debug(text); final JMenuItem jMenuItem = new JCheckBoxMenuItem(text); applyDefaultFont(jMenuItem); applyMnemonic(jMenuItem, mnemonic); return jMenuItem; } | private JCheckBoxMenuItem doCreateCheckBox(final String text, final Integer mnemonic) { logger.debug(text); final JCheckBoxMenuItem jCheckBoxMenuItem = new JCheckBoxMenuItem(text); applyDefaultFont(jCheckBoxMenuItem); applyMnemonic(jCheckBoxMenuItem, mnemonic); return jCheckBoxMenuItem; } | private JMenuItem doCreateCheckBox(final String text, final Integer mnemonic) { logger.debug(text); final JMenuItem jMenuItem = new JCheckBoxMenuItem(text); applyDefaultFont(jMenuItem); applyMnemonic(jMenuItem, mnemonic); return jMenuItem; } |
this.eastCountJLabel.setVisible(false); this.eastFirstJLabel.setVisible(false); this.eastLastJLabel.setVisible(false); this.eastNextJLabel.setVisible(false); this.eastPreviousJLabel.setVisible(false); this.westCountJLabel.setVisible(false); this.westFirstJLabel.setVisible(false); this.westLastJLabel.setVisible(false); this.westNextJLabel.setVisible(false); this.westPreviousJLabel.setVisible(false); | public ContainerPanel(final BrowserSession session) { super(session); this.eastListModel = new DefaultListModel(); this.expanded = Boolean.FALSE; this.fileIconReader = new FileIconReader(); this.localization = new MainCellL18n("ContainerPanel"); this.westListModel = new DefaultListModel(); initComponents(); } |
|
color = new Color(255, 255, 255); | color = new Color(255, 255, 127); | public void bind() { bound = true; color = new Color(255, 255, 255); } |
return (1 / Math.sqrt(r * r * r)) * 1000.0; | Double r2 = r * 1.5; return (1 / Math.sqrt(r2 * r2 * r2)) * 1000.0; | private Double keplerRotation(Double r) { return (1 / Math.sqrt(r * r * r)) * 1000.0; } |
if (isSelected && list.isFocusOwner()) { textJLabel.setForeground(Colors.Browser.List.INNER_LIST_SELECTION_FG); setBackground(Colors.Browser.List.INNER_LIST_SELECTION_BG); | if (isSelected && cell.isSelectedContainer()) { if (cell.isFocusOnRight()) { textJLabel.setForeground(Colors.Browser.List.INNER_LIST_SELECTION_FG); setBackground(Colors.Browser.List.INNER_LIST_SELECTION_BG); } else { textJLabel.setForeground(Colors.Browser.List.INNER_LEFT_LIST_SELECTION_NOFOCUS_FG); setBackground(Colors.Browser.List.INNER_LEFT_LIST_SELECTION_NOFOCUS_BG); } | public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { final AbstractContentCell cell = (AbstractContentCell) value; textJLabel.setText(cell.getText()); final Icon icon = cell.getIcon(); if (null!=icon) { iconJLabel.setIcon(icon); } if (isSelected && list.isFocusOwner()) { textJLabel.setForeground(Colors.Browser.List.INNER_LIST_SELECTION_FG); setBackground(Colors.Browser.List.INNER_LIST_SELECTION_BG); } else { textJLabel.setForeground(Colors.Browser.List.LIST_FG); if (0 == index % 2) { setBackground(Colors.Browser.List.LIST_EVEN_BG); } else { setBackground(Colors.Browser.List.LIST_ODD_BG); } } return this; } |
this.logger = new Log4JWrapper(); | protected StreamClient(final StreamSession session) { super(); this.logger = new Log4JWrapper(); this.session = session; final Environment environment = session.getEnvironment(); this.socketAddress = new InetSocketAddress( environment.getStreamHost(), environment.getStreamPort()); if (environment.isStreamTLSEnabled()) { logger.logInfo("Stream Client - {0}:{1} - Secure", environment.getStreamHost(), environment.getStreamPort()); final String keyStorePath = "security/stream_client_keystore"; final char[] keyStorePassword = "password".toCharArray(); try { socketFactory = com.thinkparity.codebase.net.SocketFactory.getSecureInstance(keyStorePath, keyStorePassword, keyStorePath, keyStorePassword); } catch (final Exception x) { throw new StreamException(x); } } else { logger.logInfo("Stream Client - {0}:{1}", environment.getStreamHost(), environment.getStreamPort()); socketFactory = com.thinkparity.codebase.net.SocketFactory.getInstance(); } } |
|
protected final void connect(final Type type) { try { doConnect(); write(new StreamHeader(StreamHeader.Type.SESSION_BEGIN, session.getId())); write(new StreamHeader(StreamHeader.Type.SESSION_TYPE, type.name())); } catch (final IOException iox) { if (isConnected()) try { doDisconnect(); } catch (final IOException iox2) { logger.logError(iox2, "Could not disconnect from bad connection."); } throw new StreamException(iox); } | protected final void connect(final Type type) throws IOException { doConnect(); write(new StreamHeader(StreamHeader.Type.SESSION_ID, session.getId())); write(new StreamHeader(StreamHeader.Type.SESSION_TYPE, type.name())); | protected final void connect(final Type type) { try { doConnect(); write(new StreamHeader(StreamHeader.Type.SESSION_BEGIN, session.getId())); write(new StreamHeader(StreamHeader.Type.SESSION_TYPE, type.name())); } catch (final IOException iox) { if (isConnected()) try { doDisconnect(); } catch (final IOException iox2) { /* NOTE We do not want to mask the connection error. */ logger.logError(iox2, "Could not disconnect from bad connection."); } throw new StreamException(iox); } } |
protected final void disconnect() { try { doDisconnect(); } catch (final IOException iox) { throw new StreamException(iox); } | protected final void disconnect() throws IOException { doDisconnect(); | protected final void disconnect() { try { doDisconnect(); } catch (final IOException iox) { throw new StreamException(iox); } } |
protected final void write(final InputStream stream) { | protected final void write(final InputStream stream, final Long streamSize) { | protected final void write(final InputStream stream) { logger.logApiId(); try { StreamUtil.copy(stream, output, session.getBufferSize()); output.flush(); } catch (final IOException iox) { throw new StreamException(iox); } } |
StreamUtil.copy(stream, output, session.getBufferSize()); output.flush(); | int len, total = 0; final byte[] b = new byte[session.getBufferSize()]; try { while((len = stream.read(b)) > 0) { logger.logDebug("UPSTREAM SENT {0}/{1}", total += len, streamSize); output.write(b, 0, len); output.flush(); } } finally { stream.close(); output.flush(); output.close(); } | protected final void write(final InputStream stream) { logger.logApiId(); try { StreamUtil.copy(stream, output, session.getBufferSize()); output.flush(); } catch (final IOException iox) { throw new StreamException(iox); } } |
final Long versionId, final UUID documentUniqueId); | final Long versionId); | public List<DocumentVersion> readDocumentVersions(final UUID uniqueId, final Long versionId, final UUID documentUniqueId); |
getInternalArtifactModel().applyFlagBookmark(containerId); | getArtifactModel().applyFlagBookmark(containerId); | void addBookmark(final Long containerId) { logger.logApiId(); logger.logVariable("containerId", containerId); try { getInternalArtifactModel().applyFlagBookmark(containerId); notifyContainerUpdated(read(containerId), localEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
final InternalArtifactModel artifactModel = getInternalArtifactModel(); | final InternalArtifactModel artifactModel = getArtifactModel(); | Container create(final String name) { logger.logApiId(); logger.logVariable("name", name); try { final Container container = new Container(); container.setCreatedBy(localUserId()); container.setCreatedOn(currentDateTime()); container.setName(name); container.setState(ArtifactState.ACTIVE); container.setType(ArtifactType.CONTAINER); container.setUniqueId(UUIDGenerator.nextUUID()); container.setUpdatedBy(container.getCreatedBy()); container.setUpdatedOn(container.getCreatedOn()); // local create containerIO.create(container); // local key final InternalArtifactModel artifactModel = getInternalArtifactModel(); artifactModel.applyFlagKey(container.getId()); // create remote info artifactModel.createRemoteInfo(container.getId(), container.getCreatedBy(), container.getCreatedOn()); // index getIndexModel().indexContainer(container.getId()); // create team final TeamMember teamMember = createTeam(container.getId()); // create first draft createFirstDraft(container.getId(), teamMember); // audit\fire event final Container postCreation = read(container.getId()); auditContainerCreated(postCreation); notifyContainerCreated(postCreation, localEventGenerator); return postCreation; } catch (final Throwable t) { throw translateError(t); } } |
final InternalArtifactModel artifactModel = getInternalArtifactModel(); | final InternalArtifactModel artifactModel = getArtifactModel(); | ContainerDraft createDraft(final Long containerId) { logger.logApiId(); logger.logVariable("containerId", containerId); try { assertContainerDraftDoesNotExist(containerId); if (isFirstDraft(containerId)) { createFirstDraft(containerId, localTeamMember(containerId)); } else { final InternalArtifactModel artifactModel = getInternalArtifactModel(); assertOnline("The user is not online."); final Container container = read(containerId); if (!isDistributed(container.getId())) { createDistributed(container); } final ContainerVersion latestVersion = readLatestVersion(container.getId()); final List<Document> documents = readDocuments( latestVersion.getArtifactId(), latestVersion.getVersionId()); // create final ContainerDraft draft = new ContainerDraft(); draft.setOwner(localTeamMember(containerId)); draft.setContainerId(containerId); final InternalDocumentModel documentModel = getInternalDocumentModel(); for (final Document document : documents) { draft.addDocument(document); draft.putState(document, ContainerDraft.ArtifactState.NONE); documentModel.createDraft(document.getId()); } containerIO.createDraft(draft); artifactModel.applyFlagKey(container.getId()); // remote create final List<JabberId> team = artifactModel.readTeamIds(containerId); team.remove(localUserId()); getSessionModel().createDraft(team, container.getUniqueId()); } // fire event final Container postCreation = read(containerId); final ContainerDraft postCreationDraft = readDraft(containerId); notifyDraftCreated(postCreation, postCreationDraft, localEventGenerator); return postCreationDraft; } catch (final Throwable t) { throw translateError(t); } } |
getInternalArtifactModel().createTeam(containerId); | getArtifactModel().createTeam(containerId); | private TeamMember createTeam(final Long containerId) { final List<TeamMember> team = getInternalArtifactModel().createTeam(containerId); return team.get(0); } |
getSessionModel().removeTeamMember( container.getUniqueId(), localTeamMember.getId()); | void delete(final Long containerId) { logger.logApiId(); logger.logVariable("containerId", containerId); try { final Container container = read(containerId); if (isDistributed(container.getId())) { final TeamMember localTeamMember = localTeamMember(container.getId()); deleteLocal(container.getId()); getSessionModel().removeTeamMember( container.getUniqueId(), localTeamMember.getId()); } else { deleteLocal(container.getId()); } // fire event notifyContainerDeleted(container, localEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
|
final InternalArtifactModel artifactModel = getInternalArtifactModel(); | final InternalArtifactModel artifactModel = getArtifactModel(); | private void deleteLocal(final Long containerId) { // delete the draft final ContainerDraft draft = readDraft(containerId); if (null != draft) { for(final Artifact artifact : draft.getArtifacts()) { containerIO.deleteDraftArtifactRel(containerId, artifact.getId()); } containerIO.deleteDraft(containerId); } // delete the team final InternalArtifactModel artifactModel = getInternalArtifactModel(); artifactModel.deleteTeam(containerId); // delete the remote info artifactModel.deleteRemoteInfo(containerId); // delete the audit events getInternalAuditModel().delete(containerId); // delete versions final InternalDocumentModel documentModel = getInternalDocumentModel(); final List<ContainerVersion> versions = readVersions(containerId); List<Document> documents; for (final ContainerVersion version : versions) { documents = containerIO.readDocuments(version.getArtifactId(), version.getVersionId()); // remove the version's artifact versions containerIO.removeVersions(containerId, version.getVersionId()); for(final Document document : documents) { documentModel.delete(document.getId()); } // delete the version's deltas containerIO.deleteDeltas(containerId, version.getVersionId()); // delete the version containerIO.deleteVersion(containerId, version.getVersionId()); } // delete the index getIndexModel().deleteContainer(containerId); // delete the container containerIO.delete(containerId); } |
final InternalArtifactModel artifactModel = getInternalArtifactModel(); | final InternalArtifactModel artifactModel = getArtifactModel(); | private void doPublishVersion(final PublishMonitor monitor, final Long containerId, final Long versionId, final List<Contact> contacts, final List<TeamMember> teamMembers) throws IOException { final Container container = read(containerId); final ContainerVersion version = readVersion(containerId, versionId); // update local team final InternalArtifactModel artifactModel = getInternalArtifactModel(); for (final Contact contact : contacts) artifactModel.addTeamMember(container.getId(), contact.getId()); // build the publish to list then publish final List<JabberId> publishTo = new ArrayList<JabberId>(); final List<User> publishToUsers = new ArrayList<User>(); for (final Contact contact : contacts) { publishTo.add(contact.getId()); publishToUsers.add(contact); } for (final TeamMember teamMember : teamMembers) { publishTo.add(teamMember.getId()); publishToUsers.add(teamMember); } final Calendar currentDateTime = currentDateTime(); publish(monitor, version, publishTo, localUserId(), currentDateTime); // update remote team final InternalSessionModel sessionModel = getSessionModel(); for (final Contact contact : contacts) sessionModel.addTeamMember(container.getUniqueId(), contact.getId()); // create published to list containerIO.createPublishedTo(containerId, version.getVersionId(), publishToUsers); } |
sessionModel.addTeamMember(container.getUniqueId(), contact.getId()); | sessionModel.addTeamMember(container.getUniqueId(), artifactModel .readTeamIds(container.getId()), contact.getId()); | private void doPublishVersion(final PublishMonitor monitor, final Long containerId, final Long versionId, final List<Contact> contacts, final List<TeamMember> teamMembers) throws IOException { final Container container = read(containerId); final ContainerVersion version = readVersion(containerId, versionId); // update local team final InternalArtifactModel artifactModel = getInternalArtifactModel(); for (final Contact contact : contacts) artifactModel.addTeamMember(container.getId(), contact.getId()); // build the publish to list then publish final List<JabberId> publishTo = new ArrayList<JabberId>(); final List<User> publishToUsers = new ArrayList<User>(); for (final Contact contact : contacts) { publishTo.add(contact.getId()); publishToUsers.add(contact); } for (final TeamMember teamMember : teamMembers) { publishTo.add(teamMember.getId()); publishToUsers.add(teamMember); } final Calendar currentDateTime = currentDateTime(); publish(monitor, version, publishTo, localUserId(), currentDateTime); // update remote team final InternalSessionModel sessionModel = getSessionModel(); for (final Contact contact : contacts) sessionModel.addTeamMember(container.getUniqueId(), contact.getId()); // create published to list containerIO.createPublishedTo(containerId, version.getVersionId(), publishToUsers); } |
final InternalArtifactModel artifactModel = getInternalArtifactModel(); | final InternalArtifactModel artifactModel = getArtifactModel(); | void handleArtifactPublished(final ContainerArtifactPublishedEvent event) { logger.logApiId(); logger.logVariable("event", event); try { // determine the existance of the container and the version. final InternalArtifactModel artifactModel = getInternalArtifactModel(); final Boolean doesExist = artifactModel.doesExist(event.getUniqueId()); final Long containerId; final Container container; final ContainerVersion version; if (doesExist) { containerId = artifactModel.readId(event.getUniqueId()); container = read(containerId); final Boolean doesVersionExist = artifactModel.doesVersionExist(containerId, event.getVersionId()); if (doesVersionExist) { version = readVersion(container.getId(), event.getVersionId()); } else { version = createVersion(container.getId(), event.getVersionId(), event.getPublishedBy(), event.getPublishedOn()); } } else { // ensure the published by user exists locally getInternalUserModel().readLazyCreate(event.getPublishedBy()); container = new Container(); container.setCreatedBy(event.getPublishedBy()); container.setCreatedOn(event.getPublishedOn()); container.setName(event.getName()); container.setState(ArtifactState.ACTIVE); container.setType(ArtifactType.CONTAINER); container.setUniqueId(event.getUniqueId()); container.setUpdatedBy(container.getCreatedBy()); container.setUpdatedOn(container.getCreatedOn()); // create containerIO.create(container); // create version version = createVersion(container.getId(), event.getVersionId(), event.getPublishedBy(), event.getPublishedOn()); // create remote info artifactModel.createRemoteInfo(container.getId(), event.getPublishedBy(), container.getCreatedOn()); // index getIndexModel().indexContainer(container.getId()); } // handle the artifact by specific type final ArtifactVersion artifactVersion; switch (event.getArtifactType()) { case DOCUMENT: artifactVersion = handleDocumentPublished(event); break; case CONTAINER: default: throw Assert.createUnreachable("UNKNOWN ARTIFACT TYPE"); } containerIO.addVersion(version.getArtifactId(), version.getVersionId(), artifactVersion.getArtifactId(), artifactVersion.getVersionId(), artifactVersion.getArtifactType()); } catch(final Throwable t) { throw translateError(t); } } |
final InternalArtifactModel artifactModel = getInternalArtifactModel(); | final InternalArtifactModel artifactModel = getArtifactModel(); | void handlePublished(final ContainerPublishedEvent event) { logger.logApiId(); logger.logVariable("event", event); try { final InternalArtifactModel artifactModel = getInternalArtifactModel(); final Long containerId = artifactModel.readId(event.getUniqueId()); // add to local team final InternalUserModel userModel = getInternalUserModel(); final List<TeamMember> localTeam = artifactModel.readTeam2(containerId); final List<User> publishedToUsers = new ArrayList<User>(); for (final JabberId publishedToId : event.getPublishedTo()) { if (!contains(localTeam, publishedToId)) { artifactModel.addTeamMember(containerId, publishedToId); } publishedToUsers.add(userModel.read(publishedToId)); } // add the sender as well final TeamMember publishedBy; if (!contains(localTeam, event.getPublishedBy())) { publishedBy = artifactModel.addTeamMember(containerId, event.getPublishedBy()); } else { publishedBy = localTeam.get(indexOf(localTeam, event.getPublishedBy())); } // delete draft final ContainerDraft draft = readDraft(containerId); if (null == draft) { logger.logWarning("Draft did not previously exist for {0}.", event.getName()); } else { deleteDraft(containerId); } // create published to list containerIO.createPublishedTo(containerId, event.getVersionId(), publishedToUsers); // calculate differences final ContainerVersion version = readVersion(containerId, event.getVersionId()); final ContainerVersion previous = readPreviousVersion(containerId, event.getVersionId()); final ContainerVersion next = readNextVersion(containerId, event.getVersionId()); if (null == previous) { logger.logInfo("First version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, previous.getVersionId(), version.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), version, previous)); } if (null == next) { logger.logInfo("Latest version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, version.getVersionId(), next.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), next, version)); } // apply comment if (null != event.getComment() && 0 < event.getComment().trim().length()) containerIO.updateComment(containerId, version.getVersionId(), event.getComment()); // send confirmation getSessionModel().confirmArtifactReceipt(localUserId(), event.getUniqueId(), event.getVersionId(), localUserId(), currentDateTime()); // audit\fire event final Container postPublish = read(containerId); final ContainerVersion postPublishVersion = readVersion(containerId, event.getVersionId()); auditContainerPublished(postPublish, draft, postPublishVersion, event.getPublishedBy(), event.getPublishedTo(), event.getPublishedOn()); notifyContainerPublished(postPublish, publishedBy, postPublishVersion, remoteEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
getIndexModel().indexContainer(containerId); | void handlePublished(final ContainerPublishedEvent event) { logger.logApiId(); logger.logVariable("event", event); try { final InternalArtifactModel artifactModel = getInternalArtifactModel(); final Long containerId = artifactModel.readId(event.getUniqueId()); // add to local team final InternalUserModel userModel = getInternalUserModel(); final List<TeamMember> localTeam = artifactModel.readTeam2(containerId); final List<User> publishedToUsers = new ArrayList<User>(); for (final JabberId publishedToId : event.getPublishedTo()) { if (!contains(localTeam, publishedToId)) { artifactModel.addTeamMember(containerId, publishedToId); } publishedToUsers.add(userModel.read(publishedToId)); } // add the sender as well final TeamMember publishedBy; if (!contains(localTeam, event.getPublishedBy())) { publishedBy = artifactModel.addTeamMember(containerId, event.getPublishedBy()); } else { publishedBy = localTeam.get(indexOf(localTeam, event.getPublishedBy())); } // delete draft final ContainerDraft draft = readDraft(containerId); if (null == draft) { logger.logWarning("Draft did not previously exist for {0}.", event.getName()); } else { deleteDraft(containerId); } // create published to list containerIO.createPublishedTo(containerId, event.getVersionId(), publishedToUsers); // calculate differences final ContainerVersion version = readVersion(containerId, event.getVersionId()); final ContainerVersion previous = readPreviousVersion(containerId, event.getVersionId()); final ContainerVersion next = readNextVersion(containerId, event.getVersionId()); if (null == previous) { logger.logInfo("First version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, previous.getVersionId(), version.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), version, previous)); } if (null == next) { logger.logInfo("Latest version of {0}.", event.getName()); } else { containerIO.deleteDelta(containerId, version.getVersionId(), next.getVersionId()); containerIO.createDelta(calculateDelta(read(containerId), next, version)); } // apply comment if (null != event.getComment() && 0 < event.getComment().trim().length()) containerIO.updateComment(containerId, version.getVersionId(), event.getComment()); // send confirmation getSessionModel().confirmArtifactReceipt(localUserId(), event.getUniqueId(), event.getVersionId(), localUserId(), currentDateTime()); // audit\fire event final Container postPublish = read(containerId); final ContainerVersion postPublishVersion = readVersion(containerId, event.getVersionId()); auditContainerPublished(postPublish, draft, postPublishVersion, event.getPublishedBy(), event.getPublishedTo(), event.getPublishedOn()); notifyContainerPublished(postPublish, publishedBy, postPublishVersion, remoteEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
|
return getInternalArtifactModel().doesVersionExist(containerId, Versioning.START); | return getArtifactModel().doesVersionExist(containerId, Versioning.START); | Boolean isDistributed(final Long containerId) { logger.logApiId(); logger.logVariable("containerId", containerId); try { return getInternalArtifactModel().doesVersionExist(containerId, Versioning.START); } catch (final Throwable t) { throw translateError(t); } } |
getInternalArtifactModel().removeFlagKey(containerId); | getArtifactModel().removeFlagKey(containerId); | void publishVersion(final Long containerId, final Long versionId, final List<Contact> contacts) { logger.logApiId(); logger.logVariable("containerId", containerId); logger.logVariable("versionId", versionId); logger.logVariable("contacts", contacts); try { // remove local key getInternalArtifactModel().removeFlagKey(containerId); final List<TeamMember> teamMembers = Collections.emptyList(); doPublishVersion(PUBLISH_MONITOR, containerId, versionId, contacts, teamMembers); // fire event final Container postPublish = read(containerId); final ContainerVersion postPublishVersion = readVersion(containerId, versionId); notifyContainerPublished(postPublish, postPublishVersion, localEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
return getInternalArtifactModel().readTeam(containerId, | return getArtifactModel().readTeam(containerId, | List<TeamMember> readTeam(final Long containerId) { logger.logApiId(); logger.logVariable("containerId", containerId); return getInternalArtifactModel().readTeam(containerId, UserComparatorFactory.createName(Boolean.TRUE), FilterManager.createDefault()); } |
getInternalArtifactModel().removeFlagBookmark(containerId); | getArtifactModel().removeFlagBookmark(containerId); | void removeBookmark(final Long containerId) { logger.logApiId(); logger.logVariable("containerId", containerId); try { getInternalArtifactModel().removeFlagBookmark(containerId); notifyContainerUpdated(read(containerId), localEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { | final UUID uniqueId, final Long versionId) { | void restore(final UUID uniqueId) { logger.logApiId(); logger.logVariable("uniqueId", uniqueId); try { final InternalArchiveModel archiveModel = getArchiveModel(); // restore container info final Container container = archiveModel.readContainer(uniqueId); restore(container, new RestoreModel() { public InputStream openDocumentVersion(final UUID uniqueId, final Long versionId) { return archiveModel.openDocumentVersion(uniqueId, versionId); } public List<ContainerVersion> readContainerVersions( final UUID uniqueId) { return archiveModel.readContainerVersions(uniqueId); } public List<Document> readDocuments(final UUID uniqueId, final Long versionId) { return archiveModel.readDocuments(uniqueId, versionId); } public List<DocumentVersion> readDocumentVersions( final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { return archiveModel.readDocumentVersions(uniqueId, versionId, documentUniqueId); } public List<JabberId> readTeamIds(final UUID uniqueId) { return archiveModel.readTeamIds(uniqueId); } }); archiveModel.restore(uniqueId); notifyContainerRestored(read(container.getId()), localEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
versionId, documentUniqueId); | versionId); | void restore(final UUID uniqueId) { logger.logApiId(); logger.logVariable("uniqueId", uniqueId); try { final InternalArchiveModel archiveModel = getArchiveModel(); // restore container info final Container container = archiveModel.readContainer(uniqueId); restore(container, new RestoreModel() { public InputStream openDocumentVersion(final UUID uniqueId, final Long versionId) { return archiveModel.openDocumentVersion(uniqueId, versionId); } public List<ContainerVersion> readContainerVersions( final UUID uniqueId) { return archiveModel.readContainerVersions(uniqueId); } public List<Document> readDocuments(final UUID uniqueId, final Long versionId) { return archiveModel.readDocuments(uniqueId, versionId); } public List<DocumentVersion> readDocumentVersions( final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { return archiveModel.readDocumentVersions(uniqueId, versionId, documentUniqueId); } public List<JabberId> readTeamIds(final UUID uniqueId) { return archiveModel.readTeamIds(uniqueId); } }); archiveModel.restore(uniqueId); notifyContainerRestored(read(container.getId()), localEventGenerator); } catch (final Throwable t) { throw translateError(t); } } |
final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { | final UUID uniqueId, final Long versionId) { | public List<DocumentVersion> readDocumentVersions( final UUID uniqueId, final Long versionId, final UUID documentUniqueId) { return archiveModel.readDocumentVersions(uniqueId, versionId, documentUniqueId); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.