What city are you from? Each city/county has a different housing code, so before you identify what your rights are concerning a security deposit you need to identify what city/region you are from in CA.
You're absolutely right to identify that the designation of whether this is a sublet or assignment, at law, affects what your rights are. Yes the court will figure this out...although it's impossible to tell whether you have an assignment or sublease without knowing whether you plan to move back in before your lease ends. If you do plan to move back in, it's a SUBLEASE. if you don't plan to move back in and your "subletter" is there for the remainder of your lease, it's an ASSIGNMENT.
Also, who does the subletter pay rent to? If he pays directly to your landlord, it's an ASSIGNMENT. If he pays rent to you and then you pay the rent to your landlord, it's a SUBLEASE.
A lot of people use the words interchangeably (which it sounds like your landlord did here). Unfortunately, courts don't make the determination based on what you or your landlord calls it - instead they look to whether the original tenant (you) retained any interest in the lease to determine whether it's classified as an assignment or sublease.
What it sounds like here is that you intended for it to be a sublease, but in actuality (and legally speaking), it is an assignment.
Why? Some factors that seem to lean towards "assignment":
1. Your subletter paid a security deposit to your landlord.
2. Most importantly - it doesn't appear that you have an intent to reclaim the premises, being that your lease ends in July. (Although if you DO plan to move back in, that is a STRONG argument that you have a sublease and NOT an assignment).
Legal definition:
Assigment = complete transfer of entire remaining lease term
Sublease = You retain part of the remaining term (meaning your subletter was going to move out at some point before your lease ends, and you were going to reclaim the premises).
If I were you, I would argue that it is an "assignment" and not a "sublease." Why? Because you get your security deposit back! Under an assignment, your sublessor has legally taken over your lease, so you are no longer obligated for any damages that he has incurred within the course of his new lease. If you have a "sublease", then you will likely be unhappy because this means that not only do you not get your security deposit back now, but you may be RESPONSIBLE for any damage caused by your current sublessor.
Specifically, if it is in fact legally an assignment, the landlord owes you your $1000 security deposit back. He will therefore deduct any damages incurred by the "subletter" (who is actually your assignee) from the subletter's security deposit. You are not technically on the lease anymore, because you have "assigned" your rights away to the "subletter."
However if it was a sublet, then you would have collected the security deposit from your subletter, and the landlord would still have your security deposit (essentially you are acting like a "mini landlord"). Therefore, the landlord would be able to deduct any damages caused by the subletter from YOUR security deposit because technically you are the one responsible on the lease. And then you could deduct whatever charges you wanted to from the subletter's security deposit. However, he should not be holding on to your subletter's security deposit in this case.
Either way, your landlord is being screwy by either 1) holding on to the subletter's security deposit if it is a sublet, or 2) holding on to your security deposit if it is a assignment, so I would suggest that you FILE A CLAIM IN SMALL CLAIMS COURT if he is being unresponsive to your written demands for your security deposit back (make sure they're in writing so you can use them later in court!!! very important!!).
As for the "entering without notification" and "not fixing the plumbing fast enough," those are separate stand-alone claims on their own. I'm not sure it's relevant to getting a security deposit back if you want to use it as "character evidence", by suggesting bad faith on the part of the landlord. Although the specific claims you might be interested in are:
1. breach of covenant of quiet enjoyment - if landlord fails to provide some service he has legal duty to provide & therefore makes property uninhabitable, tenant may terminate lease & seek damages. But this requires that you must move out, thereby showing the premises were uninhabitable. Examples of "uninhabitable" include: flooding, absence of heat in winter, etc. I'm not sure fixing a toilet late rises to that level of "uinhabitablity" (although it's defintely an annoyance!).
2. breach of implied warranty of habitability - if landlord violates the local housing code or if no housing code available, look to whether the conditions are reasonably suitable for human residence.
Good luck.

