commit inicial
parent
d6e3bc82ca
commit
2f0cc26fa0
|
@ -0,0 +1,6 @@
|
|||
/bin
|
||||
/target
|
||||
.classpath
|
||||
.DS_Store
|
||||
.project
|
||||
.settings
|
|
@ -0,0 +1,5 @@
|
|||
Domkee Changelog
|
||||
=============================
|
||||
|
||||
0.2.3 (2014/02/01) suport bopepo-0.2.3
|
||||
---------------------------------------
|
|
@ -0,0 +1,191 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,6 @@
|
|||
Domkee
|
||||
======
|
||||
|
||||
[](https://ci-jrimum.rhcloud.com)
|
||||
|
||||
Objetos de domínio usados no projeto [Lançado embutido, incubado]
|
|
@ -0,0 +1,207 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>jrimum-domkee</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Projeto Domkee</name>
|
||||
<version>1.0.0</version>
|
||||
<description>Projeto open source de componentes de software para o domínio de negócios do Brasil.</description>
|
||||
<url>http://www.jrimum.org/domkee</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<organization>
|
||||
<name>Projeto JRimum</name>
|
||||
<url>http://www.jrimum.org</url>
|
||||
</organization>
|
||||
|
||||
<issueManagement>
|
||||
<system>GitHub</system>
|
||||
<url>http://github.com/jrimum/domkee/issues</url>
|
||||
</issueManagement>
|
||||
|
||||
<scm>
|
||||
<url>http://github.com/jrimum/domkee</url>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Gilmar P. S. L.</name>
|
||||
<email>gilmatryx@gmail.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Misael Barreto</name>
|
||||
<email>misaelbarreto@gmail.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Rômulo Augusto</name>
|
||||
<email>romulomail@gmail.com</email>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>disable-java8-doclint</id>
|
||||
<activation>
|
||||
<jdk>[1.8,)</jdk>
|
||||
</activation>
|
||||
<properties>
|
||||
<additionalparam>-Xdoclint:none</additionalparam>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>1.6</version>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
<artifactId>java15</artifactId>
|
||||
<version>1.0</version>
|
||||
</signature>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>animal-sniffer</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/jrimum-domkee-with-dependencies.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.16</version>
|
||||
<configuration>
|
||||
<skipTests>false</skipTests>
|
||||
<includes>
|
||||
<include>org/jrimum/domkee/**/*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>org/jrimum/domkee/excludes/**/*</exclude>
|
||||
<exclude>org/jrimum/domkee/**/*$*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadoc</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<charset>UTF-8</charset>
|
||||
<docencoding>UTF-8</docencoding>
|
||||
<docfilessubdirs>true</docfilessubdirs>
|
||||
<show>private</show>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.1</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>jrimum-vallia</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava-jdk5</artifactId>
|
||||
<version>14.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>hamcrest-all</artifactId>
|
||||
<version>1.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>rj-releases</id>
|
||||
<url>http://52.5.53.15:8081/nexus/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>dep</id>
|
||||
<formats>
|
||||
<format>jar</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>false</includeBaseDirectory>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useProjectArtifact>true</useProjectArtifact>
|
||||
<unpack>true</unpack>
|
||||
<scope>runtime</scope>
|
||||
<excludes>
|
||||
<exclude>commons-lang:commons-lang</exclude>
|
||||
<exclude>log4j:log4j</exclude>
|
||||
</excludes>
|
||||
</dependencySet>
|
||||
</dependencySets>
|
||||
</assembly>
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:59:24
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:59:24
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.contato.NumeroDeTelefone;
|
||||
import org.jrimum.domkee.comum.pessoa.endereco.Endereco;
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
import org.jrimum.domkee.financeiro.banco.febraban.ContaBancaria;
|
||||
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @see org.jrimum.domkee.financeiro.banco.Pessoa
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public interface Pessoa{
|
||||
|
||||
public String getNome();
|
||||
|
||||
public void setNome(String nome);
|
||||
|
||||
public CPRF getCPRF();
|
||||
|
||||
public void setCPRF(CPRF cprf);
|
||||
|
||||
public Collection<NumeroDeTelefone> getTelefones();
|
||||
|
||||
public void setTelefones(Collection<NumeroDeTelefone> telefones);
|
||||
|
||||
public void addTelefone(NumeroDeTelefone telefone);
|
||||
|
||||
public Collection<Endereco> getEnderecos();
|
||||
|
||||
public void setEnderecos(Collection<Endereco> enderecos);
|
||||
|
||||
public void addEndereco(Endereco endereco);
|
||||
|
||||
public Collection<ContaBancaria> getContasBancarias();
|
||||
|
||||
public void setContasBancarias(Collection<ContaBancaria> contasBancarias);
|
||||
|
||||
public void addContaBancaria(ContaBancaria contaBancaria);
|
||||
|
||||
public boolean isFisica();
|
||||
|
||||
public boolean isJuridica();
|
||||
|
||||
public boolean hasContaBancaria();
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:59:31
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:59:31
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.id.RG;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @see org.jrimum.domkee.financeiro.banco.PessoaFisica
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public interface PessoaFisica extends Pessoa {
|
||||
|
||||
public PessoaFisica getConjuge();
|
||||
|
||||
public void setConjuge(PessoaFisica conjuge);
|
||||
|
||||
public String getEstadoCivil();
|
||||
|
||||
public void setEstadoCivil(String estadoCivil);
|
||||
|
||||
public Collection<RG> getRgs();
|
||||
|
||||
public void setRgs(Collection<RG> rgs);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:59:41
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:59:41
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @see org.jrimum.domkee.financeiro.banco.PessoaJuridica
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public interface PessoaJuridica extends Pessoa {
|
||||
|
||||
public String getNomeFantasia();
|
||||
|
||||
public void setNomeFantasia(String nomeFantasia);
|
||||
|
||||
public Long getInscricaoEstadual();
|
||||
|
||||
public void setInscricaoEstadual(Long inscricaoEstadual);
|
||||
|
||||
public Long getInscricaoMunicipal();
|
||||
|
||||
public void setInscricaoMunicipal(Long inscricaoMunicipal);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:07:30
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:07:30
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.contato;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representação básica de um e-mail.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Email {
|
||||
|
||||
private String email;
|
||||
|
||||
public Email() {}
|
||||
|
||||
public Email(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:10:26
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:10:26
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.contato;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representação particio
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class NumeroDeTelefone{
|
||||
|
||||
private int ddi;
|
||||
|
||||
private int ddd;
|
||||
|
||||
private int prefixo;
|
||||
|
||||
private int sufixo;
|
||||
|
||||
private String telefone;
|
||||
|
||||
public NumeroDeTelefone() {}
|
||||
|
||||
public int getDDI() {
|
||||
return ddi;
|
||||
}
|
||||
|
||||
public void setDDI(int ddi) {
|
||||
this.ddi = ddi;
|
||||
}
|
||||
|
||||
public int getDDD() {
|
||||
return ddd;
|
||||
}
|
||||
|
||||
public void setDDD(int ddd) {
|
||||
this.ddd = ddd;
|
||||
}
|
||||
|
||||
public int getPrefixo() {
|
||||
return prefixo;
|
||||
}
|
||||
|
||||
public void setPrefixo(int prefixo) {
|
||||
this.prefixo = prefixo;
|
||||
}
|
||||
|
||||
public int getSufixo() {
|
||||
return sufixo;
|
||||
}
|
||||
|
||||
public void setSufixo(int sufixo) {
|
||||
this.sufixo = sufixo;
|
||||
}
|
||||
|
||||
public String getTelefone() {
|
||||
return telefone;
|
||||
}
|
||||
|
||||
public void setTelefone(String telefone) {
|
||||
this.telefone = telefone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.comum.pessoa.contato;
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:07:05
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:07:05
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.endereco;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representação básica de um CEP.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class CEP {
|
||||
|
||||
/**
|
||||
* Primeiros cinco dígitos.
|
||||
* Exemplo: Para o CEP 59.020-300 o prefixo é o 59020.
|
||||
*/
|
||||
private Integer prefixo;
|
||||
|
||||
/**
|
||||
* Últimos dois dígitos.
|
||||
* Exemplo: Para o CEP 59.020-300 o sufixo é o 300.
|
||||
*/
|
||||
private Integer sufixo;
|
||||
|
||||
/**
|
||||
* CEP completo (prefixo+sufixo).
|
||||
* Exemplo: Para o CEP 59.020-300 o cep pode ser:
|
||||
* <ul>
|
||||
* <li>59.020-300<li>
|
||||
* <li>59020300<li>
|
||||
* </ul>
|
||||
*/
|
||||
private String cep;
|
||||
|
||||
public CEP() {}
|
||||
|
||||
public CEP(String cep) {
|
||||
|
||||
this.cep = cep;
|
||||
}
|
||||
|
||||
public Integer getPrefixo() {
|
||||
return prefixo;
|
||||
}
|
||||
|
||||
public void setPrefixo(Integer prefixo) {
|
||||
this.prefixo = prefixo;
|
||||
}
|
||||
|
||||
public Integer getSufixo() {
|
||||
return sufixo;
|
||||
}
|
||||
|
||||
public void setSufixo(Integer sufixo) {
|
||||
this.sufixo = sufixo;
|
||||
}
|
||||
|
||||
public String getCep() {
|
||||
return cep;
|
||||
}
|
||||
|
||||
public void setCep(String cep) {
|
||||
this.cep = cep;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:07:43
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:07:43
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.endereco;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Entidade que encapsula dados do endereço de uma pessoa, como também
|
||||
* facilidades na manipulação dos seus atributos.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author Misael Barreto
|
||||
* @author Rômulo Augusto
|
||||
* @author <a href="http://www.nordestefomento.com.br">Nordeste Fomento Mercantil</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Endereco {
|
||||
|
||||
/**
|
||||
* Nome da rua, avenida, etc.
|
||||
*/
|
||||
private String logradouro;
|
||||
|
||||
/**
|
||||
* Número que identifica o lugar no logradouro (ex: número da casa).
|
||||
*/
|
||||
private String numero;
|
||||
|
||||
/**
|
||||
* Informação adicional para identificar o estabelecimento na rua.
|
||||
*/
|
||||
private String complemento;
|
||||
|
||||
/**
|
||||
* Cada uma das divisões de uma cidade ou povoação.
|
||||
*/
|
||||
private String bairro;
|
||||
|
||||
/**
|
||||
* Cidade, município, etc.
|
||||
*/
|
||||
private String localidade;
|
||||
|
||||
/**
|
||||
* @see CEP
|
||||
*/
|
||||
private CEP cep;
|
||||
|
||||
/**
|
||||
* @see UnidadeFederativa
|
||||
*/
|
||||
private UnidadeFederativa uf;
|
||||
|
||||
private String pais;
|
||||
|
||||
public Endereco() {}
|
||||
|
||||
public String getBairro() {
|
||||
return bairro;
|
||||
}
|
||||
|
||||
public void setBairro(String bairro) {
|
||||
this.bairro = bairro;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the localidade
|
||||
*/
|
||||
public String getLocalidade() {
|
||||
return localidade;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param localidade the localidade to set
|
||||
*/
|
||||
public void setLocalidade(String localidade) {
|
||||
this.localidade = localidade;
|
||||
}
|
||||
|
||||
public String getLogradouro() {
|
||||
return logradouro;
|
||||
}
|
||||
|
||||
public void setLogradouro(String logradouro) {
|
||||
this.logradouro = logradouro;
|
||||
}
|
||||
|
||||
public String getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public void setNumero(String numero) {
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public UnidadeFederativa getUF() {
|
||||
return uf;
|
||||
}
|
||||
|
||||
public void setUF(UnidadeFederativa uf) {
|
||||
this.uf = uf;
|
||||
}
|
||||
|
||||
public String getComplemento() {
|
||||
return complemento;
|
||||
}
|
||||
|
||||
public void setComplemento(String complemento) {
|
||||
this.complemento = complemento;
|
||||
}
|
||||
|
||||
public CEP getCEP() {
|
||||
return cep;
|
||||
}
|
||||
|
||||
public void setCep(CEP cep) {
|
||||
this.cep = cep;
|
||||
}
|
||||
|
||||
public void setCep(String cep) {
|
||||
setCep(new CEP(cep));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the pais
|
||||
*/
|
||||
public String getPais() {
|
||||
return pais;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pais the pais to set
|
||||
*/
|
||||
public void setPais(String pais) {
|
||||
this.pais = pais;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:09:23
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:09:23
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.endereco;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import org.jrimum.utilix.text.Strings;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Enumera as unidades federativas do Brasil.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="http://www.nordestefomento.com.br">Nordeste Fomento Mercantil</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public enum UnidadeFederativa {
|
||||
|
||||
AM("Amazonas","AM","Manaus"),
|
||||
PA("Pará","PA","Belém"),
|
||||
MT("Mato Grosso","MT","Cuiabá"),
|
||||
MG("Minas Gerais","MG","Belo Horizonte"),
|
||||
BA("Bahia","BA","Salvador"),
|
||||
MS("Mato Grosso do Sul","MS","Campo Grande"),
|
||||
GO("Goiás","GO","Goiânia"),
|
||||
MA("Maranhão","MA","São Luís"),
|
||||
RS("Rio Grande do Sul","RS","Porto Alegre"),
|
||||
TO("Tocantins","TO","Palmas"),
|
||||
PI("Piauí","PI","Teresina"),
|
||||
SP("São Paulo","SP","São Paulo"),
|
||||
RO("Rondônia","RO","Porto Velho"),
|
||||
RR("Roraima","RR","Boa Vista"),
|
||||
PR("Paraná","PR","Curitiba"),
|
||||
AC("Acre","AC","Rio Branco"),
|
||||
CE("Ceará","CE","Fortaleza"),
|
||||
AP("Amapá","AP","Macapá"),
|
||||
PE("Pernambuco","PE","Recife"),
|
||||
SC("Santa Catarina","SC","Florianópolis"),
|
||||
PB("Paraíba","PB","João Pessoa"),
|
||||
RN("Rio Grande do Norte","RN","Natal"),
|
||||
ES("Espírito Santo","ES","Vitória"),
|
||||
RJ("Rio de Janeiro","RJ","Rio de Janeiro"),
|
||||
AL("Alagoas","AL","Maceió"),
|
||||
SE("Sergipe","SE","Aracaju"),
|
||||
DF("Distrito Federal","DF","Brasília"),
|
||||
DESCONHECIDO("","","");
|
||||
|
||||
private String nome;
|
||||
|
||||
private String sigla;
|
||||
|
||||
private String capital;
|
||||
|
||||
UnidadeFederativa(String nome,String sigla,String capital){
|
||||
this.nome = nome;
|
||||
this.sigla = sigla;
|
||||
this.capital = capital;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the nome
|
||||
*/
|
||||
public String getNome() {
|
||||
return nome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sigla
|
||||
*/
|
||||
public String getSigla() {
|
||||
return sigla;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the capital
|
||||
*/
|
||||
public String getCapital() {
|
||||
return capital;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Retorna uma instância que corresponde com a sigla informada, ao contrário
|
||||
* do método {@link UnidadeFederativa#valueOf(String)}, este não diferencia
|
||||
* maiúsculas de minúsculas. Caso não exista um tipo associado a sigla ou
|
||||
* seja informada uma string vazia, uma {@code IllegalArgumentException}
|
||||
* será lançada.
|
||||
* </p>
|
||||
*
|
||||
* @param sigla
|
||||
* - Sigla correspondente a um estado
|
||||
* @return UnidadeFederativa
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public static UnidadeFederativa valueOfSigla(String sigla) {
|
||||
|
||||
Strings.checkNotBlank(sigla, format(
|
||||
"Não existe Unidade Federativa com sigla vazia \"%s\"", sigla));
|
||||
|
||||
return valueOf(sigla.toUpperCase());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.comum.pessoa.endereco;
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:10:19
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:10:19
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.jrimum.domkee.financeiro.banco.PessoaFisica;
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representação básica de um Registro Geral (<em>RG</em>).
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class RG{
|
||||
|
||||
private long numero;
|
||||
|
||||
private String orgaoExpedidor;
|
||||
|
||||
private String filiacaoPai;
|
||||
|
||||
private String filiacaoMae;
|
||||
|
||||
private Date dataNascimento;
|
||||
|
||||
private PessoaFisica pessoa;
|
||||
|
||||
public long getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
public void setNumero(long numero) {
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public String getOrgaoExpedidor() {
|
||||
return orgaoExpedidor;
|
||||
}
|
||||
|
||||
public void setOrgaoExpedidor(String orgaoExpedidor) {
|
||||
this.orgaoExpedidor = orgaoExpedidor;
|
||||
}
|
||||
|
||||
public String getFiliacaoPai() {
|
||||
return filiacaoPai;
|
||||
}
|
||||
|
||||
public void setFiliacaoPai(String filiacaoPai) {
|
||||
this.filiacaoPai = filiacaoPai;
|
||||
}
|
||||
|
||||
public String getFiliacaoMae() {
|
||||
return filiacaoMae;
|
||||
}
|
||||
|
||||
public void setFiliacaoMae(String filiacaoMae) {
|
||||
this.filiacaoMae = filiacaoMae;
|
||||
}
|
||||
|
||||
public Date getDataNascimento() {
|
||||
return dataNascimento;
|
||||
}
|
||||
|
||||
public void setDataNascimento(Date dataNascimento) {
|
||||
this.dataNascimento = dataNascimento;
|
||||
}
|
||||
|
||||
public PessoaFisica getPessoa() {
|
||||
return pessoa;
|
||||
}
|
||||
|
||||
public void setPessoa(PessoaFisica pessoa) {
|
||||
this.pessoa = pessoa;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:03:20
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:03:20
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.EMPTY;
|
||||
import static org.jrimum.utilix.text.Strings.fillWithZeroLeft;
|
||||
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
import org.jrimum.vallia.AbstractCPRFValidator;
|
||||
import org.jrimum.vallia.AbstractCPRFValidator.TipoDeCPRF;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Classe que representa um <a href="http://www.receita.fazenda.gov.br/Principal/Cadastros.htm">Cadastro de Pessoas na Receita Federal</a>, esse
|
||||
* cadastro pode ser o de pessoas físicas ou jurídicas.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* O cadastro tem a finalidade de identificadar cada pessoa no país, seja ela de natureza física
|
||||
* ou jurídica. O <a href="http://www.receita.fazenda.gov.br/Aplicacoes/ATCTA/CPF/default.htm">Cadastro de Pessoa Física é o CPF</a>, já o de <a href="http://www.receita.fazenda.gov.br/PessoaJuridica/cnpj/ConsulSitCadastralCnpj.htm">Pessoa Jurídica é o CNPJ</a>.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public abstract class AbstractCPRF implements CPRF{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String codigoFormatado;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long codigo;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected AbstractCPRFValidator autenticadorCP;
|
||||
|
||||
/**
|
||||
* Cria um {@linkplain CPRF} através de um long e seu
|
||||
* {@linkplain TipoDeCPRF}.
|
||||
*
|
||||
* @param cadastroDePessoa
|
||||
* @param tipoDeCadastro
|
||||
* @return AbstractCPRF (CPF ou CNPJ)
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <C extends AbstractCPRF> C create(Long cadastroDePessoa, TipoDeCPRF tipoDeCadastro) throws IllegalArgumentException {
|
||||
|
||||
return (C) create(String.valueOf(cadastroDePessoa),tipoDeCadastro);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cria um {@linkplain CPRF} através de uma string não formatada e seu
|
||||
* {@linkplain TipoDeCPRF}.
|
||||
*
|
||||
* @param cadastroDePessoa
|
||||
* não formatado
|
||||
* @param tipoDeCadastro
|
||||
* tipo
|
||||
* @return AbstractCPRF (CPF ou CNPJ)
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <C extends AbstractCPRF> C create(String cadastroDePessoa, TipoDeCPRF tipoDeCadastro) throws IllegalArgumentException {
|
||||
|
||||
String codigo = null;
|
||||
|
||||
if (AbstractCPRFValidator.isParametrosValidos(cadastroDePessoa, tipoDeCadastro)) {
|
||||
|
||||
switch_Cadastro: {
|
||||
|
||||
if (tipoDeCadastro == TipoDeCPRF.CPF) {
|
||||
|
||||
codigo = fillWithZeroLeft(cadastroDePessoa, 11);
|
||||
break switch_Cadastro;
|
||||
|
||||
}
|
||||
|
||||
if (tipoDeCadastro == TipoDeCPRF.CNPJ) {
|
||||
|
||||
codigo = fillWithZeroLeft(cadastroDePessoa, 14);
|
||||
break switch_Cadastro;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (C) create(codigo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cria um {@linkplain CPRF} através de uma string formatada ou não.
|
||||
*
|
||||
* @param cadastroDePessoa
|
||||
* - identificador do cadastro de pessoa formatado ou não.
|
||||
* @return uma instância de AbstractCPRF.
|
||||
* @throws IllegalArgumentException
|
||||
* - caso o parâmetro não esteja em um formatador válido de
|
||||
* cadastro de pessoa.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <C extends AbstractCPRF> C create(String cadastroDePessoa)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
AbstractCPRF cp = null;
|
||||
AbstractCPRFValidator autenticadorCP = AbstractCPRFValidator.create(cadastroDePessoa);
|
||||
|
||||
if (autenticadorCP.isValido()) {
|
||||
|
||||
if (autenticadorCP.isFisica()) {
|
||||
|
||||
cp = new CPF(autenticadorCP
|
||||
.getCodigoDoCadastro());
|
||||
|
||||
} else if (autenticadorCP.isJuridica()) {
|
||||
|
||||
cp = new CNPJ(autenticadorCP
|
||||
.getCodigoDoCadastro());
|
||||
}
|
||||
|
||||
cp.autenticadorCP = autenticadorCP;
|
||||
|
||||
} else {
|
||||
|
||||
Exceptions.throwIllegalArgumentException(
|
||||
"O cadastro de pessoa [ \""+cadastroDePessoa+"\" ] não é válido.");
|
||||
}
|
||||
|
||||
return (C) cp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isFisica(){
|
||||
return autenticadorCP.isFisica();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
public boolean isJuridica(){
|
||||
return autenticadorCP.isJuridica();
|
||||
}
|
||||
|
||||
protected void setCodigoFormatado(String codigoFormatado) {
|
||||
|
||||
this.codigoFormatado = codigoFormatado;
|
||||
}
|
||||
|
||||
protected void setCodigo(Long codigo) {
|
||||
|
||||
this.codigo = codigo;
|
||||
}
|
||||
public Long getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
public String getCodigoComZeros() {
|
||||
|
||||
if(isFisica()){
|
||||
return fillWithZeroLeft(getCodigo(), 11);
|
||||
}else{
|
||||
return fillWithZeroLeft(getCodigo(), 14);
|
||||
}
|
||||
}
|
||||
|
||||
public String getCodigoFormatado() {
|
||||
|
||||
return codigoFormatado;
|
||||
}
|
||||
|
||||
public Long getRaiz(){
|
||||
|
||||
if(isFisica()){
|
||||
return Long.valueOf(codigoFormatado.split("-")[0].replaceAll("\\.", EMPTY));
|
||||
}else{
|
||||
return Long.valueOf(codigoFormatado.split("/")[0].replaceAll("\\.", EMPTY));
|
||||
}
|
||||
}
|
||||
|
||||
public String getRaizComZeros(){
|
||||
|
||||
if(isFisica()){
|
||||
return fillWithZeroLeft(getRaiz(), 9);
|
||||
}else{
|
||||
return fillWithZeroLeft(getRaiz(), 8);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRaizFormatada(){
|
||||
|
||||
if(isFisica()){
|
||||
return codigoFormatado.split("-")[0];
|
||||
}else{
|
||||
return codigoFormatado.split("/")[0];
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getDv(){
|
||||
|
||||
return Integer.valueOf(codigoFormatado.split("-")[1]);
|
||||
}
|
||||
|
||||
public String getDvComZeros(){
|
||||
|
||||
return codigoFormatado.split("-")[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Realizado através da ordem natural do {@linkplain #getCodigo()}.
|
||||
*
|
||||
* @see java.lang.Comparable#compareTo(java.lang.Object)
|
||||
*/
|
||||
public int compareTo(Object other) {
|
||||
|
||||
if(other != null){
|
||||
if(other instanceof AbstractCPRF){
|
||||
AbstractCPRF cprf = (AbstractCPRF) other;
|
||||
if(this.autenticadorCP.getTipoDeCadastro().equals(cprf.autenticadorCP.getTipoDeCadastro())){
|
||||
return this.codigo.compareTo(cprf.codigo);
|
||||
}else{
|
||||
return this.autenticadorCP.getTipoDeCadastro().compareTo(cprf.autenticadorCP.getTipoDeCadastro());
|
||||
}
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((codigo == null) ? 0 : codigo.hashCode());
|
||||
result = prime * result
|
||||
+ ((codigoFormatado == null) ? 0 : codigoFormatado.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof AbstractCPRF)) {
|
||||
return false;
|
||||
}
|
||||
AbstractCPRF other = (AbstractCPRF) obj;
|
||||
if (codigo == null) {
|
||||
if (other.codigo != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!codigo.equals(other.codigo)) {
|
||||
return false;
|
||||
}
|
||||
if (codigoFormatado == null) {
|
||||
if (other.codigoFormatado != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!codigoFormatado.equals(other.codigoFormatado)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return getCodigoFormatado();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:06:56
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:06:56
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.isNumeric;
|
||||
import static org.jrimum.utilix.text.Strings.fillWithZeroLeft;
|
||||
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
import org.jrimum.utilix.Objects;
|
||||
import org.jrimum.utilix.text.Strings;
|
||||
import org.jrimum.vallia.AbstractCPRFValidator;
|
||||
import org.jrimum.vallia.AbstractCPRFValidator.TipoDeCPRF;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representa o cadastro nacional de pssoa jurídica (CNPJ), um número
|
||||
* identificador de uma pessoa jurídica junto à Receita Federal, necessário para
|
||||
* que a pessoa jurídica tenha capacidade de fazer contratos e processar ou ser
|
||||
* processada.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* O formato do CNPJ é "##.###.###/####-XX", onde XX é o dígito verificador
|
||||
* do número.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="http://www.nordestefomento.com.br">Nordeste Fomento
|
||||
* Mercantil</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class CNPJ extends AbstractCPRF {
|
||||
|
||||
public CNPJ(Long numCNPJ) {
|
||||
|
||||
try {
|
||||
|
||||
if (AbstractCPRFValidator.isParametrosValidos(
|
||||
String.valueOf(numCNPJ), TipoDeCPRF.CNPJ)) {
|
||||
|
||||
this.autenticadorCP = AbstractCPRFValidator.create(fillWithZeroLeft(numCNPJ, 14));
|
||||
|
||||
if (autenticadorCP.isValido()){
|
||||
|
||||
initFromNumber(numCNPJ);
|
||||
|
||||
}else{
|
||||
|
||||
Exceptions.throwIllegalArgumentException("O cadastro de pessoa [ \"" + numCNPJ+ "\" ] não é válido.");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (!(e instanceof CNPJException))
|
||||
throw new CNPJException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public CNPJ(String strCNPJ) {
|
||||
|
||||
this.autenticadorCP = AbstractCPRFValidator.create(strCNPJ);
|
||||
|
||||
if (autenticadorCP.isValido()) {
|
||||
|
||||
if(isNumeric(strCNPJ)){
|
||||
|
||||
initFromNotFormattedString(strCNPJ);
|
||||
|
||||
}else{
|
||||
|
||||
initFromFormattedString(strCNPJ);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new CNPJException(new IllegalArgumentException(
|
||||
"O cadastro de pessoa [ \"" + strCNPJ + "\" ] não é válido."));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isMatriz(){
|
||||
|
||||
return getSufixoFormatado().equals("0001");
|
||||
}
|
||||
|
||||
public boolean isSufixoEquals(String sufixoFormatado){
|
||||
|
||||
Strings.checkNotNumeric(sufixoFormatado, String.format("O sufixo [%s] deve ser um número natural diferente de zero!", sufixoFormatado));
|
||||
|
||||
return isSufixoEquals(Integer.valueOf(sufixoFormatado));
|
||||
}
|
||||
|
||||
public boolean isSufixoEquals(Integer sufixo){
|
||||
|
||||
Objects.checkNotNull(sufixo,"Sufixo nulo!");
|
||||
Objects.checkArgument(sufixo > 0, String.format("O sufixo [%s] deve ser um número natural diferente de zero!", sufixo));
|
||||
|
||||
return getSufixo().equals(sufixo);
|
||||
}
|
||||
|
||||
public Integer getSufixo(){
|
||||
|
||||
return Integer.valueOf(getSufixoFormatado());
|
||||
}
|
||||
|
||||
public String getSufixoFormatado(){
|
||||
|
||||
return getCodigoFormatado().split("-")[0].split("/")[1];
|
||||
}
|
||||
|
||||
private void initFromNumber(Long numCNPJ) {
|
||||
|
||||
try {
|
||||
|
||||
this.setCodigoFormatado(format(fillWithZeroLeft(numCNPJ, 14)));
|
||||
this.setCodigo(numCNPJ);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CNPJException(e);
|
||||
}
|
||||
}
|
||||
private void initFromFormattedString(String strCNPJ) {
|
||||
|
||||
try {
|
||||
|
||||
this.setCodigoFormatado(strCNPJ);
|
||||
this.setCodigo(Long.parseLong(removeFormat(strCNPJ)));
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CNPJException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initFromNotFormattedString(String strCNPJ) {
|
||||
|
||||
try {
|
||||
|
||||
this.setCodigoFormatado(format(strCNPJ));
|
||||
this.setCodigo(Long.parseLong(strCNPJ));
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CNPJException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String format(String strCNPJ) {
|
||||
|
||||
StringBuilder codigoFormatado = new StringBuilder(strCNPJ);
|
||||
|
||||
codigoFormatado.insert(2, '.');
|
||||
codigoFormatado.insert(6, '.');
|
||||
codigoFormatado.insert(10, '/');
|
||||
codigoFormatado.insert(15, '-');
|
||||
|
||||
return codigoFormatado.toString();
|
||||
}
|
||||
|
||||
private String removeFormat(String codigo) {
|
||||
|
||||
codigo = codigo.replace(".", "");
|
||||
codigo = codigo.replace("/", "");
|
||||
codigo = codigo.replace("-", "");
|
||||
|
||||
return codigo;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
|
||||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 23/04/2008 - 01:06:14
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 23/04/2008 - 01:06:14
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Qualquer falha na geração ou operações próprias da classe CNPJ.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public class CNPJException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 7253144254681596414L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CNPJException() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public CNPJException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public CNPJException(String message) {
|
||||
super(message);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public CNPJException(Throwable cause) {
|
||||
super(cause);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:07:16
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:07:16
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.isNumeric;
|
||||
import static org.jrimum.utilix.text.Strings.fillWithZeroLeft;
|
||||
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
import org.jrimum.vallia.AbstractCPRFValidator;
|
||||
import org.jrimum.vallia.AbstractCPRFValidator.TipoDeCPRF;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representa o cadastro de pessoa física (CPF), um número identificador de todo
|
||||
* contribuinte (pessoas físicas brasileiras ou estrangeiras com negócios no
|
||||
* Brasil).
|
||||
* </p>
|
||||
* <p>
|
||||
* O formatador do CPF é "###.###.###-XX", onde XX é o dígito verificador do
|
||||
* número.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="http://www.nordestefomento.com.br">Nordeste Fomento
|
||||
* Mercantil</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class CPF extends AbstractCPRF {
|
||||
|
||||
public CPF(Long numCPF) {
|
||||
|
||||
try {
|
||||
|
||||
if (AbstractCPRFValidator.isParametrosValidos(String.valueOf(numCPF),
|
||||
TipoDeCPRF.CPF)) {
|
||||
|
||||
this.autenticadorCP = AbstractCPRFValidator.create(fillWithZeroLeft(numCPF, 11));
|
||||
|
||||
if (autenticadorCP.isValido()){
|
||||
|
||||
initFromNumber(numCPF);
|
||||
|
||||
}else{
|
||||
|
||||
Exceptions.throwIllegalArgumentException("O cadastro de pessoa [ \"" + numCPF+ "\" ] não é válido.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
if (!(e instanceof CPFException))
|
||||
throw new CPFException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public CPF(String strCPF) {
|
||||
|
||||
this.autenticadorCP = AbstractCPRFValidator.create(strCPF);
|
||||
|
||||
if (autenticadorCP.isValido()) {
|
||||
|
||||
if(isNumeric(strCPF)){
|
||||
|
||||
initFromNotFormattedString(strCPF);
|
||||
|
||||
}else{
|
||||
|
||||
initFromFormattedString(strCPF);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new CPFException(new IllegalArgumentException(
|
||||
"O cadastro de pessoa [ \"" + strCPF + "\" ] não é válido."));
|
||||
}
|
||||
}
|
||||
|
||||
private void initFromNumber(Long numCPF) {
|
||||
|
||||
try {
|
||||
|
||||
this.setCodigoFormatado(format(fillWithZeroLeft(numCPF, 11)));
|
||||
this.setCodigo(numCPF);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CPFException(e);
|
||||
}
|
||||
}
|
||||
private void initFromFormattedString(String strCPF) {
|
||||
|
||||
try {
|
||||
|
||||
this.setCodigoFormatado(strCPF);
|
||||
this.setCodigo(Long.parseLong(removeFormat(strCPF)));
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CPFException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initFromNotFormattedString(String strCPF) {
|
||||
|
||||
try {
|
||||
|
||||
this.setCodigoFormatado(format(strCPF));
|
||||
this.setCodigo(Long.parseLong(strCPF));
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new CPFException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private String format(String strCPF) {
|
||||
|
||||
StringBuilder codigoFormatado = new StringBuilder(strCPF);
|
||||
|
||||
codigoFormatado.insert(3, '.');
|
||||
codigoFormatado.insert(7, '.');
|
||||
codigoFormatado.insert(11, '-');
|
||||
|
||||
return codigoFormatado.toString();
|
||||
}
|
||||
|
||||
private String removeFormat(String codigo) {
|
||||
|
||||
codigo = codigo.replace(".", "");
|
||||
codigo = codigo.replace("-", "");
|
||||
|
||||
return codigo;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
|
||||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 23/04/2008 - 01:05:45
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 23/04/2008 - 01:05:45
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Qualquer falha na geração ou operações próprias da classe CPF.
|
||||
* </p>
|
||||
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public class CPFException extends RuntimeException {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3614884453255335650L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public CPFException() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
* @param cause
|
||||
*/
|
||||
public CPFException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public CPFException(String message) {
|
||||
super(message);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cause
|
||||
*/
|
||||
public CPFException(Throwable cause) {
|
||||
super(cause);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright 2011 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 26/10/2011 - 21:00:23
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2011 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 26/10/2011 - 21:00:23
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
/**
|
||||
* Interface comum entre Cadastro de Pessoa na Receita Federal de pessoas
|
||||
* Físicas ou Jurídicas.
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*/
|
||||
public interface CPRF extends Comparable<Object>{
|
||||
|
||||
public boolean isFisica();
|
||||
|
||||
public boolean isJuridica();
|
||||
|
||||
public Long getCodigo();
|
||||
|
||||
public String getCodigoComZeros();
|
||||
|
||||
public String getCodigoFormatado();
|
||||
|
||||
public Long getRaiz();
|
||||
|
||||
public String getRaizComZeros();
|
||||
|
||||
public String getRaizFormatada();
|
||||
|
||||
public Integer getDv();
|
||||
|
||||
public String getDvComZeros();
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.comum.pessoa.id;
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.comum.pessoa;
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 04/04/2009 - 16:36:30
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 04/04/2009 - 16:36:30
|
||||
*
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Define o contrato para classes Agencia. Esse contrato é baseado na especificação FEBRABAN:
|
||||
* </p>
|
||||
* <p>
|
||||
* Invariantes:
|
||||
* <ul>
|
||||
* <li>Código: deve ser um inteiro natural (incluindo zero) entre 1 e 5 dígitos</li>
|
||||
* <li>Dígito Verificador: alpha-numérico sendo um inteiro natural (incluindo zero)
|
||||
* ou caracter não vazio (' ') com um dígito.</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public interface Agencia<C, D>{
|
||||
|
||||
/**
|
||||
* @return Número da agência
|
||||
*/
|
||||
C getCodigo();
|
||||
|
||||
/**
|
||||
* @return Dígito verificador
|
||||
*/
|
||||
D getDigitoVerificador();
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:59:18
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:59:18
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
import java.awt.Image;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.PessoaJuridica;
|
||||
import org.jrimum.domkee.financeiro.banco.febraban.CodigoDeCompensacaoBACEN;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Interface que define o contrato para a criação de um novo banco (instituição
|
||||
* financeira) supervisionada pelo <a href="http://www.bcb.gov.br/">BACEN</a>.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public interface Banco extends PessoaJuridica {
|
||||
|
||||
|
||||
/**
|
||||
@see #setCodigoDeCompensacaoBACEN(CodigoDeCompensacaoBACEN)
|
||||
*
|
||||
* @return CodigoDeCompensacaoBACEN
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
CodigoDeCompensacaoBACEN getCodigoDeCompensacaoBACEN();
|
||||
|
||||
/**
|
||||
@see #setSegmento(String)
|
||||
*
|
||||
* @return Segmento
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
String getSegmento();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see #setImgLogo(Image)
|
||||
*
|
||||
* @return Imagem
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
Image getImgLogo();
|
||||
|
||||
|
||||
/**
* <p>
|
||||
* Código de compensação <a href="http://www.bcb.gov.br/">BACEN</a>
|
||||
* </p>>
|
||||
*
|
||||
* @param codigoDeCompensacaoBACEN
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
void setCodigoDeCompensacaoBACEN(CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN);
|
||||
|
||||
/**
* <p>
|
||||
* Segmento registrado no <a href="http://www.bcb.gov.br/">BACEN</a>.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Exemplos:
|
||||
* <ul>
|
||||
* <li>Banco Comercial Estrangeiro - Filial no país</li>
|
||||
* <li>Banco Múltiplo</li>
|
||||
* <li>Banco Comercial</li>
|
||||
* <li>Banco Múltiplo Cooperativo</li>
|
||||
* </ul>
|
||||
* </p>>
|
||||
*
|
||||
* @param segmento
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
void setSegmento(String segmento);
|
||||
|
||||
/**
|
||||
<p>
|
||||
* Imagem da logo-marca do banco.
|
||||
* </p>>
|
||||
*
|
||||
* @param imgLogo
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
void setImgLogo(Image imgLogo);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright 2013 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 20/09/2013 - 18:28:00
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 20/09/2013 - 18:28:00
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
/**
|
||||
* Key de um {@link ParametrosBancariosMap} na qual sua representacao é uma
|
||||
* nome em uma Enumeração.
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @param <P>
|
||||
* Enum usado como key do parâmetro bancário.
|
||||
*/
|
||||
public interface ParametroBancario<P extends Enum<P>> {
|
||||
|
||||
}
|
|
@ -0,0 +1,364 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 14/02/2010 - 18:00:18
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 14/02/2010 - 18:00:18
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
/**
|
||||
* Mapa de parâmetros com dados bancário para condições específicas de
|
||||
* determinados bancos ou implementações. <strong>PARÂMETROS NULOS NÃO SÃO
|
||||
* PERMITIDOS.</strong>
|
||||
*
|
||||
* <p>
|
||||
* Mais dados bancários podem ser necessários a um título para gerar um boleto,
|
||||
* por exemplo. Assim, dependendo do banco, talvez seja necessário informar mais
|
||||
* dados além de:
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>Valor do título;</li>
|
||||
* <li>Vencimento;</li>
|
||||
* <li>Nosso número;</li>
|
||||
* <li>Código do banco;</li>
|
||||
* <li>Data de vencimento;</li>
|
||||
* <li>Agência/Código do cedente</li>;
|
||||
* <li>Código da carteira;</li>
|
||||
* <li>Código da moeda;</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* Definidos como padrão pela FEBRABAN.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @version 0.2
|
||||
* @since 0.2
|
||||
*/
|
||||
public final class ParametrosBancariosMap {
|
||||
|
||||
private Map<ParametroBancario<?>, Number> dadosMap;
|
||||
|
||||
/**
|
||||
* Instancia um mapa sem parâmetros.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public ParametrosBancariosMap() {
|
||||
getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instancia o mapa com um mapeamento já especificado. Nomes e valores nulos
|
||||
* não são permitidos, o nome deve ser único.
|
||||
*
|
||||
* @param nome
|
||||
* do parâmetro a ser associado
|
||||
* @param valor
|
||||
* do parâmetro a ser associado
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* se nome ou valor == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public ParametrosBancariosMap(ParametroBancario<?> nome, Number valor) {
|
||||
|
||||
adicione(nome, valor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se o {@code ParametrosBancariosMap} passado por parâmetro
|
||||
* <strong>não</strong> é <code>null</code> e possui elementos.
|
||||
*
|
||||
*
|
||||
* @param params
|
||||
* - Instância de {@code ParametrosBancariosMap} testada.
|
||||
* @return {@code params != null && params.isNaoVazio()}
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public static boolean hasElement(ParametrosBancariosMap params){
|
||||
|
||||
return params != null && params.isNaoVazio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indica se o mapa contém um mapeamento para o nome de parâmetro
|
||||
* especificado.
|
||||
*
|
||||
* @param nome
|
||||
* do parâmetro cuja existência no mapa será testada.
|
||||
*
|
||||
* @return true se o mapa contém um mapeamento para parâmetro
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* se nome == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public boolean contemComNome(ParametroBancario<?> nome) {
|
||||
|
||||
Objects.checkNotNull(nome);
|
||||
|
||||
return dadosMap.containsKey(nome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indica se o mapa contém o valor especificado.
|
||||
*
|
||||
* @param valor
|
||||
* cuja existência no mapa será testada
|
||||
*
|
||||
* @return true se o mapa contém uma ou mais associações de parâmetros ao
|
||||
* valor especificado
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* se valor == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public <V extends Number> boolean contemComValor(V valor) {
|
||||
|
||||
Objects.checkNotNull(valor);
|
||||
|
||||
return dadosMap.containsValue(valor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o valor para o qual o parâmetro bancário especificada está
|
||||
* mapeado, ou nulo, se este mapa contém não contém nenhum mapeamento para
|
||||
* tal parâmetro. Nomes nulos não são permitidos.
|
||||
*
|
||||
* @param <V>
|
||||
* Tipo de retorno genérico do valor contido no mapa com nome
|
||||
* especificado
|
||||
* @param nome
|
||||
* do parâmetro especificado
|
||||
* @return o valor associado com o parâmetro bancário especificado, ou nulo
|
||||
* se não houver nenhum mapeamento para o mesmo
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* se nome == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Number> V getValor(ParametroBancario<?> nome) {
|
||||
|
||||
Objects.checkNotNull(nome);
|
||||
|
||||
return (V) dadosMap.get(nome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indica se o mapa não contém associações (parâmetro,valor)
|
||||
*
|
||||
* @return true se vazio
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public boolean isVazio() {
|
||||
|
||||
return dadosMap.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Indica se o mapa contém alguma associação (parâmetro,valor)
|
||||
*
|
||||
* @return !isVazio()
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public boolean isNaoVazio() {
|
||||
|
||||
return !isVazio();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna um conjuto de nomes de parâmetro do mapa.
|
||||
*
|
||||
* @return conjuto de nomes de parâmetro do mapa.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public Set<ParametroBancario<?>> nomes() {
|
||||
|
||||
return dadosMap.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna uma coleção com os valores contidos no mapa.
|
||||
*
|
||||
* @return coleção de valores do mapa.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public Collection<? extends Number> valores() {
|
||||
|
||||
return dadosMap.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna um conjuto de entradas (parâmetro,valor) do mapa. Assim qualquer
|
||||
* modificação nestes valores também reflete no mapa de parâmetros
|
||||
* bancários.
|
||||
*
|
||||
* @return conjunto dos mapeamentos contidos.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public Set<Entry<ParametroBancario<?>,Number>> entradas() {
|
||||
return dadosMap.entrySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Associa o valor especificado a um nome de parâmetro também especificado
|
||||
* que deve ser único neste mapa. Nomes e valores nulos não são permitidos.
|
||||
*
|
||||
* @param nome
|
||||
* do parâmetro a ser associado
|
||||
* @param valor
|
||||
* do parâmetro a ser associado
|
||||
* @return referência a este mapa
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* se nome ou valor == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public ParametrosBancariosMap adicione(ParametroBancario<?> nome, Number valor) {
|
||||
|
||||
Objects.checkNotNull(nome);
|
||||
Objects.checkNotNull(valor);
|
||||
|
||||
getInstance();
|
||||
|
||||
dadosMap.put(nome, valor);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adiciona todos os dados bancários de um outro mapeamento neste mapeamento.
|
||||
* Parâmetros nulos não são permitidos.
|
||||
*
|
||||
* <p>
|
||||
* O efeito desta chamada é equivalente a de adiciona("parametro", Valor)
|
||||
* neste mapa, só que uma vez para cada mapeamento.
|
||||
* </p>
|
||||
*
|
||||
* @param dados
|
||||
* - outros parâmetros bancários a serem mapeados neste mapa.
|
||||
* @return referência a este mapa
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* se dados == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public ParametrosBancariosMap adicione(ParametrosBancariosMap dados) {
|
||||
|
||||
Objects.checkNotNull(dados);
|
||||
|
||||
this.dadosMap.putAll(dados.dadosMap);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o valor removido associado ao nome do parâmetro bancário
|
||||
* informado, ou nulo se o mapa não contiver nenhum mapeamento. Nomes nulos
|
||||
* não são permitidos.
|
||||
*
|
||||
* <p>
|
||||
* Um retorno nulo indica necessariamente que não existia nenhum mapeamento
|
||||
* para o nome do parâmetro bancário.
|
||||
* </p>
|
||||
*
|
||||
* @param <V>
|
||||
* Tipo de retorno genérico do valor
|
||||
* @param nome
|
||||
* do parâmetro bancário que deve ser removido do mapa
|
||||
* @return o valor anterior associado com o parâmetro bancário, ou nulo se
|
||||
* não houver nenhum mapeamento para o mesmo
|
||||
*
|
||||
* @throws NullPointerException
|
||||
* se nome == NULL
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <V extends Number> V remova(ParametroBancario<?> nome) {
|
||||
|
||||
Objects.checkNotNull(nome);
|
||||
|
||||
return (V) dadosMap.remove(nome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove todos os os parâmetros desta instância.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public void limpe() {
|
||||
|
||||
dadosMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return retorna o número de parâmetros contidos na instância.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public int quantidade() {
|
||||
|
||||
return dadosMap.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instancia um HashMap<String,Object> para uso da deste map bancário.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
private void getInstance() {
|
||||
|
||||
if (dadosMap == null) {
|
||||
dadosMap = new HashMap<ParametroBancario<?>, Number>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:58:13
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:58:13
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
import static org.jrimum.utilix.Collections.hasElement;
|
||||
import static org.jrimum.utilix.Objects.isNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.contato.NumeroDeTelefone;
|
||||
import org.jrimum.domkee.comum.pessoa.endereco.Endereco;
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.AbstractCPRF;
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
import org.jrimum.domkee.financeiro.banco.febraban.ContaBancaria;
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representa uma pessoa no negócio de boletos bancários.
|
||||
* Ela pode assumir três papéis diferentes:
|
||||
* <ul>
|
||||
* <li>Cedente</li>
|
||||
* <li>Sacador</li>
|
||||
* <li>Sacador Avalista</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Pessoa implements org.jrimum.domkee.comum.pessoa.Pessoa {
|
||||
|
||||
private String nome;
|
||||
|
||||
/**
|
||||
* @see CPRF
|
||||
*/
|
||||
private CPRF cprf;
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
*/
|
||||
private Collection<NumeroDeTelefone> telefones;
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
*/
|
||||
private Collection<Endereco> enderecos;
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
*/
|
||||
private Collection<ContaBancaria> contasBancarias;
|
||||
|
||||
public Pessoa() {}
|
||||
|
||||
public Pessoa(String nome) {
|
||||
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public Pessoa(String nome, String cadastroDePessoa) {
|
||||
|
||||
this.nome = nome;
|
||||
this.cprf = AbstractCPRF.create(cadastroDePessoa);
|
||||
}
|
||||
|
||||
public Pessoa(String nome, CPRF cadastroDePessoa) {
|
||||
|
||||
this.nome = nome;
|
||||
this.cprf = cadastroDePessoa;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
*/
|
||||
public void addContaBancaria(ContaBancaria contaBancaria) {
|
||||
|
||||
if(isNull(contasBancarias)){
|
||||
|
||||
contasBancarias = new ArrayList<ContaBancaria>();
|
||||
}
|
||||
|
||||
contasBancarias.add(contaBancaria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se esta pessoa tem alguma conta bancária.
|
||||
*
|
||||
* @see ContaBancaria
|
||||
*/
|
||||
|
||||
public boolean hasContaBancaria(){
|
||||
|
||||
return hasElement(getContasBancarias());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
*/
|
||||
public void addEndereco(Endereco endereco) {
|
||||
|
||||
if(isNull(enderecos)){
|
||||
|
||||
enderecos = new ArrayList<Endereco>();
|
||||
}
|
||||
|
||||
enderecos.add(endereco);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
*/
|
||||
public void addTelefone(NumeroDeTelefone telefone) {
|
||||
|
||||
if(isNull(telefones)){
|
||||
|
||||
telefones = new ArrayList<NumeroDeTelefone>();
|
||||
}
|
||||
|
||||
telefones.add(telefone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CPRF
|
||||
*/
|
||||
|
||||
public CPRF getCPRF() {
|
||||
|
||||
return cprf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o resultado de uma chamada a {@code iterator.next()} de
|
||||
* {@linkplain #getContasBancarias()}, caso exista alguma conta, ou null, caso
|
||||
* não exista {@linkplain #contasBancarias}.
|
||||
*
|
||||
* @return Chamada a {@code iterator.next()}, caso exista algum endereço ou
|
||||
* null.
|
||||
*/
|
||||
public ContaBancaria getNextContaBancaria(){
|
||||
|
||||
if(hasElement(getContasBancarias())){
|
||||
|
||||
return getContasBancarias().iterator().next();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<ContaBancaria> getContasBancarias() {
|
||||
|
||||
return contasBancarias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o resultado de uma chamada a {@code iterator.next()} de
|
||||
* {@linkplain #getEnderecos()}, caso exista algum endereço, ou null, caso
|
||||
* não exista {@linkplain #enderecos}.
|
||||
*
|
||||
* @return Chamada a {@code iterator.next()}, caso exista algum endereço ou
|
||||
* null.
|
||||
*/
|
||||
public Endereco getNextEndereco(){
|
||||
|
||||
if(hasElement(getEnderecos())){
|
||||
|
||||
return getEnderecos().iterator().next();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<Endereco> getEnderecos() {
|
||||
|
||||
return enderecos;
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
|
||||
return nome;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o resultado de uma chamada a {@code iterator.next()} de
|
||||
* {@linkplain #getTelefones()}, caso exista algum telefone, ou null, caso
|
||||
* não exista {@linkplain #telefones}.
|
||||
*
|
||||
* @return Chamada a {@code iterator.next()}, caso exista algum endereço ou
|
||||
* null.
|
||||
*/
|
||||
public NumeroDeTelefone getNextTelefone(){
|
||||
|
||||
if(hasElement(getTelefones())){
|
||||
|
||||
return getTelefones().iterator().next();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<NumeroDeTelefone> getTelefones() {
|
||||
|
||||
return telefones;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CPRF
|
||||
*/
|
||||
public void setCPRF(CPRF cprf) {
|
||||
|
||||
this.cprf = cprf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
* @see Collection
|
||||
*/
|
||||
public void setContasBancarias(Collection<ContaBancaria> contasBancarias) {
|
||||
|
||||
this.contasBancarias = contasBancarias;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
* @see Collection
|
||||
*/
|
||||
public void setEnderecos(Collection<Endereco> enderecos) {
|
||||
|
||||
this.enderecos = enderecos;
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
* @see Collection
|
||||
*/
|
||||
public void setTelefones(Collection<NumeroDeTelefone> telefones) {
|
||||
|
||||
this.telefones = telefones;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se esta pessoa é uma instância de <code>PessoaFisica</code>.
|
||||
*
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#isFisica()
|
||||
*/
|
||||
public boolean isFisica() {
|
||||
|
||||
return (this instanceof PessoaFisica);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se esta pessoa é uma instância de <code>PessoaJuridica</code>.
|
||||
*
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#isJuridica()
|
||||
*/
|
||||
public boolean isJuridica() {
|
||||
|
||||
return (this instanceof PessoaJuridica);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:58:20
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:58:20
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
import static org.jrimum.utilix.Objects.isNotNull;
|
||||
import static org.jrimum.utilix.Objects.isNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.id.RG;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representação básica de uma Pessoa Física.
|
||||
* </p>
|
||||
*
|
||||
* @see Pessoa
|
||||
* @see org.jrimum.domkee.comum.pessoa.id.cprf.CPRF
|
||||
* @see org.jrimum.domkee.comum.pessoa.id.cprf.CPF
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public class PessoaFisica extends Pessoa implements
|
||||
org.jrimum.domkee.comum.pessoa.PessoaFisica {
|
||||
|
||||
private org.jrimum.domkee.comum.pessoa.PessoaFisica conjuge;
|
||||
|
||||
private String estadoCivil;
|
||||
|
||||
private Collection<RG> rgs;
|
||||
|
||||
public PessoaFisica() {
|
||||
}
|
||||
|
||||
public org.jrimum.domkee.comum.pessoa.PessoaFisica getConjuge() {
|
||||
|
||||
return conjuge;
|
||||
}
|
||||
|
||||
public String getEstadoCivil() {
|
||||
|
||||
return estadoCivil;
|
||||
}
|
||||
|
||||
public Collection<RG> getRgs() {
|
||||
|
||||
return rgs;
|
||||
}
|
||||
|
||||
public void setConjuge(
|
||||
org.jrimum.domkee.comum.pessoa.PessoaFisica conjuge) {
|
||||
|
||||
this.conjuge = conjuge;
|
||||
|
||||
if (isNotNull(conjuge) && isNull(conjuge.getConjuge()))
|
||||
conjuge.setConjuge(this);
|
||||
}
|
||||
|
||||
public void setEstadoCivil(String estadoCivil) {
|
||||
|
||||
this.estadoCivil = estadoCivil;
|
||||
}
|
||||
|
||||
public void setRgs(Collection<RG> rgs) {
|
||||
|
||||
this.rgs = rgs;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:58:26
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:58:26
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representação básica de uma Pessoa Jurídica.
|
||||
* </p>
|
||||
*
|
||||
* @see Pessoa
|
||||
* @see org.jrimum.domkee.comum.pessoa.id.cprf.CPRF
|
||||
* @see org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class PessoaJuridica extends Pessoa implements org.jrimum.domkee.comum.pessoa.PessoaJuridica {
|
||||
|
||||
private Long inscricaoEstadual;
|
||||
|
||||
private Long inscricaoMunicipal;
|
||||
|
||||
/**
|
||||
* Título do estabelecimento, diferente do <code>nome</code> (NOME EMPRESARIAL).
|
||||
*/
|
||||
private String nomeFantasia;
|
||||
|
||||
|
||||
public Long getInscricaoEstadual() {
|
||||
|
||||
return inscricaoEstadual;
|
||||
}
|
||||
|
||||
|
||||
public Long getInscricaoMunicipal() {
|
||||
|
||||
return inscricaoMunicipal;
|
||||
}
|
||||
|
||||
|
||||
public String getNomeFantasia() {
|
||||
|
||||
return nomeFantasia;
|
||||
}
|
||||
|
||||
|
||||
public void setInscricaoEstadual(Long inscricaoEstadual) {
|
||||
|
||||
this.inscricaoEstadual = inscricaoEstadual;
|
||||
}
|
||||
|
||||
|
||||
public void setInscricaoMunicipal(Long inscricaoMunicipal) {
|
||||
|
||||
this.inscricaoMunicipal = inscricaoMunicipal;
|
||||
}
|
||||
|
||||
|
||||
public void setNomeFantasia(String nomeFantasia) {
|
||||
|
||||
this.nomeFantasia = nomeFantasia;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,119 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:57:33
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:57:33
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import static org.apache.commons.lang.StringUtils.EMPTY;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Esta classe segue o padrão especificado pela FEBRABAN:
|
||||
* <br/>
|
||||
* Invariantes:
|
||||
* <ul>
|
||||
* <li>Código: deve ser um inteiro natural (incluindo zero) entre 1 e 5 dígitos</li>
|
||||
* <li>Dígito Verificador: alpha-numérico sendo um inteiro natural (incluindo zero)
|
||||
* ou caracter não vazio (' ') com um dígito.</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Agencia implements org.jrimum.domkee.financeiro.banco.Agencia<Integer, String> {
|
||||
|
||||
private final Integer codigo;
|
||||
|
||||
private final String digitoVerificador;
|
||||
|
||||
public Agencia(Integer codigo) {
|
||||
|
||||
this.codigo = codigo;
|
||||
verifyCodigo();
|
||||
this.digitoVerificador = EMPTY;
|
||||
}
|
||||
|
||||
public Agencia(Integer codigo, String digito) {
|
||||
|
||||
this.codigo = codigo;
|
||||
verifyCodigo();
|
||||
this.digitoVerificador = digito;
|
||||
verifyDv();
|
||||
}
|
||||
|
||||
public void verifyCodigo() {
|
||||
|
||||
if (codigo < 0 ) {
|
||||
Exceptions.throwIllegalArgumentException("O código da agência deve ser um inteiro natural (incluindo zero)");
|
||||
}
|
||||
|
||||
if (String.valueOf(codigo).length() > 5) {
|
||||
Exceptions.throwIllegalArgumentException("O código da agência deve possuir de 1 a 5 dígitos");
|
||||
}
|
||||
}
|
||||
|
||||
public void verifyDv(){
|
||||
|
||||
if (StringUtils.isBlank(digitoVerificador)) {
|
||||
Exceptions.throwIllegalArgumentException("O dígito verificador da agência não pode ser null ou apenas espaços em branco");
|
||||
}
|
||||
|
||||
if (digitoVerificador.length() > 1) {
|
||||
Exceptions.throwIllegalArgumentException("O dígito verificador da agência deve possuir apenas um dígito");
|
||||
}
|
||||
|
||||
if (!StringUtils.isAlphanumeric(digitoVerificador)) {
|
||||
Exceptions.throwIllegalArgumentException("O dígito verificador da agência deve ser letra ou dígito");
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
public String getDigitoVerificador() {
|
||||
return digitoVerificador;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,444 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:57:43
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:57:43
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import static org.jrimum.utilix.Objects.isNotNull;
|
||||
|
||||
import java.awt.Image;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.builder.ToStringBuilder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jrimum.domkee.comum.pessoa.contato.NumeroDeTelefone;
|
||||
import org.jrimum.domkee.comum.pessoa.endereco.Endereco;
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ;
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
import org.jrimum.domkee.financeiro.banco.Pessoa;
|
||||
import org.jrimum.domkee.financeiro.banco.PessoaJuridica;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Um Banco (instituição financeira) supervisionada pelo <a href="http://www.bcb.gov.br/">BACEN</a>.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public class Banco implements org.jrimum.domkee.financeiro.banco.Banco {
|
||||
|
||||
private static Logger log = Logger.getLogger(Banco.class);
|
||||
|
||||
private CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN;
|
||||
|
||||
private String segmento;
|
||||
|
||||
private Image imgLogo;
|
||||
|
||||
private PessoaJuridica pessoaJuridica;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Banco() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param codigoDeCompensacaoBACEN
|
||||
* @param instituicao
|
||||
*/
|
||||
public Banco(CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN, String instituicao) {
|
||||
super();
|
||||
|
||||
this.codigoDeCompensacaoBACEN = codigoDeCompensacaoBACEN;
|
||||
|
||||
pessoaJuridica = new PessoaJuridica();
|
||||
pessoaJuridica.setNome(instituicao);
|
||||
pessoaJuridica.setNomeFantasia(instituicao);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigoDeCompensacaoBACEN
|
||||
* @param instituicao
|
||||
* @param cnpj
|
||||
*/
|
||||
public Banco(CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN, String instituicao, CNPJ cnpj) {
|
||||
super();
|
||||
|
||||
this.codigoDeCompensacaoBACEN = codigoDeCompensacaoBACEN;
|
||||
|
||||
pessoaJuridica = new PessoaJuridica();
|
||||
|
||||
pessoaJuridica.setCPRF(cnpj);
|
||||
pessoaJuridica.setNome(instituicao);
|
||||
pessoaJuridica.setNomeFantasia(instituicao);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigoDeCompensacaoBACEN
|
||||
* @param instituicao
|
||||
* @param cnpj
|
||||
* @param segmento
|
||||
*/
|
||||
public Banco(CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN, String instituicao, CNPJ cnpj, String segmento) {
|
||||
|
||||
super();
|
||||
|
||||
this.codigoDeCompensacaoBACEN = codigoDeCompensacaoBACEN;
|
||||
this.segmento = segmento;
|
||||
|
||||
pessoaJuridica = new PessoaJuridica();
|
||||
pessoaJuridica.setCPRF(cnpj);
|
||||
pessoaJuridica.setNome(instituicao);
|
||||
pessoaJuridica.setNomeFantasia(instituicao);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigoDeCompensacaoBACEN
|
||||
* @param instituicao
|
||||
* @param cnpj
|
||||
* @param segmento
|
||||
* @param imgLogo
|
||||
*/
|
||||
public Banco(CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN, String instituicao, CNPJ cnpj, String segmento, Image imgLogo) {
|
||||
|
||||
super();
|
||||
|
||||
this.codigoDeCompensacaoBACEN = codigoDeCompensacaoBACEN;
|
||||
this.segmento = segmento;
|
||||
this.imgLogo = imgLogo;
|
||||
|
||||
pessoaJuridica = new PessoaJuridica();
|
||||
pessoaJuridica.setCPRF(cnpj);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Verifica se o código passado está ok em relação as regras:
|
||||
* <ol>
|
||||
* <li>Não nulo</li>
|
||||
* <li>Numérico</li>
|
||||
* <li>Com 3 digitos</li>
|
||||
* </ol>
|
||||
* </p>
|
||||
*
|
||||
* @param codigo - Código de compensação BACEN do banco
|
||||
*
|
||||
* @return se ok
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
*/
|
||||
public static boolean isCodigoDeCompensacaoOK(String codigo) {
|
||||
|
||||
boolean ok = false;
|
||||
|
||||
if (isNotNull(codigo)) {
|
||||
|
||||
if (StringUtils.isNumeric(codigo)) {
|
||||
|
||||
if (codigo.length() == 3) {
|
||||
|
||||
ok = true;
|
||||
|
||||
} else {
|
||||
log.warn("O código é de apenas 3 digitos!");
|
||||
}
|
||||
|
||||
} else {
|
||||
log.warn("O código de compensação deve ser numérico!");
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the codigoDeCompensacaoBACEN
|
||||
*/
|
||||
public CodigoDeCompensacaoBACEN getCodigoDeCompensacaoBACEN() {
|
||||
return codigoDeCompensacaoBACEN;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param codigoDeCompensacaoBACEN the codigoDeCompensacaoBACEN to set
|
||||
*/
|
||||
public void setCodigoDeCompensacaoBACEN(
|
||||
CodigoDeCompensacaoBACEN codigoDeCompensacaoBACEN) {
|
||||
this.codigoDeCompensacaoBACEN = codigoDeCompensacaoBACEN;
|
||||
}
|
||||
|
||||
|
||||
public CNPJ getCNPJ() {
|
||||
return (CNPJ)pessoaJuridica.getCPRF();
|
||||
}
|
||||
|
||||
public void setCNPJ(CNPJ cnpj) {
|
||||
pessoaJuridica.setCPRF(cnpj);
|
||||
}
|
||||
|
||||
public String getSegmento() {
|
||||
return segmento;
|
||||
}
|
||||
|
||||
public void setSegmento(String segmento) {
|
||||
this.segmento = segmento;
|
||||
}
|
||||
|
||||
public Image getImgLogo() {
|
||||
return imgLogo;
|
||||
}
|
||||
|
||||
public void setImgLogo(Image imgLogo) {
|
||||
this.imgLogo = imgLogo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#addEndereco(org.jrimum.domkee.comum.pessoa.endereco.Endereco)
|
||||
*/
|
||||
|
||||
public void addEndereco(Endereco endereco) {
|
||||
|
||||
pessoaJuridica.addEndereco(endereco);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#addTelefone(org.jrimum.domkee.comum.pessoa.contato.NumeroDeTelefone)
|
||||
*/
|
||||
|
||||
public void addTelefone(NumeroDeTelefone telefone) {
|
||||
|
||||
pessoaJuridica.addTelefone(telefone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#getCPRF()
|
||||
*/
|
||||
|
||||
public CPRF getCPRF() {
|
||||
|
||||
return pessoaJuridica.getCPRF();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#getEnderecos()
|
||||
*/
|
||||
public Collection<Endereco> getEnderecos() {
|
||||
|
||||
return pessoaJuridica.getEnderecos();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#getNome()
|
||||
*/
|
||||
|
||||
public String getNome() {
|
||||
|
||||
return pessoaJuridica.getNome();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#getTelefones()
|
||||
*/
|
||||
|
||||
public Collection<NumeroDeTelefone> getTelefones() {
|
||||
|
||||
return pessoaJuridica.getTelefones();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#isFisica()
|
||||
*/
|
||||
|
||||
public boolean isFisica() {
|
||||
|
||||
return pessoaJuridica.isFisica();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#isJuridica()
|
||||
*/
|
||||
|
||||
public boolean isJuridica() {
|
||||
|
||||
return pessoaJuridica.isJuridica();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#setCPRF(org.jrimum.domkee.comum.pessoa.id.cprf.CPRF)
|
||||
*/
|
||||
|
||||
public void setCPRF(CPRF cprf) {
|
||||
|
||||
pessoaJuridica.setCPRF(cprf);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#setEnderecos(java.util.Collection)
|
||||
*/
|
||||
public void setEnderecos(Collection<Endereco> enderecos) {
|
||||
|
||||
pessoaJuridica.setEnderecos(enderecos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#setNome(java.lang.String)
|
||||
*/
|
||||
|
||||
public void setNome(String nome) {
|
||||
|
||||
pessoaJuridica.setNome(nome);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#setTelefones(java.util.Collection)
|
||||
*/
|
||||
|
||||
public void setTelefones(Collection<NumeroDeTelefone> telefones) {
|
||||
|
||||
pessoaJuridica.setTelefones(telefones);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.PessoaJuridica#getInscricaoEstadual()
|
||||
*/
|
||||
|
||||
public Long getInscricaoEstadual() {
|
||||
|
||||
return pessoaJuridica.getInscricaoEstadual();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.PessoaJuridica#getInscricaoMunicipal()
|
||||
*/
|
||||
|
||||
public Long getInscricaoMunicipal() {
|
||||
|
||||
return pessoaJuridica.getInscricaoMunicipal();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.PessoaJuridica#getNomeFantasia()
|
||||
*/
|
||||
|
||||
public String getNomeFantasia() {
|
||||
|
||||
return pessoaJuridica.getNome();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.PessoaJuridica#setInscricaoEstadual(java.lang.Long)
|
||||
*/
|
||||
|
||||
public void setInscricaoEstadual(Long inscricaoEstadual) {
|
||||
|
||||
pessoaJuridica.setInscricaoEstadual(inscricaoEstadual);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.PessoaJuridica#setInscricaoMunicipal(java.lang.Long)
|
||||
*/
|
||||
|
||||
public void setInscricaoMunicipal(Long inscricaoMunicipal) {
|
||||
|
||||
pessoaJuridica.setInscricaoMunicipal(inscricaoMunicipal);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.PessoaJuridica#setNomeFantasia(java.lang.String)
|
||||
*/
|
||||
|
||||
public void setNomeFantasia(String nomeFantasia) {
|
||||
|
||||
pessoaJuridica.setNomeFantasia(nomeFantasia);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Pessoa#addContaBancaria(ContaBancaria)
|
||||
*/
|
||||
public void addContaBancaria(ContaBancaria contaBancaria) {
|
||||
pessoaJuridica.addContaBancaria(contaBancaria);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see Pessoa#getContasBancarias()
|
||||
*/
|
||||
|
||||
public Collection<ContaBancaria> getContasBancarias() {
|
||||
|
||||
return pessoaJuridica.getContasBancarias();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Pessoa#hasContaBancaria()
|
||||
*/
|
||||
public boolean hasContaBancaria() {
|
||||
|
||||
return pessoaJuridica.hasContaBancaria();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa#setContasBancarias(java.util.Collection)
|
||||
*/
|
||||
|
||||
public void setContasBancarias(Collection<ContaBancaria> contasBancarias) {
|
||||
|
||||
pessoaJuridica.setContasBancarias(contasBancarias);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
ToStringBuilder tb = new ToStringBuilder(this);
|
||||
tb.append(codigoDeCompensacaoBACEN);
|
||||
tb.append(segmento);
|
||||
tb.append(pessoaJuridica);
|
||||
|
||||
return tb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:57:33
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:57:33
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Carteira de Cobrança de uma Conta Corrente.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href=http://gilmatryx.googlepages.com/>Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public class Carteira {
|
||||
|
||||
/**
|
||||
* @see #setNome(String)
|
||||
*/
|
||||
private String nome;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
private Integer codigo;
|
||||
|
||||
/**
|
||||
* @see #setTipoCobranca(TipoDeCobranca)
|
||||
*/
|
||||
private TipoDeCobranca tipoDeCobranca;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Carteira() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigo
|
||||
*/
|
||||
public Carteira(Integer codigo) {
|
||||
super();
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param codigo
|
||||
* @param cobranca
|
||||
*/
|
||||
public Carteira(Integer codigo, TipoDeCobranca cobranca) {
|
||||
super();
|
||||
this.codigo = codigo;
|
||||
this.tipoDeCobranca = cobranca;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param codigo
|
||||
* @param cobranca
|
||||
* @param nome
|
||||
*/
|
||||
public Carteira(Integer codigo, TipoDeCobranca cobranca, String nome) {
|
||||
super();
|
||||
this.nome = nome;
|
||||
this.codigo = codigo;
|
||||
this.tipoDeCobranca = cobranca;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setNome(String)
|
||||
*
|
||||
* @return the nome
|
||||
*/
|
||||
public String getNome() {
|
||||
return nome;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Nome da modalidade de cobrança (ou serviços) atribuído a carteira.
|
||||
* </p>
|
||||
*
|
||||
* @param nome the nome to set
|
||||
*/
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setCodigo(Integer)
|
||||
*
|
||||
* @return the codigo
|
||||
*/
|
||||
public Integer getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Código adotado pela <a href="http://www.febraban.org.br">FEBRABAN</a>, para identificar a característica dos
|
||||
* títulos dentro das modalidades de cobrança existentes no banco.
|
||||
* </p>
|
||||
*
|
||||
* @param codigo the codigo to set
|
||||
*/
|
||||
public void setCodigo(Integer codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tipoCobranca
|
||||
*/
|
||||
public TipoDeCobranca getTipoCobranca() {
|
||||
return tipoDeCobranca;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Define o tipo de cobrança da carteira (Registrada ou não-registrada).
|
||||
* </p>
|
||||
*
|
||||
* @param cobranca
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public void setTipoCobranca(TipoDeCobranca cobranca) {
|
||||
this.tipoDeCobranca = cobranca;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Indica se é uma carteira registrada.
|
||||
* </p>
|
||||
*
|
||||
* @return true se registrada
|
||||
*/
|
||||
public boolean isComRegistro() {
|
||||
return (this.tipoDeCobranca == TipoDeCobranca.COM_REGISTRO);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Indica se é uma carteira não registrada.
|
||||
* </p>
|
||||
*
|
||||
* @return true se sem registro
|
||||
*/
|
||||
public boolean isSemRegistro() {
|
||||
return (this.tipoDeCobranca == TipoDeCobranca.SEM_REGISTRO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: Jan 28, 2010 - 1:36:56 PM
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: Jan 28, 2010 - 1:36:56 PM
|
||||
*
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representa um Cedente no modelo de negócio financeiro, que é
|
||||
* aquele que realiza a cobrança do título.
|
||||
* </p>
|
||||
* <p>
|
||||
* Cliente que entrega os títulos ao Banco para serem cobrados.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Cedente extends EntidadeDeCobranca {
|
||||
|
||||
public Cedente(String nome) {
|
||||
super(nome);
|
||||
}
|
||||
|
||||
public Cedente(String nome, String cadastroDePessoa) {
|
||||
super(nome, cadastroDePessoa);
|
||||
}
|
||||
|
||||
public Cedente(String nome, CPRF cadastroDePessoa) {
|
||||
super(nome, cadastroDePessoa);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 15/06/2008 - 16:11:16
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/06/2008 - 16:11:16
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import static org.jrimum.utilix.text.Strings.fillWithZeroLeft;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
import org.jrimum.vallia.digitoverificador.CodigoDeCompensacaoBancosBACENDV;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Código de compensação para bancos supervisionados pelo <a
|
||||
* href="http://www.bcb.gov.br/?CHEQUESCOMPE">BACEN</a>
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class CodigoDeCompensacaoBACEN {
|
||||
|
||||
private static final CodigoDeCompensacaoBancosBACENDV dv4Compensacao = new CodigoDeCompensacaoBancosBACENDV();
|
||||
|
||||
private Integer codigo;
|
||||
|
||||
private Integer digito;
|
||||
|
||||
/**
|
||||
* @param codigo
|
||||
*/
|
||||
public CodigoDeCompensacaoBACEN(Integer codigo) {
|
||||
super();
|
||||
|
||||
setCodigo(codigo);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigo
|
||||
*/
|
||||
public CodigoDeCompensacaoBACEN(String codigo) {
|
||||
super();
|
||||
|
||||
setCodigo(codigo);
|
||||
}
|
||||
|
||||
private void initDV(){
|
||||
|
||||
if(dv4Compensacao.isCodigoValido(codigo)){
|
||||
this.digito = dv4Compensacao.calcule(codigo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the codigo formatado ex: "001"
|
||||
*/
|
||||
public String getCodigoFormatado() {
|
||||
return fillWithZeroLeft(getCodigo(), 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the codigo
|
||||
*/
|
||||
public Integer getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigo the codigo to set
|
||||
*/
|
||||
public void setCodigo(Integer codigo) {
|
||||
|
||||
if(dv4Compensacao.isCodigoValido(codigo)){
|
||||
this.codigo = codigo;
|
||||
initDV();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param codigo the codigo to set
|
||||
*/
|
||||
public void setCodigo(String codigo) {
|
||||
|
||||
if(dv4Compensacao.isCodigoValido(codigo)){
|
||||
this.codigo = Integer.valueOf(codigo);
|
||||
initDV();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the digito
|
||||
*/
|
||||
public Integer getDigito() {
|
||||
return digito;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:57:59
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:57:59
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jrimum.domkee.financeiro.banco.Banco;
|
||||
import org.jrimum.domkee.financeiro.banco.Pessoa;
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* É um vínculo entre uma Pessoa e um Banco que agrega a agência, o número da conta
|
||||
* ou o código do cedente e a carteira.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*
|
||||
* @see org.jrimum.domkee.comum.pessoa.Pessoa
|
||||
* @see Banco
|
||||
*/
|
||||
public class ContaBancaria {
|
||||
|
||||
/**
|
||||
* @see Banco
|
||||
*/
|
||||
private Banco banco;
|
||||
|
||||
/**
|
||||
* @see Agencia
|
||||
*/
|
||||
private Agencia agencia;
|
||||
|
||||
/**
|
||||
* @see NumeroDaConta
|
||||
*/
|
||||
private NumeroDaConta numeroDaConta;
|
||||
|
||||
/**
|
||||
* @see Carteira
|
||||
*/
|
||||
private Carteira carteira;
|
||||
|
||||
/**
|
||||
* @see Pessoa
|
||||
*/
|
||||
private Collection<Pessoa> titulares;
|
||||
|
||||
/**
|
||||
* @see Titulo
|
||||
*/
|
||||
private Collection<Titulo> titulos;
|
||||
|
||||
/**
|
||||
* @see Modalidade
|
||||
*/
|
||||
private Modalidade modalidade;
|
||||
|
||||
|
||||
public ContaBancaria() {}
|
||||
|
||||
public ContaBancaria(Banco banco) {
|
||||
|
||||
this.banco = banco;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Carteira
|
||||
*/
|
||||
public Carteira getCarteira() {
|
||||
return carteira;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Carteira
|
||||
*/
|
||||
public void setCarteira(Carteira carteira) {
|
||||
this.carteira = carteira;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Banco
|
||||
*/
|
||||
public Banco getBanco() {
|
||||
return banco;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Banco
|
||||
*/
|
||||
public void setBanco(Banco banco) {
|
||||
this.banco = banco;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Pessoa
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<Pessoa> getTitulares() {
|
||||
return titulares;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Pessoa
|
||||
* @see Collection
|
||||
*/
|
||||
public void setTitulares(Collection<Pessoa> titulares) {
|
||||
this.titulares = titulares;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Titulo
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<Titulo> getTitulos() {
|
||||
return titulos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Titulo
|
||||
* @see Collection
|
||||
*/
|
||||
public void setTitulos(Collection<Titulo> titulos) {
|
||||
this.titulos = titulos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Agencia
|
||||
*/
|
||||
public Agencia getAgencia() {
|
||||
return agencia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Agencia
|
||||
*/
|
||||
public void setAgencia(Agencia agencia) {
|
||||
this.agencia = agencia;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDaConta
|
||||
*/
|
||||
public NumeroDaConta getNumeroDaConta() {
|
||||
return numeroDaConta;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDaConta
|
||||
*/
|
||||
public void setNumeroDaConta(NumeroDaConta numeroDaConta) {
|
||||
this.numeroDaConta = numeroDaConta;
|
||||
}
|
||||
|
||||
public Modalidade getModalidade() {
|
||||
return modalidade;
|
||||
}
|
||||
|
||||
public void setModalidade(Modalidade modalidade) {
|
||||
this.modalidade = modalidade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: Jan 28, 2010 - 1:29:53 PM
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: Jan 28, 2010 - 1:29:53 PM
|
||||
*
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.contato.NumeroDeTelefone;
|
||||
import org.jrimum.domkee.comum.pessoa.endereco.Endereco;
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
import org.jrimum.domkee.financeiro.banco.Pessoa;
|
||||
|
||||
|
||||
/**
|
||||
* Supertipo para as entidades de cobrança (Sacado, Cedente, SacadorAvalista). Encapsula
|
||||
* a composição com o objeto Pessoa deixando apenas as particularidades de cada entidade nos subtipos.
|
||||
*
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class EntidadeDeCobranca{
|
||||
|
||||
/**
|
||||
* Utilizado como composição
|
||||
*/
|
||||
private Pessoa pessoa;
|
||||
|
||||
public EntidadeDeCobranca(String nome) {
|
||||
pessoa = new Pessoa(nome);
|
||||
}
|
||||
|
||||
public EntidadeDeCobranca(String nome, String cadastroDePessoa) {
|
||||
pessoa = new Pessoa(nome, cadastroDePessoa);
|
||||
}
|
||||
|
||||
public EntidadeDeCobranca(String nome, CPRF cadastroDePessoa) {
|
||||
pessoa = new Pessoa(nome, cadastroDePessoa);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Nome da entidade
|
||||
*/
|
||||
public String getNome() {
|
||||
return pessoa.getNome();
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
pessoa.setNome(nome);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CPRF
|
||||
*/
|
||||
public CPRF getCPRF() {
|
||||
return pessoa.getCPRF();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CPRF
|
||||
*/
|
||||
public void setCPRF(CPRF cprf) {
|
||||
pessoa.setCPRF(cprf);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
*/
|
||||
public void addContaBancaria(ContaBancaria contaBancaria) {
|
||||
pessoa.addContaBancaria(contaBancaria);
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifica se esta pessoa tem alguma conta bancária.
|
||||
*
|
||||
* @see ContaBancaria
|
||||
*/
|
||||
public boolean hasContaBancaria(){
|
||||
return pessoa.hasContaBancaria();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A próxima conta bancária
|
||||
*/
|
||||
public ContaBancaria getNextContaBancaria(){
|
||||
|
||||
return pessoa.getNextContaBancaria();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<ContaBancaria> getContasBancarias() {
|
||||
return pessoa.getContasBancarias();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ContaBancaria
|
||||
* @see Collection
|
||||
*/
|
||||
public void setContasBancarias(Collection<ContaBancaria> contasBancarias) {
|
||||
pessoa.setContasBancarias(contasBancarias);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
*/
|
||||
public void addEndereco(Endereco endereco) {
|
||||
pessoa.addEndereco(endereco);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return O próximo endereço da entidade.
|
||||
*/
|
||||
public Endereco getNextEndereco(){
|
||||
|
||||
return pessoa.getNextEndereco();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<Endereco> getEnderecos() {
|
||||
return pessoa.getEnderecos();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Endereco
|
||||
* @see Collection
|
||||
*/
|
||||
public void setEnderecos(Collection<Endereco> enderecos) {
|
||||
pessoa.setEnderecos(enderecos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
*/
|
||||
public void addTelefone(NumeroDeTelefone telefone) {
|
||||
pessoa.addTelefone(telefone);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return O próximo telefone da entidade.
|
||||
*/
|
||||
public NumeroDeTelefone getNextTelefone(){
|
||||
|
||||
return pessoa.getNextTelefone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
* @see Collection
|
||||
*/
|
||||
public Collection<NumeroDeTelefone> getTelefones() {
|
||||
return pessoa.getTelefones();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NumeroDeTelefone
|
||||
* @see Collection
|
||||
*/
|
||||
public void setTelefones(Collection<NumeroDeTelefone> telefones) {
|
||||
pessoa.setTelefones(telefones);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:59:18
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:59:18
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
*
|
||||
*/
|
||||
public class Modalidade {
|
||||
|
||||
private String codigo;
|
||||
|
||||
private String nome;
|
||||
|
||||
public Modalidade() {
|
||||
}
|
||||
|
||||
public Modalidade(String codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
public Modalidade(Integer codigo) {
|
||||
this.codigo = String.valueOf(codigo);
|
||||
}
|
||||
|
||||
public Modalidade(String codigo, String nome) {
|
||||
this.codigo = codigo;
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public Modalidade(Integer codigo, String nome) {
|
||||
this.codigo = String.valueOf(codigo);
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
public String getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
|
||||
public Integer getCodigoAsInteger() {
|
||||
|
||||
if (StringUtils.isNumeric(codigo)) {
|
||||
return Integer.parseInt(codigo);
|
||||
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setCodigo(String codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
public void setCodigo(Integer codigo) {
|
||||
this.codigo = String.valueOf(codigo);
|
||||
}
|
||||
|
||||
public String getNome() {
|
||||
return nome;
|
||||
}
|
||||
|
||||
public void setNome(String nome) {
|
||||
this.nome = nome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:58:07
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:58:07
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Identifica uma conta bancária e assume os sinônimos:
|
||||
* <ul>
|
||||
* <li>Código do cedente</li>
|
||||
* <li>Convênio</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class NumeroDaConta {
|
||||
|
||||
private Integer codigoDaConta = 0;
|
||||
|
||||
private String digitoDaConta = "";
|
||||
|
||||
public NumeroDaConta() {}
|
||||
|
||||
public NumeroDaConta(Integer codigoDaConta) {
|
||||
|
||||
this.codigoDaConta = codigoDaConta;
|
||||
}
|
||||
|
||||
public NumeroDaConta(Integer codigoDaConta, String digitoDaConta) {
|
||||
|
||||
this.codigoDaConta = codigoDaConta;
|
||||
this.digitoDaConta = digitoDaConta;
|
||||
}
|
||||
|
||||
public Integer getCodigoDaConta() {
|
||||
return codigoDaConta;
|
||||
}
|
||||
|
||||
public void setCodigoDaConta(Integer codigoDaConta) {
|
||||
this.codigoDaConta = codigoDaConta;
|
||||
}
|
||||
|
||||
public String getDigitoDaConta() {
|
||||
return digitoDaConta;
|
||||
}
|
||||
|
||||
public void setDigitoDaConta(String digitoDaConta) {
|
||||
this.digitoDaConta = digitoDaConta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: Jan 26, 2010 - 1:27:20 PM
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: Jan 26, 2010 - 1:27:20 PM
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representa um Sacado no modelo de negócio financeiro, que é
|
||||
* aquele que emite um título de crédito a favor de alguém.
|
||||
* </p>
|
||||
* <p>
|
||||
* Pessoa física ou jurídica a que se destina a cobrança do compromisso, é o cliente do Cedente.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Sacado extends EntidadeDeCobranca {
|
||||
|
||||
public Sacado(String nome) {
|
||||
super(nome);
|
||||
}
|
||||
|
||||
public Sacado(String nome, String cadastroDePessoa) {
|
||||
super(nome, cadastroDePessoa);
|
||||
}
|
||||
|
||||
public Sacado(String nome, CPRF cadastroDePessoa) {
|
||||
super(nome, cadastroDePessoa);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: Jan 28, 2010 - 1:43:30 PM
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: Jan 28, 2010 - 1:43:30 PM
|
||||
*
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.jrimum.domkee.comum.pessoa.id.cprf.CPRF;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representa um Sacador Avalista no modelo de negócio financeiro, que é o co-responsável
|
||||
* pelo título emitido pelo avalizado (Sacado), ou seja, caso a dívida não seja liquidada pelo Sacado,
|
||||
* cabe ao Sacador Avalista liquidá-la.
|
||||
* </p>
|
||||
* <p>
|
||||
* Cedente original do Título.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class SacadorAvalista extends EntidadeDeCobranca {
|
||||
|
||||
public SacadorAvalista(String nome) {
|
||||
super(nome);
|
||||
}
|
||||
|
||||
public SacadorAvalista(String nome, String cadastroDePessoa) {
|
||||
super(nome, cadastroDePessoa);
|
||||
}
|
||||
|
||||
public SacadorAvalista(String nome, CPRF cadastroDePessoa) {
|
||||
super(nome, cadastroDePessoa);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
|
||||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 19/04/2008 - 21:12:40
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 19/04/2008 - 21:12:40
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Representação dos tipos básicos de cobrança:<br />
|
||||
* <ul>
|
||||
* <li>Registrada (ou com registro)</li>
|
||||
* <li>Não Registrada (ou sem registro)</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a> Valerio
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public enum TipoDeCobranca{
|
||||
/**
|
||||
* <p>Tipo onde os títulos emitidos são sempre registrados no banco antes de seu vencimento ou pagamento.</p>
|
||||
*/
|
||||
COM_REGISTRO,
|
||||
/**
|
||||
* <p>Tipo onde os títulos emitidos só são registrados pelo banco quando são pagos.</p>
|
||||
*/
|
||||
SEM_REGISTRO;
|
||||
}
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:08:53
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:08:53
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Representa as moedas existentes que fazem parte do universo de um título, segundo a FEBRABAN.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="http://www.nordestefomento.com.br">Nordeste Fomento Mercantil</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public enum TipoDeMoeda {
|
||||
|
||||
/**
|
||||
* Padrão FEBRABAN
|
||||
*/
|
||||
|
||||
DOLAR_AMERICANO_COMERCIAL_VENDA(2),
|
||||
DOLAR_AMERICANO_TURISMO_VENDA(3),
|
||||
ITRD(4),
|
||||
IDTR(5),
|
||||
UFIR_DIARIA(6),
|
||||
UFIR_MENSAL(7),
|
||||
FAJ_TR(8),
|
||||
REAL(9),
|
||||
TR(10),
|
||||
IGPM(11),
|
||||
CDI(12),
|
||||
PERCENTUAL_DO_CDI(13),
|
||||
EURO(14);
|
||||
|
||||
private int codigo;
|
||||
|
||||
/**
|
||||
* @param codigo
|
||||
*/
|
||||
private TipoDeMoeda(int codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
public int getCodigo() {
|
||||
|
||||
return this.codigo;
|
||||
}
|
||||
|
||||
public String write(){
|
||||
|
||||
String s = StringUtils.EMPTY;
|
||||
|
||||
switch (this) {
|
||||
|
||||
case REAL:
|
||||
s = "R$";
|
||||
break;
|
||||
|
||||
default:
|
||||
s += this.getCodigo();
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,228 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:09:13
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:09:13
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Enumeração de códigos adotados pela <a
|
||||
* href="http://www.febraban.org.br/">FEBRABAN</a> para identificar o tipo de
|
||||
* título de cobrança. Domínio:
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
*
|
||||
* <ul>
|
||||
* <li> '01' = CH Cheque</li>
|
||||
* <li> '02' = DM Duplicata Mercantil</li>
|
||||
* <li> '03' = DMI Duplicata Mercantil p/ Indicação</li>
|
||||
* <li> '04' = DS Duplicata de Serviço</li>
|
||||
* <li> '05' = DSI Duplicata de Serviço p/ Indicação</li>
|
||||
* <li> '06' = DR Duplicata Rural</li>
|
||||
* <li> '07' = LC Letra de Câmbio</li>
|
||||
* <li> '08' = NCC Nota de Crédito Comercial</li>
|
||||
* <li> '09' = NCE Nota de Crédito a Exportação</li>
|
||||
* <li> '10' = NCI Nota de Crédito Industrial</li>
|
||||
* <li> '11' = NCR Nota de Crédito Rural</li>
|
||||
* <li> '12' = NP Nota Promissória</li>
|
||||
* <li> '13' = NPR Nota Promissória Rural</li>
|
||||
* <li> '14' = TM Triplicata Mercantil</li>
|
||||
* <li> '15' = TS Triplicata de Serviço</li>
|
||||
* <li> '16' = NS Nota de Seguro</li>
|
||||
* <li> '17' = RC Recibo</li>
|
||||
* <li> '18' = FAT Fatura</li>
|
||||
* <li> '19' = ND Nota de Débito</li>
|
||||
* <li> '20' = AP Apólice de Seguro</li>
|
||||
* <li> '21' = ME Mensalidade Escolar</li>
|
||||
* <li> '22' = PC Parcela de Consórcio</li>
|
||||
* <li> '23' = NF Nota Fiscal</li>
|
||||
* <li> '24' = DD Documento de Dívida</li>
|
||||
* <li> ‘25’ = Cédula de Produto Rural</li>
|
||||
* <li> ‘26’ = Warrant</li>
|
||||
* <li> ‘27’ = Dívida Ativa de Estado</li>
|
||||
* <li> ‘28’ = Dívida Ativa de Município</li>
|
||||
* <li> ‘29’ = Dívida Ativa da União</li>
|
||||
* <li> ‘30’ = Cota Condominial</li>
|
||||
* <li> '99' = Outros</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="mailto:samuelvalerio@gmail.com">Samuel Valério</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public enum TipoDeTitulo{
|
||||
|
||||
CH_CHEQUE(1,"CH"),
|
||||
DM_DUPLICATA_MERCANTIL(2,"DM"),
|
||||
DMI_DUPLICATA_MERCANTIL_PARA_INDICACAO(3,"DMI"),
|
||||
DS_DUPLICATA_DE_SERVICO(4,"DS"),
|
||||
DSI_DUPLICATA_DE_SERVICO_PARA_INDICACAO(5,"DSI"),
|
||||
DR_DUPLICATA_RURAL(6,"DR"),
|
||||
LC_LETRA_DE_CAMBIO(7,"LC"),
|
||||
NCC_NOTA_DE_CREDITO_COMERCIAL(8,"NCC"),
|
||||
NCE_NOTA_DE_CREDITO_A_EXPORTACAO(9,"NCE"),
|
||||
NCI_NOTA_DE_CREDITO_INDUSTRIAL(10,"NCI"),
|
||||
NCR_NOTA_DE_CREDITO_RURAL(11,"NCR"),
|
||||
NP_NOTA_PROMISSORIA(12,"NP"),
|
||||
NPR_NOTA_PROMISSORIA_RURAL(13,"NPR"),
|
||||
TM_TRIPLICATA_MERCANTIL(14,"TM"),
|
||||
TS_TRIPLICATA_DE_SERVICO(15,"TS"),
|
||||
NS_NOTA_DE_SEGURO(16,"NS"),
|
||||
RC_RECIBO(17,"RC"),
|
||||
FAT_FATURA(18,"FAT"),
|
||||
ND_NOTA_DE_DEBITO(19,"ND"),
|
||||
AP_APOLICE_DE_SEGURO(20,"AP"),
|
||||
ME_MENSALIDADE_ESCOLAR(21,"ME"),
|
||||
PC_PARCELA_DE_CONSORCIO(22,"PC"),
|
||||
NF_NOTA_FISCAL(23,"NF"),
|
||||
DD_DOCUMENTO_DE_DIVIDA(24,"DD"),
|
||||
CEDULA_DE_PRODUTO_RURAL(25,"CPR"),
|
||||
WARRANT(26,"W"),
|
||||
DIVIDA_ATIVA_DE_ESTADO(27,"DAE"),
|
||||
DIVIDA_ATIVA_DE_MUNICIPIO(28,"DAM"),
|
||||
DIVIDA_ATIVA_DA_UNIAO(29,"DAU"),
|
||||
COTA_CONDOMINIAL(30,"CC"),
|
||||
OUTROS(99,"O");
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Código adotado pela FEBRABAN para identificar o tipo de título de
|
||||
* cobrança.
|
||||
* </p>
|
||||
*/
|
||||
private int codigo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sigla ou nome compelto de um tipo de título de cobrança.
|
||||
* </p>
|
||||
*/
|
||||
private String sigla;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Instancia os tipos de a cordo com os valores passados.
|
||||
* </p>
|
||||
*
|
||||
* @param codigo
|
||||
* @param sigla
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
private TipoDeTitulo(int codigo, String sigla) {
|
||||
this.codigo = codigo;
|
||||
this.sigla = sigla;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Apesar do nome, este método pode retornar não uma sigla, e sim, um nome
|
||||
* compelto de uma espécie de título de cobrança. Isto se justifica pelo
|
||||
* fato de que não há uma sigla determinada pela FEBRABAN para alguns casos.
|
||||
* </p>
|
||||
*
|
||||
* @return sigla ou descrição completa.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public String getSigla(){
|
||||
|
||||
return sigla;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Código adotado pela FEBRABAN para identificar o tipo de título de
|
||||
* cobrança.
|
||||
* </p>
|
||||
*
|
||||
* @return código FEBRABAN
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public int getCodigo() {
|
||||
|
||||
return codigo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna uma instância que corresponde com a sigla do tipo de título.
|
||||
* Caso não exista um tipo associado a sigla determinada uma {@code
|
||||
* IllegalArgumentException} será lançada.
|
||||
*
|
||||
* @param sigla
|
||||
* - Sigla do tipo de título procurado
|
||||
* @return tipo de título correspondente a sigla
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public static TipoDeTitulo valueOfSigla(String sigla){
|
||||
for(TipoDeTitulo t : values()){
|
||||
if(t.getSigla().equals(sigla)){
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return Exceptions.throwIllegalArgumentException(format("Nenhuma constante enum %s com sigla igual a %s!", TipoDeTitulo.class, sigla));
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna uma instância que corresponde com o código do tipo de título.
|
||||
* Caso não exista um tipo associado ao código determinado uma {@code
|
||||
* IllegalArgumentException} será lançada.
|
||||
*
|
||||
* @param codigo
|
||||
* - Código do tipo de título procurado
|
||||
* @return tipo de título correspondente ao código
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public static TipoDeTitulo valueOf(int codigo){
|
||||
for(TipoDeTitulo t : values()){
|
||||
if(t.getCodigo() == codigo){
|
||||
return t;
|
||||
}
|
||||
}
|
||||
return Exceptions.throwIllegalArgumentException(format("Nenhuma constante enum %s com código igual a %s!", TipoDeTitulo.class, codigo));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,779 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 18:58:42
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 18:58:42
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import static org.jrimum.utilix.Objects.isNotNull;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
|
||||
import org.jrimum.domkee.financeiro.banco.ParametroBancario;
|
||||
import org.jrimum.domkee.financeiro.banco.ParametrosBancariosMap;
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
import org.jrimum.utilix.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* Representa um título em cobrança, tais como:
|
||||
*
|
||||
* <br />
|
||||
*
|
||||
* <ul>
|
||||
* <li>Cheque</li>
|
||||
* <li>Duplicata Mercantil</li>
|
||||
* <li>Duplicata de Serviço</li>
|
||||
* <li>Duplicata Rural</li>
|
||||
* <li>Letra de Câmbio</li>
|
||||
* <li>Nota de Crédito Comercial</li>
|
||||
* <li>Nota de Crédito Industrial</li>
|
||||
* <li>Nota de Crédito Rural</li>
|
||||
* <li>E outras espécies pagáveis através da rede bancária.</li>
|
||||
*
|
||||
* @see TipoDeTitulo
|
||||
*
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
* @author <a href="mailto:misaelbarreto@gmail.com">Misael Barreto</a>
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
* @author <a href="http://www.nordestefomento.com.br">Nordeste Fomento
|
||||
* Mercantil</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class Titulo {
|
||||
|
||||
/**
|
||||
* @see #setNumeroDoDocumento(String)
|
||||
*/
|
||||
private String numeroDoDocumento;
|
||||
|
||||
/**
|
||||
* @see #setDataDoDocumento(Date)
|
||||
*/
|
||||
private Date dataDoDocumento;
|
||||
|
||||
/**
|
||||
* @see #setDataDoVencimento(Date)
|
||||
*/
|
||||
private Date dataDoVencimento;
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.financeiro.banco.febraban.TipoDeMoeda
|
||||
*/
|
||||
private TipoDeMoeda tipoDeMoeda = TipoDeMoeda.REAL;
|
||||
|
||||
/**
|
||||
* @see #setValor(BigDecimal)
|
||||
*/
|
||||
private BigDecimal valor;
|
||||
|
||||
/**
|
||||
* @see #setDesconto(BigDecimal)
|
||||
*/
|
||||
private BigDecimal desconto;
|
||||
|
||||
/**
|
||||
* @see #setMora(BigDecimal)
|
||||
*/
|
||||
private BigDecimal mora;
|
||||
|
||||
/**
|
||||
* @see #setDeducao(BigDecimal)
|
||||
*/
|
||||
private BigDecimal deducao;
|
||||
|
||||
/**
|
||||
* @see #setAcrecimo(BigDecimal)
|
||||
*/
|
||||
private BigDecimal acrecimo;
|
||||
|
||||
/**
|
||||
* @see #setValorCobrado(BigDecimal)
|
||||
*/
|
||||
private BigDecimal valorCobrado;
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.financeiro.banco.febraban.TipoDeTitulo
|
||||
*/
|
||||
private TipoDeTitulo tipoDeDocumento;
|
||||
|
||||
/**
|
||||
* @see #setNossoNumero(String)
|
||||
*/
|
||||
private String nossoNumero;
|
||||
|
||||
/**
|
||||
* @see #setDigitoDoNossoNumero(String)
|
||||
*/
|
||||
private String digitoDoNossoNumero;
|
||||
|
||||
/**
|
||||
* @see #setContaBancaria(ContaBancaria)
|
||||
*/
|
||||
private ContaBancaria contaBancaria;
|
||||
|
||||
/**
|
||||
* @see #setCedente(Cedente)
|
||||
*/
|
||||
private Cedente cedente;
|
||||
|
||||
/**
|
||||
* @see #setSacado(Sacado)
|
||||
*/
|
||||
private Sacado sacado;
|
||||
|
||||
/**
|
||||
* @see #setSacadorAvalista(SacadorAvalista)
|
||||
*/
|
||||
private SacadorAvalista sacadorAvalista;
|
||||
|
||||
/**
|
||||
* @see #setParametrosBancarios(ParametrosBancariosMap)
|
||||
*/
|
||||
private ParametrosBancariosMap parametrosBancariosMap;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Identificação de Título Aceito / Não Aceito Código adotado pela FEBRABAN
|
||||
* para identificar se o título de cobrança foi aceito (reconhecimento da
|
||||
* dívida pelo Sacado). Domínio:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>'A' = Aceite</li>
|
||||
* <li>'N' = Não Aceite</li>
|
||||
* </ul>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public enum Aceite {
|
||||
/**
|
||||
* 'A' = Título Aceite.
|
||||
*/
|
||||
A,
|
||||
/**
|
||||
* 'N' = Título Não Aceite.
|
||||
*/
|
||||
N;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setAceite(org.jrimum.domkee.financeiro.banco.febraban.Titulo.Aceite)
|
||||
*
|
||||
* @see Aceite
|
||||
*/
|
||||
private Aceite aceite;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cria uma instância de título.
|
||||
* </p>
|
||||
*
|
||||
* @param contaBancaria
|
||||
* @param sacado
|
||||
* @param cedente
|
||||
*
|
||||
*/
|
||||
public Titulo(ContaBancaria contaBancaria, Sacado sacado, Cedente cedente) {
|
||||
this.setContaBancaria(contaBancaria);
|
||||
this.setSacado(sacado);
|
||||
this.setCedente(cedente);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cria uma instância de título com sacador avalista.
|
||||
* </p>
|
||||
*
|
||||
* @param contaBancaria
|
||||
* @param sacado
|
||||
* @param cedente
|
||||
* @param sacadorAvalista
|
||||
*
|
||||
*/
|
||||
public Titulo(ContaBancaria contaBancaria, Sacado sacado, Cedente cedente, SacadorAvalista sacadorAvalista) {
|
||||
this(contaBancaria, sacado, cedente);
|
||||
this.setSacadorAvalista(sacadorAvalista);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cria uma instância de título acrescentado outros dados bancários ao
|
||||
* mesmo.
|
||||
* </p>
|
||||
*
|
||||
* @param contaBancaria
|
||||
* @param sacado
|
||||
* @param cedente
|
||||
* @param parametrosBancariosMap
|
||||
*
|
||||
*/
|
||||
public Titulo(ContaBancaria contaBancaria, Sacado sacado, Cedente cedente,
|
||||
ParametrosBancariosMap parametrosBancariosMap) {
|
||||
this.setContaBancaria(contaBancaria);
|
||||
this.setSacado(sacado);
|
||||
this.setCedente(cedente);
|
||||
this.setParametrosBancarios(parametrosBancariosMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cria uma instância de título com sacador avalista e acrescentado outros
|
||||
* dados bancários além do título.
|
||||
* </p>
|
||||
*
|
||||
* @param contaBancaria
|
||||
* @param sacado
|
||||
* @param cedente
|
||||
* @param parametrosBancariosMap
|
||||
* @param sacadorAvalista
|
||||
*
|
||||
*/
|
||||
public Titulo(ContaBancaria contaBancaria, Sacado sacado, Cedente cedente,
|
||||
ParametrosBancariosMap parametrosBancariosMap, SacadorAvalista sacadorAvalista) {
|
||||
this(contaBancaria, sacado, cedente, parametrosBancariosMap);
|
||||
this.setSacadorAvalista(sacadorAvalista);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Indica se o título possuem sacador avalista na instância
|
||||
* </p>
|
||||
*
|
||||
* @return true se tem
|
||||
*/
|
||||
public boolean hasSacadorAvalista() {
|
||||
|
||||
boolean has = false;
|
||||
|
||||
if (isNotNull(this.sacadorAvalista)) {
|
||||
has = true;
|
||||
}
|
||||
|
||||
return has;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setAceite(org.jrimum.domkee.financeiro.banco.febraban.Titulo.Aceite)
|
||||
*
|
||||
* @return the aceite
|
||||
*/
|
||||
public Aceite getAceite() {
|
||||
return aceite;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Indicação de aceite.
|
||||
* </p>
|
||||
*
|
||||
* @param aceite
|
||||
* the aceite to set
|
||||
*/
|
||||
public void setAceite(Aceite aceite) {
|
||||
this.aceite = aceite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setDataDoDocumento(Date)
|
||||
*
|
||||
* @return the dataDoDocumento
|
||||
*/
|
||||
public Date getDataDoDocumento() {
|
||||
return dataDoDocumento;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Data de emissão do documento.
|
||||
* </p>
|
||||
*
|
||||
* @param dataDoDocumento
|
||||
* the dataDoDocumento to set
|
||||
*/
|
||||
public void setDataDoDocumento(Date dataDoDocumento) {
|
||||
this.dataDoDocumento = dataDoDocumento;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setDataDoVencimento(Date)
|
||||
*
|
||||
* @return the dataDoVencimento
|
||||
*/
|
||||
public Date getDataDoVencimento() {
|
||||
return dataDoVencimento;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Data de vencimento nominal do título de cobrança, ou melhor, data limite
|
||||
* para pagamento do título.
|
||||
* </p>
|
||||
*
|
||||
* @param dataDoVencimento
|
||||
* the dataDoVencimento to set
|
||||
*/
|
||||
public void setDataDoVencimento(Date dataDoVencimento) {
|
||||
this.dataDoVencimento = dataDoVencimento;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setDigitoDoNossoNumero(String)
|
||||
*
|
||||
* @return the dígitoDoNossoNúmero
|
||||
*/
|
||||
public String getDigitoDoNossoNumero() {
|
||||
return digitoDoNossoNumero;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Dígito verificador do nosso número, caso exista.
|
||||
* </p>
|
||||
*
|
||||
* @param digitoDoNossoNumero
|
||||
* the dígitoDoNossoNúmero to set
|
||||
*/
|
||||
public void setDigitoDoNossoNumero(String digitoDoNossoNumero) {
|
||||
this.digitoDoNossoNumero = digitoDoNossoNumero;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.financeiro.banco.febraban.TipoDeMoeda
|
||||
*
|
||||
* @return the enumMoeda
|
||||
*/
|
||||
public TipoDeMoeda getTipoDeMoeda() {
|
||||
return tipoDeMoeda;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.jrimum.domkee.financeiro.banco.febraban.TipoDeMoeda
|
||||
*
|
||||
* @param tipoDeMoeda
|
||||
* the enumMoeda to set
|
||||
*/
|
||||
public void setTipoDeMoeda(TipoDeMoeda tipoDeMoeda) {
|
||||
this.tipoDeMoeda = tipoDeMoeda;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setNossoNumero(String)
|
||||
*
|
||||
* @return the nossoNúmero
|
||||
*/
|
||||
public String getNossoNumero() {
|
||||
return nossoNumero;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Código fornecido pelo Banco correspondente para identificação do título
|
||||
* ou identificação do título atribuído pelo esmissor do título de cobrança.
|
||||
* </p>
|
||||
*
|
||||
* @param nossoNumero
|
||||
* the nossoNúmero to set
|
||||
*/
|
||||
public void setNossoNumero(String nossoNumero) {
|
||||
this.nossoNumero = nossoNumero;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setNumeroDoDocumento(String)
|
||||
*
|
||||
* @return the númeroDoDocumento
|
||||
*/
|
||||
public String getNumeroDoDocumento() {
|
||||
return numeroDoDocumento;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Número de controle do cedente para o referido título. Não confundir com o
|
||||
* nosso número.
|
||||
* </p>
|
||||
*
|
||||
* @param numeroDoDocumento
|
||||
* the númeroDoDocumento to set
|
||||
*/
|
||||
public void setNumeroDoDocumento(String numeroDoDocumento) {
|
||||
this.numeroDoDocumento = numeroDoDocumento;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setContaBancaria(ContaBancaria)
|
||||
*
|
||||
* @return the contaBancaria
|
||||
*/
|
||||
public ContaBancaria getContaBancaria() {
|
||||
return contaBancaria;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Conta na qual o título se encontra, conta do favorecido (Cedente).
|
||||
* </p>
|
||||
*
|
||||
* @param contaBancaria
|
||||
* the contaBancaria to set
|
||||
*/
|
||||
public void setContaBancaria(ContaBancaria contaBancaria) {
|
||||
|
||||
if (isNotNull(contaBancaria)) {
|
||||
this.contaBancaria = contaBancaria;
|
||||
} else {
|
||||
Exceptions.throwIllegalArgumentException("ContaBancaria não pode ser nula!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setCedente(Cedente)
|
||||
*
|
||||
* @return the cedente
|
||||
*/
|
||||
public Cedente getCedente() {
|
||||
return cedente;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cliente que entrega os títulos ao Banco para serem cobrados.
|
||||
* </p>
|
||||
*
|
||||
* @param cedente
|
||||
* the cedente to set
|
||||
*/
|
||||
public void setCedente(Cedente cedente) {
|
||||
if (isNotNull(cedente)) {
|
||||
this.cedente = cedente;
|
||||
} else {
|
||||
Exceptions.throwIllegalArgumentException("Cedente não pode ser nulo!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setSacado(Sacado)
|
||||
*
|
||||
* @return the sacado
|
||||
*/
|
||||
public Sacado getSacado() {
|
||||
return sacado;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Pessoa física ou jurídica a que se destina a cobrança do compromisso, é o
|
||||
* cliente do Cedente.
|
||||
* </p>
|
||||
*
|
||||
* @param sacado
|
||||
* the sacado to set
|
||||
*/
|
||||
public void setSacado(Sacado sacado) {
|
||||
if (isNotNull(sacado)) {
|
||||
this.sacado = sacado;
|
||||
} else {
|
||||
Exceptions.throwIllegalArgumentException("Sacado não pode ser nulo!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setSacadorAvalista(SacadorAvalista)
|
||||
*
|
||||
* @return the sacadorAvalista
|
||||
*/
|
||||
public SacadorAvalista getSacadorAvalista() {
|
||||
return sacadorAvalista;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Cedente original do Título.
|
||||
* </p>
|
||||
*
|
||||
* @param sacadorAvalista
|
||||
* the sacadorAvalista to set
|
||||
*/
|
||||
public void setSacadorAvalista(SacadorAvalista sacadorAvalista) {
|
||||
if (isNotNull(sacadorAvalista)) {
|
||||
this.sacadorAvalista = sacadorAvalista;
|
||||
} else {
|
||||
Exceptions.throwIllegalArgumentException("SacadorAvalista não pode ser nulo!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tipoDeDocumento
|
||||
*/
|
||||
public TipoDeTitulo getTipoDeDocumento() {
|
||||
return tipoDeDocumento;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tipoDeDocumento
|
||||
* the tipoDeDocumento to set
|
||||
*/
|
||||
public void setTipoDeDocumento(TipoDeTitulo tipoDeDocumento) {
|
||||
this.tipoDeDocumento = tipoDeDocumento;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setValor(BigDecimal)
|
||||
*
|
||||
* @return the valor
|
||||
*/
|
||||
public BigDecimal getValor() {
|
||||
return valor;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui um valor (original do Título) expresso em moeda corrente e
|
||||
* arredondanda em duas casas decimais para baixo.
|
||||
* </p>
|
||||
* <p>
|
||||
* Exemplo: Para o valor 12,349 ele definirá o valor para 12,34.
|
||||
* </p>
|
||||
*
|
||||
* @param valor
|
||||
* the valor to set
|
||||
*/
|
||||
public void setValor(BigDecimal valor) {
|
||||
valor = valor.setScale(2, RoundingMode.DOWN);
|
||||
this.valor = valor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setDesconto(BigDecimal)
|
||||
*
|
||||
* @return the desconto
|
||||
*/
|
||||
public BigDecimal getDesconto() {
|
||||
return desconto;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui um valor de descontos/abatimentos ao valor original do título expresso em
|
||||
* moeda corrente e arredondanda em duas casas decimais para baixo.
|
||||
* </p>
|
||||
* <p>
|
||||
* Exemplo: Para o valor 12,349 ele definirá o valor para 12,34.
|
||||
* </p>
|
||||
*
|
||||
* @param desconto
|
||||
* the desconto to set
|
||||
*/
|
||||
public void setDesconto(BigDecimal desconto) {
|
||||
|
||||
if (desconto != null) {
|
||||
desconto = desconto.setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
this.desconto = desconto;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setMora(BigDecimal)
|
||||
*
|
||||
* @return the mora
|
||||
*/
|
||||
public BigDecimal getMora() {
|
||||
return mora;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui um valor de mora/multa ao título expresso em moeda corrente e
|
||||
* arredondanda em duas casas decimais para baixo.
|
||||
* </p>
|
||||
* <p>
|
||||
* Exemplo: Para o valor 12,349 ele definirá o valor para 12,34.
|
||||
* </p>
|
||||
*
|
||||
* @param mora
|
||||
*/
|
||||
public void setMora(BigDecimal mora) {
|
||||
if (mora != null) {
|
||||
mora = mora.setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
this.mora = mora;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setDeducao(BigDecimal)
|
||||
*
|
||||
* @return the deducao
|
||||
*/
|
||||
public BigDecimal getDeducao() {
|
||||
return deducao;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui um valor para outras deduções ao título expresso em moeda
|
||||
* corrente e arredondanda em duas casas decimais para baixo.
|
||||
* </p>
|
||||
* <p>
|
||||
* Exemplo: Para o valor 12,349 ele definirá o valor para 12,34.
|
||||
* </p>
|
||||
*
|
||||
* @param deducao
|
||||
*/
|
||||
public void setDeducao(BigDecimal deducao) {
|
||||
if (deducao != null) {
|
||||
deducao = deducao.setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
this.deducao = deducao;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setAcrecimo(BigDecimal)
|
||||
*
|
||||
* @return the acrecimo
|
||||
*/
|
||||
public BigDecimal getAcrecimo() {
|
||||
|
||||
return acrecimo;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui um valor para outros acrécimos ao título expresso em moeda
|
||||
* corrente e arredondanda em duas casas decimais para baixo.
|
||||
* </p>
|
||||
* <p>
|
||||
* Exemplo: Para o valor 12,349 ele definirá o valor para 12,34.
|
||||
* </p>
|
||||
*
|
||||
* @param acrecimo
|
||||
*/
|
||||
public void setAcrecimo(BigDecimal acrecimo) {
|
||||
if (acrecimo != null) {
|
||||
acrecimo = acrecimo.setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
this.acrecimo = acrecimo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #setValorCobrado(BigDecimal)
|
||||
*
|
||||
* @return the valorCobrado
|
||||
*/
|
||||
public BigDecimal getValorCobrado() {
|
||||
return valorCobrado;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui um "valor cobrardo" ao título expresso em moeda corrente e
|
||||
* arredondanda em duas casas decimais para baixo.
|
||||
* </p>
|
||||
* <p>
|
||||
* Exemplo: Para o valor 12,349 ele definirá o valor para 12,34.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Note que o valor cobrado não é o valor de face do título e sim um valor
|
||||
* resultante de deduções ou acrécimos.
|
||||
* </p>
|
||||
*
|
||||
* @param valorCobrado
|
||||
*/
|
||||
public void setValorCobrado(BigDecimal valorCobrado) {
|
||||
if (valorCobrado != null) {
|
||||
valorCobrado = valorCobrado.setScale(2, RoundingMode.DOWN);
|
||||
}
|
||||
this.valorCobrado = valorCobrado;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Indica se existe parâmetros bancários no título.
|
||||
* </p>
|
||||
*
|
||||
* @return parametrosBancarios
|
||||
*
|
||||
* @see #getParametrosBancarios()
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
public boolean hasParametrosBancarios() {
|
||||
return ParametrosBancariosMap.hasElement(getParametrosBancarios());
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Retorna os parâmetros bancários usados no título.
|
||||
* </p>
|
||||
*
|
||||
* @return parametrosBancarios
|
||||
*
|
||||
* @see #setParametrosBancarios(ParametrosBancariosMap)
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public ParametrosBancariosMap getParametrosBancarios() {
|
||||
return parametrosBancariosMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Atribui Parâmetros bancários necessários ao título.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Em alguns casos, talvez seja necessário utilizar este campo para fornecer
|
||||
* mais informações a um título. Seja para simplesmente gerar um boleto ou
|
||||
* quando se desejar implementar um campo livre ou banco ainda não
|
||||
* suportado.
|
||||
* </p>
|
||||
*
|
||||
* @see org.jrimum.domkee.financeiro.banco.ParametrosBancariosMap
|
||||
*
|
||||
* @param parametrosBancariosMap
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
|
||||
public <P extends ParametroBancario<?>> void setParametrosBancarios(ParametrosBancariosMap parametrosBancariosMap) {
|
||||
this.parametrosBancariosMap = parametrosBancariosMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toString(this);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
|
@ -0,0 +1,132 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 14/02/2010 - 15:00:00
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 14/02/2010 - 15:00:00
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.hsbc;
|
||||
|
||||
import static java.lang.String.format;
|
||||
|
||||
import org.jrimum.utilix.Exceptions;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* Tipo do identificador do nosso número utilizado nos títulos de boletos
|
||||
* bancários de Cobrança Não Registrada (CNR).
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Basicamente são dois os tipos de nosso número (NN):
|
||||
* </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>O que vincula “vencimento”, “código do cedente” e “código do documento”.
|
||||
* Enumerado como {@link #COM_VENCIMENTO } (constante 4);</li>
|
||||
* <li>O que vincula “código do cedente” e “código do documento”. Enumerado como
|
||||
* {@link #SEM_VENCIMENTO } (constante 5).</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* <strong>OBS:</strong> vale lembrar que é o tipo do identificador que
|
||||
* determina se o boleto HSBC CNR tem vencimento ou se é do tipo com vencimento
|
||||
* “À Vista” ou “Contra Apresentação”.
|
||||
* </p>
|
||||
*
|
||||
* @author <a href=http://gilmatryx.googlepages.com/>Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
|
||||
public enum TipoIdentificadorCNR {
|
||||
|
||||
/**
|
||||
* Identificador do <strong>"tipo 4"</strong> que vincula “vencimento”,
|
||||
* “código do cedente” e “código do documento”.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
COM_VENCIMENTO {
|
||||
/**
|
||||
* @see org.jrimum.domkee.financeiro.banco.hsbc.TipoIdentificadorCNR#getConstante()
|
||||
*/
|
||||
@Override
|
||||
public int getConstante() {
|
||||
return VALOR_COM_VENCIMENTO;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Identificador do <strong>"tipo 5"</strong> que vincula “código do
|
||||
* cedente” e “código do documento”.
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
SEM_VENCIMENTO {
|
||||
/**
|
||||
* @see org.jrimum.domkee.financeiro.banco.hsbc.TipoIdentificadorCNR#getConstante()
|
||||
*/
|
||||
@Override
|
||||
public int getConstante() {
|
||||
return VALOR_SEM_VENCIMENTO;
|
||||
}
|
||||
};
|
||||
|
||||
private static final int VALOR_SEM_VENCIMENTO = 5;
|
||||
private static final int VALOR_COM_VENCIMENTO = 4;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Retorna a constante numérica bancária do tipo (4 ou 5)
|
||||
* </p>
|
||||
*
|
||||
* @return constante do tipo (4 ou 5)
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public abstract int getConstante();
|
||||
|
||||
|
||||
public static TipoIdentificadorCNR valueOf(int valor) {
|
||||
switch (valor) {
|
||||
|
||||
case VALOR_SEM_VENCIMENTO:
|
||||
|
||||
return SEM_VENCIMENTO;
|
||||
|
||||
case VALOR_COM_VENCIMENTO:
|
||||
|
||||
return COM_VENCIMENTO;
|
||||
|
||||
default:
|
||||
return Exceptions.throwIllegalStateException(format(
|
||||
"Tipo de identificador CNR \"%d\" desconhecido!", valor));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco.hsbc;
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright 2010 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 15/08/2010 - 15:37:49
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2010 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 15/08/2010 - 15:37:49
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco;
|
|
@ -0,0 +1,346 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:11:04
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:11:04
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
import static org.jrimum.utilix.text.Strings.fillWithZeroLeft;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.jrimum.vallia.AbstractCPRFValidator.TipoDeCPRF;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Teste da classe {@linkplain AbstractCPRF} e base para as sublcasses {@linkplain CPF} e {@linkplain CNPJ}.
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public abstract class TestAbstractCPRF{
|
||||
|
||||
private TipoDeCPRF tipo;
|
||||
private String cprfStringFormatada;
|
||||
private String cprfStringFormatadaErr;
|
||||
private String cprfString;
|
||||
private String cprfStringErr;
|
||||
private Long cprfLong;
|
||||
private Long cprfLongErr;
|
||||
private Long cprfRaizLong;
|
||||
private Long cprfRaizLongErr;
|
||||
private String cprfRaizFormatada;
|
||||
private String cprfRaizFormatadaErr;
|
||||
private Integer cprfDv;
|
||||
private Integer cprfDvErr;
|
||||
|
||||
private CPRF cprf;
|
||||
private CPRF cprfOutro;
|
||||
|
||||
@Test
|
||||
public final void testCreateLongTipoDeCPRF() {
|
||||
assertNotNull(AbstractCPRF.create(cprfLong, tipo));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public final void testDoNotCreateLongTipoDeCPRF() {
|
||||
assertNotNull(AbstractCPRF.create(cprfLongErr, tipo));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateStringTipoDeCPRF() {
|
||||
assertNotNull(AbstractCPRF.create(cprfString, tipo));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testDoNotCreateStringTipoDeCPRF() {
|
||||
assertNotNull(AbstractCPRF.create(cprfStringErr, tipo));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testDoNotCreateStringFormatadaTipoDeCPRF() {
|
||||
assertNotNull(AbstractCPRF.create(cprfStringFormatada, tipo));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateString() {
|
||||
assertNotNull(AbstractCPRF.create(cprfString));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testDoNotCreateString() {
|
||||
assertNotNull(AbstractCPRF.create(cprfStringErr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateStringFormatada() {
|
||||
assertNotNull(AbstractCPRF.create(cprfStringFormatada));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void testDoNotCreateStringFormatada() {
|
||||
assertNotNull(AbstractCPRF.create(cprfStringFormatadaErr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsFisica() {
|
||||
assertTipo();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsJuridica() {
|
||||
assertTipo();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCodigo() {
|
||||
assertEquals(cprfLong, cprf.getCodigo());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCodigoComZeros() {
|
||||
|
||||
int tamanho = -1;
|
||||
|
||||
if(cprf.isFisica()){
|
||||
tamanho = 11;
|
||||
}else{
|
||||
tamanho = 14;
|
||||
}
|
||||
|
||||
assertEquals(fillWithZeroLeft(cprfLong, tamanho), cprf.getCodigoComZeros());
|
||||
assertTrue(!cprf.getCodigoComZeros().equals(fillWithZeroLeft(cprfLongErr, tamanho)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCodigoFormatado() {
|
||||
assertEquals(cprfStringFormatada, cprf.getCodigoFormatado());
|
||||
assertTrue(!cprf.getCodigoFormatado().equals(cprfStringFormatadaErr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRaiz() {
|
||||
assertEquals(cprfRaizLong, cprf.getRaiz());
|
||||
assertTrue(cprf.getRaiz().longValue() == cprfRaizLong.longValue());
|
||||
assertTrue(!cprf.getRaiz().equals(cprfLongErr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRaizComZeros() {
|
||||
|
||||
int tamanho = -1;
|
||||
|
||||
if(cprf.isFisica()){
|
||||
tamanho = 9;
|
||||
}else{
|
||||
tamanho = 8;
|
||||
}
|
||||
|
||||
assertEquals(fillWithZeroLeft(cprfRaizLong, tamanho), cprf.getRaizComZeros());
|
||||
assertTrue(!cprf.getRaizComZeros().equals(fillWithZeroLeft(cprfRaizLongErr,tamanho)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRaizFormatada() {
|
||||
assertEquals(cprfRaizFormatada, cprf.getRaizFormatada());
|
||||
assertTrue(!cprf.getRaizComZeros().equals(cprfRaizFormatadaErr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDv() {
|
||||
assertEquals(cprfDv, cprf.getDv());
|
||||
assertTrue(!cprf.getDv().equals(cprfDvErr));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetDvComZeros() {
|
||||
assertEquals(fillWithZeroLeft(cprf.getDv(),2), cprf.getDvComZeros());
|
||||
assertTrue(!cprf.getDvComZeros().equals(fillWithZeroLeft(cprfDvErr,2)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompareTo() {
|
||||
int c1 = this.cprf.compareTo(this.cprfOutro);
|
||||
int c2 = this.cprfOutro.compareTo(this.cprf);
|
||||
assertTrue(c1 != c2);
|
||||
assertTrue(cprf.compareTo(AbstractCPRF.create(cprf.getCodigoFormatado())) == 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsObject() {
|
||||
assertEquals(cprf, AbstractCPRF.create(cprf.getCodigoFormatado()));
|
||||
assertTrue(!cprf.equals(cprfOutro));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHashCode() {
|
||||
assertEquals(cprf.hashCode(), AbstractCPRF.create(cprf.getCodigoFormatado()).hashCode());
|
||||
assertTrue(cprf.hashCode() != cprfOutro.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToString() {
|
||||
|
||||
assertEquals(cprfStringFormatada, cprf.getCodigoFormatado());
|
||||
assertTrue(!cprf.getCodigoFormatado().equals(cprfStringFormatadaErr));
|
||||
}
|
||||
/*
|
||||
* HELPERS
|
||||
*/
|
||||
|
||||
private void assertTipo(){
|
||||
|
||||
if(tipo.equals(TipoDeCPRF.CPF)){
|
||||
assertTrue(cprf.isFisica());
|
||||
assertTrue(!cprf.isJuridica());
|
||||
}else{
|
||||
|
||||
if(tipo.equals(TipoDeCPRF.CNPJ)){
|
||||
assertTrue(cprf.isJuridica());
|
||||
assertTrue(!cprf.isFisica());
|
||||
}else{
|
||||
fail("TIPO NÃO PREVISTO PELO PROGRAMA!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* DEFINERS
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param tipo the tipo to set
|
||||
*/
|
||||
public final void setTipo(TipoDeCPRF tipo) {
|
||||
this.tipo = tipo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfStringFormatada the cprfStringFormatada to set
|
||||
*/
|
||||
public final void setCprfStringFormatada(String cprfStringFormatada) {
|
||||
this.cprfStringFormatada = cprfStringFormatada;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfStringFormatadaErr the cprfStringFormatadaErr to set
|
||||
*/
|
||||
public final void setCprfStringFormatadaErr(String cprfStringFormatadaErr) {
|
||||
this.cprfStringFormatadaErr = cprfStringFormatadaErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfString the cprfString to set
|
||||
*/
|
||||
public final void setCprfString(String cprfString) {
|
||||
this.cprfString = cprfString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfStringErr the cprfStringErr to set
|
||||
*/
|
||||
public final void setCprfStringErr(String cprfStringErr) {
|
||||
this.cprfStringErr = cprfStringErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfLong the cprfLong to set
|
||||
*/
|
||||
public final void setCprfLong(Long cprfLong) {
|
||||
this.cprfLong = cprfLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfLongErr the cprfLongErr to set
|
||||
*/
|
||||
public final void setCprfLongErr(Long cprfLongErr) {
|
||||
this.cprfLongErr = cprfLongErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfRaizLong the cprfRaizLong to set
|
||||
*/
|
||||
public final void setCprfRaizLong(Long cprfRaizLong) {
|
||||
this.cprfRaizLong = cprfRaizLong;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfRaizLongErr the cprfRaizLongErr to set
|
||||
*/
|
||||
public final void setCprfRaizLongErr(Long cprfRaizLongErr) {
|
||||
this.cprfRaizLongErr = cprfRaizLongErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfRaizFormatada the cprfRaizFormatado to set
|
||||
*/
|
||||
public final void setCprfRaizFormatada(String cprfRaizFormatada) {
|
||||
this.cprfRaizFormatada = cprfRaizFormatada;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfRaizFormatadaErr the cprfRaizFormatadoErr to set
|
||||
*/
|
||||
public final void setCprfRaizFormatadaErr(String cprfRaizFormatadaErr) {
|
||||
this.cprfRaizFormatadaErr = cprfRaizFormatadaErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfDv the cprfDv to set
|
||||
*/
|
||||
public final void setCprfDv(Integer cprfDv) {
|
||||
this.cprfDv = cprfDv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfDvErr the cprfDvErr to set
|
||||
*/
|
||||
public final void setCprfDvErr(Integer cprfDvErr) {
|
||||
this.cprfDvErr = cprfDvErr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprf the cprf to set
|
||||
*/
|
||||
public final void setCprf(CPRF cprf) {
|
||||
this.cprf = cprf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cprfOutro the cprfOutro to set
|
||||
*/
|
||||
public final void setCprfOutro(CPRF cprfOutro) {
|
||||
this.cprfOutro = cprfOutro;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:11:13
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:11:13
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.jrimum.vallia.AbstractCPRFValidator.TipoDeCPRF;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Teste da classe CNPJ.
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 2.0
|
||||
*
|
||||
* @version 2.0
|
||||
*/
|
||||
public class TestCNPJ extends TestAbstractCPRF{
|
||||
|
||||
/*
|
||||
* CNPJ: 60.746.948/0001-12 | BANCO BRADESCO
|
||||
*/
|
||||
private final String cnpjBradescoFilialStrFmt = "60.746.948/0005-46";
|
||||
private final String cnpjBradescoStrFmt = "60.746.948/0001-12";
|
||||
private final String cnpjBradescoStr = "60746948000112";
|
||||
private final Long cnpjBradesco = 60746948000112L;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
setTipo(TipoDeCPRF.CNPJ);
|
||||
setCprfLong(cnpjBradesco);
|
||||
setCprfLongErr(60746948000113L);
|
||||
setCprfString(cnpjBradescoStr);
|
||||
setCprfStringErr("60746948000113");
|
||||
setCprfStringFormatada(cnpjBradescoStrFmt);
|
||||
setCprfStringFormatadaErr("60.746.948/0001-13");
|
||||
setCprfRaizLong(60746948L);
|
||||
setCprfRaizLongErr(60746941L);
|
||||
setCprfRaizFormatada("60.746.948");
|
||||
setCprfRaizFormatadaErr("60.746.941");
|
||||
setCprfDv(12);
|
||||
setCprfDvErr(13);
|
||||
setCprf(new CNPJ(cnpjBradescoStrFmt));
|
||||
//BANCO DO NORDESTE
|
||||
setCprfOutro(new CNPJ("07.237.373/0001-20"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#CNPJ(java.lang.Long)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCNPJLong() {
|
||||
CNPJ cnpj = new CNPJ(cnpjBradesco);
|
||||
assertConsistent(cnpj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#CNPJ(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCNPJStringWithZeros() {
|
||||
CNPJ cnpj = new CNPJ(cnpjBradescoStr);
|
||||
assertConsistent(cnpj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#CNPJ(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCNPJStringWithFormat() {
|
||||
CNPJ cnpj = new CNPJ(cnpjBradescoStrFmt);
|
||||
assertConsistent(cnpj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#getSufixo()}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSufixo() {
|
||||
assertEquals(Integer.valueOf(1), new CNPJ(cnpjBradescoStrFmt).getSufixo());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#getSufixoFormatado()}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetSufixoFormatado() {
|
||||
assertEquals("0001", new CNPJ(cnpjBradescoStrFmt).getSufixoFormatado());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#isMatriz()}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsMatriz() {
|
||||
assertTrue(new CNPJ(cnpjBradescoStrFmt).isMatriz());
|
||||
assertTrue(!new CNPJ(cnpjBradescoFilialStrFmt).isMatriz());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#isSufixoEquals(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSufixoEqualsString() {
|
||||
|
||||
assertTrue(new CNPJ(cnpjBradescoStrFmt).isSufixoEquals("0001"));
|
||||
assertTrue(!new CNPJ(cnpjBradescoFilialStrFmt).isSufixoEquals("0001"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CNPJ#isSufixoEquals(java.lang.Integer)}.
|
||||
*/
|
||||
@Test
|
||||
public void testIsSufixoEqualsInteger() {
|
||||
assertTrue(new CNPJ(cnpjBradescoFilialStrFmt).isSufixoEquals(5));
|
||||
assertTrue(!new CNPJ(cnpjBradescoStrFmt).isSufixoEquals(5));
|
||||
}
|
||||
|
||||
private void assertConsistent(CNPJ cnpj) {
|
||||
|
||||
assertNotNull(cnpj);
|
||||
assertEquals(cnpjBradesco, cnpj.getCodigo());
|
||||
assertEquals(cnpjBradescoStr, cnpj.getCodigoComZeros());
|
||||
assertEquals(cnpjBradescoStrFmt, cnpj.getCodigoFormatado());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 30/03/2008 - 19:11:24
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 30/03/2008 - 19:11:24
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.comum.pessoa.id.cprf;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.jrimum.vallia.AbstractCPRFValidator.TipoDeCPRF;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Teste da classe CPF.
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class TestCPF extends TestAbstractCPRF{
|
||||
|
||||
/*
|
||||
* CPF: 070.680.938-68 | LUIZ INACIO LULA DA SILVA
|
||||
*/
|
||||
private final String cpfLulaStrFmt = "070.680.938-68";
|
||||
private final String cpfLulaStr = "07068093868";
|
||||
private final Long cpfLula = 7068093868L;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
|
||||
setTipo(TipoDeCPRF.CPF);
|
||||
setCprfLong(cpfLula);
|
||||
setCprfLongErr(7068093867L);
|
||||
setCprfString(cpfLulaStr);
|
||||
setCprfStringErr("07068093867");
|
||||
setCprfStringFormatada(cpfLulaStrFmt);
|
||||
setCprfStringFormatadaErr("070.680.938-67");
|
||||
setCprfRaizLong(70680938L);
|
||||
setCprfRaizLongErr(70680936L);
|
||||
setCprfRaizFormatada("070.680.938");
|
||||
setCprfRaizFormatadaErr("070.680.936");
|
||||
setCprfDv(68);
|
||||
setCprfDvErr(67);
|
||||
setCprf(new CPF(cpfLulaStrFmt));
|
||||
//FICTICIO
|
||||
setCprfOutro(new CPF("222.222.222-22"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CPF#CPF(java.lang.Long)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCPFLong() {
|
||||
CPF cpf = new CPF(cpfLula);
|
||||
assertConsistent(cpf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CPF#CPF(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCPFStringWithZeros() {
|
||||
CPF cpf = new CPF(cpfLulaStr);
|
||||
assertConsistent(cpf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.jrimum.domkee.comum.pessoa.id.cprf.CPF#CPF(java.lang.String)}.
|
||||
*/
|
||||
@Test
|
||||
public void testCPFStringWithFormat() {
|
||||
CPF cpf = new CPF(cpfLulaStrFmt);
|
||||
assertConsistent(cpf);
|
||||
}
|
||||
|
||||
private void assertConsistent(CPF cpf) {
|
||||
|
||||
assertNotNull(cpf);
|
||||
assertEquals(cpfLula, cpf.getCodigo());
|
||||
assertEquals(cpfLulaStr, cpf.getCodigoComZeros());
|
||||
assertEquals(cpfLulaStrFmt, cpf.getCodigoFormatado());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,369 @@
|
|||
/*
|
||||
* Copyright 2013 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 26/09/2013 - 19:06:06
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2013 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 26/09/2013 - 19:06:06
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco;
|
||||
|
||||
import static org.hamcrest.Matchers.arrayContainingInAnyOrder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class ParametrosBancariosMapTest {
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
private int V1 = 1;
|
||||
private Integer V2 = 1;
|
||||
private Double V3 = 3d;
|
||||
private BigDecimal V4 = BigDecimal.ONE;
|
||||
|
||||
@Test
|
||||
public void deve_estar_vazio_na_instanciacao_sem_parametros(){
|
||||
ParametrosBancariosMap parametrosBancariosMap = new ParametrosBancariosMap();
|
||||
|
||||
assertTrue(parametrosBancariosMap.isVazio());
|
||||
assertFalse(parametrosBancariosMap.isNaoVazio());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_conter_um_parametro_na_instanciacao_com_parametros(){
|
||||
ParametrosBancariosMap parametrosBancariosMap = new ParametrosBancariosMap(ParamBancTest.P1,V1);
|
||||
|
||||
Set<ParametroBancario<?>> nomes = parametrosBancariosMap.nomes();
|
||||
|
||||
assertEquals(ParamBancTest.P1, nomes.iterator().next());
|
||||
assertEquals(V1, parametrosBancariosMap.getValor(ParamBancTest.P1));
|
||||
assertFalse(parametrosBancariosMap.isVazio());
|
||||
assertTrue(parametrosBancariosMap.isNaoVazio());
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_caso_o_nome_do_parametro_seja_nulo(){
|
||||
new ParametrosBancariosMap(null,V1);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_caso_o_valor_do_parametro_seja_nulo(){
|
||||
new ParametrosBancariosMap(ParamBancTest.P1,null);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_caso_os_parametros_sejam_nulos(){
|
||||
new ParametrosBancariosMap(null,null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_nao_tem_elementos_quando_o_map_passado_eh_nulo(){
|
||||
ParametrosBancariosMap map = null;
|
||||
|
||||
assertFalse(ParametrosBancariosMap.hasElement(map));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_nao_tem_elementos_quando_o_map_passado_eh_vazio(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap();
|
||||
|
||||
assertFalse(ParametrosBancariosMap.hasElement(map));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_tem_elementos_quando_o_map_passado_tem__apenas_um_elemento(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap(ParamBancTest.P1,V1);
|
||||
|
||||
assertTrue(ParametrosBancariosMap.hasElement(map));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_tem_elementos_quando_o_map_passado_tem_mais_de_um_elementos(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
|
||||
assertTrue(ParametrosBancariosMap.hasElement(map));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_contem_um_parametro_que_estah_no_mapa(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
|
||||
assertTrue(map.contemComNome(ParamBancTest.P1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que__nao_contem_um_parametro_que_nao_estah_no_mapa(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
|
||||
assertFalse(map.contemComNome(ParamBancTest.P3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_contem_um_valor_que_estah_no_mapa(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
|
||||
assertTrue(map.contemComValor(V1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que__nao_contem_um_valor_que_nao_estah_no_mapa(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
|
||||
assertFalse(map.contemComValor(V3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_um_valor_que_esteja_no_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2)
|
||||
.adicione(ParamBancTest.P3,V3);
|
||||
|
||||
assertEquals(V2, map.getValor(ParamBancTest.P2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_null_quando_o_valor_nao_existe_no_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P3,V3);
|
||||
|
||||
assertNull(map.getValor(ParamBancTest.P2));
|
||||
}
|
||||
|
||||
public void deve_lancar_excecao_quando_o_nome_passado_eh_nulo(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P3,V3);
|
||||
|
||||
thrown.expect(IllegalArgumentException.class);
|
||||
map.getValor(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_eh_vazio_quando_nao_existem_parametros_no_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap();
|
||||
|
||||
assertTrue(map.isVazio());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_que_nao_eh_vazio_quando_existem_parametros_no_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap(ParamBancTest.P1,V1);
|
||||
|
||||
assertFalse(map.isVazio());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_o_oposto_que_eh_vazio_quando_nao_existem_parametros_no_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap();
|
||||
|
||||
assertFalse(map.isNaoVazio());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_indicar_o_oposto_que_nao_eh_vazio_quando_existem_parametros_no_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap(ParamBancTest.P1,V1);
|
||||
|
||||
assertTrue(map.isNaoVazio());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_os_nomes_contidos_no_map(){
|
||||
Set<ParamBancTest> nomesEsperados = Sets.newHashSet(ParamBancTest.P1,ParamBancTest.P2,ParamBancTest.P3);
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V1)
|
||||
.adicione(ParamBancTest.P3,V3);
|
||||
|
||||
Set<ParametroBancario<?>> nomes = map.nomes();
|
||||
|
||||
assertThat(nomes.size(), is(equalTo(nomesEsperados.size())));
|
||||
assertEquals(nomesEsperados, nomes);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_os_valores_contidos_no_map(){
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<?> valoresEsperados = Lists.newArrayList(V3,V1,V4,V2);
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2)
|
||||
.adicione(ParamBancTest.P3,V3)
|
||||
.adicione(ParamBancTest.P4,V4);
|
||||
|
||||
Collection<?> valores = map.valores();
|
||||
|
||||
assertThat(valores.size(), is(equalTo(valoresEsperados.size())));
|
||||
assertThat(valores.toArray(), arrayContainingInAnyOrder(valoresEsperados.toArray()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_o_conjunto_de_entradas_do_map(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
Map<ParametroBancario<?>,Number> mapEsperado = Maps.newHashMap();
|
||||
mapEsperado.put(ParamBancTest.P1,V1);
|
||||
mapEsperado.put(ParamBancTest.P2,V2);
|
||||
Set<Entry<ParametroBancario<?>,Number>> entradasEsperadas = mapEsperado.entrySet();
|
||||
|
||||
Set<Entry<ParametroBancario<?>,Number>> entradas = map.entradas();
|
||||
|
||||
assertThat(entradas, is(equalTo(entradasEsperadas)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_adicionar_um_parametro_e_um_valor_corretamente(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap();
|
||||
|
||||
map = map.adicione(ParamBancTest.P1,V1);
|
||||
|
||||
assertThat(map.getValor(ParamBancTest.P1), is(equalTo((Number)V1)));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_ao_adicionar_nome_nulo(){
|
||||
new ParametrosBancariosMap().adicione(null,V1);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_ao_adicionar_valor_nulo(){
|
||||
new ParametrosBancariosMap().adicione(ParamBancTest.P1,null);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_ao_adicionar_nome_e_valor_nulos(){
|
||||
new ParametrosBancariosMap().adicione(null,null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_adicionar_todos_os_parametros_de_um_outro_objeto_parametro_bancario_map_corretamente(){
|
||||
ParametrosBancariosMap mapA = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
ParametrosBancariosMap mapB = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P3,V3)
|
||||
.adicione(ParamBancTest.P4,V4);
|
||||
final Integer totalEsperadoA = 4;
|
||||
final Integer totalEsperadoB = 2;
|
||||
|
||||
mapA = mapA.adicione(mapB);
|
||||
|
||||
assertThat(mapA.quantidade(), is(equalTo(totalEsperadoA)));
|
||||
assertThat(mapB.quantidade(), is(equalTo(totalEsperadoB)));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excecao_ao_tentar_adicionar_um_outro_objeto_parametro_bancario_map_null(){
|
||||
new ParametrosBancariosMap().adicione(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_remover_o_parametro_do_map_corretamente(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap(ParamBancTest.P1,V1);
|
||||
|
||||
Integer valor = map.remova(ParamBancTest.P1);
|
||||
|
||||
assertTrue(map.isVazio());
|
||||
assertThat(valor, is(equalTo(V1)));
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excecao_ao_tentar_remover_parametro_null(){
|
||||
new ParametrosBancariosMap().remova(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_remover_todos_os_parametros_do_map_corretamente(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
|
||||
map.limpe();
|
||||
|
||||
assertTrue(map.isVazio());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_o_numero_de_parametros_correto(){
|
||||
ParametrosBancariosMap map = new ParametrosBancariosMap()
|
||||
.adicione(ParamBancTest.P1,V1)
|
||||
.adicione(ParamBancTest.P2,V2);
|
||||
final int quantidadeEsperada = 2;
|
||||
|
||||
assertThat(map.quantidade(), is(equalTo(quantidadeEsperada)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Enum utilizado para uso apenas nesta classe de teste.
|
||||
*
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L</a>
|
||||
*
|
||||
* @since 0.2
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
private enum ParamBancTest implements ParametroBancario<ParamBancTest>{
|
||||
P1,P2,P3,P4;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 04/04/2009 - 12:31:48
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 04/04/2009 - 12:31:48
|
||||
*
|
||||
*/
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
*
|
||||
* <p>
|
||||
* OBJETIVO/PROPÓSITO
|
||||
* </p>
|
||||
*
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @version 0.2
|
||||
*/
|
||||
public class TestAgencia {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testCodigoMenorQueZero() {
|
||||
|
||||
new Agencia(-1, "x");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testCodigoMaiorQueCincoDigitos() {
|
||||
|
||||
new Agencia(123456, "x");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDigitoCharVazio() {
|
||||
|
||||
new Agencia(1, " ");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDigitoCharNaoLetra() {
|
||||
|
||||
new Agencia(1, "-");
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void testDigitoCharDigitoInteiroNaoNatural() {
|
||||
|
||||
new Agencia(1, "-1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValoresCorretos() {
|
||||
|
||||
new Agencia(12345, "x");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright 2008 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
|
||||
* applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
* OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
* Created at: 22/02/2010 - 13:52:30
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2008 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode usar
|
||||
* esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob
|
||||
* esta LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER
|
||||
* TIPO, sejam expressas ou tácitas. Veja a LICENÇA para a redação específica a
|
||||
* reger permissões e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 22/02/2010 - 13:52:30
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Classe de teste para a classe Banco.
|
||||
*
|
||||
* @author <a href="mailto:romulomail@gmail.com">Rômulo Augusto</a>
|
||||
*
|
||||
* @version 0.2
|
||||
*
|
||||
* @since 0.2
|
||||
*/
|
||||
public class TestBanco {
|
||||
|
||||
@Test
|
||||
public void testIsCodigoDeCompensacaoOKNaoNulo() {
|
||||
|
||||
assertTrue(Banco.isCodigoDeCompensacaoOK("001"));
|
||||
|
||||
assertFalse(Banco.isCodigoDeCompensacaoOK(null));
|
||||
assertFalse(Banco.isCodigoDeCompensacaoOK("ABC"));
|
||||
assertFalse(Banco.isCodigoDeCompensacaoOK("0011"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright 2014 JRimum Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*
|
||||
* Created at: 11/04/2014 - 12:23:59
|
||||
*
|
||||
* ================================================================================
|
||||
*
|
||||
* Direitos autorais 2014 JRimum Project
|
||||
*
|
||||
* Licenciado sob a Licença Apache, Versão 2.0 ("LICENÇA"); você não pode
|
||||
* usar esse arquivo exceto em conformidade com a esta LICENÇA. Você pode obter uma
|
||||
* cópia desta LICENÇA em http://www.apache.org/licenses/LICENSE-2.0 A menos que
|
||||
* haja exigência legal ou acordo por escrito, a distribuição de software sob esta
|
||||
* LICENÇA se dará “COMO ESTÁ”, SEM GARANTIAS OU CONDIÇÕES DE QUALQUER TIPO, sejam
|
||||
* expressas ou tácitas. Veja a LICENÇA para a redação específica a reger permissões
|
||||
* e limitações sob esta LICENÇA.
|
||||
*
|
||||
* Criado em: 11/04/2014 - 12:23:59
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jrimum.domkee.financeiro.banco.febraban;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* @author <a href="http://gilmatryx.googlepages.com/">Gilmar P.S.L.</a>
|
||||
*
|
||||
*/
|
||||
public class TestTipoDeTitulo {
|
||||
|
||||
@Test
|
||||
public void deve_retornar_corretamente_qualquer_enum_buscada_pelo_seu_codigo(){
|
||||
for(TipoDeTitulo t : TipoDeTitulo.values()){
|
||||
assertEquals(t, TipoDeTitulo.valueOf(t.getCodigo()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_quando_codigo_nao_existe_na_enumeracao(){
|
||||
TipoDeTitulo.valueOf(-1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deve_retornar_corretamente_qualquer_enum_buscada_pelo_sua_sigla(){
|
||||
for(TipoDeTitulo t : TipoDeTitulo.values()){
|
||||
assertEquals(t, TipoDeTitulo.valueOfSigla(t.getSigla()));
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void deve_lancar_excessao_quando_sigla_nao_existe_na_enumeracao(){
|
||||
TipoDeTitulo.valueOf("JJJ");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue