public void notifyCompleted(final boolean success) {
   log.info("Completed - layer:", layerId, "type:", type, "success:", success);
   Map<String, Object> output = createCommonResponse("completed");
   output.put("success", success);
   output.put("type", type.toString());
   this.service.addResults(session.getClient(), ResultProcessor.CHANNEL_STATUS, output);
 }
 public void sendCommonErrorResponse(final String message, final boolean once) {
   Map<String, Object> output = createCommonResponse(message);
   if (once) {
     output.put(OUTPUT_ONCE, once);
   }
   this.service.addResults(session.getClient(), ResultProcessor.CHANNEL_ERROR, output);
 }
 /**
  * Checks if the map scale is valid
  *
  * @return <code>true</code> if map scale is valid; <code>false</code> otherwise.
  */
 protected boolean validateMapScales() {
   return JobHelper.isRequestScalesInRange(
       this.session.getMapScales(),
       (int) this.session.getLocation().getZoom(),
       layer,
       session.getLocation().getSrs());
 }
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (APP_ID == null) {
      Util.showAlert(
          this,
          "Warning",
          "Facebook Applicaton ID must be "
              + "specified before running this example: see Example.java");
    }

    setContentView(R.layout.main);
    mLoginButton = (LoginButton) findViewById(R.id.login);
    mText = (TextView) FacebookApplicationActivity.this.findViewById(R.id.txt);
    mUserPic = (ImageView) FacebookApplicationActivity.this.findViewById(R.id.user_pic);
    //       	mFacebook = new Facebook(APP_ID);
    Utility.mFacebook = new Facebook(APP_ID);
    // Instantiate the asynrunner object for asynchronous api calls.
    Utility.mAsyncRunner = new AsyncFacebookRunner(Utility.mFacebook);
    SessionStore.restore(mFacebook, this);
    SessionEvents.addAuthListener(new FbAPIsAuthListener());
    SessionEvents.addLogoutListener(new FbAPIsLogoutListener());
    mLoginButton.init(this, AUTHORIZE_ACTIVITY_RESULT_CODE, Utility.mFacebook, permissions);

    if (Utility.mFacebook.isSessionValid()) {
      requestUserData();
    }

    list = (ListView) findViewById(R.id.main_list);

    list.setOnItemClickListener(this);
    list.setAdapter(new ArrayAdapter<String>(this, R.layout.main_list_item, main_items));
  }
 /** Send image parsing error */
 protected void imageParsingFailed(final String message) {
   log.debug("Image parsing failed");
   Map<String, Object> output = new HashMap<String, Object>();
   output.put(OUTPUT_LAYER_ID, this.layerId);
   output.put(OUTPUT_ONCE, true);
   output.put(OUTPUT_MESSAGE, message);
   this.service.addResults(session.getClient(), ResultProcessor.CHANNEL_ERROR, output);
 }
 public void notifyError(String error) {
   if (error == null) {
     error = "Something went wrong";
   }
   log.error("On Error - layer:", layerId, "type:", type, "msg:", error);
   Map<String, Object> output = createCommonResponse(error);
   output.put("type", type.toString());
   this.service.addResults(session.getClient(), ResultProcessor.CHANNEL_ERROR, output);
 }
 /**
  * Checks if enough information for running the task type
  *
  * @return <code>true</code> if enough information for type; <code>false</code> otherwise.
  */
 public boolean hasValidParams() {
   if (this.type == JobType.HIGHLIGHT) {
     if (this.sessionLayer.getHighlightedFeatureIds() != null
         && this.sessionLayer.getHighlightedFeatureIds().size() > 0) {
       return true;
     }
   } else if (this.type == JobType.MAP_CLICK) {
     if (session.getMapClick() != null) {
       return true;
     }
   } else if (this.type == JobType.GEOJSON) {
     if (session.getFilter() != null) {
       return true;
     }
   } else if (this.type == JobType.PROPERTY_FILTER) {
     if (session.getPropertyFilter() != null) {
       return true;
     }
   } else if (this.type == JobType.NORMAL) {
     return true;
   }
   return false;
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_NO_TITLE);

    if (Utility.APP_ID == null) {
      Util.showAlert(
          this,
          "Warning",
          "Facebook Applicaton ID must be "
              + "specified before running this example: see Example.java");
    }

    setContentView(R.layout.main);

    /* Get Handles for all the controls on the screen which needs
     * manipulation
     */
    mLoginButton = (LoginButton) findViewById(R.id.login);
    btnSearchHotel = (Button) findViewById(R.id.btnSearch);
    lblWelcome = (TextView) findViewById(R.id.lblWelcome);
    txtCityName = (EditText) findViewById(R.id.txtCityName);
    layoutForm = (LinearLayout) findViewById(R.id.layoutForm);
    layoutForm.setVisibility(View.INVISIBLE);

    // Create an instance of Facebook object, passing the APP ID.
    Utility.mFacebook = new Facebook(Utility.APP_ID);

    Utility.mAsyncRunner = new AsyncFacebookRunner(Utility.mFacebook);

    SessionStore.restore(Utility.mFacebook, this);
    SessionEvents.addAuthListener(new SampleAuthListener());
    SessionEvents.addLogoutListener(new SampleLogoutListener());
    mLoginButton.init(this, Utility.mFacebook);

    Spinner spin = (Spinner) findViewById(R.id.ddlHotelChain);
    spin.setOnItemSelectedListener(
        new OnItemSelectedListener() {

          public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long id) {
            // Set the Hotel Chain selected.
            strHotelChain = items_hotel_chain[position];
          }

          public void onNothingSelected(AdapterView<?> arg0) {
            // So, nothing comes here. ;)
          }
        });

    @SuppressWarnings({"rawtypes", "unchecked"})
    ArrayAdapter aa =
        new ArrayAdapter(this, android.R.layout.simple_spinner_item, items_hotel_chain);

    aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spin.setAdapter(aa);

    btnSearchHotel.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            // If city name is entered, call new intent by passing,
            // city name and hotel chain to the new intent.
            if (!txtCityName.getText().toString().trim().equals("")) {
              Intent i = new Intent(getBaseContext(), HotelList.class);
              i.putExtra("cityName", txtCityName.getText().toString().replace(" ", "+").trim());
              i.putExtra("hotelChain", strHotelChain);
              startActivity(i);
            }
            // City name cannot be empty, so tell the user.
            else {
              Toast.makeText(getBaseContext(), "Please enter city name", Toast.LENGTH_SHORT).show();
            }
          }
        });

    if (Utility.mFacebook.isSessionValid()) {
      lblWelcome.setText("Welcome, " + Utility.strUsername);
      layoutForm.setVisibility(View.VISIBLE);
    }
  }
 public void notifyStart() {
   log.info("On start - layer:", layerId, "type:", type);
   this.service.addResults(
       session.getClient(), ResultProcessor.CHANNEL_STATUS, createCommonResponse("started"));
 }