Package com.chandu0101.passwordmemoryclient.rest

Examples of com.chandu0101.passwordmemoryclient.rest.BlueprintResource


        basePresenter.getAddEditPopOver().hide();

    }

    private void saveRecord() {
        BluePrint bluePrint = new BluePrint();
        RestClient restClient = basePresenter.getRestClient();
        bluePrint.setUrl(urlTextField.getText());
        bluePrint.setUsername(usernameTextField.getText());
        bluePrint.setEncryptedPassword(AES.encrypt(passwordTextField.getText(), restClient.getMasterPassword()));
        basePresenter.getAllPasswords().add(restClient.createPassword(bluePrint));
        basePresenter.getAddEditPopOver().hide();
    }
View Full Code Here


    @Override
    protected void updateItem(String s, boolean empty) {
        super.updateItem(s, empty);
        if(!empty && StringUtils.isNotEmpty(s)) {
                BluePrint bluePrint = getTableView().getItems().get(getTableRow().getIndex());
                setText(s);
                Tooltip tooltip = new Tooltip();
                tooltip.setId("tooltip");
                tooltip.textProperty().bind(bluePrint.passwordProperty());
                setTooltip(tooltip);
        } else { // this is needed if table is dynamic otherwise you will see unexpected results
                setText(null);
                setTooltip(null);
        }
View Full Code Here

        addEditPresenter.showAddScreen();
    }

    @FXML
    void handleDeletePassword(ActionEvent event) {
        BluePrint bluePrint = passwordsTable.getSelectionModel().getSelectedItem();
        if(bluePrint != null) {
           restClient.deletePassword(bluePrint.getId());
           allPasswords.remove(bluePrint);
        } else {
            Dialogs.create()
                    .title("Delete Password")
                    .message("Please Select a row/cell in table before deleting.").showInformation();
View Full Code Here

        }
    }

    @FXML
    void handleEditPassword(ActionEvent event) {
        BluePrint bluePrint = passwordsTable.getSelectionModel().getSelectedItem();
        if(bluePrint != null) {
          addEditPresenter.setSelectedBluePrint(bluePrint);
          addEditPresenter.showEditScreen();
        } else {
            Dialogs.create()
View Full Code Here

        }
        return bluePrintList;
    }

    public BluePrint getPasswordById(long id) {
       BluePrint bluePrint = null;
       Response response = passwordsTarget.path(String.valueOf(id)).request(MediaType.APPLICATION_JSON).get();
       if(response.getStatus() == OK.getStatusCode()) {
           BlueprintResource blueprintResource = response.readEntity(BlueprintResource.class);
           bluePrint = createBluePrint(blueprintResource);
       }
View Full Code Here

       }
        return bluePrint;
    }

    public BluePrint createPassword(BluePrint bluePrint) {
       BluePrint result = null;
       Response response = passwordsTarget.request(MediaType.APPLICATION_JSON).post(Entity.json(bluePrint));
        if(response.getStatus() == CREATED.getStatusCode()) {
            BlueprintResource blueprintResource = response.readEntity(BlueprintResource.class);
            result = createBluePrint(blueprintResource);
        }
View Full Code Here

        }
         return result;
    }

    public BluePrint updatePassword(long id,Map newValues) {
        BluePrint result = null;
        Response response = passwordsTarget.path(String.valueOf(id)).request(MediaType.APPLICATION_JSON).put(Entity.json(newValues));
        if(response.getStatus() == CREATED.getStatusCode()) {
            BlueprintResource blueprintResource = response.readEntity(BlueprintResource.class);
            result = createBluePrint(blueprintResource);
        }
View Full Code Here

        return  result;
    }


    private BluePrint createBluePrint(BlueprintResource bResource) {
         BluePrint bPrint = new BluePrint();
         bPrint.setId(Long.valueOf(bResource.getHref().substring(bResource.getHref().lastIndexOf('/')+1)));
         bPrint.setUrl(bResource.getUrl());
         bPrint.setUsername(bResource.getUsername());
         bPrint.setEncryptedPassword(bResource.getEncryptedPassword());
         bPrint.setPassword(AES.decrypt(bResource.getEncryptedPassword(),masterPassword));
         return bPrint;
    }
View Full Code Here

*/


    @Test
    public void testCreateResource() throws Exception {
        BluePrint bPrint = new BluePrint();
        bPrint.setUrl("testutl462");
        bPrint.setUsername("testusername41");
        bPrint.setEncryptedPassword("junitpass28");
        assertNotEquals(null, restClient.createPassword(bPrint));

    }
View Full Code Here

    @FXML
    void handleLogin(ActionEvent event) {
        App.getInstance().setMastePassword(masterPasswordField.getText());
        BaseView view = new BaseView();
        BasePresenter basePresenter = (BasePresenter) view.getPresenter();
        App.getInstance().replaceStageContent(view.getView());
    }
View Full Code Here

TOP

Related Classes of com.chandu0101.passwordmemoryclient.rest.BlueprintResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.