Last active
December 13, 2015 23:59
-
-
Save dkandalov/4995820 to your computer and use it in GitHub Desktop.
Beautiful code best practice enterprise patterns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Insert the method's description here. | |
| * Creation date: (4/16/01 3:47:01 PM) | |
| * @param newHierarchy com.xxxx.xxxxxxxx.reporting.xxxxx.api.datasource.Hierarchy | |
| */ | |
| public void setHierarchy(com.xxxx.xxxxxxxx.reporting.xxxxx.api.datasource.Hierarchy newHierarchy) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| log.debug("allFeeds: " + allFeeds.size()); | |
| if (allFeeds == null) | |
| { | |
| allFeeds = new ArrayList(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (userObject instanceof com.xxxx.xxxxxxxx.reporting.xxxxx.api.datasource.Dimension) { | |
| id = ((com.xxxx.xxxxxxxx.reporting.xxxxx.api.datasource.Dimension) userObject).getID(); | |
| //System.out.println("Dimension Id: " + id); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (ds != null) { | |
| if (ds != null && ds.getID() != null) { | |
| ... | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * A convenience method to return "name" attribute. | |
| * Creation date: (08/06/2002 10:58:32 AM) | |
| * @return java.lang.String | |
| */ | |
| public String getName(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * QueryEngineTest constructor comment. | |
| */ | |
| public QueryEngineTest(...) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Test | |
| public void testModel() | |
| { | |
| System.out.println(_topology.toString()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| boolean secondPhase = false; //this variable is unnecessary but | |
| // aids understanding | |
| if (tempMaster.isStatusOK()) { | |
| secondPhase = true; | |
| } | |
| else { | |
| if (tempMasterControl.rollbackTransaction()) { | |
| // [...] | |
| throw new IllegalArgumentException("..."); | |
| } | |
| else { | |
| log.error("[...]"); | |
| //do master anyway for what else can we do... | |
| secondPhase = true; | |
| } | |
| } | |
| if (secondPhase) { | |
| // [...] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| selectionPanel.add(new JLabel("COB : ", JLabel.RIGHT)); | |
| selectionPanel.add(datePicker); | |
| selectionPanel.add(new JLabel(" ", JLabel.RIGHT)); | |
| selectionPanel.add(new JLabel("Feed : ", JLabel.RIGHT)); | |
| selectionPanel.add(feedCombo); | |
| selectionPanel.add(new JLabel(" ", JLabel.RIGHT)); | |
| refreshButton = new JButton("Refresh"); | |
| selectionPanel.add(refreshButton); | |
| selectionPanel.add(new JLabel(" ", JLabel.RIGHT)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| id = (Integer) rData.getTagSetID(getSelectedDataSource(), tags, Boolean.parseBoolean("true")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // while Refresh is in progress, donot return to the caller, wait until the | |
| // refresh finishes, so that user will surely no there is no refresh | |
| // Sleep thread for 1 second | |
| try | |
| { | |
| // Thread.currentThread().sleep(5000); | |
| Thread.currentThread().wait(5000); | |
| } | |
| catch (Exception e) | |
| { | |
| log.info("Error during sleeping thread for 5 seconds before checking isRefreshInProgress : "); | |
| blockRefData = oldBlockRefData; | |
| e.printStackTrace(); | |
| throw new XxxxxException("Error during sleeping thread for 5 seconds before checking isRefreshInProgress : "); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected void initGUI() { | |
| Thread.yield(); | |
| controller = new FeedMenuBar(); | |
| FeedInfoPanel infoPanel = new FeedInfoPanel(); | |
| SlaInfoPanel slaInfoPanel = new SlaInfoPanel(); | |
| Thread.yield(); | |
| FeedMappingPanel mappingPanel = new FeedMappingPanel(); | |
| FeedUserPanel userPanel = new FeedUserPanel(); | |
| ... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment