net.nicoulaj.bonita.connectors
Class EncodeQRCode

java.lang.Object
  extended by org.ow2.bonita.connector.core.Connector
      extended by org.ow2.bonita.connector.core.ProcessConnector
          extended by net.nicoulaj.bonita.connectors.EncodeQRCode
All Implemented Interfaces:
org.ow2.bonita.definition.TxHook

public class EncodeQRCode
extends org.ow2.bonita.connector.core.ProcessConnector

A Connector that encodes a text to a QR code.

Since:
0.1
Author:
Julien Nicoulaud

Field Summary
 
Fields inherited from class org.ow2.bonita.connector.core.Connector
validation
 
Constructor Summary
EncodeQRCode()
           
 
Method Summary
protected  void executeConnector()
          Encode the value of text as a QR code.
 com.google.zxing.common.BitMatrix getMatrix()
          Get the resulting QR code encoded BitMatrix.
 String getText()
          The value of the text to be encoded as a QR code.
 void setText(String text)
          Set the text to be encoded as a QR code.
protected  List<org.ow2.bonita.connector.core.ConnectorError> validateValues()
          Validate the input values.
 
Methods inherited from class org.ow2.bonita.connector.core.ProcessConnector
getActivitytInstanceUUID, getProcessDefinitionUUID, getProcessInstanceUUID, setActivityInstanceUUID, setProcessDefinitionUUID, setProcessInstanceUUID
 
Methods inherited from class org.ow2.bonita.connector.core.Connector
bonitaListToArrayMap, bonitaListToMap, checkGraphicalAnnotations, checkRuntimeAnnotations, containsErrors, execute, execute, fieldExists, getField, getFieldName, getGetterName, getGetterReturnType, getGetters, getMethod, getSetters, isFieldExist, validate, validateConnector
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncodeQRCode

public EncodeQRCode()
Method Detail

validateValues

protected List<org.ow2.bonita.connector.core.ConnectorError> validateValues()
Validate the input values.

Only checks the text is not blank.

Specified by:
validateValues in class org.ow2.bonita.connector.core.Connector
Returns:
the list of validation errors.

executeConnector

protected void executeConnector()
                         throws Exception
Encode the value of text as a QR code.

Specified by:
executeConnector in class org.ow2.bonita.connector.core.Connector
Throws:
Exception - if the QR code could not be encoded for some reason.

getText

public String getText()
The value of the text to be encoded as a QR code.

Returns:
the value of text.

setText

public void setText(String text)
Set the text to be encoded as a QR code.

Parameters:
text - the value to use.

getMatrix

public com.google.zxing.common.BitMatrix getMatrix()
Get the resulting QR code encoded BitMatrix.

The matrix can then be used this way:

 MatrixToImageWriter.writeToFile(matrix,"PNG",new File("some/path.png")); // Write to a file
 MatrixToImageWriter.writeToStream(matrix, "PNG", outputStream); // Write to a stream
 BufferedImage image = MatrixToImageWriter.toBufferedImage(matrix); // Get a BufferedImage
 

Returns:


Copyright © 2011. All Rights Reserved.