multipart-message nevyn bengtsson's blog

featured articles 🦄, about, archive, tags

Software Archaeology Find #4: The New Programming Paradigm Is Copy & Paste & Insanity

    private boolean  loginOrganisation(String pUserName, String pPassword) {


        try {

            RemoteAddress[] status;
            if (Constants.DEBUG) {
                System.out.println(“[MotorolaEmulatorActivator.loginOrganisation] User ” +pUserName );
            }

            RemoteAddress[] domain = null;

            if (pUserName.equals(COUNTY_COUNCIL_USER)) {

                try {
                    domain = mHelp.lookup(COUNTY_COUNCIL_DOMAIN);
                    if (Constants.DEBUG) {
                       System.out.println(“[MotorolaEmulatorActivator.loginOrganisation] Number of correct domains found ” +domain.length);
                   }

                } catch (Exception e) {

                    if (Constants.DEBUG) {
                        System.out.println(“[MotorolaEmulatorActivator.loginOrganisation] Fel på Lookup”);
                    }

                    e.printStackTrace();  //To change body of catch statement use Options | File Templates.
                }

                RemoteAddress[] childs = mHelp.getChilds(domain[0]);

                if (COUNTY_COUNCIL_CONCEPT.equals(mHelp.getProperty(childs[0]))) {

                    mOrganizationDomain = domain[0];
                    mOrganisationConcept = childs[0];
                    mLoggedinOrganisationDomain = COUNTY_COUNCIL_DOMAIN;
                    //status = mHelp.getChilds(childs[0]);
                    //mHelp.setProperty(status[0], “online”);

                 return true;
                }
            }

            if (pUserName.equals(MUNICIPAL_USER)) {

                domain = mHelp.lookup(MUNICIPAL_DOMAIN);

                  if (Constants.DEBUG) {
                    System.out.println(“[MotorolaEmulatorActivator.loginOrganisation] Number of correct domains found ” +domain.length);
                }

                RemoteAddress[] childs = mHelp.getChilds(domain[0]);


                if (MUNICIPAL_CONCEPT.equals(mHelp.getProperty(childs[0]))) {
                    mOrganizationDomain = domain[0];
                    mOrganisationConcept = childs[0];
                    mLoggedinOrganisationDomain = MUNICIPAL_DOMAIN;
                    //status = mHelp.getChilds(childs[0]);
                    //mHelp.setProperty(status[0], “online”);

                 return true;
                }
            }

            if (pUserName.equals(PRIVATE_USER)) {

                domain = mHelp.lookup(PRIVATE_DOMAIN);

                  if (Constants.DEBUG) {
                    System.out.println(“[MotorolaEmulatorActivator.loginOrganisation] Number of correct domains found ” +domain.length);
                }

                RemoteAddress[] childs = mHelp.getChilds(domain[0]);


                if (PRIVATE_CONCEPT.equals(mHelp.getProperty(childs[0]))) {
                    mOrganizationDomain = domain[0];
                    mOrganisationConcept = childs[0];
                    mLoggedinOrganisationDomain = PRIVATE_DOMAIN;
                    //status = mHelp.getChilds(childs[0]);
                    //mHelp.setProperty(status[0], “online”);

                 return true;
                }
            }


        } catch (Exception e) {
            e.printStackTrace();  //To change body of catch statement use Options | File Templates.
        }


        return false;
    }

< Previous archaeology find

Tagged software-archaeology