Skip to content

Instantly share code, notes, and snippets.

@dkandalov
Last active December 13, 2015 23:59
Show Gist options
  • Select an option

  • Save dkandalov/4995820 to your computer and use it in GitHub Desktop.

Select an option

Save dkandalov/4995820 to your computer and use it in GitHub Desktop.
Beautiful code best practice enterprise patterns
/**
* 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) {
log.debug("allFeeds: " + allFeeds.size());
if (allFeeds == null)
{
allFeeds = new ArrayList();
}
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);
}
if (ds != null) {
if (ds != null && ds.getID() != null) {
...
}
/**
* A convenience method to return "name" attribute.
* Creation date: (08/06/2002 10:58:32 AM)
* @return java.lang.String
*/
public String getName();
/**
* QueryEngineTest constructor comment.
*/
public QueryEngineTest(...)
@Test
public void testModel()
{
System.out.println(_topology.toString());
}
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) {
// [...]
}
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));
id = (Integer) rData.getTagSetID(getSelectedDataSource(), tags, Boolean.parseBoolean("true"));
// 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 : ");
}
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