forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.8 KiB
73 lines
1.8 KiB
package siprp.database.cayenne.objects;
|
|
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
|
|
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
|
|
|
|
import java.text.DateFormat;
|
|
import java.util.HashMap;
|
|
import java.util.Locale;
|
|
|
|
import org.apache.cayenne.CayenneDataObject;
|
|
import org.apache.cayenne.PersistenceState;
|
|
|
|
import com.evolute.utils.strings.UnicodeChecker;
|
|
|
|
import siprp.database.cayenne.providers.MedicinaDAO;
|
|
import siprp.medicina.MedicinaConstants;
|
|
|
|
public class BaseObject extends CayenneDataObject
|
|
{
|
|
|
|
static {
|
|
UnicodeChecker.setUseDoubleSlash( true );
|
|
}
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
protected static MedicinaDAO medicinaProvider = new MedicinaDAO();
|
|
|
|
protected static final DateFormat sdf = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) );
|
|
|
|
protected static final String isNewMessage = " ";
|
|
|
|
public boolean isNew()
|
|
{
|
|
return getPersistenceState() == PersistenceState.NEW;
|
|
}
|
|
|
|
public boolean isCommited()
|
|
{
|
|
return getPersistenceState() == PersistenceState.COMMITTED;
|
|
}
|
|
|
|
public boolean isModified()
|
|
{
|
|
return getPersistenceState() == PersistenceState.MODIFIED;
|
|
}
|
|
|
|
public HashMap<Integer, String> getConsultaEstados()
|
|
{
|
|
HashMap<Integer, String> result = new HashMap<Integer, String>();
|
|
for( int i = 0; i < MedicinaConstants.ESTADOS_CONSULTA_STR.length; ++i )
|
|
{
|
|
if( MedicinaConstants.ESTADOS_CONSULTA_STR[i] != null)
|
|
{
|
|
result.put( new Integer( i ), MedicinaConstants.ESTADOS_CONSULTA_STR[i] );
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
protected String parseToUnicode( String string )
|
|
{
|
|
String result = UnicodeChecker.parseToUnicode( string );
|
|
return result.replaceAll( "\\\\\\\\", "\\\\" );
|
|
}
|
|
|
|
protected String parseFromUnicode( String string )
|
|
{
|
|
return UnicodeChecker.parseFromUnicode( string );
|
|
}
|
|
|
|
}
|